@font-face { font-family: "Hand"; src: url("/font/hand.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #f6f5f1; --surface: #fffefb; --surface-2: #f0efea; --line: #e2e0d8; --line-2: #d2cfc4;
  --text: #22232a; --muted: #6b6d78; --navy: #1c2c5c; --navy-2: #2a3f7e;
  --red: #c8302c; --green: #1c804a; --blue: #2060c4;
  --hl-point: #ffe98a; --hl-key: #ffc9c2; --hl-title: #c9dcff; --now: #eef3ff;
  --shadow: 0 1px 2px rgba(20,22,40,.06), 0 6px 20px rgba(20,22,40,.06);
  --radius: 12px; --on-navy: #fff;
  --hand: "Hand", "Patrick Hand", "Comic Neue", "Segoe Print", cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161b; --surface: #1d1f26; --surface-2: #252832; --line: #2e313c; --line-2: #3a3e4b;
    --text: #e8e8ec; --muted: #9b9eab; --navy: #9db4ff; --navy-2: #b9c9ff;
    --red: #ff7b72; --green: #5fd18f; --blue: #79a8ff;
    --hl-point: #5c5014; --hl-key: #6a2b27; --hl-title: #213a6b; --now: #232a3d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --on-navy: #10131c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; min-height: 100dvh;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }
.muted { color: var(--muted); }
.error { color: var(--red); margin: 10px 0 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--navy); text-decoration: none; font: 24px var(--hand); white-space: nowrap; }
.brand img { border-radius: 7px; }
.proj-title {
  flex: 1; min-width: 0; border: 1px solid transparent; background: none; border-radius: 8px;
  padding: 4px 8px; font-weight: 600; text-overflow: ellipsis;
}
.proj-title:hover, .proj-title:focus { border-color: var(--line-2); background: var(--surface); outline: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.save-state { font-size: 13px; color: var(--muted); }
.pill {
  font-size: 12.5px; padding: 3px 10px 3px 22px; border-radius: 99px; border: 1px solid var(--line-2);
  position: relative; white-space: nowrap; color: var(--muted); background: var(--surface);
}
.pill::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--line-2); }
.pill.on { color: var(--text); }
.pill.on::before { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px;
  padding: 7px 13px; font-weight: 550; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger, .danger { color: var(--red); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.big { width: 100%; padding: 12px; font-size: 16px; margin-top: 6px; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- home ---------- */
.home { width: min(980px, 100%); margin: 0 auto; padding: 40px 16px 60px; }
.hero { max-width: 700px; margin: 0 auto 48px; text-align: center; }
.hero h1 { font: clamp(34px, 6vw, 52px)/1.1 var(--hand); color: var(--navy); }
.hero .ink { position: relative; white-space: nowrap; }
.hero .ink::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6 Q 15 1 30 5 T 60 5 T 90 5 T 118 4' fill='none' stroke='%23c8302c' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.lede { color: var(--muted); font-size: 17px; margin: 14px auto 26px; max-width: 560px; }
.url-form { display: flex; gap: 8px; }
.url-form input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); box-shadow: var(--shadow);
}
.url-form .btn { padding: 0 22px; border-radius: 12px; }
.drop {
  display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding: 22px; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: 14px; color: var(--muted); transition: border-color .15s, background .15s;
}
.drop strong { color: var(--text); }
.drop:hover, .drop.over { border-color: var(--navy); background: color-mix(in srgb, var(--navy) 5%, transparent); }
.sub-pick { display: inline-block; margin-top: 10px; font-size: 13.5px; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--blue) 40%, transparent); }
.sub-pick:hover { text-decoration-color: currentColor; }
.progress { position: relative; height: 22px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.progress div { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--navy) 30%, transparent); transition: width .3s; }
.progress span { position: relative; display: block; text-align: center; font-size: 12.5px; line-height: 22px; font-weight: 600; color: var(--text); }

.recent h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; position: relative; transition: transform .15s;
}
.card:hover { transform: translateY(-2px); }
.card .thumb { aspect-ratio: 16/9; background: var(--surface-2) center / cover no-repeat; }
.card .body { padding: 10px 12px 12px; }
.card h3 { font-size: 14.5px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.card .del { position: absolute; top: 6px; right: 6px; opacity: 0; background: var(--surface); border-radius: 8px; }
.card:hover .del, .card:focus-within .del { opacity: 1; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); }
.tag.ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.tag.err { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }

/* ---------- editor ---------- */
.editor {
  flex: 1; display: grid; grid-template-columns: minmax(380px, 5fr) minmax(400px, 6fr);
  gap: 0; min-height: 0; height: calc(100dvh - 53px);
}
.pane { min-height: 0; display: flex; flex-direction: column; }
.pane.left { border-right: 1px solid var(--line); background: var(--surface); }
.player-wrap { background: #000; }
.player-wrap video { display: block; width: 100%; max-height: 38vh; background: #000; }
.tx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 18px 8px; border-bottom: 1px solid var(--line); }
.tx-head h2 { font-size: 16px; }
.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.transcript { flex: 1; overflow-y: auto; padding: 10px 10px 40vh; outline: none; }
.sent { display: flex; gap: 10px; padding: 4px 8px; border-radius: 8px; line-height: 1.65; }
.sent.now { background: var(--now); }
.sent .ts {
  flex: none; width: 46px; padding-top: 2px; font: 12px/1.9 ui-monospace, monospace; color: var(--muted);
  border: 0; background: none; cursor: pointer; text-align: right; user-select: none; -webkit-user-select: none;
}
.sent .ts:hover { color: var(--blue); text-decoration: underline; }
.sent .tx { flex: 1; font-size: 15.5px; }
mark { color: inherit; border-radius: 3px; padding: 1px 0; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.point { background: var(--hl-point); }
mark.key { background: var(--hl-key); box-shadow: inset 0 -2px 0 var(--red); }
mark.title { background: var(--hl-title); box-shadow: inset 0 -2px 0 var(--navy); }
mark.flash { animation: flash 1s ease 2; }
@keyframes flash { 50% { filter: brightness(.8); } }
.tx-status { padding: 40px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tx-status.err .spinner { display: none; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.right { background: var(--bg); }
.tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.tabs button, .mobile-tabs button {
  border: 0; background: none; padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on, .mobile-tabs button.on { color: var(--navy); border-bottom-color: var(--navy); }
.tabs b, .mobile-tabs b { font-weight: 600; font-size: 12px; background: var(--surface-2); border-radius: 99px; padding: 0 7px; margin-left: 4px; }
.tab { display: none; flex: 1; overflow-y: auto; padding: 14px 16px 60px; }
.tab.on { display: block; }
.plan-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.plan-tools .btn { font-size: 13px; padding: 5px 10px; }

.board {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 14px; overflow: hidden;
}
.board.sel { border-color: var(--navy); box-shadow: 0 0 0 2px color-mix(in srgb, var(--navy) 30%, transparent), var(--shadow); }
.board-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 4px; }
.board-num { font: 12px ui-monospace, monospace; color: var(--muted); white-space: nowrap; cursor: pointer; }
.board-num:hover { color: var(--blue); }
.board-title {
  flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 8px; padding: 3px 6px; background: none;
  font: 22px/1.2 var(--hand); color: var(--navy);
}
.board-title::placeholder { color: var(--muted); font-size: 18px; }
.board-title:hover, .board-title:focus { border-color: var(--line-2); outline: none; }
.board-body { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 4px 12px 12px; }
@media (min-width: 1400px) { .board-body { grid-template-columns: minmax(0, 1fr) 280px; } }
.preview {
  position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); order: -1;
}
@media (min-width: 1400px) { .preview { order: 1; align-self: start; } }
.preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview.loading::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%) -100% 0 / 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: 100% 0; } }
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pt { display: grid; grid-template-columns: auto auto 1fr auto; gap: 6px; align-items: start; padding: 4px; border-radius: 8px; position: relative; }
.pt:hover, .pt:focus-within { background: var(--surface-2); }
.pt.flash { animation: flashbg 1.2s ease; }
@keyframes flashbg { 0%, 60% { background: var(--hl-point); } }
.kind { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); }
.kind.key { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.pt textarea {
  width: 100%; resize: none; border: 1px solid transparent; background: none; border-radius: 6px; padding: 3px 6px;
  line-height: 1.4; field-sizing: content; min-height: 30px; overflow: hidden;
}
.pt textarea:focus { border-color: var(--line-2); background: var(--surface); outline: none; }
.pt.key textarea { color: var(--red); }
.pt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pt-time { font: 11.5px ui-monospace, monospace; color: var(--muted); cursor: pointer; border: 0; background: none; padding: 2px 4px; }
.pt-time:hover { color: var(--blue); }
.pt-acts { display: flex; gap: 2px; opacity: .0; transition: opacity .15s; }
.pt:hover .pt-acts, .pt:focus-within .pt-acts { opacity: 1; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.icon-btn:hover { background: var(--line); color: var(--text); }
.warn { font-size: 11.5px; color: #a35d00; padding: 0 6px; }
.board-note { font-size: 12.5px; color: var(--muted); padding: 0 6px; }

.empty { text-align: center; padding: 30px 20px; color: var(--muted); max-width: 420px; margin: 0 auto; }
.empty svg { width: 200px; color: var(--line-2); }
.empty h3 { color: var(--text); margin: 10px 0 6px; font-size: 17px; }
.empty .btn { margin-top: 10px; }

.settings { display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.field label { display: flex; justify-content: space-between; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field output { font-weight: 500; color: var(--muted); }
.field input[type=range] { width: 100%; accent-color: var(--navy); }
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input:not([type]) { width: 80px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); font-family: ui-monospace, monospace; }
.range-row input[type=range] { flex: 1; }
.range-row .toggle { font-weight: 500; }
.render-box { margin-top: 14px; }
.render-box .progress { margin-top: 0; }
.render-box p { margin: 8px 0; font-size: 13px; }
.output { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.output video { width: 100%; border-radius: var(--radius); background: #000; box-shadow: var(--shadow); }

/* floating toolbars */
.selbar {
  position: fixed; z-index: 50; display: flex; gap: 2px; padding: 4px; border-radius: 12px;
  background: var(--navy); box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
:root:not([data-theme="light"]) .selbar { background: #1c2c5c; }
.selbar button { border: 0; background: none; color: #fff; padding: 7px 11px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.selbar button:hover { background: rgba(255,255,255,.14); }
.selbar button.danger { color: #ffb4ad; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px;
}

.mobile-tabs { display: none; }

@media (max-width: 899px) {
  .editor { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - 53px); }
  .mobile-tabs { display: flex; position: sticky; top: 53px; z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 8px; }
  .mobile-tabs button { flex: 1; }
  .pane { display: none; }
  .pane.on { display: flex; }
  .right .tabs { display: none; }
  .pane.left { border-right: 0; }
  .player-wrap { position: sticky; top: 92px; z-index: 5; }
  .transcript { overflow: visible; padding-bottom: 120px; }
  .tab { overflow: visible; }
  .proj-title { font-size: 14px; }
  .brand span { display: none; }
  .hint .kbds { display: none; }
  .selbar { left: 8px !important; right: 8px; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .pt-acts { opacity: 1; }
}

/* transcript editing */
.tx-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
#btnEditTx[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.edit-bar { padding: 10px 18px 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--hl-title) 35%, var(--surface)); display: flex; flex-direction: column; gap: 8px; }
.edit-bar .hint { margin: 0; }
.find-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.find-row input:not([type]) { flex: 1 1 120px; min-width: 0; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
.small-text { font-size: 12.5px; }
.push-right { margin-left: auto; }
.transcript.editing .sent { align-items: flex-start; }
.tx-edit {
  flex: 1; width: 100%; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px;
  background: var(--surface); line-height: 1.6; font-size: 15px; min-height: 34px; overflow: hidden; min-width: 0;
}
.tx-edit:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 18%, transparent); }
.tx-edit.changed { border-color: color-mix(in srgb, var(--green) 60%, transparent); }
.tx-edit.is-empty { border-style: dashed; }
.sent.gone { display: none; }

/* ---------- settings ---------- */
.icon-link { display: inline-flex; color: var(--muted); padding: 4px; border-radius: 8px; }
.icon-link:hover, .icon-link.on { color: var(--navy); background: var(--surface-2); }
a.pill { text-decoration: none; }
a.pill:hover { border-color: var(--navy); }
.settings-page { width: min(760px, 100%); margin: 0 auto; padding: 28px 16px 120px; }
.settings-head h1 { font: 34px/1.1 var(--hand); color: var(--navy); }
.settings-head p { margin: 6px 0 22px; }
.file-path { font: 12px ui-monospace, monospace; background: var(--surface-2); border-radius: 6px; padding: 1px 6px; word-break: break-all; }
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 20px; margin-bottom: 18px; }
.settings-card h2 { font-size: 17px; }
.settings-card > .hint { margin: 4px 0 14px; font-size: 13.5px; }
.settings-card .field { margin-top: 14px; }
.settings-card .field.narrow { max-width: 280px; }
.settings-card .field label { justify-content: flex-start; gap: 8px; }
.settings-card .field label .muted { font-weight: 450; }
.settings-card input:not([type=checkbox]):not([type=range]), .settings-card select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--bg);
}
.settings-card input:focus, .settings-card select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 16%, transparent); }
.settings-card .row { display: flex; gap: 8px; align-items: center; }
.settings-card .row input { flex: 1; min-width: 0; }
.settings-card .field .hint { margin-top: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1px solid var(--line-2); background: var(--bg); border-radius: 10px; padding: 8px 14px;
  font-weight: 600; cursor: pointer; color: var(--muted);
}
.seg button[aria-checked="true"] { border-color: var(--navy); color: var(--navy); background: color-mix(in srgb, var(--navy) 9%, var(--surface)); box-shadow: inset 0 0 0 1px var(--navy); }
#aiProvHint { margin: 10px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; font-family: ui-monospace, monospace; }
.chips button:hover { border-color: var(--navy); color: var(--navy); }
.chips button.on { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.test-row { margin-top: 16px; flex-wrap: wrap; }
.test-msg { font-size: 13.5px; }
.test-msg.ok { color: var(--green); }
.test-msg.bad { color: var(--red); }
.save-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%);
}
.save-bar #setMsg { margin-right: auto; font-size: 13.5px; }
code { font: 12.5px ui-monospace, monospace; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
@media (max-width: 899px) { .settings-page { padding-top: 18px; } .settings-card { padding: 16px; } }

/* ---------- board operations ---------- */
.grip {
  width: 16px; height: 28px; border: 0; background: none; padding: 0; cursor: grab; color: var(--line-2);
  border-radius: 5px; display: grid; place-items: center; touch-action: none;
}
.grip:hover { color: var(--muted); background: var(--line); }
.grip:active { cursor: grabbing; }
.grip svg { width: 10px; height: 16px; }
.pt.dragging { opacity: .35; }
.pt.drop-before::before, .pt.drop-after::after {
  content: ""; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 3px; background: var(--blue);
}
.pt.drop-before::before { top: -3px; }
.pt.drop-after::after { bottom: -3px; }
.points.drop-end::after { content: ""; display: block; height: 3px; margin: 2px 4px; border-radius: 3px; background: var(--blue); }
.board.drop-ok { border-color: var(--blue); box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 30%, transparent), var(--shadow); }
.board.drop-full { border-color: var(--red); }
.board-full { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.menu {
  position: fixed; z-index: 55; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 5px;
}
.menu .menu-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px 4px; }
.menu button {
  display: flex; width: 100%; align-items: baseline; gap: 8px; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 7px 10px; border-radius: 8px; font-size: 13.5px;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button:disabled { opacity: .45; cursor: default; }
.menu button.danger { color: var(--red); }
.menu button .sub { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }
@media (pointer: coarse) { .grip { display: none; } .pt { grid-template-columns: auto 1fr auto; } }

/* ---------- advanced render options: speaker focus ---------- */
.advanced { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px; }
.advanced summary { cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "▸"; font-size: 11px; color: var(--muted); transition: transform .15s; }
.advanced[open] summary::before { transform: rotate(90deg); }
.adv-badge { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--navy) 12%, transparent); color: var(--navy); }
.advanced .field { margin-top: 14px; }
.advanced .seg button { padding: 6px 14px; }
.advanced .hint { margin: 6px 0 0; }
.focus-preview { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); margin-top: 14px; display: grid; place-items: center; }
.focus-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.focus-preview span { font-size: 13px; padding: 12px; text-align: center; }
.focus-preview.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%) -100% 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
.focus-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.focus-list li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; font-size: 13.5px; }
.focus-list li:hover { background: var(--surface-2); }
.focus-list label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; font-weight: 500; margin: 0; justify-content: flex-start; }
.focus-list .t { font-family: ui-monospace, monospace; font-size: 12.5px; }
.focus-list li.off .t { color: var(--muted); text-decoration: line-through; }
.focus-list .empty-note { color: var(--muted); font-size: 13px; padding: 4px 0; }

