:root {
  --bg: #0E1A14; --bg2: #122019; --card: #16261D; --card2: #1B2E23; --line: #24382C; --line2: #2A4134;
  --text: #F2F0E8; --text2: #D9DED6; --muted: #A8B5AC; --green: #1F6B45; --green2: #7FCCA0;
  --orange: #F28C28; --orange2: #FFB060; --yellow: #FFD34D; --blue: #7FD3FF; --red: #C8102E;
  --radius: 14px; --head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--orange); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; margin: 0; letter-spacing: .3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.side .brand img { width: 38px; height: 38px; }
.side .brand b { font-family: var(--head); font-size: 24px; letter-spacing: .5px; display: block; line-height: 1; }
.side .brand span { font-size: 12px; color: var(--muted); }
.nav-link { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px; color: #C9D2CB; text-decoration: none; font-size: 15px; }
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-link.on { background: var(--line); color: var(--text); font-weight: 600; }
.nav-link.on svg { color: var(--orange); }
.side .me { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--card); display: flex; align-items: center; gap: 10px; }
.main { flex: 1; min-width: 0; padding: 26px 32px 60px; }
.main.full { padding: 0; }
.tabbar { display: none; }
@media (max-width: 899px) {
  .side { display: none; }
  .main { padding: 16px 16px calc(96px + var(--safe-b)); }
  .tabbar { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #0E1A14F2; backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 6px calc(10px + var(--safe-b)); }
  .tabbar a { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--muted); text-decoration: none; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--orange); }
}

/* ---------- common ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 38px; line-height: 1; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.back { width: 44px; height: 44px; border-radius: 22px; background: var(--card); color: var(--text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.grid { display: grid; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; }
.btn { min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--line2); background: transparent; color: var(--text); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #0E1A14; font-weight: 600; }
.btn.green { background: var(--green); border-color: var(--green); font-weight: 600; }
.btn.light { background: var(--text); border-color: var(--text); color: #0E1A14; font-weight: 600; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.on { background: var(--orange); color: #0E1A14; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line2); background: transparent; color: var(--text); font-size: 13px; }
.chip.on { background: var(--orange); border-color: var(--orange); color: #0E1A14; font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--orange); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--line); font-size: 12px; color: var(--text2); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); border-radius: 4px; }
.bar.green > i { background: var(--green2); }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--line2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar.mister { background: var(--orange); color: #0E1A14; }
.avatar.ct { background: var(--green); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--radius); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #C9D2CB; }
.input { min-height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font-size: 15px; width: 100%; }
textarea.input { padding: 12px 14px; min-height: 96px; line-height: 1.45; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #A8B5AC 50%), linear-gradient(135deg, #A8B5AC 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.section-title { font-size: 21px; margin: 26px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--text); color: #0E1A14; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; }
#toast.on { opacity: 1; transform: translateX(-50%); }
@media (min-width: 900px) { #toast { bottom: 32px; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(ellipse at top, #1A3527, var(--bg) 60%); }
.login-box { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 18px; }
.login-box .logo { width: 72px; height: 72px; }
.login-box h1 { font-size: 46px; line-height: .95; }
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.user-pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 60px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); text-align: left; }
.user-pick span { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; }
.user-pick small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: 1fr; } }
.next { background: var(--green); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.next .eyebrow { color: #CDE8D7; }
.next h2 { font-size: 36px; line-height: 1; }
.crest { width: 56px; height: 56px; border-radius: 28px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-weight: 700; font-size: 18px; flex-shrink: 0; }
.clip-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--card); text-decoration: none; color: var(--text); }
.clip-item:hover { background: var(--card2); }
.thumb { width: 104px; aspect-ratio: 16/9; border-radius: 8px; background: var(--line) center/cover; flex-shrink: 0; position: relative; overflow: hidden; }
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 4px; bottom: 4px; font-size: 11px; background: #000A; padding: 1px 5px; border-radius: 4px; }
.thumb .seen { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--orange); }
.clip-item .t { font-weight: 600; font-size: 15px; line-height: 1.25; }
.clip-item .s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.rival-card { padding: 14px; border-radius: 14px; background: var(--card); display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); min-height: 92px; }
.rival-card:hover { background: var(--card2); }
.rival-card b { font-size: 15px; }

/* ---------- rival ---------- */
.sit { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); text-decoration: none; color: var(--text); width: 100%; border: none; text-align: left; }
.sit .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-weight: 700; font-size: 17px; color: var(--orange); flex-shrink: 0; }
.sit-block { display: flex; flex-direction: column; gap: 8px; }
.sit-clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding-left: 0; }

