:root {
    --blue-950: #051936;
    --blue-900: #082b5d;
    --blue-800: #0a3f86;
    --blue-700: #0b5fb5;
    --blue-100: #eaf5ff;
    --cyan-500: #48d9ce;
    --cyan-700: #1f8f89;
    --yellow-400: #ffd846;
    --yellow-600: #cc9b00;
    --white: #ffffff;
    --ink: #122033;
    --muted: #607086;
    --line: #d8e5f2;
    --danger: #c93443;
    --success: #198754;
    --shadow: 0 18px 44px rgba(5, 25, 54, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(180deg, var(--blue-100), var(--white) 360px);
    font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--blue-700);
    text-decoration: none;
}

a:hover {
    color: var(--cyan-700);
}

img {
    max-width: 100%;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
    padding: 12px clamp(18px, 4vw, 48px);
    color: var(--white);
    background: rgba(5, 25, 54, 0.96);
    border-bottom: 3px solid var(--cyan-500);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-weight: 800;
    font-size: 1.25rem;
}

.brand:hover {
    color: var(--yellow-400);
}

.brand-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--white);
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: var(--white);
    background: transparent;
    font-size: 1.4rem;
    cursor: pointer;
}

.main-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.main-nav a,
.logout-form button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    color: var(--white);
    background: transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.main-nav a:hover,
.logout-form button:hover {
    color: var(--blue-950);
    background: var(--yellow-400);
}

.main-nav .nav-cta,
.main-nav .admin-link {
    background: var(--blue-700);
}

.logout-form {
    margin: 0;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 60px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
    align-items: center;
    gap: clamp(24px, 5vw, 64px);
    min-height: calc(100vh - 170px);
    padding: 30px 0 52px;
}

.hero-copy h1 {
    margin: 0;
    color: var(--blue-950);
    font-size: clamp(3rem, 9vw, 6.8rem);
    line-height: 0.95;
}

.hero-copy p {
    max-width: 560px;
    color: var(--muted);
    font-size: 1.08rem;
}

.hero-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-logo {
    width: min(100%, 760px);
    max-height: 400px;
    object-fit: contain;
    filter: drop-shadow(0 22px 36px rgba(8, 43, 93, 0.12));
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--cyan-700);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-actions,
.song-actions,
.inline-actions,
.filter-bar,
.reply-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.button.primary {
    color: var(--blue-950);
    background: var(--yellow-400);
    border-color: var(--yellow-400);
}

.button.primary:hover {
    color: var(--white);
    background: var(--blue-700);
    border-color: var(--blue-700);
}

.button.secondary {
    color: var(--white);
    background: var(--cyan-700);
}

.button.ghost {
    color: var(--blue-900);
    background: var(--white);
    border-color: var(--line);
}

.button.danger {
    color: var(--white);
    background: var(--danger);
}

.button.full {
    width: 100%;
}

.section {
    padding: 28px 0;
}

.section.narrow {
    width: min(760px, 100%);
    margin: 0 auto;
}

.section-heading {
    margin-bottom: 24px;
}

.section-heading h1 {
    margin: 0;
    color: var(--blue-950);
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.9rem;
}

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

.panel,
.form-card,
.notice-detail,
.chart-panel,
.song-card,
.inquiry-admin-card,
.empty-state,
.success-panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel,
.notice-detail,
.chart-panel,
.empty-state,
.success-panel,
.inquiry-admin-card {
    padding: 22px;
}

.panel-heading,
.inquiry-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-heading h2,
.notice-detail h2,
.chart-panel h2,
.empty-state h2,
.success-panel h2 {
    margin: 0;
    color: var(--blue-900);
}

.rank-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rank-list li {
    display: grid;
    grid-template-columns: 38px 1fr;
    align-items: center;
    gap: 12px;
}

.rank-badge,
.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: var(--blue-950);
    background: var(--yellow-400);
    font-weight: 900;
}

.rank-list span,
.song-line span,
.notice-list span,
.inquiry-head span {
    display: block;
    color: var(--muted);
    font-size: 0.92rem;
}

.song-stack,
.notice-list,
.inquiry-list,
.admin-inquiries {
    display: grid;
    gap: 12px;
}

.song-line,
.notice-list a {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.song-line.rich {
    align-items: center;
}

.auth-layout,
.split-layout,
.info-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 1.25fr);
    align-items: start;
    gap: clamp(20px, 4vw, 46px);
}

.auth-copy h1 {
    margin: 0;
    color: var(--blue-950);
    font-size: clamp(2.3rem, 6vw, 4rem);
}

