@import 'tokens.css';

/* ═══════════════════════════════════════════════════════════════════════
   Base — adopted from the Clipper / Shifter shared theme verbatim
   ═══════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(123, 92, 255, 0.14), transparent 60%),
    radial-gradient(900px 400px at 85% 110%, rgba(255, 45, 149, 0.10), transparent 60%),
    radial-gradient(900px 400px at 10% 100%, rgba(0, 240, 255, 0.08), transparent 60%),
    var(--bg);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 100%);
}

::selection { background: rgba(0, 240, 255, 0.3); color: #fff; }
[hidden] { display: none !important; }

/* ── Header ── */

.app-header { text-align: center; padding: 26px 16px 8px; position: relative; }

.logo { width: 44px; height: 44px; filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6)); }

.app-header h1 {
  margin: 6px 0 2px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  color: var(--ink);
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.55), 0 0 40px rgba(0, 240, 255, 0.2);
}

.tagline { margin: 0; font-size: 10px; letter-spacing: 0.4em; text-indent: 0.4em; color: var(--ink-dim); }

/* ── Layout ── */

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

.card-title {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.meta-row { font-size: 10px; color: var(--ink-dim); letter-spacing: 0.08em; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 14px; }

label.field-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--ink-dim);
}

/* ── Buttons ── */

.btn {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  padding: 13px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s, transform 0.1s, opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.btn-outline {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.45);
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}
.btn-outline:hover { box-shadow: var(--glow-cyan); }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(125, 138, 165, 0.35);
  color: var(--ink-dim);
}
.btn-ghost:hover { border-color: rgba(125, 138, 165, 0.6); color: var(--ink); }

.btn-danger {
  background: rgba(255, 45, 149, 0.06);
  border: 1px solid rgba(255, 45, 149, 0.4);
  color: var(--magenta);
}
.btn-danger:hover { box-shadow: var(--glow-magenta); }
.btn-danger[aria-pressed="true"] {
  background: rgba(255, 45, 149, 0.22);
  box-shadow: var(--glow-magenta);
  animation: recPulse 1.1s ease-in-out infinite;
}

@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 45, 149, 0.45); }
  50% { box-shadow: 0 0 20px rgba(255, 45, 149, 0.75); }
}

.btn-small { font-size: 10px; letter-spacing: 0.18em; text-indent: 0.18em; padding: 8px 12px; border-radius: 9px; flex-shrink: 0; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Segmented / toggle button rows (chord type, modifiers, perf modes) ── */

.seg-row { display: flex; gap: 8px; flex-wrap: wrap; }

.seg-btn {
  flex: 1 1 0;
  min-width: 64px;
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  padding: 11px 10px;
  border-radius: 10px;
  border: 1px solid rgba(125, 138, 165, 0.35);
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink-dim);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.seg-btn:hover { border-color: rgba(0, 240, 255, 0.4); color: var(--ink); }
.seg-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.seg-btn.is-active {
  background: rgba(0, 240, 255, 0.14);
  border-color: var(--cyan);
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.2);
}

.modifier-row .seg-btn.is-active {
  background: rgba(123, 92, 255, 0.16);
  border-color: var(--violet);
  color: #c9bcff;
  text-shadow: 0 0 8px rgba(123, 92, 255, 0.6);
}

/* ── Switch ── */

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; flex-shrink: 0; }
.switch input { position: absolute; width: 38px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }

.switch-track {
  pointer-events: none;
  width: 38px; height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(125, 138, 165, 0.5);
  background: rgba(0, 0, 0, 0.4);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.switch-track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink-dim);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.switch input:focus-visible + .switch-track { box-shadow: var(--glow-cyan); }
.switch input:checked + .switch-track { border-color: var(--cyan); box-shadow: inset 0 0 8px rgba(0, 240, 255, 0.25); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--cyan); box-shadow: 0 0 8px rgba(0, 240, 255, 0.8); }
.switch-label { font-size: 11px; letter-spacing: 0.2em; color: var(--ink); }

/* ── Sliders ── */

.control-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.control-row > .switch-label { width: 72px; flex-shrink: 0; }

.slider-group { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 120px; }

.slider-val {
  font-size: 12px; color: var(--cyan); min-width: 4.5em; text-align: right;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5); flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 26px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.5), rgba(255, 45, 149, 0.5));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
  margin-top: -7px;
}
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.5), rgba(255, 45, 149, 0.5));
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
}

