/* kadroom pages. Tokens and primitives live in tokens.css. */

/* ---- layout ---- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 80px max(16px, env(safe-area-inset-left)); }
.narrow { max-width: 420px; margin: 0 auto; padding: 72px 16px; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0 22px; }
.nav a:not(.logo) { color: var(--dim); text-decoration: none; font-size: 14px; }
.nav a:not(.logo):hover { color: var(--fg); }

.nav-links { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; justify-content: flex-end; white-space: nowrap; }
.site-links { display: none; gap: 14px; }
@media (min-width: 720px) { .site-links { display: flex; } .nav-links { gap: 16px; } }
@media (max-width: 719px) { .nav a:not(.logo), .linklike { font-size: 13px; } .nav .btn-sm { min-height: 34px; padding: 0 10px; } }
.linklike { background: none; border: 0; padding: 0; color: var(--dim); font: inherit; font-size: 14px; cursor: pointer; }
.linklike:hover { color: var(--fg); }
header.wrap { padding-bottom: 0; }

/* ---- landing ---- */
.hero { padding-top: 8px; }
.hero-grid { display: grid; gap: 20px; grid-template-areas: "text" "wave" "upload"; }
.hero-text { grid-area: text; } .hero-grid .wave-card { grid-area: wave; margin: 0; } .hero-grid .upload-col { grid-area: upload; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.15fr .85fr; grid-template-areas: "text wave" "text upload"; gap: 20px 40px; align-items: start; }
  .hero { padding-top: 32px; padding-bottom: 40px; }
}
h1.hero { font: 800 clamp(34px, 7.2vw, 72px)/1.0 var(--display); letter-spacing: -.025em; margin: 8px 0 18px; overflow-wrap: anywhere; }
h1.hero em { font-style: normal; color: var(--blue); }
.lede { color: var(--muted); font-size: clamp(16px, 2vw, 19px); margin: 0 0 18px; max-width: 46ch; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.pill { font: 500 12px var(--mono); padding: 9px 12px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; }
.pill-blue { color: var(--blue); border-color: #4f3bff55; }
.section { padding: 40px 16px; }
@media (min-width: 900px) { .section { padding: 64px 16px; } }
.section-head { max-width: 640px; margin-bottom: 24px; }
.h2 { font: 700 clamp(24px, 3.6vw, 36px)/1.1 var(--display); letter-spacing: -.02em; margin: 8px 0 12px; }
.cards3, .steps3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards3, .steps3 { grid-template-columns: repeat(3, 1fr); } }
.cards3 .card h3, .step h3 { font: 600 17px var(--body); margin: 8px 0 8px; }
.cards3 .card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.cards3 .card li + li { margin-top: 6px; }
.tag { font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.step { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 18px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.step-n { font: 600 12px var(--mono); color: var(--blue); }
.price { display: grid; gap: 20px; padding: 24px; background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (min-width: 900px) { .price { grid-template-columns: 1.2fr 1fr; align-items: center; padding: 32px; } }
.price .eyebrow { color: var(--muted-d); }
.price-num { font: 700 clamp(22px, 3vw, 32px)/1.15 var(--display); letter-spacing: -.02em; margin-top: 10px; }
.price-sub { color: var(--muted-d); margin: 10px 0 0; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { padding-left: 26px; position: relative; line-height: 1.45; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--violet); font-weight: 700; }
.card .checks li::before { color: var(--blue); }
.faq details { border-top: 1px solid var(--rule); padding: 14px 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--muted); font: 500 18px var(--mono); }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.foot { display: flex; justify-content: space-between; padding: 24px 16px 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--rule); }
.foot a { color: var(--muted); text-decoration: none; }
.sub-hero { max-width: 520px; margin: 0 auto; padding: 24px 0 60px; display: flex; flex-direction: column; gap: 12px; }
.sub-card { display: flex; flex-direction: column; gap: 18px; padding: 22px; }

.wave-card { background: var(--ink); color: var(--paper); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 28px); margin: 0 0 18px; position: relative; overflow: hidden; }
.wave-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 18px; }
.wave-card .eyebrow { color: var(--muted-d); }
.wave-clock { font: 600 clamp(22px, 3.4vw, 28px) var(--mono); font-variant-numeric: tabular-nums; margin-top: 4px; }
.wave-clock .to { opacity: .35; margin-inline: 8px; font-weight: 400; }
.wave-clock .out { color: var(--violet); }
.wave { display: flex; align-items: center; gap: 2px; height: 80px; margin-bottom: 16px; overflow: hidden; }
@media (min-width: 900px) { .wave { height: 96px; } }
.wave .bar {
  flex: 0 0 auto; width: 4px; height: 8px; border-radius: 2px; background: #5F5A72;
  transition: height .45s var(--ease), width .55s cubic-bezier(.6, 0, .2, 1), margin .55s cubic-bezier(.6, 0, .2, 1), background-color .3s, opacity .35s;
}
.wave .bar.keep { background: var(--violet); }
.wave .bar.dead { background: var(--cut); }
.wave .bar.gone { width: 0; margin-inline: -1px; opacity: 0; }
.wave-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.wave-note { font-size: 14px; opacity: .6; max-width: 38ch; margin: 0; }
.replay { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; background: none; border: 1px solid rgba(251, 250, 247, .28); color: var(--paper); border-radius: 999px; padding: 10px 14px; min-height: 40px; cursor: pointer; }
.replay:hover { border-color: var(--paper); }