.auth-copy p {
    color: var(--muted);
}

.form-card {
    display: grid;
    gap: 16px;
    padding: 24px;
}

.form-card h2 {
    margin: 0;
    color: var(--blue-900);
}

label {
    display: grid;
    gap: 7px;
    color: var(--blue-950);
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--white);
    font: inherit;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(72, 217, 206, 0.3);
    border-color: var(--cyan-700);
}

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

.check-result {
    min-height: 20px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.check-result.success {
    color: var(--success);
}

.check-result.danger {
    color: var(--danger);
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-line input {
    width: 18px;
    min-height: 18px;
}

.form-error,
.flash {
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.form-error,
.flash.danger {
    color: #7b1020;
    background: #ffe8ec;
}

.flash.success,
.success-panel {
    color: #064b2d;
    background: #e7fbf0;
}

.flash.warning {
    color: #6b4a00;
    background: #fff4cc;
}

.form-footnote {
    margin: 0;
    text-align: center;
}

.profile-subform {
    margin-top: 18px;
}

.readonly-field {
    display: grid;
    gap: 5px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--blue-100);
}

.readonly-field span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.readonly-field strong {
    color: var(--blue-900);
    font-size: 1.05rem;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
}

.tabs a {
    min-width: 86px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--blue-900);
    background: var(--white);
    text-align: center;
    font-weight: 900;
}

.tabs a.active {
    color: var(--blue-950);
    background: var(--yellow-400);
    border-color: var(--yellow-400);
}

.rank-table {
    display: grid;
    gap: 12px;
}

.rank-row {
    display: grid;
    grid-template-columns: 54px minmax(200px, 1fr) minmax(120px, 0.25fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 10px 28px rgba(8, 43, 93, 0.08);
}

.rank-main h2 {
    margin: 0 0 4px;
    color: var(--blue-950);
}

.rank-main p,
.song-artist {
    margin: 0;
    color: var(--muted);
}

.rank-stats strong {
    display: block;
    color: var(--cyan-700);
    font-size: 1.6rem;
}

.rank-stats span {
    color: var(--muted);
    font-size: 0.9rem;
}

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

.song-card {
    overflow: hidden;
}

.song-card iframe,
.video-placeholder,
.song-detail-media iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    background: var(--blue-950);
}

.video-placeholder {
    display: grid;
    place-items: center;
    color: var(--white);
    font-weight: 800;
}

.song-body {
    padding: 18px;
}

.song-body h2 {
    margin: 7px 0 4px;
    color: var(--blue-900);
}

.song-body h2 a,
.rank-main h2 a,
.song-line strong,
.chart-panel h2 a {
    color: var(--blue-900);
}

.song-body h2 a:hover,
.rank-main h2 a:hover,
.chart-panel h2 a:hover {
    color: var(--cyan-700);
}

.song-detail {
    display: grid;
    grid-template-columns: minmax(320px, 1.2fr) minmax(280px, 0.8fr);
    gap: 24px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.song-detail-body h1 {
    margin: 0 0 8px;
    color: var(--blue-950);
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.05;
}

.song-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.song-stat-row span {
    padding: 9px 11px;
    border-radius: 8px;
    color: var(--blue-900);
    background: var(--blue-100);
    font-weight: 800;
}

.song-stat-row strong {
    color: var(--cyan-700);
}

.song-description {
    color: var(--ink);
}

.song-meta,
.notice-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 8px;
    color: var(--blue-950);
    background: var(--blue-100);
    font-size: 0.78rem;
    font-weight: 900;
}

.pill.yellow {
    background: var(--yellow-400);
}

.pill.cyan,
.pill.open {
    background: #d9fbf8;
    color: #08615c;
}

.pill.answered {
    background: #e8f0ff;
    color: var(--blue-800);
}

.pill.closed {
    background: #edf1f5;
    color: #53606f;
}

.pill.hidden {
    color: #7b1020;
    background: #ffe8ec;
}

.moderation-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.moderation-row {
    align-items: flex-start;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--white);
    background: var(--blue-900);
}

.empty-cell {
    color: var(--muted);
    text-align: center;
}

