/* tabla-js app: one sheet for the player and the composer. Palette from swaralipi-js. */
:root {
  color-scheme: light dark;
  --paper: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f3ece2;
  --ink: #2a1c12;
  --muted: #6b5642;
  --line: #e7ddcf;
  --accent: #c76418;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --khali: #4f6b8a;
  --shadow: 0 1px 2px rgb(42 28 18 / 0.06), 0 8px 24px rgb(42 28 18 / 0.06);
  --radius: 16px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Bengali', 'Kohinoor Bangla', 'Noto Sans Devanagari', 'Kohinoor Devanagari', sans-serif;
  --gap: 16px;
  /* iOS zooms into a field whose text is under 16px */
  --field: 14px;
  /* a quick second tap (Tap, + −) must not zoom; pinch zoom stays */
  touch-action: manipulation;
}

@media (pointer: coarse) {
  :root { --field: 16px; }
}

:root[data-theme='dark'] {
  --paper: #120e0a;
  --surface: #1b1510;
  --surface-2: #261d15;
  --ink: #ece6dd;
  --muted: #b3a58f;
  --line: #3a2e24;
  --accent: #e5813a;
  --accent-ink: #1b1007;
  --khali: #9db6d3;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #120e0a;
    --surface: #1b1510;
    --surface-2: #261d15;
    --ink: #ece6dd;
    --muted: #b3a58f;
    --line: #3a2e24;
    --accent: #e5813a;
    --accent-ink: #1b1007;
    --khali: #9db6d3;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  }
}

:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.sprite { display: none; }
small, .hint { color: var(--muted); }
.hint { font-size: 13px; margin: 8px 0 0; }

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; }

.taal-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.taal-pick span:first-child { overflow: hidden; text-overflow: ellipsis; }
.taal-pick small { color: var(--muted); font-size: 14px; }
.taal-pick .meta { color: var(--muted); font-size: 13px; }

.top-links { display: flex; gap: 4px; }

@media (max-width: 520px) {
  .brand span, .taal-pick .meta { display: none; }
  .top { gap: 8px; }
}

