:root {
  --bg: #0b0a10;
  --panel: #15131d;
  --line: #2a2636;
  --text: #f3f0fa;
  --muted: #9a93ad;
  --approve: #2ee59d;
  --reject: #ff4d6d;
  --redo: #ffc23d;
  --accent: #b18cff;
  --stoic: #e8b450;
  --science: #38e8ff;
  --ai: #39ff88;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* login */
#login { align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, #2a1a4a, var(--bg) 60%); }
.login-card { width: min(360px, 88vw); text-align: center; }
.login-card p { color: var(--muted); margin: 6px 0 28px; }
.login-card input { width: 100%; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 17px; margin-bottom: 12px; }
.error { color: var(--reject); min-height: 1em; }

.logo { font-weight: 700; letter-spacing: 3px; font-size: 20px; }
.logo span { color: var(--accent); }
.logo.big { font-size: 44px; }

/* header */
header { padding: calc(var(--safe-top) + 8px) 12px 8px; background: linear-gradient(var(--bg), transparent); z-index: 3; }
.row { display: flex; align-items: center; justify-content: space-between; }
.row.gap { gap: 10px; }
header .row { gap: 8px; }
header .logo { margin-right: auto; }
.net { padding: 5px 10px; border-radius: 999px; font: 700 11px var(--mono); background: #3a2a05; color: var(--redo); border: 1px solid #ffc23d55; white-space: nowrap; }
.bell { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 17px; padding: 0; }
.bell.on { border-color: var(--accent); }
select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: 500 14px var(--font); }
.chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; color: var(--muted); }
.chip b { color: var(--text); margin-left: 4px; }
.chip.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }

/* stage */
main { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 8px; min-height: 0; }
.card { position: relative; height: 100%; max-height: 100%; aspect-ratio: 9 / 16; max-width: 100%; border-radius: 20px; overflow: hidden; background: #000; box-shadow: 0 20px 60px #0009; touch-action: none; will-change: transform; transition: transform .25s ease, opacity .25s ease; }
.card.dragging { transition: none; }
.card video { width: 100%; height: 100%; object-fit: cover; display: block; }

.stamp { position: absolute; top: 18%; padding: 6px 16px; border: 4px solid; border-radius: 12px; font: 700 30px var(--font); letter-spacing: 3px; opacity: 0; pointer-events: none; }
.stamp.approve { left: 18px; color: var(--approve); border-color: var(--approve); transform: rotate(-14deg); }
.stamp.reject { right: 18px; color: var(--reject); border-color: var(--reject); transform: rotate(14deg); }

.overlay-top { position: absolute; top: 12px; left: 12px; right: 60px; display: flex; flex-wrap: wrap; gap: 6px; }
.badge { white-space: nowrap; padding: 5px 10px; border-radius: 8px; font: 700 12px var(--mono); letter-spacing: 1px; background: #000a; backdrop-filter: blur(6px); }
.badge.evergreen { color: var(--approve); }
.badge.timely { color: var(--science); }
.badge.fresh { color: #fff; background: #c2183fcc; }
.badge.fresh.urgent { animation: pulse 1s infinite; }
@keyframes pulse { 50% { background: #ff4d6d; } }

.sound-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; padding: 10px 16px; border: 1px solid #ffffff40; border-radius: 999px; background: #000b; backdrop-filter: blur(6px); font: 700 14px var(--font); color: #fff; }
.side { position: absolute; right: 8px; top: 34%; display: flex; flex-direction: column; gap: 12px; }
.round { width: 42px; height: 42px; border-radius: 50%; border: none; background: #000a; backdrop-filter: blur(6px); font-size: 20px; }

.overlay-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 10px; background: linear-gradient(transparent, #000b); }
.title { font-weight: 700; font-size: 15px; line-height: 1.3; text-shadow: 0 2px 8px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-flag { display: block; width: 100%; margin-top: 6px; padding: 6px 9px; border: 1px solid #ffc23d66; border-radius: 10px; background: #2a1e04d9; text-align: left; font: 500 12px/1.35 var(--font); color: #ffe3a1; }
.notes-flag span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scrub { margin-top: 10px; height: 3px; background: #ffffff30; border-radius: 2px; overflow: hidden; }
#scrub-fill { height: 100%; width: 0; background: #fff; }

.empty { text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); margin: 8px 0 4px; }
.empty-emoji { font-size: 54px; color: var(--accent); }
.bank { margin-top: 18px; display: grid; gap: 8px; }
.bank div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; text-align: left; font-size: 14px; }

/* actions */
footer { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 10px 0 calc(var(--safe-bottom) + 10px); }
.act { width: 56px; height: 56px; border-radius: 50%; border: 2px solid; background: var(--panel); font-size: 28px; font-weight: 700; transition: transform .12s; }
.act:active { transform: scale(.9); }
.act.approve { color: var(--approve); border-color: var(--approve); width: 66px; height: 66px; box-shadow: 0 0 26px #2ee59d44; }
.act.reject { color: var(--reject); border-color: var(--reject); width: 66px; height: 66px; box-shadow: 0 0 26px #ff4d6d44; }
.act.redo { color: var(--redo); border-color: var(--redo); }
.counter { font: 700 13px var(--mono); color: var(--muted); min-width: 44px; text-align: center; }

/* sheets */
.scrim { position: fixed; inset: 0; background: #0008; z-index: 9; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 82vh; background: var(--panel); border-radius: 22px 22px 0 0; z-index: 10; display: flex; flex-direction: column; animation: up .22s ease; border-top: 1px solid var(--line); }
@keyframes up { from { transform: translateY(100%); } }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 4px; flex: none; }
.sheet-body { overflow-y: auto; padding: 6px 18px calc(var(--safe-bottom) + 20px); }
.sheet h3 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.sheet h3 small { text-transform: none; letter-spacing: 0; color: var(--redo); margin-left: 6px; }
.notes { background: #3a2a05; border: 1px solid var(--redo); color: #ffe3a1; padding: 12px; border-radius: 12px; font-size: 14px; margin-top: 8px; }
.sources, .credits { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.sources a { display: block; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--science); text-decoration: none; font-size: 14px; }
.credits li { font-size: 13px; color: var(--muted); }
.script { white-space: pre-wrap; font: 14px/1.5 var(--font); background: var(--bg); padding: 12px; border-radius: 10px; margin: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input, label textarea, #note-text { display: block; width: 100%; margin-top: 4px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 15px var(--font); resize: vertical; }
.disclosure { font: 13px var(--mono); color: var(--muted); }
.btn { padding: 13px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; flex: 1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #12081f; width: 100%; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick button { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; }
.quick button.on { border-color: var(--redo); color: var(--redo); }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 110px); transform: translateX(-50%); background: #fff; color: #111; padding: 10px 10px 10px 16px; border-radius: 12px; display: flex; gap: 14px; align-items: center; font-weight: 700; z-index: 20; box-shadow: 0 10px 30px #0008; }
.toast button { border: none; background: #111; color: #fff; padding: 8px 12px; border-radius: 8px; font-weight: 700; }

@media (min-width: 900px) {
  footer { gap: 34px; }
  .sheet { left: auto; right: 24px; bottom: 24px; width: 440px; border-radius: 22px; max-height: 88vh; }
}

/* lab */
.bell.on { border-color: var(--accent); background: #2a1a4a; }
.lab { flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px calc(var(--safe-bottom) + 20px); }
.lab .chips { margin: 0 0 12px; }
.lab code { font: 12px var(--mono); color: var(--text); background: var(--panel); padding: 2px 6px; border-radius: 6px; }
.seg { display: flex; padding: 3px; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1; padding: 9px 4px; white-space: nowrap; font-size: 13px; border: none; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; }
.seg button.on { background: var(--accent); color: #12081f; }
.lab-text { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 14px 2px; font-style: italic; }
.duel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duel-play { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1; border: 2px solid var(--line); border-radius: 20px; background: var(--panel); }
.duel-play .big { font: 700 64px/1 var(--font); }
.duel-play .st { font: 700 13px var(--mono); color: var(--muted); }
.duel-play.playing { border-color: var(--accent); box-shadow: 0 0 30px #b18cff44; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #ffffff14; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.duel-pick { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin-top: 14px; }
.duel-pick .btn { width: auto; }
.duel-pick .btn:not(.ghost):not(:disabled) { border-color: var(--approve); color: var(--approve); }
.btn:disabled { opacity: .35; }
.btn.ghost { color: var(--muted); }
.btn.danger { color: var(--reject); }
.lab-hint { text-align: center; color: var(--muted); font: 12px var(--mono); margin: 10px 0 0; min-height: 1em; }
.lab-all { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lab-all li { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.lab-all li.playing { border-color: var(--accent); }
.lab-play { position: relative; overflow: hidden; height: 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.lab-play .st { font: 700 12px var(--mono); }
.lab-label { font-weight: 700; font-size: 14px; }
.lab-sub { font: 11px/1.4 var(--mono); color: var(--muted); margin-top: 3px; word-break: break-word; }
.lab-picked { font-size: 12px; color: var(--approve); margin-top: 4px; }
.lab-use { grid-column: 1 / -1; width: 100%; }
.lab-danger { margin-top: 16px; }
@media (min-width: 900px) { .lab { width: 100%; max-width: 640px; margin: 0 auto; } }

/* ideas */
.bell.count { position: relative; }
.bell.count[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--reject); color: #fff; font: 700 10px/17px var(--mono); }
.idea-form { display: grid; gap: 8px; margin-bottom: 14px; }
.idea-form textarea { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 15px var(--font); resize: vertical; }
.idea-form select { flex: 1; min-width: 0; }
.idea-form .btn.primary { width: auto; flex: none; padding: 12px 22px; }
#idea-tabs b { margin-left: 4px; color: inherit; }
.idea-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.idea { padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.idea.new { border-color: #b18cff66; }
.idea-head { display: flex; align-items: center; gap: 8px; }
.idea-head .idea-date:last-child { margin-left: auto; }
.badge.by-claude { color: var(--accent); }
.badge.by-you { color: var(--approve); }
.idea-channel { padding: 5px 8px; font-size: 12px; }
.idea-date { font: 11px var(--mono); color: var(--muted); }
.idea h4 { margin: 10px 0 0; font-size: 16px; }
.idea-text { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: #d9d3e8; white-space: pre-wrap; word-break: break-word; }
.idea-text a { color: var(--science); }
.idea .sources { margin-top: 8px; }
.idea-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; align-items: center; }
.idea-actions .btn { flex: none; padding: 9px 14px; }
.btn.go { border-color: var(--approve); color: var(--approve); }
