/* Shiklo Video — the look of Shiklo PDF and the Photo Editor (navy header, pill buttons, round icon chips, blue panels),
   light and dark. Layout: header / tool list | player over the timeline | tool panel. Phones (≤ 760 px): player,
   timeline, the tool list as a bottom bar, the panel as a drawer opened by picking a tool. Shared parts are Shiklo
   PDF's (pdf_app/style.css); the player and the timeline are this app's. */
:root {
  --primary: #2563eb; --primary-2: #1d4ed8; --soft: #e8f0fe; --soft-2: #d4e3fd; --on-soft: #13296b;
  --bg: #f5f7fb; --surface: #fff; --surface-2: #edf1f8; --surface-3: #e3e8f0;
  --text: #1f2937; --text-2: #5b6577; --muted: #7c8698; --line: #e3e8f0; --line-2: #c9d4e6;
  --head: #0b1f4d; --head-text: #dbe6ff; --stage: #e6ebf3; --thumbs: #eef2f8; --sheet: #fff;
  --ok: #16a34a; --ok-bg: #e7f7ee; --ok-fg: #14532d; --warn-bg: #fff4e5; --warn-fg: #8a4b00; --danger: #c8215f;
  --scrim: rgba(11, 31, 77, .42);
  --g-primary: linear-gradient(180deg, #5b95ff 0%, #2563eb 60%, #1d4ed8 100%);
  --g-success: linear-gradient(180deg, #5bd98a 0%, #22a356 60%, #178a45 100%);
  --g-neutral: linear-gradient(180deg, #fff 0%, #f5f7fb 60%, #e9eef6 100%);
  --shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 6px 18px rgba(15, 23, 42, .06);
  --shadow-3: 0 20px 60px rgba(11, 31, 77, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #6aa1ff; --primary-2: #4f8bff; --soft: rgba(106, 161, 255, .16); --soft-2: rgba(106, 161, 255, .26); --on-soft: #cfe0ff;
    --bg: #0d1424; --surface: #141c2e; --surface-2: #1b2539; --surface-3: #243049;
    --text: #e6ebf5; --text-2: #a9b4c8; --muted: #8592a8; --line: #26324a; --line-2: #34425f;
    --head: #071331; --head-text: #c9d6f3; --stage: #0f1729; --thumbs: #111a2c;
    --ok-bg: rgba(34, 163, 86, .18); --ok-fg: #9be7b9; --warn-bg: rgba(161, 92, 0, .22); --warn-fg: #ffd08a;
    --g-neutral: linear-gradient(180deg, #212c43 0%, #1b2539 60%, #172033 100%);
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #6aa1ff; --primary-2: #4f8bff; --soft: rgba(106, 161, 255, .16); --soft-2: rgba(106, 161, 255, .26); --on-soft: #cfe0ff;
  --bg: #0d1424; --surface: #141c2e; --surface-2: #1b2539; --surface-3: #243049;
  --text: #e6ebf5; --text-2: #a9b4c8; --muted: #8592a8; --line: #26324a; --line-2: #34425f;
  --head: #071331; --head-text: #c9d6f3; --stage: #0f1729; --thumbs: #111a2c;
  --ok-bg: rgba(34, 163, 86, .18); --ok-fg: #9be7b9; --warn-bg: rgba(161, 92, 0, .22); --warn-fg: #ffd08a;
  --g-neutral: linear-gradient(180deg, #212c43 0%, #1b2539 60%, #172033 100%);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { touch-action: pan-x pan-y; }   /* the app never zooms as a whole; the document has its own pinch (viewer.js) */
body { font: 14px/1.4 "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Devanagari", "Noto Sans JP", sans-serif; color: var(--text); background: var(--bg); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }

/* ---------- app grid ---------- */
.app { display: grid; height: 100vh; height: 100dvh; grid-template-rows: 64px minmax(0, 1fr); grid-template-columns: 236px minmax(0, 1fr) 340px;
  grid-template-areas: "head head head" "tools main panel"; }
.app-head { grid-area: head; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--head); color: #fff; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; white-space: nowrap; }
.brand .logo { width: 34px; height: 34px; display: inline-flex; } .brand .logo svg { width: 100%; height: 100%; }
.brand b { font-weight: 800; } .brand > span:last-child { color: var(--head-text); }
.hmid { flex: 1; display: flex; justify-content: center; gap: 8px; min-width: 0; }
.hend { display: flex; gap: 8px; align-items: center; }
.hbtn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06); color: #dbe6ff; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.hbtn:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.hbtn[aria-pressed="true"] { background: rgba(147,197,253,.22); border-color: rgba(147,197,253,.5); color: #fff; }
.hbtn.primary { background: var(--g-success); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(22,163,74,.35); }
.hbtn.icon { padding: 0; width: 40px; justify-content: center; }
.hbtn.ph { display: none; }
@media (max-width: 1360px) { .hmid .hbtn .btn-label, .hend .hbtn:not(.primary) .btn-label { display: none; } .hmid .hbtn, .hend .hbtn:not(.primary) { padding: 0; width: 40px; justify-content: center; } }

/* ---------- tool list ---------- */
.tools { grid-area: tools; overflow-y: auto; padding: 10px 10px 16px; background: var(--surface); border-right: 1px solid var(--line); }
.open-btn { width: 100%; display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 12px 0 6px; border: 0; border-radius: 23px; background: var(--g-neutral);
  box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; margin-bottom: 4px; }
.open-btn .ico { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: var(--soft); color: var(--primary); }
.grp { margin: 12px 8px 4px; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.tool { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 12px 4px 6px; border: 0; border-radius: 22px; background: none; text-align: left; font-size: 14.5px; }
.tool .chip { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: var(--soft); color: var(--primary); display: inline-flex; flex: none; }
.tool .chip .ico { width: 20px; height: 20px; }
.tool:hover { background: var(--surface-2); }
.tool.is-soon .tool-label { color: var(--text-2); }
.tool.is-soon::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.tool[aria-current="true"] { background: var(--g-primary); color: #fff; box-shadow: 0 3px 10px rgba(37,99,235,.3); }
.tool[aria-current="true"] .tool-label { color: #fff; }
.tool[aria-current="true"] .chip { background: rgba(255,255,255,.2); color: #fff; }


/* ---------- panel ---------- */
.panel { grid-area: panel; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.sheet-handle, .sheet-close { display: none; }
.ptitle { flex: none; height: 58px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); }
.ptitle-text { margin: 0; font-size: 16px; font-weight: 700; }
.pgroup { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.pbody { flex: 1; overflow-y: auto; padding: 16px 20px 20px; }
.pfoot { flex: none; display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.pfoot .big { flex: 1; }
.ready { flex: none; padding: 12px 20px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.ready-row { display: flex; gap: 8px; }
.ready-row button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; border: 0; background: none; font-size: 11px; font-weight: 600; color: var(--text-2); }
.ico-round { width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--g-primary); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.3); display: inline-flex; }
.ico-round .ico { width: 22px; height: 22px; }

/* panel pieces */
.sec { margin-bottom: 18px; }
.lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; color: var(--text-2); text-transform: uppercase; margin-bottom: 8px; }
.note { margin: 0 0 14px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.note-ok { background: var(--ok-bg); color: var(--ok-fg); } .note-warn { background: var(--warn-bg); color: var(--warn-fg); }
.seg { display: flex; padding: 3px; gap: 3px; border-radius: 22px; background: var(--surface-2); }
.seg button { flex: 1; min-height: 34px; border: 0; border-radius: 18px; background: none; font-size: 12.5px; font-weight: 700; color: var(--text-2); padding: 0 8px; }
.seg button[aria-checked="true"] { background: var(--g-primary); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.3); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--g-neutral); font-size: 12px; font-weight: 600; text-align: center; }
.tile .ico { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--soft); color: var(--primary); }
.tile:hover { border-color: var(--line-2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; font-size: 13.5px; margin-bottom: 8px; cursor: pointer; }
.row small { display: block; color: var(--text-2); font-size: 12px; }
.tog { width: 40px; height: 22px; border-radius: 11px; background: var(--line-2); position: relative; flex: none; border: 0; padding: 0; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.tog[aria-checked="true"] { background: var(--primary); } .tog[aria-checked="true"]::after { left: 21px; }
.inp { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; font: inherit; background: var(--surface); color: var(--text); }
.list { display: flex; flex-direction: column; gap: 6px; }
.it { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; min-height: 42px; }
.it .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.it-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.it small { margin-left: auto; color: var(--text-2); white-space: nowrap; }
.it .up, .it .down { width: 30px; height: 30px; padding: 6px; flex: none; } .it .up .ico { transform: rotate(-90deg); } .it .down .ico { transform: rotate(90deg); }
.it small + .up { margin-left: 4px; }
.it-drag { background: var(--surface); }
.it-grip { flex: none; width: 22px; height: 30px; margin: 0 -4px 0 -4px; padding: 5px 2px; color: var(--muted); cursor: grab; touch-action: none; display: inline-flex; }
.it-grip .ico { width: 18px; height: 20px; }
.merge-list .it .dot { width: 22px; height: 22px; color: #fff; font: 800 11px/22px system-ui; text-align: center; }
.lbl.is-sel { color: var(--primary); }
.big { width: 100%; min-height: 44px; border: 0; border-radius: 22px; background: var(--g-primary); color: #fff; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; }
.big .ico { width: 18px; height: 18px; }
.big.ghost { background: var(--g-neutral); color: var(--text); border: 1px solid var(--line); }
.soon-panel { text-align: center; padding-top: 12px; }
.soon-icon { display: inline-flex; width: 64px; height: 64px; padding: 16px; border-radius: 50%; background: var(--soft); color: var(--primary); }
.soon-icon .ico { width: 32px; height: 32px; }
.soon-lead { font-weight: 600; margin: 14px 0 8px; }
.soon-list { text-align: left; margin: 0; padding-left: 20px; color: var(--text-2); font-size: 13px; line-height: 1.6; }

/* ---------- start dialog ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 20px; }
.start-dlg { width: min(1060px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-3); padding: 28px 32px; }
.start-dlg h2 { margin: 0 0 18px; font-size: 26px; display: flex; align-items: center; gap: 12px; }
.dlg-x { margin-left: auto; background: var(--surface-2); width: 40px; height: 40px; }
.start-install { margin-left: auto; height: 40px; padding: 0 16px 0 4px; font-size: 12px; gap: 8px; flex: none !important; }
.start-install .ico { width: 32px; height: 32px; padding: 8px; }
.start-install:not([hidden]) + .dlg-x { margin-left: 0; }
.drop { border: 2px dashed var(--line-2); border-radius: 18px; padding: 22px 26px; }
.drop .btns { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.bigpill { display: inline-flex; align-items: center; gap: 12px; height: 52px; padding: 0 22px 0 6px; border-radius: 26px; border: 1px solid var(--line); background: var(--g-neutral); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.bigpill .ico { width: 40px; height: 40px; padding: 10px; border-radius: 50%; background: var(--g-primary); color: #fff; }
.bigpill.main { background: var(--g-primary); color: #fff; border-color: transparent; } .bigpill.main .ico { background: rgba(255,255,255,.2); }
.drop p { margin: 0; color: var(--text-2); } .drop small { color: var(--muted); }
.goals-h { margin: 22px 0 12px; font-size: 18px; font-weight: 800; }
.goals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.goal, .start-goal { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.goal:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.gi { width: 46px; height: 46px; padding: 11px; border-radius: 50%; color: #fff; flex: none; display: inline-flex; }
.gi .ico { width: 24px; height: 24px; }
.goal b, .start-goal b { display: block; font-size: 15px; } .goal > span:not(.gi) > span, .start-goal > span:not(.gi) > span { font-size: 12.5px; color: var(--text-2); }
.start-goal { margin-bottom: 14px; background: var(--soft); border-color: transparent; }
.start-goal > span:nth-child(2) { flex: 1; }
.priv { margin: 18px 0 0; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.priv-link { color: var(--primary); white-space: nowrap; }
.langs { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; } .langs a { color: var(--primary); text-decoration: none; }

/* ---------- dialogs, popups, toasts (ui.js) ---------- */
.dlg { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); }
.dlg-wide { width: min(560px, calc(100vw - 32px)); }
.dlg::backdrop, .task::backdrop { background: var(--scrim); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 8px 22px; }
.dlg-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.dlg-body { padding: 8px 22px; } .dlg-body > p { margin: 0 0 8px; color: var(--text-2); }
.dlg-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 22px 20px; border-top: 1px solid var(--line); margin-top: 12px; }
.btn { min-width: 120px; min-height: 42px; padding: 0 20px; border-radius: 21px; border: 1px solid var(--line); background: var(--g-neutral); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 12.5px; }
.btn-primary { background: var(--g-primary); color: #fff; border-color: transparent; }
.task { width: min(320px, calc(100vw - 48px)); padding: 26px 22px; border: 0; border-radius: 24px; background: var(--surface); color: var(--text); text-align: center; box-shadow: var(--shadow-3); }
.task-text { margin: 14px 0 0; font-size: 14px; font-weight: 600; }
.task-bar { height: 10px; margin-top: 14px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.task-fill { height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, #2563eb, #22b8e8); transition: width .2s; }
.task-cancel { margin-top: 14px; }
.spinner { width: 40px; height: 40px; margin: 0 auto; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--primary); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; width: max-content; max-width: min(560px, calc(100vw - 24px)); }
.toast { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 6px 6px 8px; border-radius: 26px; background: #0b1f4d; color: #eef3ff; box-shadow: var(--shadow-3); font-size: 14px; font-weight: 500; }
.toast > .ico { flex: none; width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--g-success); color: #fff; }
.toast-error > .ico { background: linear-gradient(180deg, #ff7cbc, #c22768); } .toast-info > .ico { background: var(--g-primary); }
.toast-close { flex: none; width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 50%; background: none; color: inherit; margin-left: auto; display: inline-flex; }
.toast > span:not(.ico) { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 20px; }

.ad-start { margin: 16px 0 4px; }
.ad-side { margin-top: 16px; padding: 0 8px; }
.ad-side .ad-box { min-height: 250px; }
@media (max-width: 1180px) { .ad-side { display: none !important; } }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-slot { display: flex; flex-direction: column; gap: 4px; }
.ad-slot[hidden] { display: none; }
.ad-label { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3, var(--text-2)); }
.ad-box { min-height: 90px; border-radius: 12px; overflow: hidden; }

/* ---------- from Shiklo PDF's main area: icon buttons, pills, the empty state, dropping ---------- */
.icon-btn { width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 50%; background: none; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 10px; border-radius: 17px; border: 1px solid var(--line); background: var(--g-neutral); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill .ico { width: 18px; height: 18px; color: var(--primary); }
.pill-danger .ico { color: var(--danger); }
.proj { color: var(--head-text); font-size: 13px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sp12 { height: 12px; }

/* ---------- main: the player over the timeline ---------- */
.app > .main { grid-area: main; display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--stage); position: relative; }
.empty { grid-row: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); text-align: center; padding: 20px; }
.empty > .ico { width: 56px; height: 56px; padding: 14px; border-radius: 50%; background: var(--soft); color: var(--primary); }
.empty > p { max-width: 460px; margin: 0; }
.empty .big { width: auto; padding: 0 24px; }
.app:not(.no-file) .empty, .app.no-file .stage { display: none; }
.app.dropping .main::after { content: ""; position: absolute; inset: 8px; border: 3px dashed var(--primary); border-radius: 16px; background: rgba(37,99,235,.06); pointer-events: none; }
.stage { grid-row: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px 20px 10px; }
.screen-box { flex: 1 1 0; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; padding: 10px; }   /* room for the crop handles */
.screen { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; background: #000; border-radius: 8px; box-shadow: 0 4px 18px rgba(15,23,42,.25); }   /* keeps its shape: shrinks to fit */
.controls { flex: none; display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 22px; padding: 4px 6px; box-shadow: var(--shadow); font-size: 12.5px; font-weight: 600; }
.controls .play { background: var(--g-primary); color: #fff; }
.controls .play:hover:not(:disabled) { background: var(--g-primary); filter: brightness(1.08); }
.tc { min-width: 128px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- timeline ---------- */
.timeline { grid-row: 2; min-width: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 12px 10px; user-select: none; -webkit-user-select: none; }
.tl-bar { display: flex; align-items: center; gap: 6px; min-height: 40px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tl-sp { flex: 1; }
.tl-zoomr { display: flex; align-items: center; gap: 2px; flex: none; }
.tl-zoom { width: 120px; accent-color: var(--primary); }
.tl-body { display: grid; grid-template-columns: 82px minmax(0, 1fr); }
.tl-names { display: flex; flex-direction: column; }
.tl-name { height: 54px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.tl-name .ico { width: 16px; height: 16px; color: var(--primary); }
.tl-name-ruler { height: 22px; }
.tl-name-music { height: 34px; margin-top: 6px; }
.tl-scroll { position: relative; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; touch-action: pan-x; }
.tl-inner { position: relative; }
.tl-paint { position: sticky; left: 0; top: 0; display: block; pointer-events: none; }
.tl-ruler { position: absolute; left: 0; right: 0; top: 0; height: 22px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tl-tick { position: absolute; top: 2px; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-tick::after { content: ""; position: absolute; left: 50%; top: 14px; height: 5px; border-left: 1px solid var(--muted); }
.tl-tick.is-first { transform: none; } .tl-tick.is-first::after { left: 0; }   /* the first label starts at the edge (not cut off) */
.clip { position: absolute; border-radius: 6px; border: 2px solid transparent; cursor: grab; touch-action: pan-x; box-sizing: border-box; }
.clip:hover { border-color: rgba(255,255,255,.55); }
.clip.is-sel { border-color: #facc15; box-shadow: 0 0 0 2px rgba(250,204,21,.35); }
.clip.is-dragging { opacity: .75; z-index: 3; cursor: grabbing; }
.clip.is-lifted { box-shadow: 0 8px 20px rgba(15,23,42,.35); }
.clip-name { position: absolute; left: 8px; bottom: 4px; right: 8px; color: #fff; font-size: 10.5px; text-shadow: 0 1px 3px rgba(0,0,0,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.clip-name small { font-weight: 600; opacity: .85; }
.clip-h { position: absolute; top: -2px; bottom: -2px; width: 12px; background: #facc15; cursor: ew-resize; touch-action: none; z-index: 2; }
.clip-h::after { content: ""; position: absolute; left: 50%; top: 30%; bottom: 30%; border-left: 2px solid rgba(0,0,0,.45); transform: translateX(-1px); }
.clip-hl { left: -2px; border-radius: 6px 0 0 6px; } .clip-hr { right: -2px; border-radius: 0 6px 6px 0; }
@media (pointer: coarse) { .clip-h { width: 20px; } }
.music-item { position: absolute; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.music-item.is-sel { border-color: #facc15; }
.tl-head { position: absolute; top: 0; width: 2px; margin-left: -1px; background: #dc2626; z-index: 4; pointer-events: none; }
.tl-head::before { content: ""; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top: 9px solid #dc2626; }
.tl-marker { position: absolute; width: 4px; border-radius: 2px; background: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.25); z-index: 5; pointer-events: none; }

/* ---------- panel pieces of this app ---------- */
.tfield { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tf-inp { text-align: center; font-variant-numeric: tabular-nums; padding: 0 4px; min-width: 0; }
.tf-step { width: 30px; height: 30px; padding: 6px; flex: none; }
.it.is-sel { border-color: #a9c4fa; background: var(--soft); }
.it-num { width: 22px; height: 22px; border-radius: 50%; background: var(--soft); color: var(--primary); font: 800 11px/22px system-ui; text-align: center; flex: none; }
.it .up .ico, .it .down .ico { transform: rotate(90deg); }
.est { display: flex; align-items: baseline; gap: 6px; font-size: 13px; margin-bottom: 10px; } .est b { font-size: 18px; color: var(--ok); }
.m3-slider { position: relative; display: block; --pos: 0; }
.m3-slider input { width: 100%; accent-color: var(--primary); }
.slider-thumb { display: none; }
.range { width: 100%; accent-color: var(--primary); }

/* ---------- phones: player, timeline, bottom tool bar, drawer ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px minmax(0, 1fr) 68px; grid-template-areas: "head" "main" "tools"; }
  .app-head { padding: 0 10px; gap: 6px; } .brand { font-size: 17px; margin-right: auto; } .brand .logo { width: 30px; height: 30px; }
  .proj, .hmid { display: none; } .hend .hbtn:not(.primary):not(.icon) { display: none; } .hbtn.ph { display: inline-flex; }
  .hbtn.primary { padding: 0; width: 40px; justify-content: center; } .hbtn.primary .btn-label { display: none; }
  .stage { padding: 10px 10px 6px; }
  .tc { min-width: 100px; }
  .timeline { padding: 4px 8px 8px; }
  .tl-bar .pill .btn-label, .tl-zoomr { display: none; } .tl-bar .pill { padding: 0 10px; }
  .tl-body { grid-template-columns: 28px minmax(0, 1fr); } .tl-lname { display: none; }
  .tools { display: flex; overflow-x: auto; padding: 4px 6px; gap: 2px; border-right: 0; border-top: 1px solid var(--line); scrollbar-width: none; }
  .tools .grp, .tools .open-btn { display: none; }
  .tool { flex-direction: column; justify-content: center; gap: 2px; width: 76px; min-height: 58px; padding: 4px 0; border-radius: 14px; font-size: 10.5px; text-align: center; flex: none; }
  .tool .chip { width: 30px; height: 30px; padding: 6px; } .tool.is-soon::after { display: none; }
  .tool-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 72px; }
  .panel { position: fixed; left: 0; right: 0; bottom: 68px; z-index: 6; height: var(--sheet-h, min(52vh, 480px)); max-height: calc(100dvh - 120px); border-left: 0;
    border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(15,23,42,.18); transform: translateY(calc(100% + 80px)); transition: transform .22s ease, height .22s ease; visibility: hidden; }
  .app.sheet-open .panel { transform: none; visibility: visible; }
  .panel.is-dragging { transition: none; }
  .sheet-handle { display: flex; justify-content: center; align-items: center; flex: none; height: 22px; border: 0; background: none; cursor: grab; touch-action: none; }
  .sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); }
  .sheet-close { display: inline-flex; }
  .ptitle { height: 44px; padding: 0 8px 0 18px; } .pgroup { display: none; } .ptitle .sheet-close { margin-left: auto; }
  .pbody { padding: 12px 16px; } .pfoot { padding: 10px 16px; }
  .scrim { padding: 10px; align-items: flex-end; } .start-dlg { padding: 20px 16px; border-radius: 20px; max-height: calc(100dvh - 20px); }
  .start-dlg h2 { font-size: 21px; } .goals { grid-template-columns: 1fr; } .bigpill { height: 48px; flex: 1 1 100%; }
  .toasts { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- recent projects, saved state (as Shiklo PDF) ---------- */
.recent-h { margin-top: 22px; } .recent { display: flex; flex-wrap: wrap; gap: 10px; }
.rc { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 12.5px; max-width: 320px; }
.rc-open { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; min-width: 0; }
.rc img, .rc .rc-blank { width: 64px; height: 36px; object-fit: cover; border-radius: 3px; box-shadow: var(--shadow); background: #fff; flex: none; }
.rc b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rc small { color: var(--text-2); }
.rc .icon-btn { width: 30px; height: 30px; padding: 6px; color: var(--muted); }
.hbtn[data-state="saved"] { color: #9be7b9; }

/* ---------- Record ---------- */
.tile[aria-pressed="true"] { border-color: #a9c4fa; background: var(--soft); box-shadow: 0 0 0 2px var(--soft-2); }
.big.rec { background: linear-gradient(180deg, #f87171 0%, #dc2626 60%, #b91c1c 100%); margin: 6px 0 12px; }
.rec-now { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.rec-now b { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 20px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; animation: blink 1s steps(2, start) infinite; flex: none; }
@keyframes blink { to { visibility: hidden; } }
.meter { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e 0 60%, #facc15 60% 85%, #ef4444 85%); background-size: 100vw 100%; transition: width .06s; }
.tool.is-rec .chip { background: #dc2626; color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(220,38,38,.25); } }
.stage-layer { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(11,31,77,.45); pointer-events: none; }
.countdown { font-size: 160px; font-weight: 800; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.5); }
.rec-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border-radius: 24px; background: #7f1d1d; color: #fff; box-shadow: var(--shadow-3); font-weight: 700; }
.rec-bar b { font-variant-numeric: tabular-nums; }
.rec-bar .pill { background: #fff; color: #7f1d1d; border: 0; height: 32px; }
.rec-bar .pill .ico { color: #b91c1c; }
.tl-snap[aria-pressed="true"] { background: var(--soft); border-color: #a9c4fa; color: var(--on-soft); }
@media (max-width: 760px) { .tl-snap { display: none; } }

/* ---------- M2: Shape & Size, Crop, Rotate & Flip, Filters ---------- */
.tiles.four { grid-template-columns: repeat(4, 1fr); }
.tile .ar-box { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.tile .ar-box.ar { border: 2px solid var(--primary); border-radius: 4px; background: var(--soft); }
.tile .ar-box .ico { width: 24px; height: 24px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches .sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); padding: 0; }
.swatches .sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--primary); }
.look-sw { width: 100%; height: 38px; border-radius: 8px; background: linear-gradient(180deg, #7cc4ff 0%, #bfe4ff 48%, #f5d9a6 50%, #d8ad6d 100%); }
.slider-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 46px; align-items: center; gap: 8px; min-height: 34px; font-size: 13px; }
.slider-row .rv { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.screen-box { position: relative; }
.screen-overlay { position: absolute; inset: 0; z-index: 3; overflow: hidden; }   /* the crop frame's dimming stays on the player */
.crop-layer { position: absolute; inset: 0; touch-action: none; }
.crop-frame { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 4000px rgba(0,0,0,.55); cursor: move; outline: 1px solid rgba(0,0,0,.4); }
.crop-frame::before, .crop-frame::after { content: ""; position: absolute; inset: 33.33% 0; border-top: 1px solid rgba(255,255,255,.35); border-bottom: 1px solid rgba(255,255,255,.35); pointer-events: none; }
.crop-frame::after { inset: 0 33.33%; border: 0; border-left: 1px solid rgba(255,255,255,.35); border-right: 1px solid rgba(255,255,255,.35); }
.ch { position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.4); z-index: 1; }
@media (pointer: coarse) { .ch { width: 24px; height: 24px; } }
.ch-nw { left: -8px; top: -8px; cursor: nwse-resize; } .ch-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.ch-sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .ch-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.ch-n { left: calc(50% - 8px); top: -8px; cursor: ns-resize; } .ch-s { left: calc(50% - 8px); bottom: -8px; cursor: ns-resize; }
.ch-w { top: calc(50% - 8px); left: -8px; cursor: ew-resize; } .ch-e { top: calc(50% - 8px); right: -8px; cursor: ew-resize; }

/* ---------- M2 part 2: speed buttons, transition diamonds, clip badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; }
.chips button[aria-pressed="true"] { background: var(--g-primary); border-color: transparent; color: #fff; }
.tl-tr { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; transform: rotate(45deg); border-radius: 4px; border: 2px solid var(--primary); background: var(--surface); padding: 0; z-index: 3; cursor: pointer; }
.tl-tr.is-on { background: var(--primary); }
.tl-tr:hover { box-shadow: 0 0 0 4px rgba(37,99,235,.25); }
.clip-badge { position: absolute; right: 14px; top: 4px; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font: 800 10.5px/16px system-ui; pointer-events: none; }

/* ---------- M3: text / caption blocks, the item frame, caption rows, emoji and place grids ---------- */
.tl-name { flex: none; }
.lane-item { position: absolute; border-radius: 6px; padding: 0 8px; display: flex; align-items: center; color: #fff; font-size: 11px; font-weight: 700; overflow: hidden; white-space: nowrap; cursor: grab; border: 2px solid transparent; box-sizing: border-box; touch-action: pan-x; z-index: 2; }
.lane-item .li-name { overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.li-text { background: #7c3aed; } .li-emoji { background: #db2777; font-size: 14px; } .li-image { background: #0891b2; } .li-caption { background: #0d9488; font-weight: 600; }
.lane-item.is-sel { border-color: #facc15; box-shadow: 0 0 0 2px rgba(250,204,21,.35); }
.li-h { position: absolute; top: -2px; bottom: -2px; width: 9px; background: #facc15; cursor: ew-resize; touch-action: none; }
.li-hl { left: -2px; border-radius: 6px 0 0 6px; } .li-hr { right: -2px; border-radius: 0 6px 6px 0; }
@media (pointer: coarse) { .li-h { width: 16px; } }
.item-layer { pointer-events: none; }
.item-frame { position: absolute; border: 2px dashed #fff; outline: 1px solid rgba(0,0,0,.45); border-radius: 4px; cursor: move; pointer-events: auto; touch-action: none; }
.item-frame .ch-se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.ta { height: auto; min-height: 64px; padding: 8px 12px; resize: vertical; font: inherit; line-height: 1.35; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.emojis button { height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 22px; }
.emojis button:hover { border-color: var(--line-2); background: var(--surface-2); }
.grid3 { display: grid; grid-template-columns: repeat(3, 40px); gap: 6px; }
.grid3 button { height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.grid3 button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.li-pip { background: #ea580c; }
.corners { position: relative; width: 132px; height: 76px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.corner { position: absolute; width: 38px; height: 24px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
.corner[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.c-tl { left: 6px; top: 6px; } .c-tr { right: 6px; top: 6px; } .c-bl { left: 6px; bottom: 6px; } .c-br { right: 6px; bottom: 6px; }
.sel-lbl { color: var(--primary); }
.cap-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.cap-row { border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cap-row.is-sel { border-color: #a9c4fa; background: var(--soft); }
.cap-times { display: flex; align-items: center; gap: 4px; } .cap-times .tf-inp { height: 30px; font-size: 12.5px; flex: 1; }
.cap-times .icon-btn { width: 30px; height: 30px; padding: 6px; }
.cap-ta { min-height: 44px; font-size: 13px; }
.it-btn { width: 100%; text-align: left; background: var(--surface); cursor: pointer; }
.tf { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.li-voice { background: #be123c; }
.tile small { font-size: 11px; font-weight: 500; color: var(--muted); margin-top: -4px; }
.note-info { background: var(--soft); color: var(--text-2); }
.face-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.face { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.face img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.face-name { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 13px; }
.face-name small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face.is-off img { opacity: .45; }
.face .area-mark { width: 44px; height: 44px; flex: none; border: 2px dashed var(--muted); border-radius: 8px; }
.face.is-editing { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.face .icon-btn { flex: none; }
