:root {
  --ink: #14211d;
  --muted: #66716c;
  --paper: #f4f5f1;
  --surface: #ffffff;
  --line: #dfe3dc;
  --accent: #d8ff62;
  --accent-ink: #10221e;
  --forest: #10221e;
  --forest-soft: #1b342d;
  --danger: #9d3129;
  --shadow: 0 24px 80px rgba(21, 38, 33, 0.12);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.player-page {
  background:
    radial-gradient(circle at 84% 8%, rgba(216, 255, 98, 0.16), transparent 24rem),
    var(--forest);
  color: #f6f8f3;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.player-shell { width: min(100%, 34rem); margin: 0 auto; padding: 1.35rem 1.1rem 3rem; }
.player-brand { display: flex; align-items: center; gap: .65rem; padding: .2rem .2rem 1.5rem; color: #cad5cf; font-size: .75rem; font-weight: 700; letter-spacing: .16em; }
.brand-mark, .admin-logo, .admin-wordmark span { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--forest); font-family: Georgia, serif; font-size: 1.25rem; text-decoration: none; }
.track-image { display: block; width: 100%; height: auto; max-height: 300px; margin: 0 0 1.1rem; border: 0; border-radius: 1.15rem; object-fit: contain; }
.now-playing-card { position: relative; overflow: hidden; padding: 2rem 1.2rem 1.3rem; border: 1px solid rgba(255,255,255,.11); border-radius: 1.65rem; background: linear-gradient(145deg, rgba(255,255,255,.095), rgba(255,255,255,.035)); box-shadow: 0 30px 80px rgba(0,0,0,.22); }
.now-playing-card::after { content: ""; position: absolute; width: 14rem; height: 14rem; border: 1px solid rgba(216,255,98,.16); border-radius: 50%; right: -8rem; top: -8rem; box-shadow: 0 0 0 2.5rem rgba(216,255,98,.025), 0 0 0 5rem rgba(216,255,98,.018); pointer-events: none; }
.eyebrow, .section-label { margin: 0 0 .7rem; color: #95a49e; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.now-playing-card h1 { position: relative; z-index: 1; margin: 0; max-width: 15ch; font-family: Georgia, serif; font-size: clamp(2rem, 9vw, 3.1rem); line-height: .98; font-weight: 500; }
.waveform { height: 5.2rem; margin: 2.3rem 0 .25rem; display: flex; align-items: center; justify-content: space-between; gap: .23rem; opacity: .72; }
.waveform i { flex: 1; height: calc(12% + var(--h, 30%)); max-width: .3rem; min-width: 2px; border-radius: 99px; background: linear-gradient(to top, var(--accent), #f3ffc9); transform-origin: center; }
.waveform i:nth-child(4n+1) { --h: 17%; } .waveform i:nth-child(4n+2) { --h: 48%; } .waveform i:nth-child(4n+3) { --h: 72%; } .waveform i:nth-child(4n) { --h: 30%; }
.waveform.is-playing i { animation: pulse 1.1s ease-in-out infinite alternate; animation-delay: calc(var(--h) * -10ms); }
@keyframes pulse { to { transform: scaleY(.45); opacity: .55; } }
.transport { display: grid; place-items: center; margin-top: .8rem; }
.play-button { border: 0; color: var(--forest); background: var(--accent); }
.play-button { display: grid; place-items: center; width: 4.3rem; height: 4.3rem; border-radius: 50%; background: var(--accent); color: var(--forest); box-shadow: 0 10px 30px rgba(216,255,98,.18); font-size: 1.45rem; }
#playIcon { width: 1.45rem; height: 1.45rem; object-fit: contain; }
.transcript-card { margin-top: 1.1rem; padding: 1.45rem 1.25rem; border: 1px solid rgba(255,255,255,.11); border-radius: 1.35rem; background: linear-gradient(145deg, rgba(255,255,255,.095), rgba(255,255,255,.035)); color: #f6f8f3; }
.rich-text { font-family: Georgia, serif; font-size: 1.14rem; line-height: 1.65; }
.rich-text p { margin: 0 0 1em; }
.rich-text p:last-child { margin-bottom: 0; }
.state-card { margin-top: 18vh; text-align: center; padding: 2rem; }
.state-card h1 { font-family: Georgia, serif; font-size: 2.15rem; margin: .5rem 0; }
.state-card p { color: #adbbb5; line-height: 1.55; }
.state-icon { display: grid; place-items: center; width: 4rem; height: 4rem; margin: 0 auto 1.2rem; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; color: var(--accent); font-size: 1.8rem; }
.loader { width: 2.3rem; height: 2.3rem; margin: auto; border: .2rem solid rgba(255,255,255,.13); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

.admin-page { background: var(--paper); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, var(--forest) 0 42%, #e9ece6 42%); }
.login-card { width: min(100%, 27rem); padding: 2.2rem; border-radius: 1.5rem; background: #fff; box-shadow: var(--shadow); }
.login-card h1, .dashboard-heading h1 { margin: .3rem 0 .35rem; font-family: Georgia, serif; font-size: 2.4rem; font-weight: 600; line-height: 1; }
.login-card .eyebrow { margin-top: 1.4rem; color: #6d7a74; }
.muted { margin: 0; color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: .45rem; margin-top: 1.1rem; color: #39443f; font-size: .88rem; font-weight: 600; }
.field input, .field textarea { width: 100%; border: 1px solid #cfd5cd; border-radius: .7rem; background: #fbfcfa; color: var(--ink); padding: .78rem .88rem; outline: none; }
.field textarea { resize: vertical; line-height: 1.55; min-height: 9rem; }
.field input:focus, .field textarea:focus { border-color: #71844e; box-shadow: 0 0 0 3px rgba(154,187,71,.16); }
.rich-toolbar { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border: 1px solid #cfd5cd; border-bottom: 0; border-radius: .7rem .7rem 0 0; background: #f1f3ef; color: #79837e; font-size: .75rem; font-weight: 400; }
.format-button { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border: 1px solid #bcc5bc; border-radius: .4rem; background: #fff; color: var(--ink); }
.format-button:hover, .format-button:focus-visible { border-color: #71844e; background: #eef5d8; }
.rich-editor { min-height: 12rem; max-height: 22rem; overflow-y: auto; padding: .8rem .88rem; border: 1px solid #cfd5cd; border-radius: 0 0 .7rem .7rem; background: #fbfcfa; color: var(--ink); outline: none; font-family: Georgia, serif; font-size: 1rem; line-height: 1.6; font-weight: 400; }
.rich-editor:focus { border-color: #71844e; box-shadow: 0 0 0 3px rgba(154,187,71,.16); }
.rich-editor:empty::before { content: attr(data-placeholder); color: #9aa39d; pointer-events: none; }
.rich-editor p, .rich-text p { margin: 0 0 1em; }
.rich-editor p:last-child, .rich-text p:last-child { margin-bottom: 0; }
.rich-editor strong, .rich-editor b, .rich-text strong, .rich-text b { font-weight: 700; }
.field small, .switch-field small { color: #79837e; font-weight: 400; }
.file-field { padding: .75rem; border: 1px dashed #c5cec2; border-radius: .8rem; transition: border-color .2s, background .2s; }
.file-field.is-dragging { border-color: #71844e; background: #eef5d8; }
.file-field input[type=file] { border-style: dashed; }
.drop-hint { color: #71844e !important; }
.remove-file-field { display: flex; align-items: center; gap: .5rem; color: #8d3c35; font-size: .82rem; font-weight: 600; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.8rem; border: 1px solid transparent; border-radius: .7rem; padding: .65rem 1rem; font-weight: 700; }
.button:disabled { opacity: .55; cursor: wait; }
.button-wide { width: 100%; margin-top: 1.25rem; }
.button-primary { background: var(--forest); color: #fff; }
.button-primary:hover { background: var(--forest-soft); }
.button-secondary { border-color: #cbd2c8; background: #fff; color: var(--ink); }
.button-ghost { background: transparent; color: #515c57; }
.form-error { margin: .75rem 0 0; color: var(--danger); font-size: .86rem; }
.admin-header { height: 4.5rem; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 5vw, 4.5rem); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.82); backdrop-filter: blur(16px); }
.admin-wordmark { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; font-family: Georgia, serif; font-size: 1.22rem; font-weight: 600; }
.admin-wordmark span { width: 1.8rem; height: 1.8rem; font-size: 1rem; background: var(--forest); color: var(--accent); }
.text-button { border: 0; background: transparent; color: #5a6661; font-size: .88rem; }
.admin-main { width: min(100% - 2rem, 72rem); margin: 0 auto; padding: 3.5rem 0 5rem; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2.3rem; }
.dashboard-heading .eyebrow { color: #718079; }
.track-list { display: grid; gap: .65rem; }
.track-row { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); transition: border-color .2s, transform .2s; }
.track-row:hover { border-color: #b8c0b7; transform: translateY(-1px); }
.track-disc { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; color: var(--accent); background: var(--forest); box-shadow: inset 0 0 0 .65rem #1b342d; }
.track-disc span { display: grid; place-items: center; width: 1rem; height: 1rem; border-radius: 50%; background: var(--accent); color: var(--forest); font-size: .7rem; }
.track-title-line { display: flex; align-items: center; gap: .65rem; }
.track-info h2 { margin: 0; font-size: 1rem; }
.track-info p { display: flex; gap: .5rem; margin: .38rem 0 0; color: #77817c; font-size: .8rem; }
.track-info code { color: #53615b; font-family: Inter, "Segoe UI", sans-serif; }
.status { padding: .22rem .48rem; border-radius: 99px; font-size: .65rem; font-weight: 700; }
.status.published { background: #eef5d8; color: #485d13; }
.status.draft { background: #eceeea; color: #67716c; }
.track-actions { display: flex; align-items: center; gap: .45rem; }
.mini-button, .more-button { min-height: 2.25rem; border: 1px solid #d8ddd6; border-radius: .55rem; background: #fff; color: #34413b; padding: .4rem .65rem; font-size: .78rem; font-weight: 700; }
.more-button { width: 2.25rem; padding: 0; color: #8d3c35; font-size: 1.2rem; }
.admin-empty { padding: 5rem 1rem; border: 1px dashed #c8cec5; border-radius: 1.2rem; text-align: center; }
.admin-empty h2 { margin: 1rem 0 .4rem; font-family: Georgia, serif; font-size: 1.6rem; }
.admin-empty p { max-width: 31rem; margin: 0 auto 1.2rem; color: var(--muted); }
.empty-disc { display: grid; place-items: center; width: 4rem; height: 4rem; margin: auto; border-radius: 50%; background: var(--forest); color: var(--accent); box-shadow: inset 0 0 0 .8rem #1b342d; }
.notice { position: fixed; z-index: 10; top: 5.5rem; left: 50%; translate: -50% 0; padding: .7rem 1rem; border-radius: .7rem; background: var(--forest); color: #fff; box-shadow: var(--shadow); font-size: .88rem; }

dialog { border: 0; color: var(--ink); }
dialog::backdrop { background: rgba(9, 22, 18, .58); backdrop-filter: blur(3px); }
.track-dialog { width: min(calc(100% - 1.5rem), 44rem); max-height: calc(100vh - 2rem); border-radius: 1.3rem; padding: 0; box-shadow: var(--shadow); }
.track-form { padding: 1.5rem; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 1.15rem; }
.dialog-heading h2, .qr-dialog h2 { margin: 0; font-family: Georgia, serif; font-size: 1.8rem; }
.dialog-heading .eyebrow, .qr-dialog .eyebrow { margin-bottom: .35rem; color: #718079; }
.dialog-close { border: 0; background: transparent; color: #68736e; font-size: 1.7rem; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-wide { grid-column: 1 / -1; }
.input-prefix { display: flex; align-items: center; border: 1px solid #cfd5cd; border-radius: .7rem; background: #f1f3ef; overflow: hidden; }
.input-prefix span { padding-left: .75rem; color: #7b8580; font-size: .83rem; }
.input-prefix input { border: 0; border-radius: 0; background: #fbfcfa; }
.switch-field { display: flex; align-items: center; gap: .75rem; margin-top: 1.2rem; color: #34413b; }
.switch-field input { position: absolute; opacity: 0; }
.switch { position: relative; flex: 0 0 auto; width: 2.7rem; height: 1.5rem; border-radius: 99px; background: #c9cec7; transition: .2s; }
.switch::after { content: ""; position: absolute; width: 1.1rem; height: 1.1rem; left: .2rem; top: .2rem; border-radius: 50%; background: #fff; transition: .2s; }
.switch-field input:checked + .switch { background: var(--forest); }
.switch-field input:checked + .switch::after { translate: 1.2rem 0; background: var(--accent); }
.switch-field span:last-child { display: grid; gap: .15rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.qr-dialog { width: min(calc(100% - 1.5rem), 28rem); border-radius: 1.3rem; padding: 1.5rem; text-align: center; box-shadow: var(--shadow); }
.qr-dialog .dialog-close { float: right; }
.qr-image { width: 16rem; max-width: 100%; margin: 1.5rem auto 1rem; }
.qr-image svg { display: block; width: 100%; height: auto; }
.qr-link { overflow-wrap: anywhere; color: #69746f; font-size: .78rem; }
.qr-actions { display: flex; justify-content: center; gap: .5rem; margin-top: 1.2rem; }

@media (max-width: 650px) {
  .admin-main { width: min(100% - 1.25rem, 72rem); padding-top: 2rem; }
  .dashboard-heading { align-items: start; }
  .dashboard-heading h1 { font-size: 2rem; }
  .dashboard-heading .button { padding-inline: .8rem; }
  .track-row { grid-template-columns: 2.8rem minmax(0, 1fr); gap: .75rem; padding: .85rem; }
  .track-disc { width: 2.8rem; height: 2.8rem; }
  .track-actions { grid-column: 2; }
  .track-title-line { align-items: start; flex-direction: column; gap: .35rem; }
  .track-info p { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .track-dialog { margin: auto .75rem 0; width: calc(100% - 1.5rem); max-height: calc(100vh - .75rem); border-radius: 1.2rem 1.2rem 0 0; }
  .dialog-actions { position: sticky; bottom: 0; background: #fff; }
}

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