/* ---------- clip ---------- */
.clip-page { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 100vh; }
@media (max-width: 1099px) { .clip-page { grid-template-columns: 1fr; } }
.clip-main { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.clip-side { background: var(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 1099px) { .clip-side { border-left: none; border-top: 1px solid var(--line); } .clip-main { padding: 12px 12px 8px; } }
.clip-head h1 { font-size: 30px; line-height: 1.05; }
.stage { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 16px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
@media (max-width: 899px) { .stage { border-radius: 10px; } }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .pause-tag { position: absolute; left: 12px; top: 12px; padding: 6px 10px; border-radius: 8px; background: #0E1A14E0; font-size: 12px; font-weight: 600; display: none; }
.stage .pause-tag.on { display: block; }
.stage .bigplay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; border-radius: 36px; border: none; background: #F2F0E8E6; color: #0E1A14; display: flex; align-items: center; justify-content: center; }
.stage .bigplay svg { width: 30px; height: 30px; }
.toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px; border-radius: 28px; background: var(--card); border: 1px solid var(--line2); }
.toolbar .sep { width: 1px; height: 26px; background: var(--line2); margin: 0 4px; }
@media (max-width: 600px) {
  .toolbar { gap: 0; padding: 4px; border-radius: 18px; }
  .toolbar .icon-btn { width: 36px; height: 36px; }
  .toolbar .icon-btn svg { width: 18px; height: 18px; }
  .toolbar .swatch { width: 22px; height: 22px; margin: 0 1px; }
  .toolbar .sep { margin: 0 2px; }
  .toolbar .hint, .toolbar [data-color="#FF4D6A"] { display: none; }
}
@media (max-width: 899px) { .main.full { padding-bottom: calc(80px + var(--safe-b)); } }
.swatch { width: 30px; height: 30px; border-radius: 15px; border: 3px solid transparent; margin: 0 2px; }
.swatch.on { border-color: var(--text); }
.controls { display: flex; align-items: center; gap: 12px; }
.timeline { flex: 1; height: 28px; position: relative; cursor: pointer; touch-action: none; }
.timeline .rail { position: absolute; left: 0; right: 0; top: 11px; height: 6px; border-radius: 3px; background: #FFFFFF33; }
.timeline .fill { position: absolute; left: 0; top: 11px; height: 6px; border-radius: 3px; background: var(--orange); }
.timeline .mark { position: absolute; top: 5px; width: 6px; height: 18px; margin-left: -3px; border-radius: 2px; background: var(--yellow); border: none; padding: 0; }
.time { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 14px 14px 0; }
.tabs button { min-height: 44px; border-radius: 10px; border: none; background: transparent; color: var(--muted); font-size: 14px; }
.tabs button.on { background: var(--line); color: var(--text); font-weight: 600; }
.side-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; overflow: auto; }
.desc { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text2); white-space: pre-line; }
.audio-box { padding: 12px; border-radius: 14px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.audio-box audio { width: 100%; height: 40px; }
.drawing-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: transparent; color: var(--text); text-align: left; width: 100%; }
.drawing-item b { color: var(--yellow); font-variant-numeric: tabular-nums; }
.drawing-item.on { border-color: var(--orange); }
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; }
.msg .avatar { width: 32px; height: 32px; font-size: 12px; }
.msg .who { font-size: 12px; font-weight: 600; color: var(--green2); }
.msg .who.mister { color: var(--orange); }
.msg .who small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.msg p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; }
.msg .at { background: none; border: none; color: var(--yellow); padding: 0; font-weight: 600; font-size: 14px; }
.composer { display: flex; gap: 8px; padding: 10px 14px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); }
.composer .input { border-radius: 22px; }

/* ---------- pizarra ---------- */
.board-page { display: flex; flex-direction: column; gap: 14px; }
.board-wrap { display: flex; gap: 14px; align-items: stretch; }
.board-tools { width: 76px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; border-radius: 16px; background: var(--card); }
.board-tools .lbl { font-size: 11px; color: var(--muted); margin-top: 6px; }
.token-btn { width: 40px; height: 40px; border-radius: 20px; border: none; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.board { flex: 1; min-width: 0; border-radius: 16px; overflow: hidden; background: #2A6646; touch-action: none; }
.board svg { display: block; width: 100%; height: auto; }
.board .tok { cursor: grab; }
@media (max-width: 899px) {
  .board-wrap { flex-direction: column; }
  .board-tools { width: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 6px; }
  .board-tools .lbl { display: none; }
}

/* ---------- panel ---------- */
.panel-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.drop { min-height: 260px; border-radius: 16px; border: 2px dashed #3A5446; background: var(--bg2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; position: relative; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop video { width: 100%; border-radius: 10px; max-height: 220px; background: #000; }
.form { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
.rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec .dot { width: 10px; height: 10px; border-radius: 5px; background: #FF4D4D; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); }
table.t { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; }
table.t th { background: var(--card); text-align: left; padding: 12px 14px; color: #C9D2CB; font-weight: 600; }
table.t td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--bg2); }
.pct { font-variant-numeric: tabular-nums; font-weight: 600; }
.warn { color: var(--orange2); }
.ok { color: var(--green2); }
.meter { padding: 14px; border-radius: 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.demo-note { font-size: 12px; color: var(--muted); margin-top: 30px; }
