:root {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --surface-muted: #f1eee7;
    --text: #1d1c18;
    --muted: #6c675f;
    --border: #ded8cc;
    --accent: #0c6b58;
    --accent-soft: #e2f1ed;
    --warning: #b7791f;
    --warning-soft: #fff4d6;
    --danger: #b44a4a;
    --night: #2a2722;
    --shadow: 0 16px 40px rgba(34, 30, 22, 0.08);
}

html {
    color-scheme: light;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    letter-spacing: 0;
}

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

/* 리스팅 페이지의 브랜드/메뉴 영역을 전체 사이트 공통 셸로 사용한다. */
.top-nav {
    position: fixed !important;
    inset: 0 0 auto 0 !important;
    z-index: 1000 !important;
    min-height: 59px;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    margin: 0 !important;
    padding: 10px max(12px, 1vw) !important;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
}

.top-nav .nav-logo {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.top-nav .nav-logo img {
    width: auto !important;
    max-width: 29px !important;
    max-height: 29px !important;
    opacity: 1 !important;
    object-fit: contain;
}

.top-nav .nav-links {
    min-width: 0;
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
}

.top-nav .nav-links a,
.top-nav .nav-links span {
    display: block;
    padding: 7px 9px;
    border-radius: 6px;
    color: var(--muted) !important;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
}

.top-nav .nav-links a:hover {
    background: var(--surface-muted);
    color: var(--text) !important;
}

.top-nav .nav-links .current {
    background: var(--text);
    color: #ffffff !important;
}

.top-nav .nav-data-status {
    min-width: 152px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: 0 4px 14px rgba(34, 30, 22, 0.05);
}

.top-nav .nav-data-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #b5aea2;
}

.top-nav .nav-data-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.top-nav .nav-data-label,
.top-nav .nav-data-time {
    white-space: nowrap;
}