.format-picker {
  display: flex; gap: 0;
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 12px;
  overflow: hidden;
}
.format-btn {
  font-family: inherit; font-size: 11px; letter-spacing: 0.18em; text-indent: 0.18em;
  padding: 8px 14px; background: transparent; border: none; color: var(--ink-dim);
  cursor: pointer; transition: background 0.2s, color 0.2s, text-shadow 0.2s;
}
.format-btn.active { background: rgba(0, 240, 255, 0.12); color: var(--cyan); text-shadow: 0 0 8px rgba(0, 240, 255, 0.6); }
.arp-row { gap: 10px; }

/* ── Footer ── */

.app-footer { text-align: center; padding: 10px 16px 18px; font-size: 10px; letter-spacing: 0.15em; color: rgba(125, 138, 165, 0.6); }

/* ═══════════════════════════════════════════════════════════════════════
   Shared app chrome — copied from CyBeat (top bar, tabs, chips,
   transport, sheets, dialog, toast)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --strip-h: 0px;
  --tabs-h: 46px;
  --transport-h: 84px;
}

body { -webkit-tap-highlight-color: transparent; }
body.has-sheet { overflow: hidden; }
button { font-family: inherit; }
.hint { margin: 8px 0 0; font-size: 10.5px; color: var(--ink-dim); line-height: 1.5; }
.spacer { flex: 1; }

/* ── Top bar ── */

.top-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 8px; max-width: 900px; width: 100%; margin: 0 auto; position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.top-bar .logo { width: 30px; height: 30px; }
.top-bar h1 {
  margin: 0; font-size: 17px; font-weight: 700;
  letter-spacing: 0.4em; text-indent: 0;
  color: var(--ink);
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.55), 0 0 40px rgba(0, 240, 255, 0.2);
}
.top-meta { display: flex; gap: 8px; min-width: 0; }
.top-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 0; max-width: 150px;
  padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--card-border); background: var(--card-bg);
  color: var(--ink); cursor: pointer; text-align: left;
}
.top-chip:hover { border-color: rgba(0, 240, 255, 0.45); }
.top-chip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.top-chip-label { font-size: 8px; letter-spacing: 0.25em; color: var(--ink-dim); }
.top-chip-value {
  font-size: 11px; letter-spacing: 0.04em; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--cyan); text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}
.dirty-dot { color: var(--magenta); margin-left: 4px; text-shadow: var(--glow-magenta); font-size: 9px; }

/* ── Tabs ── */

.tabs {
  position: sticky; top: var(--strip-h); z-index: 19;
  display: flex; gap: 6px;
  padding: 4px 14px 8px;
  max-width: 900px; width: 100%; margin: 0 auto;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tab {
  flex: 1; padding: 9px 0;
  font-size: 12px; letter-spacing: 0.3em; text-indent: 0.3em;
  border-radius: 10px; border: 1px solid rgba(125, 138, 165, 0.3);
  background: transparent; color: var(--ink-dim); cursor: pointer;
}
.tab[aria-selected="true"] {
  color: var(--cyan); border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.15);
}
.tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

main { max-width: 900px; padding: 6px 14px calc(var(--transport-h) + 28px + env(safe-area-inset-bottom)); }
.view { display: flex; flex-direction: column; gap: 14px; }

.drawer summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.drawer summary::-webkit-details-marker { display: none; }
.drawer-caret { color: var(--ink-dim); transition: transform 0.2s; }
.drawer[open] .drawer-caret { transform: rotate(180deg); }
.drawer-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(125, 138, 165, 0.15); }
.drawer-section .field-label { display: block; margin-bottom: 8px; font-size: 9px; letter-spacing: 0.2em; color: var(--ink-dim); }

.stepper-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.stepper {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px; border-radius: 10px;
  border: 1px solid rgba(125, 138, 165, 0.3); background: rgba(0, 0, 0, 0.2);
}
.stepper.is-off { opacity: 0.55; }
.stepper-label { font-size: 9px; letter-spacing: 0.15em; color: var(--ink-dim); padding: 0 4px; }
.stepper-val { min-width: 4.4em; text-align: center; font-size: 12px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.stepper-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(0, 240, 255, 0.3); background: transparent; color: var(--cyan); font-size: 16px;
}

/* ── LOOPS ── */

.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  font-size: 10.5px; letter-spacing: 0.16em;
  border: 1px solid rgba(125, 138, 165, 0.35); background: rgba(0, 0, 0, 0.2); color: var(--ink-dim);
}
.chip.is-active {
  border-color: var(--cyan); color: var(--cyan); background: rgba(0, 240, 255, 0.12);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}
