/* --- Reset / base --- */
:root {
    --glass: rgba(255, 255, 255, 0.08);
    --glass-strong: rgba(255, 255, 255, 0.12);
    --muted: rgba(255, 255, 255, 0.75);
    --accent: rgba(255, 255, 255, 0.95);
    --radius: 14px;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
    --blur: 12px;
    font-family: "Pretendard Variable", Pretendard, -apple-system,
        BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI",
        "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
* {
    box-sizing: border-box;
}
html,
body,
#app {
    height: 100%;
}
body {
    margin: 0;
    color: var(--accent);
    background: #000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* --- Background --- */
.bg {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.75);
    transition: filter 0.4s ease, transform 0.6s ease;
    transform-origin: center;
    z-index: 0;
}
.overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.45) 45%,
        rgba(0, 0, 0, 0.65) 100%
    );
    z-index: 1;
}

/* --- Layout --- */
.container {
    position: relative;
    z-index: 2;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 28px 36px;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    z-index: 3;
}
.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}
.logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.06),
        rgba(255, 255, 255, 0.03)
    );
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 700;
    font-size: 20px;
    color: var(--accent);
}
.brand span {
    font-size: 14px;
    opacity: 0.95;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.btn {
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    backdrop-filter: blur(var(--blur));
}
.btn:hover {
    background: var(--glass-strong);
}

/* --- Center content --- */
main {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1400px;
    padding: 0 36px;
    z-index: 5; /* 검색 입력이 상단 패널보다 위로 오도록 */
}
.card {
    width: min(980px, 94%);
    text-align: center;
    padding: 34px;
    border-radius: 18px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.015)
    );
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(6px);
    position: relative;
    z-index: 6; /* 입력 필드 클릭 우선권 확보 */
}
h1 {
    margin: 0;
    font-size: 36px;
    letter-spacing: -0.02em;
}
p.lead {
    margin: 8px 0 20px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
}

/* --- Search --- */
.search-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
}
.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
}
.search-input {
    width: 100%;
    min-width: 260px;
    padding: 14px 18px;
    border-radius: 999px;
    font-size: 16px;
    border: none;
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.02);
    transition: box-shadow 0.12s ease, transform 0.12s ease;
    pointer-events: auto; /* 클릭 차단 이슈 방지 */
}
.search-input:focus {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    transform: translateY(-1px);
}
.search-btn {
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, #ffffff10, #ffffff06);
    font-weight: 600;
    cursor: pointer;
    color: var(--accent);
}

/* --- Autocomplete dropdown --- */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    max-height: 280px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.autocomplete-item {
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.autocomplete-item.highlight {
    background: rgba(255, 255, 255, 0.12);
}
.autocomplete-highlight {
    font-weight: 600;
    color: var(--accent);
}

/* --- Recent searches sidebar --- */
.recent-searches {
    min-width: 280px;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    max-height: 400px;
    overflow-y: auto;
}
.recent-searches h4 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.recent-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.recent-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.recent-item-remove {
    opacity: 0.5;
    cursor: pointer;
    font-size: 12px;
    transition: opacity 0.15s ease;
}
.recent-item-remove:hover {
    opacity: 1;
}
.recent-searches .empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    padding: 20px 0;
}

.meta {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

/* --- Quick links --- */
.links {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.link-card {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
}
.link-title {
    font-weight: 600;
}
.link-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.icon-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

/* --- Footer small --- */
footer {
    position: fixed;
    left: 22px;
    bottom: 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    z-index: 3;
}

/* --- Modal / Panel --- */
.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
    overflow-y: auto;
}
.panel {
    width: min(720px, 94%);
    max-width: 720px;
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.03);
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    margin: auto;
}
.panel h3 {
    margin: 0 0 10px;
    font-size: 18px;
}
.row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
input[type="text"],
input[type="url"],
select {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent);
}
.small {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* --- Custom Scrollbar --- */
/* 웹킷 브라우저 스크롤바 스타일링 */
*::-webkit-scrollbar {
    width: 10px;
}
*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}
*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.5);
    background-clip: padding-box;
}

/* Firefox 스크롤바 스타일링 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(255, 255, 255, 0.03);
}

/* --- Responsive tweaks --- */
@media (max-width: 640px) {
    h1 {
        font-size: 28px;
    }
    .search-input {
        width: 60%;
    }
    .links {
        grid-template-columns: repeat(2, 1fr);
    }
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-right {
        width: 100%;
        align-items: stretch;
    }
    .recent-searches {
        min-width: 100%;
        max-width: 100%;
    }
    main {
        padding: 0 16px;
    }
    .card {
        padding: 24px;
    }
}
