:root {
  --ink: #302b28;
  --muted: #726b65;
  --cream: #fffaf0;
  --paper: #fffdf8;
  --sky: #cfeaf0;
  --sky-deep: #9bcfd9;
  --yellow: #f3cd61;
  --gold: #dba943;
  --mint: #badfd2;
  --coral: #ec8b73;
  --line: rgba(48, 43, 40, 0.14);
  --shadow: 0 18px 50px rgba(64, 84, 84, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }

.hero-shell {
  min-height: 700px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 77% 43%, rgba(255, 250, 232, 0.95) 0 16%, transparent 16.3%),
    radial-gradient(circle at 9% 18%, rgba(255, 255, 255, 0.52) 0 3px, transparent 4px),
    var(--sky);
  border-bottom: 1px solid rgba(48, 43, 40, 0.09);
}
.hero-shell::after {
  content: "";
  position: absolute;
  left: -4%; right: -4%; bottom: -56px;
  height: 110px;
  background: var(--cream);
  border-radius: 50% 50% 0 0 / 90% 90% 0 0;
}
.topbar, .hero, .library-section, .admin-header, .admin-intro, .admin-columns {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}
.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .05em; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  height: 35px;
  padding: 0 11px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  font-family: Georgia, serif;
  font-size: 13px;
  letter-spacing: .12em;
  background: rgba(255, 253, 248, .45);
}
.admin-link, .admin-nav a, .admin-nav .nav-button {
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border: 1px solid rgba(48, 43, 40, .38);
  border-radius: 99px;
  transition: background .18s ease, transform .18s ease;
}
.admin-nav .nav-button { color: var(--ink); background: transparent; cursor: pointer; }
.admin-link:hover, .admin-nav a:hover, .admin-nav .nav-button:hover { background: var(--paper); transform: translateY(-1px); }
.hero {
  min-height: 540px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: 54px;
  position: relative;
  z-index: 1;
  padding-bottom: 62px;
}
.eyebrow {
  margin: 0 0 16px;
  font: 700 11px/1.2 Georgia, serif;
  letter-spacing: .22em;
  color: #6b6159;
}
.hero h1 {
  margin: 0;
  max-width: 660px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(48px, 6.4vw, 84px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.04em;
}
.hero h1 em { color: #ae6e35; font-style: normal; position: relative; }
.hero h1 em::after {
  content: "";
  position: absolute;
  left: 2%; right: -3%; bottom: 4px;
  height: 8px;
  border-bottom: 3px solid rgba(174, 110, 53, .55);
  border-radius: 50%;
}
.hero-note { max-width: 545px; margin: 28px 0; color: #5f5a56; line-height: 1.8; font-size: 16px; }
.search-box {
  width: min(540px, 100%);
  height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px 0 20px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 7px 7px 0 rgba(48, 43, 40, .12);
}
.search-box > span { font: 28px/1 Georgia, serif; transform: rotate(-18deg); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 16px; }
.search-box input::placeholder { color: #9c948d; }
.search-box button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #ece7de; cursor: pointer; font-size: 20px; }

.mascot-scene { height: 440px; position: relative; isolation: isolate; }
.mascot-scene::before {
  content: "";
  position: absolute;
  width: 410px; height: 410px;
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff5d8;
  border: 1px dashed rgba(48, 43, 40, .2);
}
.cat { position: absolute; width: 170px; height: 150px; border-radius: 48% 48% 43% 43%; z-index: 2; }
.cat-black { left: 60px; top: 132px; background: #332f2d; transform: rotate(-5deg); }
.cat-gold { right: 45px; top: 155px; background: #d5a956; transform: rotate(7deg); box-shadow: inset 0 -26px 0 rgba(255,255,255,.18); }
.cat .ear { position: absolute; width: 72px; height: 78px; top: -38px; background: inherit; clip-path: polygon(50% 0, 100% 100%, 0 82%); }
.cat .ear::after { content: ""; position: absolute; inset: 18px 19px 16px; background: #d98b7f; opacity: .75; clip-path: polygon(50% 0, 100% 100%, 0 82%); }
.cat .ear.left { left: 2px; transform: rotate(-12deg); }
.cat .ear.right { right: 1px; transform: scaleX(-1) rotate(-12deg); }
.cat .eye { position: absolute; top: 61px; width: 29px; height: 14px; border-bottom: 4px solid currentColor; border-radius: 50%; color: #f5e6a1; }
.cat-gold .eye { color: #493a2d; }
.cat .eye.left { left: 35px; transform: rotate(4deg); }
.cat .eye.right { right: 35px; transform: rotate(-4deg); }
.cat .nose { position: absolute; width: 12px; height: 9px; left: calc(50% - 6px); top: 88px; background: #e79b8c; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.cat .nose::after, .cat .nose::before { content: ""; position: absolute; top: 6px; width: 20px; height: 12px; border-bottom: 2px solid currentColor; border-radius: 50%; color: #b97e71; }
.cat .nose::before { right: 5px; }
.cat .nose::after { left: 5px; }
.fish { position: absolute; z-index: 3; left: calc(50% - 31px); top: 278px; width: 66px; height: 36px; border-radius: 55% 45% 45% 55%; background: var(--yellow); transform: rotate(-8deg); border: 2px solid rgba(48,43,40,.65); }
.fish::before { content: ""; position: absolute; width: 34px; height: 42px; right: -28px; top: -4px; background: var(--yellow); border: 2px solid rgba(48,43,40,.65); clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.fish::after { content: ""; position: absolute; left: 15px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.fish i { position: absolute; left: 11px; right: 10px; top: 17px; border-bottom: 1px dashed rgba(48,43,40,.5); }
.scene-shadow { position: absolute; left: 70px; right: 48px; top: 312px; height: 34px; background: rgba(64, 79, 79, .16); filter: blur(12px); border-radius: 50%; z-index: 0; }
.music-note { position: absolute; z-index: 3; font-family: Georgia, serif; font-weight: 700; color: #ae6e35; }
.note-one { left: 25px; top: 80px; font-size: 34px; transform: rotate(-15deg); }
.note-two { right: 18px; top: 78px; font-size: 42px; transform: rotate(9deg); }

.library-section { padding: 60px 0 100px; }
.admin-intro h1 { margin: 0; font: 700 clamp(35px, 4vw, 50px)/1.1 "STKaiti", "KaiTi", serif; }

.song-section { padding-top: 30px; }
.song-panel { padding: 28px; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.song-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button { padding: 10px 13px; border: 1px solid transparent; border-radius: 99px; background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; }
.tabs button:hover { background: #f3eee5; }
.tabs button.active { color: var(--paper); background: var(--ink); }
.status-filter { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--muted); font-size: 12px; }
.status-filter select, .admin-card select, .admin-card input, .admin-card textarea {
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(48,43,40,.3);
  border-radius: 11px;
  outline: 0;
}
.status-filter select { padding: 9px 34px 9px 11px; }
.status-filter select:focus, .admin-card select:focus, .admin-card input:focus, .admin-card textarea:focus { border-color: #9c713a; box-shadow: 0 0 0 3px rgba(219,169,67,.17); }
.result-line { margin: 20px 0 14px; color: var(--muted); font-size: 13px; }
.result-line strong { color: var(--ink); }
.song-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0; }
.song-grid li { min-height: 78px; display: flex; align-items: center; gap: 12px; position: relative; padding: 13px 14px; background: #f8f5ee; border: 1px solid transparent; border-radius: 14px; }
.song-grid li:hover { border-color: rgba(48,43,40,.16); background: #fff; }
.song-grid li.restricted { background: #fff1ed; border-color: rgba(205, 93, 65, .2); }
.song-grid li.needs-record-confirmation:not(.restricted) { background: #fff8de; border-color: rgba(185, 133, 28, .22); }
.song-grid li.has-badges { padding-bottom: 34px; }
.song-number { width: 27px; flex: 0 0 auto; font: italic 11px Georgia, serif; color: #a19991; }
.song-copy { min-width: 0; }
.song-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.song-copy small { display: block; margin-top: 5px; color: #968e87; font-size: 11px; }
.song-badges { position: absolute; left: 53px; right: 10px; bottom: 7px; display: flex; flex-wrap: wrap; gap: 4px; }
.status-badge { padding: 3px 7px; border-radius: 99px; font-size: 9px; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.restricted-badge { color: #a8412e; background: #ffd9d0; }
.record-badge { color: #765517; background: #f9dfa0; }
.load-more { display: block; margin: 28px auto 2px; padding: 12px 22px; border: 1.5px solid var(--ink); border-radius: 99px; background: #fff; cursor: pointer; font-size: 13px; font-weight: 700; }
.load-more:hover { background: var(--yellow); }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-state > span { font: 50px Georgia, serif; color: var(--gold); }
.empty-state h3 { margin: 4px 0 8px; font-size: 20px; }
.empty-state p { margin: 0; color: var(--muted); }
footer { padding: 48px 24px 54px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); background: #f6efe2; }
footer p { margin: 0 0 10px; font: 700 17px Georgia, serif; letter-spacing: .18em; color: var(--ink); }
footer p span:nth-child(1) { color: #b48821; } footer p span:nth-child(2) { color: #4a8d83; } footer p span:nth-child(3) { color: #bf5e49; }
footer small { line-height: 1.7; }

.admin-shell { min-height: 100vh; padding-bottom: 80px; background: linear-gradient(180deg, var(--sky) 0 280px, var(--cream) 280px); }
.admin-header { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.admin-header > div:first-child { display: flex; align-items: center; gap: 18px; }
.admin-header p { margin: 0; color: #625e59; font-size: 12px; }
.admin-nav { display: flex; gap: 8px; }
.admin-intro { padding: 55px 0 76px; }
.admin-intro p:last-child { margin: 16px 0 0; color: #5e5a56; }
.admin-columns { display: grid; grid-template-columns: .8fr 1.2fr; gap: 22px; align-items: start; }
.admin-card { padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.admin-card-heading { display: flex; gap: 15px; align-items: flex-start; margin-bottom: 24px; }
.admin-card-heading > span { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; background: var(--yellow); font: italic 11px Georgia, serif; }
.admin-card h2 { margin: 0; font: 700 25px/1.2 "STKaiti", "KaiTi", serif; }
.admin-card-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.admin-card > label, .admin-search { display: grid; gap: 8px; margin: 18px 0; font-size: 13px; font-weight: 700; }
.admin-card select, .admin-card input, .admin-card textarea { width: 100%; padding: 12px 13px; resize: vertical; font-size: 14px; }
.admin-card textarea { min-height: 226px; line-height: 1.7; }
.primary-button, .secondary-button { display: inline-grid; place-items: center; min-height: 43px; padding: 0 19px; border: 1.5px solid var(--ink); border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 800; }
.primary-button { color: var(--paper); background: var(--ink); }
.primary-button:hover { background: #5a4d42; }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.secondary-button { background: var(--paper); }
.import-card .primary-button { width: 100%; }
.admin-message { margin: 15px 0 0; padding: 11px 13px; color: #635326; background: #fff3c9; border-radius: 10px; font-size: 12px; line-height: 1.6; }
.manage-hint { color: var(--muted); font-size: 11px; }
.admin-song-list { max-height: 650px; overflow: auto; border-top: 1px solid var(--line); }
.admin-song-list article { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 3px; border-bottom: 1px solid var(--line); }
.admin-song-list article > div:first-child { min-width: 0; }
.admin-song-list strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.admin-song-list article span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.row-actions { display: flex; flex: 0 0 auto; gap: 5px; }
.row-actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #f6f1e9; cursor: pointer; font-size: 10px; }
.row-actions button:hover { background: var(--yellow); }
.row-actions button.danger:hover { color: #fff; background: #c95f49; }
.denied-shell { display: grid; place-items: center; padding: 30px; background: var(--sky); }
.denied-card { max-width: 560px; padding: 50px; text-align: center; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 28px; box-shadow: 9px 10px 0 rgba(48,43,40,.1); }
.denied-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 23px; color: #fff; background: var(--coral); border-radius: 50%; font: 700 25px Georgia, serif; }
.denied-card h1 { margin: 0; font: 700 34px/1.2 "STKaiti", "KaiTi", serif; }
.denied-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.denied-actions { display: flex; justify-content: center; gap: 10px; margin-top: 26px; }

.is-hidden { display: none !important; }
.login-wrap {
  width: min(520px, calc(100% - 32px));
  margin: 72px auto 0;
}
.login-card { padding: 42px; border: 1.5px solid var(--ink); box-shadow: 8px 9px 0 rgba(48,43,40,.1); }
.login-card h1 { margin: 0; font: 700 38px/1.2 "STKaiti", "KaiTi", serif; }
.login-card > p:not(.eyebrow):not(.admin-message) { color: var(--muted); line-height: 1.75; }
.login-card label { display: grid; gap: 8px; margin: 25px 0 18px; font-size: 13px; font-weight: 700; }
.login-card input { width: 100%; padding: 13px 14px; border: 1px solid rgba(48,43,40,.3); border-radius: 11px; outline: 0; }
.login-card input:focus { border-color: #9c713a; box-shadow: 0 0 0 3px rgba(219,169,67,.17); }
.login-card .primary-button { width: 100%; }
.login-card code { padding: 2px 5px; border-radius: 5px; color: #7d472c; background: #f5e7cf; font-size: .9em; }
.admin-message[data-kind="error"] { color: #8f2f22; background: #ffe2dc; }

@media (max-width: 900px) {
  .hero-shell { min-height: auto; }
  .hero { grid-template-columns: 1fr; gap: 8px; padding-top: 45px; padding-bottom: 98px; }
  .hero-copy { text-align: center; }
  .hero-note, .search-box { margin-left: auto; margin-right: auto; }
  .mascot-scene { height: 370px; width: min(500px, 100%); margin: 0 auto; }
  .mascot-scene::before { width: 330px; height: 330px; }
  .cat-black { left: 12%; top: 118px; }
  .cat-gold { right: 9%; top: 135px; }
  .fish { top: 260px; }
  .scene-shadow { top: 295px; }
  .song-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-columns { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar, .hero, .library-section, .admin-header, .admin-intro, .admin-columns { width: min(100% - 28px, 1180px); }
  .topbar { height: 72px; }
  .brand { font-size: 13px; gap: 8px; }
  .brand-mark { height: 31px; padding: 0 8px; font-size: 10px; }
  .admin-link { padding: 8px 11px; font-size: 11px; }
  .hero { padding-top: 30px; }
  .hero h1 { font-size: clamp(43px, 14vw, 64px); }
  .hero-note { margin: 20px 4px; font-size: 14px; }
  .search-box { height: 56px; }
  .mascot-scene { height: 330px; transform: scale(.88); margin-top: -5px; margin-bottom: -20px; }
  .cat { width: 150px; height: 135px; }
  .cat-black { left: 3%; }
  .cat-gold { right: 0; }
  .cat .eye { top: 56px; }
  .cat .nose { top: 82px; }
  .library-section { padding-top: 38px; }
  .song-panel { padding: 17px 12px; margin-left: -4px; margin-right: -4px; border-radius: 20px; }
  .song-toolbar { align-items: stretch; flex-direction: column; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .tabs button { text-align: center; }
  .status-filter { justify-content: space-between; }
  .song-grid { grid-template-columns: 1fr; }
  .song-grid li { min-height: 70px; }
  .admin-header { align-items: flex-start; padding-top: 20px; }
  .admin-header > div:first-child { display: block; }
  .admin-header p { margin-top: 8px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
  .admin-nav { flex-direction: column; }
  .admin-nav a, .admin-nav .nav-button { padding: 7px 9px; text-align: center; font-size: 10px; }
  .admin-intro { padding: 50px 0 62px; }
  .admin-card { padding: 20px 16px; }
  .admin-song-list article { align-items: flex-start; flex-direction: column; }
  .row-actions { width: 100%; }
  .row-actions button { flex: 1; }
  .denied-card { padding: 38px 22px; }
  .denied-actions { flex-direction: column; }
  .login-card { padding: 34px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