.chip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.select {
  font-family: inherit; font-size: 11px; letter-spacing: 0.1em;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  color: var(--cyan); background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

/* ── Transport ── */

.transport {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(10, 14, 23, 0.6), rgba(10, 14, 23, 0.97) 30%);
  border-top: 1px solid rgba(0, 240, 255, 0.14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.play-btn {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--cyan); background: rgba(0, 240, 255, 0.12);
  box-shadow: var(--glow-cyan); color: var(--cyan);
}
.play-btn svg { width: 28px; height: 28px; fill: currentColor; }
.play-btn .icon-stop { display: none; }
.play-btn.is-playing { border-color: var(--magenta); background: rgba(255, 45, 149, 0.16); color: var(--magenta); box-shadow: var(--glow-magenta); }
.play-btn.is-playing .icon-play { display: none; }
.play-btn.is-playing .icon-stop { display: block; }
.play-btn:active { transform: scale(0.96); }
.play-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ── Sheets & dialogs ── */

.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 12, 0.7); opacity: 0; transition: opacity 0.2s; }
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet-panel {
  position: relative; width: 100%; max-width: 640px; max-height: 86dvh; overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--card-border); border-bottom: none;
  background: linear-gradient(var(--bg-2), var(--bg));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 240, 255, 0.05);
  transform: translateY(24px); opacity: 0; transition: transform 0.22s ease-out, opacity 0.18s;
  display: flex; flex-direction: column; gap: 12px;
}
.sheet.is-open .sheet-panel { transform: none; opacity: 1; }
.sheet-full .sheet-panel { max-width: 760px; height: 100dvh; max-height: 100dvh; border-radius: 0; padding-top: calc(16px + env(safe-area-inset-top)); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; }
.sheet-footer { border-top: 1px solid rgba(125, 138, 165, 0.15); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sheet-footer .field-label { font-size: 9px; letter-spacing: 0.2em; color: var(--ink-dim); }

.dialog { align-items: center; z-index: 60; }
.dialog-panel { max-width: 380px; margin: 16px; border-radius: 16px; border-bottom: 1px solid var(--card-border); padding-bottom: 18px; }
.dialog-body { font-size: 12px; line-height: 1.6; color: var(--ink); }
.dialog-buttons { justify-content: flex-end; }
.text-input {
  font-family: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; width: 100%;
  color: var(--ink); background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(0, 240, 255, 0.4);
}
.text-input:focus { outline: none; box-shadow: var(--glow-cyan); }
.help-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 11.5px; }

.lib-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lib-group { font-size: 9px; letter-spacing: 0.25em; color: var(--ink-dim); margin: 10px 0 2px; }
.lib-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  border-radius: 12px; border: 1px solid rgba(125, 138, 165, 0.2); background: var(--card-bg);
}
.lib-row.is-active { border-color: var(--cyan); background: rgba(0, 240, 255, 0.06); }
.lib-main { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; background: none; border: none; color: var(--ink); cursor: pointer; text-align: left; min-width: 0; }
.lib-name { font-size: 12px; }
.lib-meta { font-size: 9.5px; color: var(--ink-dim); }
.lib-more { width: 44px; height: 44px; background: none; border: none; color: var(--ink-dim); font-size: 18px; cursor: pointer; }
.lib-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px 10px; }
.btn-danger-ghost { color: var(--magenta); border-color: rgba(255, 45, 149, 0.4); }

/* ── Toast ── */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--transport-h) + 24px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translateX(-50%) translateY(8px); opacity: 0;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  font-size: 11px; line-height: 1.5; text-align: center; color: var(--ink);
  background: rgba(13, 19, 34, 0.96); border: 1px solid rgba(0, 240, 255, 0.4); box-shadow: var(--glow-cyan);
  transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translateX(-50%); }

/* Sheet content never shrinks — the panel scrolls instead. */
.sheet-panel > * { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════════
   SKETCHER-specific components (derived from the tokens above)
   ═══════════════════════════════════════════════════════════════════════ */

.screen { display: flex; flex-direction: column; min-height: 100dvh; position: relative; }
.center { text-align: center; }
.center-hint { text-align: center; padding: 0 12px; }
.top-note { font-size: 9.5px; letter-spacing: 0.15em; color: var(--ink-dim); min-width: 60px; text-align: right; }
.screen-title { flex: 1; text-align: center; }
textarea.text-input { font-size: 14px; line-height: 1.5; min-height: 96px; resize: vertical; }

/* ── diagrams ── */

.diagram { display: block; width: 100%; height: auto; overflow: visible; }
.diagram .dg-dot { filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.6)); }
.diagram-box { width: 100%; }
.diagram-empty { padding: 26px 8px; text-align: center; font-size: 11px; color: var(--ink-dim); letter-spacing: 0.1em; }

