:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-strong: #eef3f8;
    --text: #18202f;
    --muted: #647086;
    --line: #dbe3ee;
    --accent: #2f6f73;
    --accent-strong: #255b5f;
    --warm: #b8613f;
    --gold: #b38b1e;
    --shadow: 0 16px 36px rgba(24, 32, 47, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.site-header {
    background: linear-gradient(135deg, #163c40 0%, #28666b 56%, #b8613f 100%);
    color: #ffffff;
}

.site-header.compact .hero {
    min-height: 300px;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 22px 0;
}

.brand {
    font-weight: 800;
    letter-spacing: 0;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-links a {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.86);
}

.nav-links a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(1180px, calc(100% - 40px));
    min-height: 430px;
    margin: 0 auto;
    padding: 56px 0 86px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero .eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3,
p {
    overflow-wrap: break-word;
    word-break: keep-all;
}

h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(2.4rem, 7vw, 5.8rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.hero-copy {
    max-width: 760px;
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.16rem;
}

.period-range {
    display: inline-flex;
    width: fit-content;
    margin: 18px 0 0;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
    font-weight: 700;
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: -54px auto 72px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 30px;
}

.metric-card,
.panel,
.search-panel,
.details-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-card {
    min-height: 128px;
    padding: 18px;
}

.metric-label {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.metric-value {
    margin: 0;
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 850;
    line-height: 1.1;
}

.metric-sub {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.section-block {
    margin-top: 44px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.25;
}

.section-heading p:last-child {
    max-width: 520px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.panel {
    min-width: 0;
    padding: 18px;
}

.panel-wide {
    grid-column: 1 / -1;
}

.panel h3 {
    margin: 0 0 14px;
    font-size: 1.08rem;
    line-height: 1.35;
    text-wrap: balance;
}

.panel-note {
    margin: -6px 0 14px;
    color: var(--muted);
    font-size: 0.9rem;
}

.rank-list {
    display: grid;
    gap: 10px;
}

.rank-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 8px;
    border-radius: 8px;
    background: var(--surface-strong);
}

.rank-num {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-align: center;
}

.rank-main {
    min-width: 0;
}

.rank-title {
    margin: 0;
    font-weight: 800;
}

.rank-sub {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.rank-value {
    color: var(--accent-strong);
    font-weight: 850;
    text-align: right;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--line);
}

.bar-chart {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(70px, 120px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.bar-label,
.bar-value {
    color: var(--muted);
    font-size: 0.9rem;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5ebf3;
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--warm));
}

.heat-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(34px, 1fr));
    gap: 5px;
}

.panel-wide .heat-grid {
    grid-template-columns: repeat(24, minmax(28px, 1fr));
}

.heat-cell {
    display: grid;
    place-items: center;
    min-height: 36px;
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 800;
}

.empty-state {
    margin: 0;
    padding: 18px;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--muted);
}

.search-panel {
    padding: 20px;
}

.search-box label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 800;
}

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.search-row input {
    min-height: 48px;
    min-width: 0;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.search-row button,
.result-button {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.search-row button {
    padding: 0 18px;
}

.result-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.result-button {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px;
    background: var(--surface-strong);
    color: var(--text);
    text-align: left;
}

.profile-view {
    margin-top: 26px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding: 20px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.profile-avatar {
    width: 86px;
    height: 86px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--line);
}

.profile-header h2 {
    margin: 0;
    font-size: 2rem;
}

.profile-header p:last-child {
    margin: 6px 0 0;
    color: var(--muted);
}

.details-panel {
    margin-top: 32px;
    padding: 16px;
}

.details-panel summary {
    cursor: pointer;
    font-weight: 850;
}

.details-panel .dashboard-grid {
    margin-top: 16px;
}

.scroll-top-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 12px 26px rgba(24, 32, 47, 0.18);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.scroll-top-button:hover {
    background: var(--accent-strong);
}

.scroll-top-button.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .summary-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        display: block;
    }

    .section-heading p:last-child {
        margin-top: 8px;
    }

    .panel-wide .heat-grid {
        grid-template-columns: repeat(12, minmax(34px, 1fr));
    }
}

@media (max-width: 640px) {
    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-links {
        width: 100%;
    }

    .nav-links a {
        flex: 1;
        text-align: center;
    }

    .hero {
        min-height: 360px;
        padding-bottom: 78px;
    }

    .page-shell,
    .hero,
    .nav {
        width: min(100% - 28px, 1180px);
    }

    .bar-row {
        grid-template-columns: 74px minmax(0, 1fr);
    }

    .bar-value {
        grid-column: 2;
    }

    .heat-grid {
        grid-template-columns: repeat(6, minmax(32px, 1fr));
    }

    .panel-wide .heat-grid {
        grid-template-columns: repeat(6, minmax(32px, 1fr));
    }

    .rank-item,
    .result-button {
        grid-template-columns: 28px minmax(0, 1fr);
    }

    .rank-value,
    .result-button > span:last-child {
        grid-column: 2;
        text-align: left;
    }

    .profile-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .scroll-top-button {
        right: 16px;
        bottom: 16px;
        width: 46px;
        height: 46px;
    }
}
