@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  font-family: "DM Sans", "Noto Sans KR", sans-serif;
  color: #28351f;
  background: #f4f8ed;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #28351f;
  --muted: #77816f;
  --line: #dfe8d3;
  --accent: #86b72d;
  --accent-dark: #416b1e;
  --surface: #fff;
  --soft: #edf5dc;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.page-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.site-header { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand img { display: block; width: 96px; height: 48px; object-fit: contain; }
.brand span, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.request-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.request-status::before { width: 7px; height: 7px; border-radius: 50%; background: #aaa99f; content: ""; }
.request-status.is-open { color: var(--accent-dark); }
.request-status.is-open::before { background: #86b72d; }
.intro { padding: 76px 0 68px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.intro h1 { margin: 0; font-size: clamp(30px, 5vw, 48px); font-weight: 600; letter-spacing: -.065em; line-height: 1.25; }
.intro-mascots { display: flex; align-items: center; gap: 12px; }
.intro-logo { display: block; width: min(150px, 38vw); max-height: 160px; object-fit: contain; }
.intro-guidelines { width: fit-content; margin-top: 24px; padding: 15px 20px; border: 0; border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; background: #e8f3cf; color: var(--accent-dark); font-size: 16px; font-weight: 400; line-height: 1.7; }
.intro-guidelines p { margin: 0; }
.intro-guidelines .guidelines-title { margin-bottom: 6px; }
.intro-guidelines p + p { margin-top: 6px; }
.library-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; margin-bottom: 24px; }
.library-heading > div:first-child { display: flex; align-items: baseline; gap: 12px; }
.library-heading h2 { width: fit-content; margin: 0; padding: 7px 13px; border-left: 4px solid var(--accent); border-radius: 0 6px 6px 0; background: #e8f3cf; color: var(--accent-dark); font-size: 20px; font-weight: 700; letter-spacing: -.04em; line-height: 1.4; white-space: nowrap; }
.intro-guidelines .guidelines-title { width: fit-content; margin: 0 0 6px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--accent-dark); font-size: 20px; font-weight: 700; letter-spacing: -.04em; line-height: 1.4; white-space: nowrap; }
.muted { color: var(--muted); font-size: 12px; }
.library-heading .muted { margin: 6px 0 0; }
.library-tools { display: grid; justify-items: stretch; gap: 9px; width: 100%; }
.search-box input, .filter-box select { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--surface); color: var(--ink); }
.search-box input { width: 100%; }
.admin-song-search { display: block; margin-bottom: 10px; }
.filter-group { display: flex; flex-wrap: nowrap; justify-content: start; gap: 5px; overflow-x: auto; padding: 3px; }
.filter-group::-webkit-scrollbar { height: 4px; }
.filter-group::-webkit-scrollbar-thumb { border-radius: 4px; background: #d5dfc6; }
.filter-option { flex: 0 0 auto; min-height: 29px; padding: 4px 9px; border: 1px solid transparent; border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 10px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.filter-option:hover { transform: translateY(-1px); }
.filter-option.is-selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px currentColor; }
.filter-option.filter-all { border-color: #d5e3bd; background: #f0f7e4; color: var(--accent-dark); }
.filter-box select { min-width: 130px; }
.search-box input:focus, input:focus, select:focus, textarea:focus { border-color: #a7ca67; box-shadow: 0 0 0 3px #86b72d24; }
.song-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.song-table { width: 100%; min-width: 850px; border-collapse: collapse; table-layout: fixed; }
.song-table.admin-mode { min-width: 1105px; }
.song-table th, .song-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.song-table th { background: #f4f8ed; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.song-table tbody tr:last-child td { border-bottom: 0; }
.song-table th:first-child, .song-table td:first-child { width: 76px; text-align: center; }
.song-table th:nth-child(2), .song-table td:nth-child(2) { width: 135px; white-space: nowrap; }
.song-table th:nth-child(3), .song-table td:nth-child(3) { width: 14%; }
.song-table th:nth-child(4), .song-table td:nth-child(4) { width: 28%; }
.song-table th:nth-child(5), .song-table td:nth-child(5) { width: 14%; }
.song-table th:nth-child(6), .song-table td:nth-child(6) { width: 19%; }
.song-table.admin-mode th:nth-child(1), .song-table.admin-mode td:nth-child(1) { width: 66px; }
.song-table.admin-mode th:nth-child(2), .song-table.admin-mode td:nth-child(2) { width: 92px; }
.song-table.admin-mode th:nth-child(3), .song-table.admin-mode td:nth-child(3) { width: 100px; }
.song-table.admin-mode th:nth-child(4), .song-table.admin-mode td:nth-child(4) { width: 250px; }
.song-table.admin-mode th:nth-child(5), .song-table.admin-mode td:nth-child(5) { width: 125px; }
.song-table.admin-mode th:nth-child(6), .song-table.admin-mode td:nth-child(6) { width: 170px; }
.song-table.admin-mode th:nth-child(7), .song-table.admin-mode td:nth-child(7) { width: 80px; }
.song-table.admin-mode th:nth-child(8), .song-table.admin-mode td:nth-child(8) { width: 94px; text-align: center; }
.song-table.admin-mode th:nth-child(9), .song-table.admin-mode td:nth-child(9) { width: 128px; }
.sort-button { padding: 3px 0; border: 0; background: transparent; color: inherit; font: inherit; }
.sort-button span { margin-left: 4px; color: var(--accent-dark); }
.copy-button { min-height: 30px; padding: 0 9px; border: 1px solid #d5e3bd; border-radius: 5px; background: #f0f7e4; color: var(--accent-dark); font-size: 11px; font-weight: 600; white-space: nowrap; }
.copy-button:hover { background: #e4f0cf; }
.table-admin-button { min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); font-size: 10px; white-space: nowrap; }
.table-admin-button:hover { border-color: #b9bead; background: #f7faF2; }
.song-detail-row > td { padding: 12px !important; background: #fbfcf8; }
.song-admin-details { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.song-admin-details.has-video { grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); }
.song-admin-video { width: 100%; max-width: 360px; overflow: hidden; border-radius: 5px; }
.song-admin-video[hidden] { display: none; }
.song-admin-content { min-width: 0; }
.song-admin-content:empty { display: none; }
.song-admin-content .admin-song-lyrics { max-height: 320px; }
.song-title-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cover-wrap { position: relative; flex: none; width: 42px; height: 42px; overflow: hidden; border-radius: 5px; background: #efeee8; }
.cover-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; }
.song-title { overflow-wrap: anywhere; color: var(--ink); font-size: 14px; font-weight: 700; letter-spacing: -.025em; line-height: 1.45; }
.song-artist-cell { color: #65645c; font-size: 12px; overflow-wrap: anywhere; }
.song-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.genre-chip, .tag-chip { display: inline-block; max-width: 100%; padding: 4px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.genre-kpop { border-color: #f2c5c5; background: #fff0f0; color: #9d4148; }
.genre-jpop { border-color: #d8c8ef; background: #f4effc; color: #704d9c; }
.genre-pop { border-color: #bed7f2; background: #edf6ff; color: #3d6895; }
.genre-animation { border-color: #f2d69e; background: #fff7e5; color: #896319; }
.genre-cute-song { border-color: #efc5df; background: #fff0f8; color: #974f7a; }
.tag-cute { border-color: #f1c5d9; background: #fff0f6; color: #984b70; }
.tag-upbeat { border-color: #f2d398; background: #fff6e2; color: #89631d; }
.tag-mood { border-color: #c9c5ed; background: #f2f0ff; color: #615994; }
.tag-healing { border-color: #bee0cb; background: #eef9f1; color: #427653; }
.tag-nostalgic { border-color: #c5d7ef; background: #eff5ff; color: #4d6890; }
.tag-rap { border-color: #d3c4b7; background: #f7f0ea; color: #75573f; }
.tag-practice { border-color: #c5d4dc; background: #eef5f8; color: #4c6975; }
.tag-warmup { border-color: #efc8a8; background: #fff3e9; color: #945c35; }
.tag-other { border-color: #d7dccf; background: #f3f5ef; color: #626b57; }
.song-memo { max-width: 80px; color: #6f6e66; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.price-chip { display: inline-block; margin-top: 4px; padding: 4px 7px; border-radius: 4px; background: #fff2d5; color: #886013; font-size: 10px; font-weight: 700; white-space: nowrap; }
.empty-state { padding: 40px 20px !important; color: var(--muted); text-align: center !important; }
.load-sentinel { display: flex; justify-content: center; min-height: 52px; padding: 12px; }
.load-sentinel[hidden] { display: none; }
.notice { margin: 0 0 16px; padding: 12px 15px; border-radius: 5px; background: #eef3e9; color: var(--accent-dark); font-size: 13px; }
.notice.is-error { background: #f8e9e6; color: #963f33; }
footer { display: flex; justify-content: space-between; margin: 60px 0 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.button { min-height: 39px; padding: 0 15px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 600; }
.button-primary { border-color: var(--accent); background: var(--accent); color: white; }
.button-primary:hover { background: var(--accent-dark); }
.button-quiet:hover { border-color: #b9bead; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--accent-dark); font-size: 11px; }
.dialog { width: min(520px, calc(100% - 28px)); max-height: min(90vh, 860px); padding: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 22px 80px #24251d30; }
.dialog::backdrop { background: #1f211bb3; backdrop-filter: blur(3px); }
.dialog-close-row { display: flex; justify-content: end; margin: -8px -8px 6px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f1f0eb; color: var(--ink); font-size: 24px; line-height: 1; }
.admin-inline { margin: 0 0 20px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.admin-inline h2, .song-dialog h2 { margin: 0; font-size: 23px; letter-spacing: -.05em; }
.stack-form, .song-form { display: grid; gap: 14px; }
.stack-form { margin-top: 24px; }
.stack-form label, .song-form > label { display: grid; gap: 7px; color: #595950; font-size: 12px; font-weight: 600; }
.stack-form input, .song-form input, .song-form select, .song-form textarea { width: 100%; min-height: 41px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: white; color: var(--ink); font-size: 13px; font-weight: 400; }
.song-form textarea { resize: vertical; line-height: 1.65; }
.song-form label small { margin-top: -3px; font-weight: 400; }
.form-error { min-height: 18px; margin: 10px 0 0; color: #a13f32; font-size: 12px; }
.admin-title, .admin-section-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-title { margin-bottom: 20px; }
.admin-title .eyebrow, .dialog-heading .eyebrow { margin-bottom: 5px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #f7faF2; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { font-size: 13px; }
.toggle-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.toggle-row input { width: 42px; height: 23px; accent-color: var(--accent); cursor: pointer; }
.admin-section-heading { margin: 26px 0 10px; }
.admin-section-heading h3 { margin: 0; font-size: 15px; }
.admin-request-list { display: grid; gap: 7px; }
.admin-request-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 5px; }
.admin-request-row strong, .admin-request-row small { display: block; }
.admin-request-row strong { font-size: 12px; }
.admin-request-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.admin-song-lyrics { max-height: 320px; overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #f7faF2; color: var(--ink); font: inherit; font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-song-mr { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #f7faF2; color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }
.admin-song-mr a { color: var(--accent-dark); font-weight: 600; }
.row-actions { display: flex; flex: none; flex-wrap: wrap; gap: 6px; }
.row-actions button { min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); font-size: 10px; }
.row-actions .delete-button { color: #a13f32; }
.admin-empty { padding: 18px; color: var(--muted); font-size: 12px; text-align: center; }
.form-actions { display: flex; justify-content: end; gap: 8px; margin-top: 3px; }
.video-frame { aspect-ratio: 16 / 9; background: #101010; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 640px) {
  .page-shell { width: min(calc(100% - 28px), 480px); }
  .site-header { min-height: 74px; height: auto; gap: 8px; padding: 10px 0; }
  .brand { gap: 8px; }
  .brand img { width: 76px; height: 40px; }
  .brand strong { font-size: 16px; }
  .header-actions { min-width: 0; justify-content: end; gap: 8px; }
  .request-status { max-width: 125px; font-size: 10px; text-align: right; }
  .header-actions .button { min-height: 40px; padding: 0 10px; }
  .intro { padding: 42px 0 38px; }
  .intro-mascots { gap: 8px; }
  .intro-logo { width: min(130px, 38vw); max-height: 140px; }
  .intro-guidelines { width: 100%; max-width: 100%; margin-top: 20px; padding: 12px 14px; font-size: 13px; }
  .intro-guidelines .guidelines-title { font-size: 18px; }
  .library-heading { gap: 12px; margin-bottom: 18px; }
  .library-heading > div:first-child { justify-content: space-between; gap: 8px; }
  .library-heading h2 { padding: 6px 10px; font-size: 18px; }
  .library-heading .muted { text-align: right; }
  .library-tools { justify-items: stretch; }
  .search-box input { width: 100%; height: 46px; font-size: 16px; }
  .filter-group { margin-inline: -3px; padding: 4px 3px 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .filter-option { min-height: 38px; padding: 7px 10px; font-size: 11px; scroll-snap-align: start; }
  .song-table-wrap { overflow: visible; border: 0; background: transparent; }
  .song-table, .song-table.admin-mode { display: block; width: 100%; min-width: 0; table-layout: auto; }
  .song-table thead { display: none; }
  .song-table tbody { display: grid; gap: 10px; }
  .song-table tbody tr:not(.song-detail-row) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "title title"
      "genre price"
      "artist artist"
      "tags tags"
      "memo memo"
      "copy copy";
    gap: 0 12px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }
  .song-table.admin-mode tbody tr:not(.song-detail-row) {
    grid-template-areas:
      "title title"
      "genre price"
      "artist artist"
      "tags tags"
      "memo memo"
      "copy copy"
      "lyrics manage";
  }
  .song-table th, .song-table td { width: auto !important; padding: 7px 0; border: 0; text-align: left; }
  .song-table tbody td { display: flex; min-width: 0; align-items: center; gap: 7px; font-size: 11px; }
  .song-table tbody td::before { flex: none; color: var(--muted); font-size: 10px; font-weight: 600; }
  .song-table tbody td:nth-child(1) { grid-area: copy; }
  .song-table tbody td:nth-child(1)::before { content: "신청 문구"; }
  .song-table tbody td:nth-child(2) { grid-area: price; }
  .song-table tbody td:nth-child(2)::before { content: "가격"; }
  .song-table tbody td:nth-child(2):empty::after { color: var(--muted); content: "무료"; }
  .song-table tbody td:nth-child(3) { grid-area: genre; }
  .song-table tbody td:nth-child(3)::before { content: "장르"; }
  .song-table tbody td:nth-child(4) { grid-area: title; padding: 2px 0 9px; }
  .song-table tbody td:nth-child(5) { grid-area: artist; }
  .song-table tbody td:nth-child(5)::before { content: "가수"; }
  .song-table tbody td:nth-child(6) { grid-area: tags; align-items: flex-start; }
  .song-table tbody td:nth-child(6)::before { content: "태그"; padding-top: 3px; }
  .song-table tbody td:nth-child(7) { grid-area: memo; align-items: flex-start; }
  .song-table tbody td:nth-child(7)::before { content: "메모"; padding-top: 2px; }
  .song-table.admin-mode tbody td:nth-child(8) { grid-area: lyrics; }
  .song-table.admin-mode tbody td:nth-child(9) { grid-area: manage; }
  .song-table tbody td.empty-state { grid-column: 1 / -1; display: block; padding: 28px 12px !important; text-align: center; }
  .song-table tbody td.empty-state::before { content: none; }
  .copy-button, .table-admin-button { min-height: 40px; }
  .song-title-cell { gap: 9px; }
  .cover-wrap { width: 38px; height: 38px; }
  .song-title { font-size: 13px; }
  .song-memo { max-width: none; }
  .song-detail-row { display: block; }
  .song-table .song-detail-row > td { display: block; width: 100%; padding: 0 !important; }
  .song-admin-details.has-video { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .admin-inline { padding: 16px; }
  .request-overlay-controls { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .request-overlay-controls select, .request-overlay-controls input { min-height: 40px; font-size: 14px; }
  .song-form input, .song-form select, .song-form textarea { font-size: 16px; }
  .dialog { width: calc(100% - 20px); max-height: 92vh; padding: 16px; }
  footer { flex-wrap: wrap; gap: 12px; margin-top: 38px; }
}

@media (max-width: 380px) {
  .page-shell { width: calc(100% - 24px); }
  .brand img { width: 64px; height: 36px; }
  .header-actions { gap: 5px; }
  .request-status { max-width: 105px; font-size: 9px; }
  .intro-logo { width: min(118px, 37vw); }
  .intro-guidelines { font-size: 12px; }
  .song-table tbody tr:not(.song-detail-row) { padding-inline: 10px; }
}