/* ── library ── */

.lib-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.btn-hero { padding: 18px 14px; font-size: 14px; font-weight: 700; }
.rec-glyph { width: 12px; height: 12px; border-radius: 50%; background: var(--magenta); box-shadow: var(--glow-magenta); flex-shrink: 0; }
.search-input { font-size: 14px; }
.search-input::placeholder { color: rgba(125, 138, 165, 0.7); }

.idea-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.idea-row {
  display: grid; grid-template-columns: 1fr auto; align-items: stretch;
  border-radius: 14px; border: 1px solid var(--card-border); background: var(--card-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.idea-row:hover { border-color: rgba(0, 240, 255, 0.4); }
.idea-open {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 4px 12px 14px;
  background: none; border: none; color: var(--ink); text-align: left; cursor: pointer; font-family: inherit;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.idea-open:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; border-radius: 14px; }
.idea-name { font-size: 13.5px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-meta { font-size: 9.5px; color: var(--ink-dim); letter-spacing: 0.08em; }
.mini-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.mini-chip {
  font-size: 9.5px; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 999px;
  border: 1px solid currentColor; background: rgba(0, 0, 0, 0.25);
}
.mini-chip-more { color: var(--ink-dim); border-color: transparent; }
.idea-more { width: 46px; background: none; border: none; color: var(--ink-dim); font-size: 18px; cursor: pointer; border-radius: 0 14px 14px 0; }
.idea-more:hover { color: var(--cyan); }
.empty-card .hint { margin-top: 10px; }

/* ── record ── */

.rec-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 16px 22px; }
.rec-time {
  font-size: clamp(54px, 18vw, 92px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  color: var(--ink); text-shadow: 0 0 18px rgba(0, 240, 255, 0.45);
}
.rec-card.is-recording .rec-time { color: var(--magenta); text-shadow: 0 0 18px rgba(255, 45, 149, 0.55); }
.rec-wave { width: 100%; height: 110px; border-radius: 10px; border: 1px solid rgba(0, 240, 255, 0.18); background: rgba(0, 0, 0, 0.35); }
.meter { width: 100%; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(125, 138, 165, 0.25); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--violet) 75%, var(--magenta)); box-shadow: var(--glow-cyan); transition: width 0.06s linear; }
.rec-meta { width: 100%; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 10px; letter-spacing: 0.12em; }
.rec-level { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.clip-warn { color: var(--magenta); text-shadow: var(--glow-magenta); }
.rec-btn {
  width: 104px; height: 104px; border-radius: 50%; margin-top: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--magenta); background: rgba(255, 45, 149, 0.08); box-shadow: var(--glow-magenta);
}
.rec-btn:focus-visible { outline: 2px solid var(--magenta); outline-offset: 4px; }
.rec-dot { width: 54px; height: 54px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 18px rgba(255, 45, 149, 0.7); transition: border-radius 0.2s, width 0.2s, height 0.2s; }
.rec-btn.is-on { animation: recPulse 1.1s ease-in-out infinite; background: rgba(255, 45, 149, 0.18); }
.rec-btn.is-on .rec-dot { width: 36px; height: 36px; border-radius: 6px; }
.rec-btn:disabled { opacity: 0.5; }
.rec-status { margin: 0; font-size: 11px; letter-spacing: 0.25em; text-indent: 0.25em; color: var(--ink-dim); text-align: center; }

/* ── idea ── */

.idea-bar { gap: 8px; }
.idea-title {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--ink); cursor: pointer; font-family: inherit; padding: 2px 4px;
}
#idea-title-text {
  max-width: 100%; font-size: 14px; letter-spacing: 0.12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
}
.idea-sub { font-size: 9px; letter-spacing: 0.16em; color: var(--ink-dim); }
.idea-main { gap: 12px; }