/* ---------- hosted: sign in, plan, billing ---------- */
.plan-pill::before { background: var(--navy); }
.signin-page { min-height: calc(100dvh - 60px); display: grid; place-items: center; padding: 24px 16px 60px; }
.signin-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 24px; display: flex; flex-direction: column; gap: 12px;
}
.signin-card img { align-self: center; }
.signin-card h1 { font: 30px var(--hand); color: var(--navy); text-align: center; margin: 0; }
.signin-card > .muted { text-align: center; margin: -6px 0 6px; }
.signin-card .field label { font-weight: 600; font-size: 13.5px; display: block; margin-bottom: 6px; }
.signin-card input {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text);
}
.signin-card input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 16%, transparent); }
.btn.wide { width: 100%; justify-content: center; }
.signin-switch { text-align: center; margin: 0; font-size: 14px; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--blue); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint.center { text-align: center; }
.signin-msg { margin: 0; padding: 10px 12px; border-radius: 9px; font-size: 14px; background: var(--surface-2); }
.signin-msg.bad { color: var(--red); }
.notice { padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--green) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); margin: 0 0 18px; }
.bill-current, .bill-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.bill-current h2 { font-size: 22px; margin: 0; }
.bill-current p { margin: 4px 0 0; }
.meter { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 16px 0 8px; }
.meter > div { height: 100%; background: var(--navy); border-radius: 99px; transition: width .3s; }
.meter.low > div { background: var(--red); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.plan-card.current { border-color: var(--navy); box-shadow: 0 0 0 2px color-mix(in srgb, var(--navy) 20%, transparent); }
.plan-card h3 { margin: 0; font-size: 15px; }
.plan-card .price { font-size: 22px; font-weight: 700; }
.plan-card .price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan-card ul { margin: 2px 0 8px; padding-left: 18px; font-size: 13px; color: var(--muted); flex: 1; }
.seg.small button { font-size: 12.5px; padding: 3px 10px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