.top-nav .nav-data-label {
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.top-nav .nav-data-time {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.top-nav .nav-data-status[data-state="static"] .nav-data-dot {
    background: var(--accent);
}

.top-nav .nav-data-status[data-state="live"] .nav-data-dot {
    background: #0f9d76;
    box-shadow: 0 0 0 4px rgba(15, 157, 118, 0.12);
    animation: nav-status-pulse 1.6s ease-in-out infinite;
}

.top-nav .nav-data-status[data-state="connecting"] .nav-data-dot,
.top-nav .nav-data-status[data-state="updating"] .nav-data-dot {
    background: var(--warning);
    animation: nav-status-pulse 1s ease-in-out infinite;
}

.top-nav .nav-data-status[data-state="poll"] .nav-data-dot {
    background: var(--warning);
}

.top-nav .nav-data-status[data-state="error"] .nav-data-dot {
    background: var(--danger);
}

@keyframes nav-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.top-nav a:focus-visible,
.top-nav span:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.theme-listing .app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Home */
.theme-home .slide {
    padding-top: 104px;
    padding-bottom: 76px;
    background: var(--bg);
}

.theme-home .slide:nth-child(2),
.theme-home .slide:nth-child(4) {
    background: var(--surface-muted);
}

.theme-home .tagline,
.theme-home .section-subtitle,
.theme-home .section-text,
.theme-home .team-text,
.theme-home .service-desc,
.theme-home .metric-label {
    color: var(--muted);
}

.theme-home .section-subtitle {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.theme-home .section-title,
.theme-home .service-title,
.theme-home .metric-value {
    font-family: inherit;
    color: var(--text);
}

.theme-home .section-title {
    margin-bottom: 28px;
    font-size: 32px;
    font-weight: 700;
}

.theme-home .metrics {
    gap: 12px;
}

.theme-home .metric {
    min-width: 150px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.theme-home .metric-value {
    font-size: 28px;
    font-weight: 700;
}

.theme-home .services-grid {
    gap: 12px;
}

.theme-home .service-card {
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.theme-home .service-title {
    font-size: 18px;
    font-weight: 700;
}

.theme-home .contact-email {
    color: var(--text);
    border-color: var(--accent);
}

.theme-home .cta-button {
    padding: 12px 24px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    background: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.theme-home .cta-button:hover {
    background: #095848;
}

.theme-home .arrow {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--muted);
    font-family: inherit;
    font-size: 20px;
    box-shadow: 0 8px 20px rgba(34, 30, 22, 0.06);
}

.theme-home .arrow:hover {
    border-color: var(--text);
    color: var(--text);
}

.theme-home .dot {
    height: 4px;
    background: var(--border);
}

.theme-home .dot.active {
    background: var(--accent);
}

.theme-home .footer-text {
    color: var(--muted);
}

/* Charts */
.theme-charts .container {
    max-width: 1600px;
    padding: 88px max(16px, 2vw) 24px;
}

.theme-charts .page-header {
    margin-bottom: 16px;
    text-align: left;
}

.theme-charts .page-subtitle {
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.theme-charts .page-title,
.theme-charts .chart-title {
    font-family: inherit;
    color: var(--text);
}

.theme-charts .page-title {
    font-size: 24px;
    font-weight: 700;
}

.theme-charts .chart-controls,
.theme-charts .chart-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.theme-charts .chart-controls {
    margin: 0 0 12px;
    padding: 16px;
}

.theme-charts .chart-section {
    margin-bottom: 12px;
    padding: 20px;
}

.theme-charts .chart-title {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-color: var(--border);
    font-size: 17px;
    font-weight: 700;
}

.theme-charts .exclude-input,
.theme-charts .control-btn,
.theme-charts .preset-btn {
    border-color: var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
}

.theme-charts .exclude-input:focus,
.theme-charts .control-btn:hover,
.theme-charts .preset-btn:hover {
    border-color: var(--accent);
}

.theme-charts .control-btn.primary,
.theme-charts .preset-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.theme-charts .symbol-chip {
    border-color: var(--border);
    border-radius: 7px;
    background: var(--surface-muted);
    color: var(--text);
}

.theme-charts .symbol-chip button {
    background: var(--surface);
    color: var(--muted);
}

.theme-charts .symbol-chip button:hover {
    background: var(--text);
    color: #ffffff;
}

.theme-charts .chart-note,
.theme-charts .footer {
    color: var(--muted);
}

/* HL Funding / TSMC Gap */
.theme-dashboard .container {
    padding: 88px max(14px, 1.5vw) 32px;
}

.theme-dashboard .hero,
.theme-dashboard .card,
.theme-dashboard .chart-card,
.theme-dashboard details.report,
.theme-dashboard .metric-card {
    border-color: var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.theme-dashboard .hero {
    margin-bottom: 12px;
    padding: 20px;
}

.theme-dashboard .hero h1,
.theme-dashboard .panel-header h2 {
    font-family: inherit;
    color: var(--text);
    font-weight: 700;
}

.theme-dashboard .hero h1 {
    font-size: 24px;
}

.theme-dashboard .panel-header h2 {
    font-size: 20px;
}

.theme-dashboard .symbol-grid,
.theme-dashboard .spread-hero {
    gap: 10px;
}

.theme-dashboard .controls-card {
    margin-bottom: 12px;
}

.theme-dashboard .chart-card {
    box-shadow: none;
}

.theme-dashboard .pill,
.theme-dashboard .chip,
.theme-dashboard .ctl,
.theme-dashboard .chart-controls .seg,
.theme-dashboard .status-badge {
    border-radius: 7px;
}

.theme-dashboard .ctl:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    background: var(--surface-muted);
}

.theme-dashboard .pill {
    background: var(--surface-muted);
}

.theme-dashboard .chip.active,
.theme-dashboard .chart-controls .seg.active {
    border-color: var(--accent);
    background: var(--accent);
}

.theme-dashboard th {
    background: var(--surface-muted);
}

/* Research */
.theme-research {
    min-height: 100vh;
}

.research-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 104px 0 56px;
}

.research-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 32px;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.research-eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.research-hero h1 {
    margin: 0;
    font-size: clamp(30px, 5vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.research-hero-copy {
    max-width: 660px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.research-count {
    min-width: 126px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    text-align: center;
}

.research-count strong,
.research-count span {
    display: block;
}

.research-count strong {
    font-size: 28px;
    line-height: 1;
}

.research-count span {
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.research-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
    gap: 10px;
    margin: 16px 0;
}

.research-toolbar input,
.research-toolbar select {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.research-card {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(34, 30, 22, 0.04);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.research-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.research-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.research-card h2 {
    margin: 22px 0 10px;
    font-size: 20px;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.research-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.research-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    padding-top: 18px;
}

.research-tag {
    padding: 5px 7px;
    border-radius: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
}

.research-empty {
    grid-column: 1 / -1;
    padding: 72px 24px;
    border: 1px dashed var(--border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.45);
    text-align: center;
}

.research-empty h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.research-empty p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

@media (max-width: 720px) {
    .top-nav {
        gap: 10px !important;
        padding: 9px 12px !important;
    }

    .top-nav .nav-links {
        flex-wrap: nowrap !important;
        flex: 1 1 auto;
        width: auto;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .top-nav .nav-links::-webkit-scrollbar {
        display: none;
    }

    .top-nav .nav-links a,
    .top-nav .nav-links span {
        flex: 0 0 auto;
    }

    .top-nav .nav-data-status {
        min-width: 0;
        flex: 0 0 auto;
        padding: 6px 7px;
    }

    .top-nav .nav-data-time {
        display: none;
    }

    .top-nav .nav-data-label {
        max-width: 92px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .theme-home .slide {
        padding-top: 96px;
        padding-bottom: 70px;
    }

    .theme-home .metrics {
        width: min(100%, 320px);
        gap: 8px;
    }

    .theme-home .metric {
        width: 100%;
        min-width: 0;
        padding: 10px 14px;
    }

    .theme-home .services-grid {
        width: min(100%, 360px);
        gap: 8px;
    }

    .theme-home .service-card {
        padding: 16px;
    }

    .theme-charts .container {
        padding: 84px 14px 20px;
    }

    .theme-charts .chart-section,
    .theme-charts .chart-controls {
        padding: 14px;
    }

    .theme-dashboard .container {
        padding-top: 84px;
    }

    .research-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 88px;
    }

    .research-hero {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 20px;
        padding: 24px 20px;
    }

    .research-count {
        width: 100%;
        text-align: left;
    }

    .research-toolbar,
    .research-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
