:root {
  --bg: #0b0e13; --panel: #121722; --panel2: #171d2b; --line: #232b3b; --text: #d9dfea; --dim: #8390a6;
  --accent: #5aa9ff; --accent-bg: rgba(90,169,255,.14); --up: #38d98f; --down: #ff5d6c; --new: #ffa24a; --wave: #56657f;
  --radius: 8px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
button:hover:not(:disabled) { border-color: #3a4660; background: #1d2536; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=text], input[type=search], input[type=number], textarea, select { background: #0d1119; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-width: 0; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; width: 100%; }
a { color: var(--accent); cursor: pointer; text-decoration: none; } a:hover { text-decoration: underline; }
.dim { color: var(--dim); } .grow { flex: 1; }
.kh { display: inline-block; font-size: 10px; line-height: 1; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; color: var(--dim); background: #0d1119; font-family: ui-monospace, Menlo, Consolas, monospace; }
svg { display: block; fill: currentColor; }

/* top bar */
#top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.brand { font-weight: 650; letter-spacing: .02em; }
.search { position: relative; } .search input { width: 200px; padding-right: 26px; } .search .kh { position: absolute; right: 6px; top: 6px; pointer-events: none; }
.chips { display: flex; gap: 6px; }
.chip { border-radius: 999px; padding: 4px 12px; background: transparent; }
.chip[aria-pressed=true] { background: var(--accent-bg); border-color: var(--accent); color: #fff; }
.chip .n { color: var(--dim); margin-left: 4px; } .chip.hot .n { color: var(--new); }
.channels { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 12px; }
.channels b { color: var(--text); font-weight: 600; }
.topbtns { display: flex; gap: 6px; align-items: center; }
.me { color: var(--dim); font-size: 12px; margin: 0 4px; }
.promote { border-color: #3a5a86; }
.qbtn { width: 28px; height: 28px; padding: 0; border-radius: 50%; }

/* layout */
#app { flex: 1; display: grid; grid-template-columns: minmax(250px, 330px) 1fr; min-height: 0; }
#list { overflow-y: auto; border-right: 1px solid var(--line); background: #0e121a; padding-bottom: 40px; }
#pane { overflow-y: auto; min-width: 0; position: relative; display: flex; flex-direction: column; }
@media (max-width: 1000px) { #app { grid-template-columns: 240px 1fr; } .search input { width: 140px; } }

/* event list */
.ghead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 12px; background: #0e121a; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; text-align: left; }
.ghead:hover:not(:disabled) { background: #121824; border-color: var(--line); }
.ghead svg { width: 10px; height: 10px; transition: transform .12s; } .ghead[aria-expanded=false] svg { transform: rotate(-90deg); }
.ghead .cnt { margin-left: auto; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; width: 100%; text-align: left; border: 0; border-left: 3px solid transparent; border-radius: 0; background: transparent; padding: 6px 12px 6px 9px; min-height: 48px; }
.row:hover:not(:disabled) { background: #131925; }
.row.sel { background: var(--accent-bg); border-left-color: var(--accent); }
.row .nm { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .ds { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.row .ct { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--new); flex: none; }
.nomark { color: var(--down); font-weight: 700; font-size: 11px; border: 1px solid var(--down); border-radius: 4px; padding: 0 4px; }
.empty { padding: 28px 18px; color: var(--dim); text-align: center; }

/* event header + settings */
.evhead { padding: 12px 18px 8px; border-bottom: 1px solid var(--line); flex: none; }
.evhead h2 { margin: 0; font-size: 18px; display: inline; } .evhead .bus { margin-left: 8px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; color: var(--dim); font-size: 11px; }
.evhead p { margin: 2px 0 8px; color: var(--dim); }
.settings { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--dim); }
.settings label { display: inline-flex; align-items: center; gap: 4px; }
.settings input[type=number] { width: 62px; padding: 2px 4px; }
.settings .sep { color: var(--line); }
.saving { color: var(--accent); }

/* create */
.create { margin: 10px 18px 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: 1fr 250px; gap: 12px; flex: none; }
.create.off { opacity: .55; }
.create h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.create textarea { height: 76px; }
.cctl { display: grid; gap: 6px; align-content: start; font-size: 12px; color: var(--dim); }
.cctl label { display: grid; grid-template-columns: 74px 1fr 38px; align-items: center; gap: 6px; }
.cctl input[type=range] { width: 100%; accent-color: var(--accent); min-width: 0; }
.cctl .val { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.stepper button { width: 24px; height: 24px; padding: 0; line-height: 1; }
.stepper span { min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.crow { display: flex; align-items: center; gap: 10px; }
.gen { background: var(--accent); border-color: var(--accent); color: #04101f; font-weight: 700; font-size: 15px; padding: 9px 14px; flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; }
.gen:hover:not(:disabled) { background: #7bbcff; border-color: #7bbcff; } .gen .kh { color: #04101f; background: rgba(255,255,255,.35); border-color: transparent; }
.sub { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; color: var(--dim); font-size: 12px; grid-column: 1 / -1; }
.drop { border: 1px dashed #34405a; border-radius: 6px; padding: 4px 10px; cursor: pointer; background: transparent; color: var(--dim); }
.drop.over { border-color: var(--accent); color: var(--text); background: var(--accent-bg); }
.hist { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; max-height: 120px; overflow: auto; }
.hist button { text-align: left; border: 0; background: transparent; color: var(--dim); padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist button:hover { color: var(--text); background: #1a2232; }
.nokey { grid-column: 1 / -1; color: var(--new); }

/* takes */
.takes { padding: 12px 18px 60px; display: flex; flex-direction: column; gap: 6px; }
.take { display: grid; grid-template-columns: 44px minmax(110px, 1fr) 46px 84px 46px 46px 44px 44px; grid-template-rows: 46px auto; gap: 4px 8px; align-items: center; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: var(--radius); }
.take.sel { border-color: #3a5a86; border-left-color: var(--accent); background: #141b29; }
.take.isnew { border-left-color: var(--new); }
.take.dim { opacity: .7; } .take.dim:hover, .take.dim.sel { opacity: 1; }
.take.skel { opacity: .8; }
.pbtn { width: 44px; height: 44px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--accent-bg); border-color: #2f5688; color: #cfe6ff; }
.pbtn:hover:not(:disabled) { background: #20406b; }
.pbtn svg { width: 18px; height: 18px; }
.pbtn.playing { background: var(--accent); color: #04101f; }
.wave { width: 100%; height: 42px; display: block; cursor: pointer; border-radius: 4px; background: #0d1119; }
.len { color: var(--dim); font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.badge { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--dim); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge.elevenlabs { color: #b9a3ff; border-color: #4d4380; } .badge.upload { color: #7fd6e8; border-color: #2f6270; } .badge.edit { color: #e8c37f; border-color: #6d5a2f; } .badge.base { color: #9aa7bd; }
.vbtn { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; position: relative; border-radius: 10px; }
.vbtn svg { width: 22px; height: 22px; }
.vbtn .kh { position: absolute; right: 2px; bottom: 2px; font-size: 9px; padding: 1px 3px; opacity: .8; }
.vbtn.up:hover:not(:disabled) { border-color: var(--up); color: var(--up); } .vbtn.down:hover:not(:disabled) { border-color: var(--down); color: var(--down); }
.vbtn.up.on { background: var(--up); border-color: var(--up); color: #04180e; } .vbtn.down.on { background: var(--down); border-color: var(--down); color: #200509; }
.vbtn.on .kh { color: inherit; background: rgba(255,255,255,.3); border-color: transparent; }
.ibtn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; position: relative; }
.ibtn svg { width: 18px; height: 18px; } .ibtn .kh { position: absolute; right: 2px; bottom: 2px; font-size: 9px; padding: 1px 3px; }
.take .line2 { grid-column: 2 / -1; display: flex; gap: 8px; align-items: center; min-height: 26px; font-size: 12px; color: var(--dim); min-width: 0; }
.take .line2 .tag { flex: none; }
.newtag { color: #2a1700; background: var(--new); font-weight: 700; font-size: 10px; letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; }
.note { flex: 0 1 190px; min-width: 70px; padding: 3px 6px; font-size: 12px; }
.prompt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.prompt.open { white-space: normal; }
.take .line2 .small { padding: 2px 8px; font-size: 12px; flex: none; }
.who { flex: none; font-size: 11px; }
.rejtoggle { align-self: flex-start; background: transparent; border: 0; color: var(--dim); padding: 6px 4px; }
.rejtoggle:hover:not(:disabled) { background: transparent; color: var(--text); }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sk { height: 42px; border-radius: 4px; background: linear-gradient(90deg, #131a27, #1c2536, #131a27); background-size: 200% 100%; animation: shim 1.4s linear infinite; }
@keyframes shim { to { background-position: -200% 0; } }

/* trim */
.trimbox { grid-column: 1 / -1; display: grid; gap: 8px; padding: 8px 0 2px; border-top: 1px solid var(--line); }
.trimbox canvas { width: 100%; height: 96px; background: #0d1119; border-radius: 4px; touch-action: none; cursor: ew-resize; }
.trimctl { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: 12px; color: var(--dim); }
.trimctl label { display: inline-flex; gap: 6px; align-items: center; } .trimctl input[type=range] { width: 120px; accent-color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: #04101f; font-weight: 650; }
.primary:hover:not(:disabled) { background: #7bbcff; border-color: #7bbcff; }

/* review */
.review { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 30px; min-height: 0; }
.review .prog { color: var(--dim); font-variant-numeric: tabular-nums; display: flex; gap: 12px; align-items: center; width: 100%; max-width: 860px; }
.bar { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; } .bar i { display: block; height: 100%; background: var(--accent); }
.review h2 { margin: 0; font-size: 26px; text-align: center; } .review .desc { color: var(--dim); text-align: center; margin-top: -8px; max-width: 700px; }
.review .wave { height: 170px; max-width: 860px; }
.review .meta { color: var(--dim); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 860px; }
.bigvotes { display: flex; gap: 24px; align-items: center; }
.bigvote { width: 170px; height: 150px; border-radius: 18px; display: grid; place-items: center; gap: 4px; position: relative; font-weight: 650; }
.bigvote svg { width: 56px; height: 56px; } .bigvote span.l { font-size: 13px; } .bigvote .kh { position: absolute; top: 8px; right: 8px; }
.bigvote.up { border-color: #1f6b4a; color: var(--up); } .bigvote.up:hover:not(:disabled) { background: var(--up); color: #04180e; border-color: var(--up); }
.bigvote.down { border-color: #7a2a33; color: var(--down); } .bigvote.down:hover:not(:disabled) { background: var(--down); color: #200509; border-color: var(--down); }
.bigvote.flash { animation: flash .35s; }
@keyframes flash { 30% { transform: scale(1.06); } }
.review .pbig { width: 64px; height: 64px; }
.review .pbig svg { width: 26px; height: 26px; }
.rnav { display: flex; gap: 8px; align-items: center; color: var(--dim); }
.done { text-align: center; } .done h2 { margin-bottom: 8px; }

/* toasts, modal, help */
#toasts { position: fixed; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 50; max-width: 420px; }
.toast { background: #1b2436; border: 1px solid #34425e; border-radius: 8px; padding: 8px 12px; display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: pop .15s; }
.toast.err { border-color: var(--down); } .toast button { padding: 2px 8px; } .toast .grow { min-width: 0; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
#modal { position: fixed; inset: 0; z-index: 40; background: rgba(4,6,10,.7); display: flex; align-items: center; justify-content: center; padding: 20px; }
#modal[hidden] { display: none; }
.dlg { background: var(--panel); border: 1px solid #34425e; border-radius: 12px; padding: 18px 20px; width: min(720px, 100%); max-height: 88vh; overflow: auto; }
.dlg h3 { margin: 0 0 10px; font-size: 16px; }
.dlg .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.dlg table { width: 100%; border-collapse: collapse; } .dlg td, .dlg th { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dlg th { color: var(--dim); font-weight: 500; font-size: 12px; }
.keys { columns: 2; column-gap: 28px; } .keys div { display: flex; gap: 8px; align-items: center; padding: 3px 0; break-inside: avoid; } .keys .kh { font-size: 11px; padding: 3px 6px; min-width: 20px; text-align: center; color: var(--text); }
.keys .d { color: var(--dim); }
.diff { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; }
.plus { color: var(--up); } .minus { color: var(--down); }
.menu { position: absolute; z-index: 30; background: var(--panel2); border: 1px solid #34425e; border-radius: 8px; padding: 4px; min-width: 190px; box-shadow: 0 8px 28px rgba(0,0,0,.5); max-height: 70vh; overflow: auto; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px; } .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 10px 0; } .progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.signin { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.signin button { font-size: 16px; padding: 12px 22px; }

@media (max-width: 960px) {
  .take { grid-template-columns: 44px minmax(80px, 1fr) 40px 72px 46px 46px 44px 44px; gap: 4px 6px; }
  .create { grid-template-columns: 1fr 210px; } .create textarea { height: 64px; } .note { flex-basis: 120px; }
  .cctl label { grid-template-columns: 62px 1fr 34px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.takes { overflow-y: auto; flex: 1; min-height: 0; }
