:root {
  --ink: #eee9df;
  --muted: #aaa297;
  --night: #171411;
  --panel: #211c18;
  --panel-2: #2a231d;
  --line: rgba(238, 233, 223, .14);
  --gold: #bd8959;
  --amber: #d4b184;
  --danger: #d98272;
  --success: #8bb58f;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(189, 137, 89, .12), transparent 34rem),
    radial-gradient(circle at 100% 25%, rgba(212, 177, 132, .08), transparent 28rem),
    var(--night);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid var(--gold);
  border-radius: 10px;
  color: #17110d;
  background: linear-gradient(135deg, var(--amber), var(--gold));
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:disabled { cursor: wait; opacity: .55; }
button.ghost, .button.ghost { color: var(--ink); background: transparent; border-color: var(--line); }
button.danger { color: #ffdcd5; background: transparent; border-color: rgba(217, 130, 114, .55); }
a { color: var(--amber); }

.site-header {
  border-bottom: 1px solid rgba(212, 177, 132, .25);
  background: linear-gradient(105deg, rgba(111,75,43,.34), rgba(35,28,22,.96) 32%, rgba(23,20,17,.97));
}
.header-inner, main, .footer-inner { width: min(1080px, calc(100% - 32px)); margin-inline: auto; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 78px; }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand strong { display: block; letter-spacing: .07em; font-size: .9rem; }
.brand span { display: block; color: var(--muted); font-size: .72rem; }

main { padding: clamp(2rem, 5vw, 4rem) 0 5rem; }
h1, h2, h3 { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.025em; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.03; }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.eyebrow { margin: 0 0 .55rem; color: var(--gold); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.lead { max-width: 720px; color: #cbc4b8; font-size: 1.08rem; }
.muted { color: var(--muted); }
.small { font-size: .83rem; }
.hidden, [hidden] { display: none !important; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(42,35,29,.93), rgba(28,24,20,.96));
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.login { width: min(520px, 100%); margin: 5vh auto; padding: clamp(1.25rem, 4vw, 2.2rem); }
label { display: grid; gap: .35rem; color: #d9d2c7; font-weight: 650; }
input, textarea {
  width: 100%;
  border: 1px solid rgba(238,233,223,.2);
  border-radius: 9px;
  padding: .72rem .8rem;
  color: var(--ink);
  background: rgba(8,7,6,.55);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-top: 1rem; }
.status { min-height: 1.5rem; color: var(--amber); }
.error { color: #ffb7aa; }
.success { color: #b8d8bb; }

.admin-top { display: flex; justify-content: space-between; gap: 1.5rem; align-items: end; margin-bottom: 2rem; }
.admin-top h1 { margin-bottom: .25rem; }
.new-project { padding: clamp(1.1rem, 3vw, 1.6rem); margin-bottom: 1.5rem; }
.storage-summary { display: flex; flex-wrap: wrap; gap: .2rem; margin: -1rem 0 1.2rem; color: var(--muted); font-size: .82rem; }
.storage-summary strong { color: #d8d0c4; }
.storage-summary.warning, .storage-summary.warning strong { color: #ffbf84; }
.project-list { display: grid; gap: .9rem; }
.project-card { padding: 1rem 1.1rem; }
.project-summary { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; align-items: center; width: 100%; color: var(--ink); background: transparent; border: 0; padding: 0; text-align: left; }
.project-summary strong { display: block; font: 1.3rem Georgia, serif; }
.project-summary small { color: var(--muted); }
.badge { display: inline-flex; width: max-content; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 999px; color: var(--amber); font-size: .74rem; }
.project-body { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.project-facts { display: grid; grid-template-columns: repeat(4,1fr); gap: .55rem; margin-bottom: 1rem; }
.project-facts div { padding: .65rem; border-radius: 9px; background: rgba(255,255,255,.035); }
.project-facts b, .project-facts span { display: block; }
.project-facts span { color: var(--muted); font-size: .75rem; }
.admin-versions { display: grid; gap: 1rem; }
.version-admin { display: grid; gap: .9rem; padding: clamp(.9rem, 3vw, 1.35rem); border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.version-admin-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: start; }
.version-admin-header h4 { margin: 0 0 .25rem; font: clamp(1.3rem, 3vw, 1.7rem) Georgia, serif; overflow-wrap: anywhere; }
.version-admin-header .delete-version { background: transparent; font-size: .82rem; padding-inline: .65rem; }
.version-admin audio { width: min(100%, 34rem); }
.version-feedback { border-top: 1px solid var(--line); padding-top: .8rem; }
.version-feedback ul { list-style: none; padding: 0; display: grid; gap: .65rem; }
.version-feedback li { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .75rem; align-items: start; }
.version-feedback p { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.upload-version { margin: 1.35rem 0; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.version-admin small { display: block; color: var(--muted); }
.code-box { display: inline-flex; padding: .45rem .7rem; border: 1px dashed var(--gold); border-radius: 8px; font: 700 1.05rem ui-monospace, monospace; letter-spacing: .12em; }

.project-head { margin-bottom: 2rem; }
.project-head h1 { margin-bottom: .5rem; }
.expiry-note { max-width: 760px; padding: .75rem 1rem; border-left: 2px solid var(--gold); color: #d7cec0; background: rgba(189,137,89,.07); }
.versions { display: grid; gap: 1rem; }
.version { overflow: hidden; }
.version > summary { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1rem 1.15rem; cursor: pointer; list-style: none; }
.version > summary::-webkit-details-marker { display: none; }
.version > summary strong, .version > summary small { display: block; }
.version > summary small { color: var(--muted); }
.version > summary::after { content: '+'; color: var(--gold); font: 1.7rem Georgia,serif; }
.version[open] > summary::after { content: '−'; }
.version-content { border-top: 1px solid var(--line); padding: 1rem 1.15rem 1.3rem; }
.player-row { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; }
.play-button { width: 52px; min-width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.wave-wrap { position: relative; margin: 1rem 0; border: 1px solid var(--line); border-radius: 10px; background: #100e0c; overflow: hidden; }
.waveform { display: block; width: 100%; height: 118px; cursor: pointer; touch-action: manipulation; }
.markers { position: absolute; inset: 0; pointer-events: none; }
.marker { position: absolute; top: 8px; width: 26px; height: 26px; min-height: 26px; padding: 0; transform: translateX(-50%); border: 0; border-radius: 50%; color: #17110d; background: var(--amber); font-size: .72rem; pointer-events: auto; }
.comment-form { padding: .9rem; border-radius: 10px; background: rgba(255,255,255,.035); }
.comment-form .form-grid { grid-template-columns: minmax(150px,.35fr) 1fr; }
.comment-list { display: grid; gap: .55rem; margin-top: 1rem; }
.comment { display: grid; grid-template-columns: auto 1fr; gap: .7rem; padding: .7rem; border-left: 2px solid var(--gold); background: rgba(255,255,255,.03); }
.comment-time { color: var(--amber); background: transparent; border: 0; min-height: 0; padding: 0; }
.comment p { margin: .15rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment small { color: var(--muted); }
.approval { margin-top: 1.5rem; padding: clamp(1rem, 3vw, 1.4rem); }
.approval form { max-width: 560px; }
.footer { border-top: 1px solid var(--line); }
.footer-inner { padding: 1.4rem 0 2rem; color: var(--muted); font-size: .8rem; }

@media (max-width: 720px) {
  .header-inner { min-height: 70px; }
  .brand > span { display: block; }
  .brand > span > span { display: none; }
  .admin-top { display: block; }
  .admin-top .actions { margin-top: 1rem; }
  .form-grid, .comment-form .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .project-facts { grid-template-columns: repeat(2,1fr); }
  .version-admin { grid-template-columns: 1fr; }
  .player-row { grid-template-columns: 46px 1fr; }
  .play-button { width: 46px; min-width: 46px; height: 46px; }
  .waveform { height: 96px; }
}