@media (min-width: 700px) {
  .taal-pick { flex: 0 1 520px; margin-right: auto; }
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- layout: 1, 2 or 3 columns ---------- */
.layout {
  display: grid;
  gap: var(--gap);
  padding: var(--gap) max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  max-width: 1440px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.library { display: none; }

@media (min-width: 700px) {
  .player .layout { grid-template-columns: minmax(0, 1fr) clamp(280px, 34vw, 340px); align-items: start; padding-bottom: 32px; }
  .instruments { position: sticky; top: 76px; max-height: calc(100dvh - 92px); overflow: auto; }
}

@media (min-width: 1180px) {
  .player .layout { grid-template-columns: 300px minmax(0, 1fr) 340px; }
  .library { display: flex; flex-direction: column; position: sticky; top: 76px; max-height: calc(100dvh - 92px); }
  .player #open-library { pointer-events: none; }
  .player #open-library .meta { display: none; }
}

/* Tablets and desktops: the player fits the window and each column scrolls on its own.
   The ring takes the height the other controls leave. Landscape phones keep the page scroll. */
@media (min-width: 700px) and (min-height: 560px) {
  .player { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .player .layout { width: 100%; min-height: 0; align-items: stretch; padding-bottom: var(--gap); }
  .player .layout > * { position: static; max-height: none; min-height: 0; overflow: auto; }
  .player .stage { grid-template-rows: minmax(200px, 1fr); align-content: start; gap: 12px; }
  .player .ring-box { container-type: size; }
  .player .ring-wrap { width: min(100cqw, 100cqh, 380px); margin: 0; }
  .taal-list { min-height: 0; }
  .dock { display: none !important; }
}

@media (min-width: 700px) and (min-height: 560px) and (max-height: 820px) {
  .player .stage { gap: 10px; }
  .player .layout { padding-top: 12px; padding-bottom: 12px; }
}

/* ---------- library ---------- */
.lib-head { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
/* .lib-head: the sheet's `label` grid must not reach the search box when it moves into the sheet */
.lib-head .search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 44px; border: 0; padding: 0; background: transparent; outline: none; color: var(--ink); font-size: var(--field); line-height: normal; appearance: none; }

.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { flex: 1; padding: 6px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 550; }
.seg button[aria-checked='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.small button { padding: 4px 8px; font-size: 12px; }

.taal-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.taal-list li { display: flex; align-items: center; gap: 6px; border-radius: 12px; }
.taal-list li > button:first-child { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; padding: 9px 10px; border: 0; background: transparent; text-align: left; border-radius: 12px; }
.taal-list li > button:first-child:hover { background: var(--surface-2); }
.taal-list li[aria-selected='true'] > button:first-child { background: var(--accent-soft); }
.taal-list b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taal-list .m { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.taal-list small { grid-column: 1 / -1; font-size: 12.5px; }
.taal-list .fav { border: 0; background: transparent; color: var(--line); padding: 8px; border-radius: 10px; }
.taal-list .fav[aria-pressed='true'] { color: var(--accent); }
.taal-list .group { padding: 12px 10px 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- stage: ring, bols, transport, tempo ---------- */
.stage { display: grid; gap: var(--gap); min-width: 0; }

.ring-box { display: grid; place-items: center; min-width: 0; }
.ring-wrap { position: relative; width: min(100%, 380px, 44svh); aspect-ratio: 1; margin: 4px auto 0; container-type: inline-size; }
.ring { display: block; width: 100%; height: 100%; overflow: visible; }
.ring .arc { fill: none; stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.ring .arc.khali { stroke-dasharray: 2 6; }
.ring .progress { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; opacity: 0.85; }
.ring .dot { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; transition: r 120ms ease, fill 120ms ease; }
.ring .dot.vibhag { fill: var(--muted); }
.ring .dot.sam { fill: var(--accent); stroke: var(--accent); }
.ring .dot.khali { fill: var(--surface); stroke: var(--khali); stroke-width: 2; }
.ring .dot.now { fill: var(--accent); stroke: var(--accent); r: 9px; }
.ring .mark { fill: var(--muted); font: 600 13px var(--font); text-anchor: middle; dominant-baseline: central; }
.ring .mark.sam { fill: var(--accent); font-size: 16px; }
.ring .mark.khali { fill: var(--khali); }

.ring-center { position: absolute; inset: 22%; display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; gap: 2cqi; text-align: center; pointer-events: none; }
.ring-center > * { max-width: 100%; overflow-wrap: anywhere; }
.section-label { align-self: end; font-size: clamp(10px, 3.2cqi, 15px); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.section-label.tihai, .section-label.end { color: var(--accent); }
/* trimmed to the digits' ink, so they centre optically, not by their line box */
.beat-num { font-size: 23cqi; line-height: 1; text-box: trim-both cap alphabetic; font-weight: 300; font-variant-numeric: tabular-nums; }
.bol-now { align-self: start; font-size: clamp(14px, 5.4cqi, 28px); line-height: 1.2; font-weight: 550; color: var(--accent); }

.variations { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; justify-content: safe center; }
.variations::-webkit-scrollbar { display: none; }
.variations button { flex: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13.5px; }
.variations button[aria-checked='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.bols { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; }
.bols .vib { display: flex; gap: 4px; }
.bols .cell { position: relative; min-width: 46px; padding: 18px 6px 6px; border-radius: 10px; text-align: center; font-size: 14px; line-height: 1.2; background: var(--surface-2); transition: background 80ms ease, color 80ms ease; }
.bols .cell i { position: absolute; top: 3px; left: 0; right: 0; font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.bols .cell i.sam { color: var(--accent); }
.bols .cell i.khali { color: var(--khali); }
.bols .cell.now { background: var(--accent); color: var(--accent-ink); }
.bols .cell.now i { color: inherit; }

.transport { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; }
.transport > :first-child { justify-self: end; }
.transport > :last-child { justify-self: start; }
.play {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 120ms ease;
}
.play:active { transform: scale(0.96); }
.play svg { width: 32px; height: 32px; }
.play .i-stop, .playing .play .i-play { display: none; }
.playing .play .i-stop { display: block; }

.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 550; }
.pill:disabled { opacity: 0.45; cursor: default; }
.pill.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pill.armed { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill.wide { width: 100%; margin-top: 12px; }
.pill svg { width: 18px; height: 18px; }

.tempo { padding: 16px; display: grid; gap: 12px; }
.tempo-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.step { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.bpm { display: flex; align-items: baseline; gap: 6px; }
.bpm input { width: 3.2ch; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 44px; font-weight: 300; text-align: center; font-variant-numeric: tabular-nums; appearance: none; }
.bpm span { color: var(--muted); font-size: 13px; }
.chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.chips button { min-width: 52px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 550; }
.chips .tap { min-width: 72px; border-color: var(--accent); color: var(--accent); }
.stats { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
/* range inputs */
input[type='range'] { width: 100%; accent-color: var(--accent); }
.slider { height: 28px; }

/* ---------- instrument cards ---------- */
.instruments { display: grid; gap: var(--gap); align-content: start; }
/* the way back to the site; an installed app keeps only the link in Settings (iOS reports fullscreen) */
.site-link { text-align: center; }
@media (display-mode: standalone), (display-mode: fullscreen) { .site-link { display: none; } }
.inst { padding: 14px 16px 16px; display: grid; gap: 10px; }
.inst header { display: flex; align-items: center; justify-content: space-between; }
.inst h2 { margin: 0; font-size: 16px; font-weight: 650; }
.inst label, .sheet label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.inst select, .sheet select, .sheet input:not([type]), .sheet input[type='text'], .row input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--field);
}
.inst label.range, .sheet label { grid-template-columns: 1fr auto; align-items: center; }
.inst label.range input, .sheet label input[type='range'], .sheet label select { grid-column: 1 / -1; }
.inst label.check, .sheet label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.inst output, .sheet output { color: var(--ink); font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inst input#swar-line { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: var(--field) ui-monospace, 'SF Mono', Menlo, monospace; }
.levels summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.level-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.level-row label { display: grid; justify-items: center; gap: 4px; font-size: 11.5px; }
.level-row input { writing-mode: vertical-lr; direction: rtl; width: 28px; height: 90px; }
.inst.off > :not(header) { opacity: 0.55; }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 150ms ease; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 150ms ease; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* tanpura strings shimmer on each pluck */
.strings { display: flex; justify-content: space-between; gap: 6px; height: 34px; padding: 0 8px; }
.strings i { width: 2px; height: 100%; border-radius: 1px; background: var(--line); transform-origin: center; }
.strings i.pluck { animation: pluck 1.6s ease-out; background: var(--accent); }
@keyframes pluck {
  0% { transform: scaleX(2.5); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0.4; }
}

/* ---------- phone dock ---------- */
.dock {
  transition: transform 200ms ease, opacity 200ms ease;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.dock.away { transform: translateY(140%); opacity: 0; pointer-events: none; }
.dock .play { width: 48px; height: 48px; box-shadow: none; }
.dock .play svg { width: 22px; height: 22px; }
.dock-taal { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dock-beat { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 300; min-width: 2ch; text-align: right; }
.dock-bpm { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.dock-bpm::after { content: ' bpm'; }

/* ---------- dialogs ---------- */
.sheet {
  width: min(560px, 100% - 24px);
  max-height: min(86dvh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.3);
}
.sheet::backdrop { background: rgb(18 14 10 / 0.45); backdrop-filter: blur(3px); }
.sheet form { display: grid; gap: 14px; padding: 6px 20px 22px; }
.sheet header { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; padding: 12px 0 4px; background: var(--surface); z-index: 1; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet.library-sheet { height: 86dvh; }
.sheet.library-sheet form { height: 100%; grid-template-rows: auto auto 1fr; padding-bottom: 0; }
.sheet.library-sheet .taal-list { padding: 0 0 20px; }

.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.file { cursor: pointer; }
.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.session-list li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 12px; }
.session-list li span { flex: 1; min-width: 0; }
.session-list li small { display: block; }
.session-list button { border: 0; background: var(--surface-2); border-radius: 9px; padding: 6px 10px; font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.toast.show { opacity: 1; }
/* above the phone dock while it shows */
.dock:not(.away) ~ .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }

@media (min-width: 700px) and (min-height: 560px) {
  .toast, .dock:not(.away) ~ .toast { bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- composer ---------- */
.page-title { flex: 1; margin: 0; font-size: 17px; font-weight: 650; }
.compose { grid-template-areas: 'meta' 'editor' 'out'; }
.compose .meta { grid-area: meta; padding: 16px; display: grid; gap: 12px; }
.compose .editor { grid-area: editor; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.compose .output { grid-area: out; padding: 16px; display: grid; gap: 12px; align-content: start; }
@media (min-width: 1024px) {
  .compose { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: 'meta out' 'editor out'; }
  .compose .output { position: sticky; top: 76px; }
}
.compose label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.compose label > :is(input, select, textarea) { grid-column: 1 / -1; }
.compose label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.compose input:not([type]), .compose input[type='number'], .compose select, .compose textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--field);
}
.vibhags-edit .label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.vibhag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.vibhag { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.vibhag b { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.vibhag .mark { width: 34px; height: 34px; border: 0; border-radius: 9px; background: var(--surface); font-weight: 700; }
.vibhag .mark.sam { color: var(--accent); }
.vibhag .mark.khali { color: var(--khali); }
.step.small { width: 32px; height: 32px; border-radius: 9px; font-size: 18px; line-height: 1; }
.pill.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.tabs button { padding: 8px 6px; }
.tabs button[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.section-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.section-tools label:not(.check) { width: 9rem; }
.bols.edit { justify-content: flex-start; }
.bols.edit .cell { border: 1px solid transparent; font: inherit; color: inherit; min-height: 52px; }
.bols.edit .cell.sel { border-color: var(--accent); background: var(--accent-soft); }
.bols.edit .cell.rest { color: var(--muted); }
.bols.edit .cell.now { background: var(--accent); color: var(--accent-ink); }
.cell-edit { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.cell-edit input { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
code { padding: 1px 5px; border-radius: 6px; background: var(--surface-2); font-size: 0.92em; }
.keypad { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.keypad.small { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); margin-top: 8px; }
.key { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; font-weight: 550; }
.key:active { background: var(--accent-soft); }
.keypad.small .key { min-height: 34px; font-size: 11.5px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.keypad-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.strokes summary, .output summary { cursor: pointer; color: var(--muted); font-size: 13px; }
[inert] { opacity: 0.45; }
.preview { display: flex; align-items: end; gap: 12px; }
.preview .play { width: 60px; height: 60px; flex: none; }
.preview .play svg { width: 24px; height: 24px; }
.check-msg { margin: 0; font-size: 13.5px; color: var(--muted); }
.check-msg.bad { color: #b3261e; }
:root[data-theme='dark'] .check-msg.bad { color: #f2b8b5; }
.save-row, .export { display: flex; flex-wrap: wrap; gap: 8px; }
.export { margin: 10px 0; }
.output textarea { min-height: 180px; font: var(--field)/1.45 ui-monospace, 'SF Mono', Menlo, monospace; resize: vertical; }
.session-list .link { padding: 6px 10px; border-radius: 9px; background: var(--surface-2); font-size: 13px; text-decoration: none; }