.drop { border: 1.5px dashed #C9C5BB; border-radius: var(--r-lg); padding: 30px 16px; text-align: center; background: #fff; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--blue); background: #f6f5ff; }
.drop .t { font: 600 17px var(--body); margin: 0 0 6px; }
.drop .fine { margin: 0 0 16px; }
.fine { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0 0; }
.upload-col { display: flex; flex-direction: column; gap: 14px; }

/* ---- job card (landing upload, waiting page) ---- */
.jobcard { display: flex; flex-direction: column; gap: 4px; }
.job { display: flex; gap: 14px; align-items: flex-start; }
.thumb { width: 64px; height: 112px; border-radius: 12px; background: linear-gradient(160deg, #3d3a56, #141218); flex: none; object-fit: cover; display: block; }
.job h3 { margin: 0 0 2px; font: 600 15px var(--body); overflow-wrap: anywhere; }
.job .meta { font: 500 12px var(--mono); color: var(--muted-d); }
.job .bar { margin: 10px 0 6px; }
.job .phase { font-size: 13px; color: var(--muted-d); }
.job .phase.ok { color: var(--ok); }
.stages { list-style: none; padding: 0; margin: 14px 0 0; }
.stages li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--rule-d); color: var(--muted-d); }
.stages li .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--rule-d); display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.stages li.done { color: var(--paper); }
.stages li.done .dot { background: var(--violet); border-color: var(--violet); color: var(--ink); font-weight: 700; }
.stages li.cur { color: var(--paper); font-weight: 500; }
.stages li.cur .dot { border-color: var(--violet); border-top-color: transparent; animation: spin 1s linear infinite; }
.stages li .eta { margin-left: auto; font: 500 12px var(--mono); color: var(--muted-d); font-variant-numeric: tabular-nums; }
.ready-at { color: var(--muted); font-size: 14px; margin: 14px 2px; }
.ready-at b { color: var(--fg); font-family: var(--mono); }
#login-card { text-align: center; }
#login-card .btn { width: 100%; }
#status-error { margin: 12px 0 0; }