.filter-bar {
    align-items: end;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.filter-bar label {
    min-width: 220px;
    flex: 1;
}

.chart-panel {
    overflow: hidden;
}

.rank-chart {
    width: 100%;
    height: auto;
    min-height: 260px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfdff, #eef8ff);
}

.chart-axis {
    stroke: #9fb5cc;
    stroke-width: 2;
}

.chart-line {
    fill: none;
    stroke: var(--blue-700);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point {
    fill: var(--yellow-400);
    stroke: var(--blue-950);
    stroke-width: 2;
}

.chart-label {
    fill: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.chart-label.bottom {
    text-anchor: middle;
}

.chart-empty {
    display: grid;
    place-items: center;
    min-height: 260px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: var(--white);
    font-weight: 800;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.history-list span {
    padding: 7px 9px;
    border-radius: 8px;
    color: var(--blue-900);
    background: var(--blue-100);
    font-size: 0.9rem;
}

.inquiry-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.reply-box {
    padding: 12px;
    border-left: 4px solid var(--cyan-500);
    border-radius: 8px;
    background: var(--blue-100);
}

.withdrawal-note {
    padding: 14px;
    border: 2px solid var(--yellow-400);
    border-radius: 8px;
    color: var(--blue-950);
    background: #fff8d9;
}

.withdrawal-note strong {
    display: block;
    margin-bottom: 4px;
    color: var(--blue-900);
}

.withdrawal-note p {
    margin: 0;
    font-weight: 800;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 25, 54, 0.58);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-card {
    width: min(440px, 100%);
    padding: 24px;
    border: 2px solid var(--yellow-400);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.modal-card h2 {
    margin: 0 0 10px;
    color: var(--blue-900);
}

.modal-card p {
    margin: 0 0 18px;
    color: var(--ink);
    font-weight: 700;
}

.modal-song-title {
    color: var(--blue-900);
    font-size: 1.05rem;
    word-break: break-word;
}

.delete-warning {
    padding: 14px;
    margin: 0 0 16px;
    border: 2px solid var(--danger);
    border-radius: 8px;
    color: #7b1020;
    background: #ffe8ec;
    font-weight: 900;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

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

.stat-card,
.admin-tile {
    display: grid;
    gap: 8px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.stat-card span,
.admin-tile span {
    color: var(--muted);
}

.stat-card strong {
    color: var(--cyan-700);
    font-size: 2rem;
}

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

.admin-tile strong {
    color: var(--blue-900);
    font-size: 1.2rem;
}

.inline-form {
    margin: 0;
}

.reply-form {
    align-items: end;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.reply-form label:first-of-type {
    flex: 1 1 420px;
}

.reply-form label:nth-of-type(2) {
    width: 170px;
}

.definition-list {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 10px 16px;
}

.definition-list dt {
    color: var(--muted);
    font-weight: 800;
}

.definition-list dd {
    margin: 0;
    color: var(--blue-950);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px clamp(18px, 4vw, 48px);
    color: var(--white);
    background: var(--blue-950);
}

.footer-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-links a {
    color: var(--yellow-400);
    font-weight: 900;
}

.legal-doc {
    display: grid;
    gap: 16px;
    line-height: 1.75;
}

.legal-doc h2 {
    margin: 18px 0 0;
    color: var(--blue-900);
    font-size: 1.2rem;
}

.legal-doc h3 {
    margin: 8px 0 0;
    color: var(--cyan-700);
    font-size: 1rem;
}

.legal-doc p,
.legal-doc ol,
.legal-doc ul {
    margin: 0;
}

.legal-doc ol,
.legal-doc ul {
    padding-left: 24px;
}

.legal-doc li {
    margin: 4px 0;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    color: var(--blue-950);
    background: var(--blue-100);
}

@media (max-width: 920px) {
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        padding: 12px 18px 18px;
        background: var(--blue-950);
        border-bottom: 3px solid var(--cyan-500);
    }

    .main-nav.open {
        display: grid;
    }

    .main-nav a,
    .logout-form button {
        width: 100%;
        justify-content: flex-start;
    }

    .hero,
    .auth-layout,
    .split-layout,
    .info-grid,
    .song-detail {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .hero-logo {
        max-height: 340px;
    }

    .dashboard-grid,
    .song-grid,
    .stat-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .rank-row {
        grid-template-columns: 46px 1fr;
    }

    .rank-stats,
    .rank-actions {
        grid-column: 2;
    }

    .site-footer {
        display: grid;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 22px, 1180px);
        padding-top: 22px;
    }

    .site-header {
        padding: 10px 14px;
    }

    .hero-copy h1 {
        font-size: 3.2rem;
    }

    .hero-logo {
        max-height: 260px;
    }

    .panel,
    .form-card,
    .notice-detail,
    .chart-panel,
    .empty-state,
    .success-panel,
    .inquiry-admin-card {
        padding: 16px;
    }

    .song-line,
    .song-line.rich,
    .panel-heading,
    .inquiry-head {
        display: grid;
    }

    .nickname-check-row {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }
}