.stage { display: grid; grid-template-columns: 1fr; gap: 12px; }
.stage .card { padding: 12px 14px 14px; }
.stage-head { display: flex; justify-content: space-between; align-items: center; }
.cur-name {
  font-size: clamp(34px, 11vw, 60px); font-weight: 700; line-height: 1.1; margin: 4px 0 8px; min-height: 1.1em;
  color: var(--cyan); text-shadow: 0 0 22px rgba(0, 240, 255, 0.55); overflow-wrap: anywhere;
}
.cur-name.is-empty { color: var(--ink-dim); text-shadow: none; }
.stage-next { opacity: 0.92; }
.next-name { font-size: 22px; font-weight: 700; color: #c9bcff; text-shadow: var(--glow-violet); margin: 2px 0 8px; min-height: 1.2em; }
.stage-next .diagram-box { max-width: 300px; }
.countdown { height: 4px; border-radius: 2px; background: rgba(125, 138, 165, 0.2); margin-bottom: 10px; overflow: hidden; }
.countdown-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--magenta)); box-shadow: var(--glow-violet); }

.wave-card { padding: 10px 12px 12px; }
.wave { display: block; width: 100%; height: 132px; touch-action: none; cursor: pointer; border-radius: 8px; background: rgba(0, 0, 0, 0.3); }
.wave-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.mini-btn {
  min-width: 36px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px;
  border: 1px solid rgba(0, 240, 255, 0.3); background: transparent; color: var(--cyan);
}
.mini-btn:disabled { opacity: 0.35; cursor: default; }
.mini-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.zoom-val { font-size: 10px; color: var(--ink-dim); min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--violet); color: #c9bcff; background: rgba(123, 92, 255, 0.18); box-shadow: var(--glow-violet); }

.timeline { display: flex; gap: 2px; margin-top: 10px; height: 34px; }
.tl-seg {
  flex: 1 1 0; min-width: 4px; overflow: hidden; padding: 0 6px; cursor: pointer;
  display: flex; align-items: center;
  font-family: inherit; font-size: 10.5px; letter-spacing: 0.04em; white-space: nowrap;
  border-radius: 6px; border: 1px solid currentColor; background: rgba(0, 0, 0, 0.3);
}
.tl-seg.is-gap { color: rgba(125, 138, 165, 0.45); border-style: dashed; }
.tl-seg.is-current { background: currentColor; }
.tl-seg.is-current span { color: var(--bg); font-weight: 700; }