/* ---- editor ---- */
body.ink .editor { display: block; }
.editor .left { display: flex; flex-direction: column; gap: 14px; }
.editor .right { position: relative; }
.stick { position: sticky; top: 0; z-index: 4; background: var(--ink); padding: 8px 0 10px; border-bottom: 1px solid var(--rule-d); margin: 0 -16px; padding-inline: 16px; display: flex; flex-direction: column; gap: 10px; }
.player { background: #000; border-radius: 16px; position: relative; overflow: hidden; }
.player video { width: 100%; display: block; max-height: 42vh; background: #000; }
.player .time { position: absolute; left: 12px; top: 10px; font: 600 12px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; pointer-events: none; }
.map { background: var(--ink-2); border: 1px solid var(--rule-d); border-radius: 14px; padding: 8px 10px 6px; }
.map-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tog { display: flex; gap: 2px; background: var(--ink-3); border-radius: 8px; padding: 2px; }
.tog button { font: 500 11px var(--mono); padding: 5px 9px; min-height: 28px; border-radius: 6px; color: var(--muted-d); background: none; border: 0; cursor: pointer; }
.tog button.on { background: var(--ink); color: var(--paper); }
canvas.tl { width: 100%; height: 34px; display: block; cursor: pointer; touch-action: none; }
.legend { display: none; gap: 14px; margin-top: 6px; font: 500 11px var(--mono); color: var(--muted-d); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.summary b { font: 600 18px var(--mono); font-variant-numeric: tabular-nums; }
.summary .arrow { opacity: .4; }
.summary .to { color: var(--violet); }
.summary .spacer { margin-left: auto; }
.styles { display: none; flex-direction: column; gap: 14px; }
.seg .pv { height: 36px; border-radius: 8px; background: #000; margin-bottom: 6px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; gap: 3px; }
.seg .pv i { display: inline-block; background: #fff; border-radius: 2px; height: 7px; }
.seg .pv.cards i { width: 24px; height: 10px; border-radius: 3px; }
.seg .pv.lines i { width: 56px; height: 4px; }
.seg .pv.auto i { width: 30px; height: 6px; background: var(--violet); }
.warn { color: var(--muted-d); font-size: 13px; margin: 0 0 10px; }
.warn:empty { display: none; }

@media (min-width: 900px) {
  body.ink .editor { display: grid; grid-template-columns: 440px 1fr; min-height: 100vh; min-height: 100dvh; }
  .editor .left { padding: 16px 20px; border-right: 1px solid var(--rule-d); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: auto; }
  .editor .right { padding: 18px 28px 120px; }
  .stick { position: static; margin: 0; padding: 0; border: 0; background: none; }
  .player video { max-height: 46vh; }
  canvas.tl { height: 56px; }
  .legend { display: flex; }
  .styles { display: flex; }
  .summary b { font-size: 22px; }
  #btn-style { display: none; }
}
@media (max-width: 899px) {
  body.ink .wrap { padding-bottom: 110px; }
  .editor .right { padding-top: 10px; }
}

/* ---- script ---- */
.script { max-width: 640px; font-size: 16px; line-height: 2.1; overflow-wrap: anywhere; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
@media (min-width: 900px) { .script { font-size: 17px; } }
.script p { margin: 0 0 22px; position: relative; }
.script .w { display: inline-block; padding: 2px 5px; margin: 0 -1px; border-radius: 7px; cursor: pointer; transition: background .12s, color .12s; color: var(--paper); }
.script .w:hover { background: var(--ink-3); }
.script .w.ahead { color: #C4BFD6; }
.script .w.now { background: var(--violet); color: var(--ink); font-weight: 600; }
.script .w.sel { background: #4f3bff66; color: var(--paper); }
.script .w.hov { box-shadow: 0 0 0 1.5px var(--blue); }
.script .w.shaky { text-decoration: underline dotted; text-underline-offset: 3px; }
.script .w.cutw { color: var(--muted-d); text-decoration: line-through; }
.script .w.anchor { box-shadow: 0 0 0 1.5px var(--blue); }
.script .cutmark { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; font: 500 12px var(--mono); color: var(--cut); background: #ff4d3d14; border: 1px solid #ff4d3d55; padding: 0 9px; border-radius: 999px; vertical-align: middle; cursor: pointer; margin: 0 3px; }
.script .cutmark.open { color: var(--muted-d); background: transparent; border-style: dashed; border-color: var(--rule-d); }
.script .hes { display: inline-block; width: 14px; height: 14px; margin: 0 2px; vertical-align: middle; cursor: pointer; position: relative; }
.script .hes::after { content: ""; position: absolute; left: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: #ff4d3d99; }
.script .hes:hover::after { background: var(--cut); }
.script .take { border: 1px solid #ff4d3d44; background: #ff4d3d0d; border-radius: 14px; padding: 10px 14px; margin: 0 0 22px; color: var(--muted-d); font-size: 14px; line-height: 1.5; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.script .take b { color: var(--paper); font-weight: 600; }
.script .take .tri { transition: transform .2s var(--ease); }
.script .take.open .tri { transform: rotate(90deg); }
.script .take-words { margin: -12px 0 22px; padding: 0 14px; line-height: 2; }
.script .joinbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 28px; padding: 0 6px; margin: 0 2px; border-radius: 8px; background: var(--ink-3); border: 1px solid var(--rule-d); color: var(--paper); font-size: 12px; vertical-align: middle; cursor: pointer; }
.script .edit-input { font: inherit; font-size: 16px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--blue); background: var(--ink-2); color: var(--paper); min-width: 60px; max-width: 240px; }
.script .notice { display: block; color: var(--cut); font-size: 13px; margin: -6px 0 6px; line-height: 1.4; }
.script .range-hint { font: 500 12px var(--mono); color: var(--blue); margin: 0 0 12px; }

/* ---- popover ---- */
.pop { position: absolute; display: flex; gap: 2px; background: var(--paper); color: var(--ink); border-radius: 12px; padding: 4px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); z-index: 30; }
.pop button { min-height: 40px; padding: 0 12px; border-radius: 9px; border: 0; background: none; font: 500 13px var(--body); cursor: pointer; white-space: nowrap; }
.pop button:hover { background: var(--paper-2); }
.pop button.danger { color: var(--cut); }
.pop::after { content: ""; position: absolute; left: var(--arrow-x, 24px); bottom: -6px; width: 10px; height: 10px; background: var(--paper); transform: rotate(45deg); }
.pop.below::after { bottom: auto; top: -6px; }

/* ---- dock ---- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--ink) 30%); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
@media (min-width: 900px) { .dock { left: 441px; padding: 12px 28px 16px; } }
.dock .cnt { margin-right: auto; color: var(--muted-d); font-size: 13px; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .cnt b { color: var(--paper); }
.dock .links { display: flex; gap: 8px; }
.dock .btn { padding: 0 14px; }
.dock .short { display: none; }
@media (max-width: 899px) { .dock .btn { min-height: 44px; font-size: 14px; padding: 0 12px; } .dock .full { display: none; } .dock .short { display: inline; } }

/* ---- sheet (mobile style picker) ---- */
.sheet { position: fixed; inset: auto 0 0 0; z-index: 25; background: var(--ink-2); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .3s var(--ease); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 -12px 30px rgba(0, 0, 0, .4); }
.sheet.open { transform: none; }
.sheet .styles { display: flex; }
.scrim { position: fixed; inset: 0; z-index: 24; background: #0008; }

/* ---- videos ---- */
.vgrid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .vgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vcard { display: flex; gap: 14px; text-decoration: none; color: inherit; cursor: pointer; }
.vcard .thumb { width: 72px; height: 128px; }
.vcard .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.vcard h3 { margin: 0; font: 600 15px var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard .nums { font: 500 13px var(--mono); color: var(--muted); }
.vcard .nums .to { color: var(--blue); }
.vcard .foot { margin-top: auto; display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.vcard .foot-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.vcard .expires { font-size: 12px; color: var(--muted); white-space: nowrap; }
.vcard .del { font-size: 13px; color: var(--muted); }
.vcard .del:hover { color: var(--cut); }
.vcard .body { padding-top: 2px; }
#empty { text-align: center; }

/* ---- admin ---- */
table.small { border-collapse: collapse; font-size: 13px; width: 100%; }
table.small th, table.small td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
pre { white-space: pre-wrap; }
