:root {
  --ground: #12100C;
  --surface: #1C1913;
  --surface-2: #232019;
  --line: #2E2A21;
  --ink: #EDE7DC;
  --ink-soft: #A79E8E;
  --ink-faint: #7A7263;
  --gold: #C9A24A;
  --gold-soft: rgba(201, 162, 74, .14);
  --warn: #D98E52;
  --bad: #C4553D;
  --ok: #7FA86B;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: Manrope, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  padding: 36px 18px 90px;
}

.wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

header { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 300; font-size: clamp(32px, 6vw, 46px); line-height: 1.05;
  margin: 0; letter-spacing: .01em;
}
.lede { color: var(--ink-soft); max-width: 62ch; margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.panel h2 {
  margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); font-weight: 700;
}

.hint { margin: 0; font-size: 13px; color: var(--ink-faint); }
.hint.bad { color: var(--warn); }

.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.row > label {
  flex: 0 0 96px; font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ------- переключатели ------- */
.segmented { display: flex; flex-wrap: wrap; border: 1px solid var(--line); }
.segmented button {
  font: inherit; font-size: 13px; padding: 7px 14px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: 0; border-left: 1px solid var(--line);
}
.segmented button:first-child { border-left: 0; }
.segmented button:hover { background: var(--surface-2); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--gold); color: var(--ground); font-weight: 700; }
.segmented button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* ------- ползунки ------- */
input[type="range"] {
  flex: 1 1 200px; min-width: 160px; height: 2px; appearance: none;
  background: var(--line); border-radius: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--gold); cursor: pointer;
}
input[type="range"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
output {
  font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums;
  min-width: 76px; text-align: right;
}

/* ------- кнопки ------- */
.btn {
  font: inherit; font-size: 14px; padding: 10px 20px; cursor: pointer;
  background: transparent; color: var(--gold); border: 1px solid var(--gold);
  text-decoration: none; display: inline-block; text-align: center;
}
.btn:hover { background: var(--gold-soft); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn.primary { background: var(--gold); color: var(--ground); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--line); color: var(--ink-soft); font-size: 13px; padding: 7px 14px; }
.btn.ghost:hover { color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; }
input[type="file"] { font: inherit; font-size: 13px; color: var(--ink-soft); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 13px; padding: 6px 12px; margin-right: 10px; cursor: pointer;
  background: transparent; color: var(--gold); border: 1px solid var(--gold);
}

/* ------- шкала ------- */
.timeline {
  position: relative; height: 78px; background: var(--surface-2);
  border: 1px solid var(--line); overflow: hidden;
}
.seg {
  position: absolute; top: 8px; height: 30px; background: var(--gold-soft);
  border: 1px solid var(--gold); display: flex; align-items: center; padding: 0 6px;
  font-size: 11px; color: var(--ink); overflow: hidden; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.seg.alt { top: 42px; }
.seg.clash { background: rgba(196, 85, 61, .22); border-color: var(--bad); }
.seg .num { color: var(--gold); font-weight: 700; margin-right: 5px; }
.plate {
  position: absolute; top: 0; bottom: 0; background: rgba(201, 162, 74, .10);
  border-left: 1px dashed var(--gold); pointer-events: none;
}
.ruler {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums;
}

/* ------- блоки ------- */
.block { border-top: 1px solid var(--line); padding: 16px 0 14px; display: flex; flex-direction: column; gap: 11px; }
.block:first-child { border-top: 0; padding-top: 2px; }
.bhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bnum {
  font-family: "Cormorant Garamond", Georgia, serif; font-size: 22px;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.btitle { font-weight: 700; }
.bscore { margin-left: auto; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.bquote {
  margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: 17px;
  line-height: 1.45; color: var(--ink-soft);
}
.takes { display: flex; flex-direction: column; gap: 1px; }
.take {
  display: grid; grid-template-columns: auto auto auto 1fr auto; align-items: center; gap: 12px;
  padding: 8px 8px 8px 6px; background: var(--surface-2); cursor: pointer;
}
.take:hover { background: #292519; }
.take[data-on="1"] { background: var(--gold-soft); box-shadow: inset 2px 0 0 var(--gold); }
.take input { accent-color: var(--gold); margin: 0; }
.take .tag {
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
  border: 1px solid var(--line); padding: 1px 6px;
}
.take .note { font-size: 13px; color: var(--ink-soft); min-width: 0; }
.take .len { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.play {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--gold);
  background: transparent; color: var(--gold); cursor: pointer; padding: 0;
  display: grid; place-items: center; flex: none;
}
.play:hover { background: var(--gold-soft); }
.play .ico {
  width: 0; height: 0; border-left: 7px solid currentColor;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; margin-left: 2px;
}
.play[data-on="1"] .ico {
  border: 0; width: 8px; height: 9px; margin-left: 0;
  background: linear-gradient(to right, currentColor 0 2.5px, transparent 2.5px 5.5px, currentColor 5.5px 8px);
}

/* ------- сборка ------- */
.sticky { position: sticky; bottom: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.build { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--ink-soft); }
.status.bad { color: var(--warn); }
.status.ok { color: var(--ok); }
video { width: 100%; background: #000; display: block; border: 1px solid var(--line); }
.result-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }

footer { color: var(--ink-faint); font-size: 13px; border-top: 1px solid var(--line); padding-top: 16px; }
footer p { margin: 0; }

@media (max-width: 620px) {
  .row > label { flex-basis: 100%; }
  .take { grid-template-columns: auto auto auto 1fr; }
  .take .len { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