.tag-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tag-chip {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px 8px 10px; min-height: 92px;
  border-radius: 12px; cursor: pointer; font-family: inherit; color: var(--ink);
  border: 1px solid var(--chip-color, var(--cyan)); background: rgba(0, 0, 0, 0.3);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 0.08s, box-shadow 0.08s, background 0.08s;
}
.tag-chip:active, .tag-chip.flash { transform: scale(0.97); box-shadow: 0 0 16px var(--chip-color, var(--cyan)); background: rgba(255, 255, 255, 0.06); }
.tag-chip:focus-visible { outline: 2px solid var(--chip-color, var(--cyan)); outline-offset: 2px; }
.tag-chip-name { font-size: 15px; font-weight: 700; color: var(--chip-color, var(--cyan)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.tag-chip.is-add { align-items: center; justify-content: center; border-style: dashed; color: var(--ink-dim); font-size: 22px; }
.tag-chip .diagram { pointer-events: none; }
.marker-tools { gap: 6px; }
.marker-shapes { margin-top: 10px; }

.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shape-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px;
  border: 1px solid var(--card-border); background: var(--card-bg); cursor: pointer; text-align: left; color: var(--ink);
  font-family: inherit; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.shape-card:hover { border-color: rgba(0, 240, 255, 0.4); }
.shape-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.shape-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 30px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 8px currentColor; background: currentColor; }
.shape-card-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shape-card-meta { font-size: 9.5px; color: var(--ink-dim); letter-spacing: 0.08em; }
.shape-card-more { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border: none; background: none; color: var(--ink-dim); font-size: 16px; cursor: pointer; }
.shape-card-more:hover { color: var(--cyan); }

/* transport (CyBeat's, plus seek and speed) */
.play-btn .icon-pause { display: none; }
.play-btn.is-playing .icon-play { display: none; }
.play-btn.is-playing .icon-pause { display: block; }
.play-btn.is-playing { border-color: var(--magenta); background: rgba(255, 45, 149, 0.16); color: var(--magenta); box-shadow: var(--glow-magenta); }
.nudge-btn {
  width: 48px; height: 46px; border-radius: 10px; cursor: pointer; font-size: 13px; letter-spacing: 0.05em;
  border: 1px solid rgba(0, 240, 255, 0.3); background: transparent; color: var(--cyan);
}
.t-time { display: flex; flex-direction: column; align-items: center; min-width: 64px; font-variant-numeric: tabular-nums; }
.t-time span { font-size: 18px; font-weight: 700; color: var(--cyan); text-shadow: 0 0 10px rgba(0, 240, 255, 0.5); }
.t-time small { font-size: 9px; color: var(--ink-dim); letter-spacing: 0.1em; }
.speed-btn {
  min-width: 54px; height: 46px; border-radius: 10px; cursor: pointer; font-size: 13px;
  border: 1px solid rgba(123, 92, 255, 0.5); background: transparent; color: #c9bcff;
}
.speed-btn.is-slow { background: rgba(123, 92, 255, 0.18); box-shadow: var(--glow-violet); }
.nudge-btn:focus-visible, .speed-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ── shape editor ── */

.editor-panel { gap: 10px; }
.editor-panel .sheet-header { gap: 10px; flex-wrap: wrap; }
.ed-name-row { display: flex; gap: 8px; align-items: center; }
.chord-input { font-size: 24px; font-weight: 700; color: var(--cyan); text-shadow: 0 0 10px rgba(0, 240, 255, 0.4); }
.ed-neck-row { display: flex; align-items: center; gap: 6px; }
.ed-neck-row .mini-btn { height: 64px; min-width: 30px; padding: 0; }
.ed-neck .diagram { max-height: min(48dvh, 420px); }
.stage .diagram { max-height: 44dvh; }
.ed-neck { flex: 1; min-width: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.ed-notes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ed-note {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(0, 240, 255, 0.25); background: rgba(0, 0, 0, 0.25); color: var(--ink); font-family: inherit;
}
.ed-note:disabled { opacity: 0.45; cursor: default; }
.ed-note-name { font-size: 14px; font-weight: 700; }
.ed-note:disabled .ed-note-name { color: var(--magenta); }
.ed-note-int { font-size: 10px; color: var(--ink-dim); }
.editor-footer { justify-content: flex-end; margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(125, 138, 165, 0.15); }
.editor-footer .btn { flex: 1; max-width: 200px; }

/* ── forms in sheets ── */

.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row > label, .form-label { font-size: 9px; letter-spacing: 0.2em; color: var(--ink-dim); }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-section { padding-top: 12px; border-top: 1px solid rgba(125, 138, 165, 0.15); display: flex; flex-direction: column; gap: 10px; }
.string-tuner { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.string-tuner .stepper { flex-direction: column; padding: 4px 2px; gap: 2px; }
.string-tuner .stepper-val { min-width: 0; font-size: 12px; }
.string-tuner .stepper-btn { width: 100%; height: 26px; font-size: 14px; }
.lib-shape-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(125, 138, 165, 0.2); }
.lib-shape-row .diagram { width: 120px; flex-shrink: 0; }
.lib-shape-row .grow { flex: 1; min-width: 0; font-size: 12px; }
.form-stack .format-picker .format-btn { flex: 1; }
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-btn { justify-content: flex-start; }
.storage-line { font-size: 11px; color: var(--ink); line-height: 1.6; }

/* ── layouts ── */

@media (max-width: 699px) and (orientation: portrait) {
  .stage-next { display: grid; grid-template-columns: minmax(96px, 0.75fr) 1.25fr; column-gap: 12px; align-items: center; }
  .stage-next > .stage-head, .stage-next > .next-name, .stage-next > .countdown { grid-column: 1; }
  .stage-next > .stage-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .stage-next > .diagram-box { grid-column: 2; grid-row: 1 / span 3; max-width: none; }
  .stage-next .countdown { margin-bottom: 0; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .cur-name { font-size: 34px; margin: 2px 0 4px; }
  .wave { height: 112px; }
}

@media (min-width: 700px), (orientation: landscape) and (min-width: 560px) {
  .stage { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .stage-next .diagram-box { max-width: none; }
  .editor-panel { max-width: 900px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .cur-name { font-size: 34px; margin: 0 0 4px; }
  .wave { height: 104px; }
  .stage .card { padding: 8px 12px 10px; }
  .rec-btn { width: 84px; height: 84px; }
  .rec-time { font-size: 48px; }
  .ed-notes { display: none; }
}

@media (max-width: 380px) {
  .nudge-btn { width: 40px; }
  .t-time { min-width: 54px; }
  .lib-actions { grid-template-columns: 1fr; }
}
