/* ==========================================================================
   Begena በገና — Modern Ethiopian Ten-String Lyre Studio
   Clean dark & light design system · Original Begena finishes & finger inks
   ========================================================================== */

:root {
  color-scheme: dark light;

  --font-sans: "Plus Jakarta Sans", "Noto Sans Ethiopic", "Ebrima", system-ui, -apple-system, sans-serif;
  --font-serif: "Alegreya", "Noto Serif Ethiopic", "Nyala", Georgia, serif;
  --font-geez: "Noto Sans Ethiopic", "Nyala", "Ebrima", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --radius-xs: 4px;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-med: 220ms;

  /* Five Finger Colors (shared across string badges, hand tracker & lessons) */
  --f-thumb: #d65a40;
  --f-index: #e6b53f;
  --f-middle: #58a56c;
  --f-ring: #5a8ad0;
  --f-pinky: #a777c6;

  /* Default Dark Theme — Deep Lapis Studio */
  --bg-canvas: #0f1626;
  --bg-stage-radial: #18233c;
  --surface-bar: rgba(15, 22, 38, 0.88);
  --surface-card: #161f33;
  --surface-subtle: #121a2c;
  --surface-control: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  --ink: #f3efe6;
  --ink-secondary: #b4bdd0;
  --ink-muted: #7f8ca4;

  --accent: #d35539;
  --accent-hover: #e16448;
  --accent-fg: #ffffff;
  --accent-subtle: rgba(211, 85, 57, 0.16);

  --brass: #e0b040;
  --danger: #e2574c;
  --danger-subtle: rgba(226, 87, 76, 0.16);
  --focus-ring: #e0b040;

  --shadow-sm: 0 2px 6px rgba(4, 8, 18, 0.28);
  --shadow-md: 0 14px 34px rgba(4, 8, 18, 0.45);
  --shadow-lg: 0 24px 60px rgba(4, 8, 18, 0.65);
  --backdrop: rgba(6, 10, 20, 0.72);
  --lyre-shadow: rgba(4, 8, 18, 0.56);

  --wire-played-1: #ecdcb4;
  --wire-played-2: #c5b182;
  --wire-rest-1: rgba(236, 220, 180, 0.62);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #f5f4f0;
  --bg-stage-radial: #fdfcf9;
  --surface-bar: rgba(255, 255, 255, 0.88);
  --surface-card: #ffffff;
  --surface-subtle: #f1efe9;
  --surface-control: rgba(15, 23, 42, 0.045);
  --surface-hover: rgba(15, 23, 42, 0.085);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.18);

  --ink: #161922;
  --ink-secondary: #4e5668;
  --ink-muted: #7b8496;

  --accent: #c24429;
  --accent-hover: #a9371f;
  --accent-fg: #ffffff;
  --accent-subtle: rgba(194, 68, 41, 0.11);

  --brass: #b8821d;
  --danger: #b82924;
  --danger-subtle: rgba(184, 41, 36, 0.11);
  --focus-ring: #c24429;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.2);
  --backdrop: rgba(15, 23, 42, 0.45);
  --lyre-shadow: rgba(28, 22, 16, 0.22);
}

/* Theme Icon Swap */
.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

:root[lang="am"] .en-only {
  display: none;
}

/* ==========================================================================
   Begena Finishes: Wanza, Weyra, Debr, Brana, Meskel
   Colours feed the inline instrument SVG (wood grain, hide, tibeb band,
   brass tacks, lacing, hand-cross) and the recorder in takes-ui.js.
   ========================================================================== */

/* Shared defaults; each finish overrides what it needs */
.begena-instrument[data-skin] {
  --grain-strength: 0.32;
  --hide-noise: 0.3;
  --carve-light: rgba(255, 236, 200, 0.16);
  --tack-fill: #b48a3c;
  --tack-hi: #ecd28c;
  --tack-rim: rgba(40, 24, 8, 0.7);
  --tibeb-edge: rgba(30, 16, 6, 0.45);
  --cross-ink: #b8913f;
  --cross-opacity: 0.85;
  --cross-wood-ink: #e2b85c;
  --cross-wood-opacity: 0.86;
  --rubric: #a3291f;
  --rubric-2: #2a1d14;
  --rubric-opacity: 0;
}

/* Wanza (ዋንዛ): honey-brown Cordia wood, natural rawhide, red-gold-green tibeb */
.begena-instrument[data-skin="wanza"] {
  --wood-hi: #a8743f;
  --wood-mid: #7f5129;
  --wood-lo: #4c2d15;
  --wood-edge: #26150a;
  --wood-grain: rgba(42, 20, 6, 0.26);
  --wood-figure: rgba(60, 28, 8, 0.2);
  --carve-shade: rgba(30, 14, 4, 0.5);
  --hide-hi: #e2cca0;
  --hide-mid: #d3b884;
  --hide-lo: #ad8d5c;
  --hide-stitch: rgba(52, 30, 14, 0.6);
  --hide-grain: rgba(110, 74, 34, 0.09);
  --hide-blot: rgba(255, 246, 226, 0.12);
  --bridge-hi: #8f5a31;
  --bridge-lo: #3f2412;
  --bridge-shadow: rgba(36, 18, 8, 0.34);
  --lace: #5a3418;
  --tibeb-ground: #ebdfc4;
  --tibeb-a: #a3302a;
  --tibeb-b: #b88a2e;
  --tibeb-c: #2e5f3e;
  --cross-ink: #6e241b;
  --cross-opacity: 0.84;
  --cross-wood-ink: #e4ba5d;
  --cross-wood-opacity: 0.86;
  --cloth-wrap: #8f2a20;
  --cloth-stripe: #c99a35;
  --cloth-stripe-2: #2e5f3e;
  --enzira-fill: #6e4122;
  --enzira-edge: #2a170b;
  --skin-ink: #2a170b;
  --skin-ink-dim: rgba(42, 23, 11, 0.5);
}

/* Weyra (ወይራ): pale olive wood with dark streaked figure, cream hide, green cloth */
.begena-instrument[data-skin="weyra"] {
  --wood-hi: #d2b47a;
  --wood-mid: #ad8c55;
  --wood-lo: #6e5531;
  --wood-edge: #3b2c16;
  --wood-grain: rgba(66, 44, 16, 0.3);
  --wood-figure: rgba(74, 46, 16, 0.42);
  --carve-shade: rgba(54, 36, 12, 0.45);
  --hide-hi: #efe3c6;
  --hide-mid: #e3d3ad;
  --hide-lo: #c4ad80;
  --hide-stitch: rgba(62, 42, 20, 0.5);
  --hide-grain: rgba(120, 92, 44, 0.08);
  --hide-blot: rgba(255, 252, 240, 0.14);
  --bridge-hi: #b8935a;
  --bridge-lo: #5c4322;
  --bridge-shadow: rgba(54, 36, 16, 0.28);
  --lace: #6b4a24;
  --tibeb-ground: #efe6cf;
  --tibeb-a: #2f6a45;
  --tibeb-b: #b88a2e;
  --tibeb-c: #7d2a1f;
  --cross-ink: #275838;
  --cross-opacity: 0.84;
  --cross-wood-ink: #3b2610;
  --cross-wood-opacity: 0.82;
  --cloth-wrap: #2f5e3a;
  --cloth-stripe: #c9a13f;
  --cloth-stripe-2: #ede2c8;
  --enzira-fill: #8a6434;
  --enzira-edge: #3b2c16;
  --skin-ink: #2b1d0c;
  --skin-ink-dim: rgba(43, 29, 12, 0.5);
}

/* Debr (ደብር): smoke-darkened church wood, aged dark hide, gilt hand-cross and tacks */
.begena-instrument[data-skin="debr"] {
  --wood-hi: #4f3a2c;
  --wood-mid: #2e2119;
  --wood-lo: #160f0b;
  --wood-edge: #070504;
  --wood-grain: rgba(0, 0, 0, 0.42);
  --wood-figure: rgba(150, 112, 72, 0.1);
  --grain-strength: 0.45;
  --carve-shade: rgba(0, 0, 0, 0.6);
  --carve-light: rgba(214, 178, 96, 0.22);
  --hide-hi: #7a5538;
  --hide-mid: #654328;
  --hide-lo: #3f2817;
  --hide-stitch: rgba(226, 196, 140, 0.5);
  --hide-grain: rgba(20, 10, 4, 0.08);
  --hide-blot: rgba(255, 226, 180, 0.05);
  --hide-noise: 0.4;
  --bridge-hi: #4a3628;
  --bridge-lo: #140e0a;
  --bridge-shadow: rgba(0, 0, 0, 0.5);
  --tack-fill: #c9a24a;
  --tack-hi: #f1dc9a;
  --tack-rim: rgba(0, 0, 0, 0.75);
  --lace: #a7835a;
  --tibeb-ground: #1d1410;
  --tibeb-a: #c9a24a;
  --tibeb-b: #8a2a20;
  --tibeb-c: #2e5f3e;
  --tibeb-edge: rgba(0, 0, 0, 0.6);
  --cross-ink: #d4ad52;
  --cross-opacity: 0.92;
  --cross-wood-ink: #dab55e;
  --cross-wood-opacity: 0.9;
  --cloth-wrap: #7a2019;
  --cloth-stripe: #c9a24a;
  --cloth-stripe-2: #1d1410;
  --enzira-fill: #2b1e16;
  --enzira-edge: #8a6a44;
  --skin-ink: #f4e7c9;
  --skin-ink-dim: rgba(244, 231, 201, 0.5);
}

/* Brana (ብራና): parchment-pale hide with rubric double rule, reddish tid (juniper) wood */
.begena-instrument[data-skin="brana"] {
  --wood-hi: #b07348;
  --wood-mid: #8a5333;
  --wood-lo: #56301b;
  --wood-edge: #2c170c;
  --wood-grain: rgba(52, 22, 8, 0.26);
  --wood-figure: rgba(120, 52, 26, 0.22);
  --carve-shade: rgba(40, 16, 6, 0.5);
  --hide-hi: #f4ead4;
  --hide-mid: #ebdfc3;
  --hide-lo: #cdbb95;
  --hide-stitch: rgba(60, 40, 22, 0.5);
  --hide-grain: rgba(130, 104, 60, 0.07);
  --hide-blot: rgba(196, 170, 120, 0.1);
  --hide-noise: 0.22;
  --bridge-hi: #9a6440;
  --bridge-lo: #4a2814;
  --bridge-shadow: rgba(50, 30, 14, 0.26);
  --lace: #6a3c20;
  --tibeb-ground: #f1e7cf;
  --tibeb-a: #a3291f;
  --tibeb-b: #241812;
  --tibeb-c: #b88a2e;
  --cross-ink: #a3291f;
  --cross-opacity: 0.88;
  --cross-wood-ink: #eed498;
  --cross-wood-opacity: 0.86;
  --rubric-opacity: 0.85;
  --cloth-wrap: #a3291f;
  --cloth-stripe: #241812;
  --cloth-stripe-2: #ede2c8;
  --enzira-fill: #7a4a28;
  --enzira-edge: #2c170c;
  --skin-ink: #231710;
  --skin-ink-dim: rgba(35, 23, 16, 0.5);
}

/* Meskel (መስቀል): deep red-brown wood, amber hide, red cloth, red-ink hand-cross */
.begena-instrument[data-skin="meskel"] {
  --wood-hi: #8a3b28;
  --wood-mid: #612418;
  --wood-lo: #33110a;
  --wood-edge: #1a0705;
  --wood-grain: rgba(26, 4, 0, 0.28);
  --wood-figure: rgba(20, 2, 0, 0.22);
  --carve-shade: rgba(20, 4, 0, 0.55);
  --hide-hi: #ddb07a;
  --hide-mid: #cf9d66;
  --hide-lo: #a9733f;
  --hide-stitch: rgba(52, 22, 10, 0.55);
  --hide-grain: rgba(96, 44, 16, 0.09);
  --hide-blot: rgba(255, 230, 196, 0.1);
  --bridge-hi: #7e3524;
  --bridge-lo: #2e0e08;
  --bridge-shadow: rgba(36, 14, 8, 0.4);
  --lace: #4a1c10;
  --tibeb-ground: #9e2a1f;
  --tibeb-a: #e2b445;
  --tibeb-b: #e9dcc0;
  --tibeb-c: #2e5f3e;
  --tibeb-edge: rgba(30, 8, 4, 0.55);
  --cross-ink: #7a1d15;
  --cross-opacity: 0.88;
  --cross-wood-ink: #ebc058;
  --cross-wood-opacity: 0.9;
  --cloth-wrap: #a3291f;
  --cloth-stripe: #e2b445;
  --cloth-stripe-2: #2e5f3e;
  --enzira-fill: #5e2416;
  --enzira-edge: #24100a;
  --skin-ink: #24110a;
  --skin-ink-dim: rgba(36, 17, 10, 0.5);
}

[data-finger="thumb"] { --finger: var(--f-thumb); }
[data-finger="index"] { --finger: var(--f-index); }
[data-finger="middle"] { --finger: var(--f-middle); }
[data-finger="ring"] { --finger: var(--f-ring); }
[data-finger="pinky"] { --finger: var(--f-pinky); }

/* ==========================================================================
   Base, Scrollbars, Selection & Typography
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

::selection {
  background: var(--accent);
  color: var(--accent-fg);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius-s);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

/* ==========================================================================
   Buttons & Shared Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform 90ms ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary[aria-pressed="true"] {
  background: var(--surface-control);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-quiet {
  background: var(--surface-control);
  color: var(--ink);
  border-color: var(--border);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-icon {
  width: 36px;
  padding: 0;
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.btn-sm.btn-icon {
  width: 32px;
  padding: 0;
}

.btn-xs {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.btn-lang {
  font-family: var(--font-geez);
  font-weight: 600;
  padding: 0 11px;
}

.link-btn {
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.2px;
}

.link-btn:hover {
  color: var(--accent-hover);
}

/* ==========================================================================
   App Shell
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 75% 65% at 50% 48%, var(--bg-stage-radial), transparent 76%),
    var(--bg-canvas);
}

/* ==========================================================================
   Top Workspace Bar
   ========================================================================== */

.topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 10px 20px;
  background: var(--surface-bar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 20;
  min-width: 0;
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 10px 14px;
  min-width: 0;
  flex: 1;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
  flex: none;
}

.brand-geez {
  font-family: var(--font-geez);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.brand-latin {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink-secondary);
}

.status-line {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.status-line.is-notice {
  color: var(--ink);
  font-weight: 500;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.control-group-utils {
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

/* Record Button & Popover */
.record-wrap {
  position: relative;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex: none;
}

.btn-record.is-recording {
  border-color: var(--danger);
  background: var(--danger-subtle);
}

.btn-record.is-recording .rec-dot {
  animation: rec-pulse 1.1s ease-in-out infinite;
}

.rec-timer {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--danger);
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.pop-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 264px;
  padding: 6px;
  border-radius: var(--radius-m);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pop-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-s);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.pop-item:hover {
  background: var(--surface-hover);
}

.pop-item-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.pop-choice {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.pop-hint {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.35;
}

.pop-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 6px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-control);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

/* ==========================================================================
   Active Guided Lesson Ribbon
   ========================================================================== */

.lesson-bar {
  grid-row: 2;
  min-width: 0;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 15;
}

.lesson-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.lesson-badge {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lesson-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.lesson-progress {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.lesson-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lesson-body {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}

.lesson-notes {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  flex: 1;
}

.lesson-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex: none;
  transition: transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.lesson-note .note-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--finger, var(--brass));
}

.lesson-note.is-gap {
  color: var(--ink-muted);
  border-style: dashed;
}

.lesson-note.is-past {
  opacity: 0.38;
  background: transparent;
}

.lesson-note.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  transform: translateY(-1px);
}

.lesson-note.is-current .note-dot {
  background: var(--accent-fg);
}

.lesson-note.is-current kbd {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--accent-fg);
}

.lesson-note.is-wrong {
  border-color: var(--danger);
  background: var(--danger-subtle);
  color: var(--danger);
  animation: note-shake 260ms ease;
}

@keyframes note-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.lesson-complete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  flex-wrap: wrap;
}

.lesson-result {
  margin: 0;
  font-weight: 600;
}

.lesson-complete-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Full-Stage Workspace, Camera Backdrop & FX Layers
   ========================================================================== */

.stage {
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px 20px 12px;
  gap: 6px;
  overflow: hidden;
}

.camera-source-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stage-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.stage-workspace {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.stage-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ==========================================================================
   Playable Begena Lyre Component
   ========================================================================== */

.begena-instrument {
  position: relative;
  width: min(100%, 700px, calc((100dvh - 134px) * (680 / 620)));
  aspect-ratio: 680 / 620;
  user-select: none;
  -webkit-user-select: none;
  flex: none;
}

.app-shell[data-show-strings="true"] .begena-instrument {
  width: min(100%, 620px);
}

.begena-body {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.begena-strings {
  position: absolute;
  top: 4.5%;
  bottom: 6.5%;
  left: 18.8%;
  right: 18.8%;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  z-index: 4;
  touch-action: none;
}

.begena-instrument[data-flipped="true"] .begena-strings {
  direction: rtl;
}

.begena-instrument[data-flipped="true"] .string-target {
  direction: ltr;
}

.string-target {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.string-target::before {
  content: "";
  position: absolute;
  inset: 7% 6% 24% 6%;
  border-radius: var(--radius-s);
  background: transparent;
  transition: background-color var(--dur-fast) var(--ease-out);
  pointer-events: none;
}

.string-target:hover::before {
  background: rgba(224, 176, 64, 0.08);
}

.string-target:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -1px;
}

/* Cloth String Wrap on Crossbar Yoke */
.string-peg {
  position: absolute;
  top: 1.6%;
  width: clamp(9px, 26%, 14px);
  height: 8%;
  border-radius: 3px;
  background:
    repeating-linear-gradient(-22deg, transparent 0 3px, rgba(0, 0, 0, 0.28) 3px 4px),
    linear-gradient(
      180deg,
      var(--cloth-wrap) 0 36%,
      var(--cloth-stripe) 36% 50%,
      var(--cloth-wrap) 50% 68%,
      var(--cloth-stripe-2) 68% 78%,
      var(--cloth-wrap) 78%
    );
  border: 1px solid rgba(0, 0, 0, 0.32);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* Color-Coded Finger Circle (1–5) & Hollow Rest Ring below Yoke */
.string-marker {
  position: absolute;
  top: 11.4%;
  width: clamp(14px, 60%, 24px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-size: clamp(9px, 1.75vw, 12px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

.string-target[data-role="played"] .string-marker {
  background: var(--finger);
  color: #1d140e;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.38);
}

.string-target[data-role="rest"] .string-marker {
  background: transparent;
  border: 1.75px solid var(--finger);
}

.string-target[data-active="false"] .string-marker {
  opacity: 0.45;
}

.string-target.is-plucked .string-marker {
  transform: scale(1.14);
}

/* Gut String Wire */
.string-wire {
  position: absolute;
  top: 5.5%;
  bottom: 24.8%;
  width: 2.5px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    var(--wire-played-2) 0%,
    var(--wire-played-1) 50%,
    var(--wire-played-2) 100%
  );
  box-shadow: 1px 0 2px rgba(20, 12, 6, 0.28);
  pointer-events: none;
  transition: opacity 90ms ease;
}

.string-target[data-string="4"] .string-wire,
.string-target[data-string="10"] .string-wire {
  width: 3px;
}

.string-target[data-role="rest"] .string-wire {
  width: 1.7px;
  background: var(--wire-rest-1);
  box-shadow: none;
}

.string-target[data-active="false"] .string-wire {
  opacity: 0.3;
}

.string-target[data-vibrating="true"] .string-wire {
  opacity: 0;
}

/* Enzira Leather Buzz Pad on Bridge */
.string-enzira {
  position: absolute;
  top: 73.2%;
  width: clamp(9px, 24%, 13px);
  height: 6.5px;
  border-radius: 3px 3px 2px 2px;
  background:
    linear-gradient(var(--enzira-edge), var(--enzira-edge)) center 55% / 64% 1px no-repeat,
    var(--enzira-fill);
  border: 1px solid var(--enzira-edge);
  pointer-events: none;
}

.string-target[data-role="rest"] .string-enzira {
  width: clamp(7px, 19%, 10px);
  height: 5.5px;
  opacity: 0.78;
}

/* Direct-on-Soundboard Note Label below Bridge */
.string-note-label {
  position: absolute;
  top: 78.8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}

.string-note {
  font-family: var(--font-serif);
  font-size: clamp(10px, 1.65vw, 13.5px);
  font-weight: 700;
  line-height: 1;
  color: var(--skin-ink);
  font-variant-numeric: tabular-nums;
}

.string-target[data-active="false"] .string-note {
  color: var(--skin-ink-dim);
}

.string-key {
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  font-size: 9.5px;
  padding: 0 4px;
}

.string-target:hover .string-key,
.string-target:focus-visible .string-key {
  opacity: 0.9;
  transform: translateY(0);
}

.string-target.is-target::before {
  background: rgba(224, 176, 64, 0.14);
}

.string-target.is-wrong::before {
  background: var(--danger-subtle);
}

/* ==========================================================================
   Subtle Inline Stage Footer Strip
   ========================================================================== */

.stage-context {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.context-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.context-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.context-btn:hover {
  background: var(--surface-control);
  color: var(--ink);
}

.context-btn-toggle[aria-expanded="true"] {
  background: var(--accent-subtle);
  color: var(--accent);
}

.context-k {
  color: var(--ink-muted);
}

.context-v {
  font-weight: 600;
  color: var(--ink);
}

.context-sep {
  color: var(--ink-muted);
}

.context-mono {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.note-readout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.readout-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.readout-note {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.readout-hz {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.touch-keys {
  display: none;
}

/* ==========================================================================
   Collapsible 10-String Fine Tuning Tray
   ========================================================================== */

.tuning-tray {
  grid-row: 4;
  min-width: 0;
  background: var(--surface-card);
  border-top: 1px solid var(--border);
  padding: 12px 20px 18px;
}

.tuning-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto 10px;
}

.tuning-tray-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.tuning-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(96px, 1fr));
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto;
  overflow-x: auto;
  padding-bottom: 4px;
}

.app-shell[data-flipped="true"] .tuning-grid {
  direction: rtl;
}

.app-shell[data-flipped="true"] .tune-card {
  direction: ltr;
}

.tune-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 7px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  text-align: center;
}

.tune-card[data-active="false"] .tune-note,
.tune-card[data-active="false"] .tune-hz {
  opacity: 0.42;
}

.tune-head {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tune-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--finger);
}

.tune-card[data-role="rest"] .tune-dot {
  background: transparent;
  box-shadow: inset 0 0 0 1.6px var(--finger);
}

.tune-num {
  font-family: var(--font-mono);
  font-size: 13px;
}

.tune-trad {
  font-family: var(--font-geez);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.tune-finger {
  font-size: 11px;
  color: var(--ink-muted);
}

.tune-note {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tune-hz {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.tune-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-secondary);
  cursor: pointer;
  margin: 2px 0;
}

.tune-toggle input {
  accent-color: var(--finger);
  margin: 0;
  width: 14px;
  height: 14px;
}

.tune-semis {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tune-step-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.tune-step-btn:hover {
  background: var(--surface-hover);
}

.tune-semi {
  min-width: 26px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tune-cents {
  width: 100%;
  max-width: 84px;
}

/* ==========================================================================
   Native Dialogs & Slide-Over Settings Drawer
   ========================================================================== */

dialog {
  padding: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: var(--backdrop);
}

.drawer-dialog {
  margin: 0 0 0 auto;
  width: min(340px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  border-radius: var(--radius-m) 0 0 var(--radius-m);
  border-right: 0;
  border-top: 0;
  border-bottom: 0;
  overflow: hidden;
}

.drawer-dialog[open] {
  display: flex;
  flex-direction: column;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 20px;
}

.modal-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(86dvh, 760px);
  border-radius: var(--radius-m);
  overflow: hidden;
}

.modal-dialog.modal-lg {
  width: min(640px, calc(100vw - 24px));
}

.modal-dialog.modal-sm {
  width: min(430px, calc(100vw - 24px));
}

.modal-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}

.dialog-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.dialog-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.geez-sub {
  font-family: var(--font-geez);
  font-size: 0.85em;
  font-weight: 500;
  color: var(--ink-muted);
  margin-left: 6px;
}

.modal-body {
  padding: 18px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dialog-copy {
  margin: 0;
  color: var(--ink-secondary);
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Settings Fields & Controls */
.settings-group {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-group:last-child {
  border-bottom: 0;
}

.group-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.group-heading {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.field-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
}

.hz-val {
  color: var(--ink-muted);
  margin-left: 4px;
}

.field-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-muted);
}

.field-switch {
  cursor: pointer;
}

.switch-input {
  appearance: none;
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--surface-control);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  flex: none;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.switch-input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink-muted);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.switch-input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-input:checked::before {
  transform: translateX(18px);
  background: var(--accent-fg);
}

input[type="range"] {
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 2px solid var(--accent);
  margin-top: -6px;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 2px solid var(--accent);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preset-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 11px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.preset-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.preset-card[aria-checked="true"] {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.preset-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.preset-card[aria-checked="true"] .preset-name {
  color: var(--accent);
}

.preset-sub {
  font-family: var(--font-geez);
  font-size: 12px;
  color: var(--ink-muted);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  gap: 2px;
}

.segmented button {
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.segmented button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.segmented button[aria-checked="true"] {
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Compact 2-Column Begena Finish Picker */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.skin-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.skin-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.skin-card[aria-checked="true"] {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.skin-card[aria-checked="true"] .skin-name {
  color: var(--accent);
}

.skin-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.32);
  flex: none;
}

/* Finish previews: wood frame, hide panel, tibeb strip and EOTC cross motif */
.skin-swatch-wanza {
  background: #7f5129 url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><rect width='22' height='22' fill='%237f5129'/><path d='M0 2.2C8 1.6 14 2.8 22 2.2M0 4.8C7 5.4 15 4.2 22 4.8' fill='none' stroke='%234c2d15' stroke-width='.8'/><rect x='3' y='7' width='16' height='13' fill='%23d3b884'/><rect x='3' y='8' width='16' height='3' fill='%23ebdfc4'/><path d='M6 8.3l1.2 1.2L6 10.7 4.8 9.5zM11 8.3l1.2 1.2-1.2 1.2-1.2-1.2zM16 8.3l1.2 1.2-1.2 1.2-1.2-1.2z' fill='%23a3302a'/><path d='M3 11.3h16' stroke='%232e5f3e' stroke-width='.6'/><path d='M10.2 12.4h1.6l-.3 2h2l.3-.4v2.2l-.3-.4h-2l.3 2h-1.6l.3-2h-2l-.3.4V14l.3.4h2z' fill='%236e241b'/></svg>") center / 100% 100% no-repeat;
}

.skin-swatch-weyra {
  background: #ad8c55 url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><rect width='22' height='22' fill='%23ad8c55'/><path d='M0 2C8 1.2 14 3 22 2M0 5C7 5.8 15 4.4 22 5' fill='none' stroke='%234a2e10' stroke-width='1.2' opacity='.7'/><rect x='3' y='7' width='16' height='13' fill='%23e3d3ad'/><rect x='3' y='8' width='16' height='3' fill='%23efe6cf'/><path d='M6 8.3l1.2 1.2L6 10.7 4.8 9.5zM11 8.3l1.2 1.2-1.2 1.2-1.2-1.2zM16 8.3l1.2 1.2-1.2 1.2-1.2-1.2z' fill='%232f6a45'/><path d='M3 11.3h16' stroke='%23b88a2e' stroke-width='.6'/><path d='M10.2 12.4h1.6l-.3 2h2l.3-.4v2.2l-.3-.4h-2l.3 2h-1.6l.3-2h-2l-.3.4V14l.3.4h2z' fill='%23275838'/></svg>") center / 100% 100% no-repeat;
}

.skin-swatch-debr {
  background: #2e2119 url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><rect width='22' height='22' fill='%232e2119'/><path d='M0 2.2C8 1.6 14 2.8 22 2.2M0 4.8C7 5.4 15 4.2 22 4.8' fill='none' stroke='%23000' stroke-width='.8' opacity='.6'/><rect x='3' y='7' width='16' height='13' fill='%23654328'/><rect x='3' y='8' width='16' height='3' fill='%231d1410'/><path d='M6 8.3l1.2 1.2L6 10.7 4.8 9.5zM11 8.3l1.2 1.2-1.2 1.2-1.2-1.2zM16 8.3l1.2 1.2-1.2 1.2-1.2-1.2z' fill='%23c9a24a'/><path d='M10.2 12.4h1.6l-.3 2h2l.3-.4v2.2l-.3-.4h-2l.3 2h-1.6l.3-2h-2l-.3.4V14l.3.4h2z' fill='%23d4ad52'/></svg>") center / 100% 100% no-repeat;
}

.skin-swatch-brana {
  background: #8a5333 url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><rect width='22' height='22' fill='%238a5333'/><path d='M0 2.2C8 1.6 14 2.8 22 2.2M0 4.8C7 5.4 15 4.2 22 4.8' fill='none' stroke='%2356301b' stroke-width='.8'/><rect x='3' y='7' width='16' height='13' fill='%23ebdfc3'/><rect x='3' y='8' width='16' height='3' fill='%23f1e7cf'/><path d='M6 8.3l1.2 1.2L6 10.7 4.8 9.5zM11 8.3l1.2 1.2-1.2 1.2-1.2-1.2zM16 8.3l1.2 1.2-1.2 1.2-1.2-1.2z' fill='%23a3291f'/><rect x='4.5' y='12.2' width='13' height='6.6' fill='none' stroke='%23a3291f' stroke-width='.65'/><path d='M10.2 12.8h1.6l-.3 1.9h1.9l.3-.4v2.1l-.3-.4h-1.9l.3 1.9h-1.6l.3-1.9H8.6l-.3.4v-2.1l.3.4h1.9z' fill='%23a3291f'/></svg>") center / 100% 100% no-repeat;
}

.skin-swatch-meskel {
  background: #612418 url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><rect width='22' height='22' fill='%23612418'/><path d='M0 2.2C8 1.6 14 2.8 22 2.2M0 4.8C7 5.4 15 4.2 22 4.8' fill='none' stroke='%2333110a' stroke-width='.8'/><rect x='3' y='7' width='16' height='13' fill='%23cf9d66'/><rect x='3' y='8' width='16' height='3' fill='%239e2a1f'/><path d='M6 8.3l1.2 1.2L6 10.7 4.8 9.5zM11 8.3l1.2 1.2-1.2 1.2-1.2-1.2zM16 8.3l1.2 1.2-1.2 1.2-1.2-1.2z' fill='%23e2b445'/><path d='M10.2 12.4h1.6l-.3 2h2l.3-.4v2.2l-.3-.4h-2l.3 2h-1.6l.3-2h-2l-.3.4V14l.3.4h2z' fill='%237a1d15'/></svg>") center / 100% 100% no-repeat;
}

.skin-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-more summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
}

.settings-more summary::-webkit-details-marker {
  display: none;
}

.settings-more summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--ink-muted);
}

.settings-more[open] summary::after {
  content: "−";
}

.more-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
}

.drawer-footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
}

/* ==========================================================================
   Learn Catalog, Notes Import & Recordings Library
   ========================================================================== */

.section-label {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.learn-section,
.saved-imports-section,
.recordings-library-section,
.take-preview-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.catalog-list,
.recordings-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.catalog-list:empty,
.recordings-list:empty {
  display: none;
}

.catalog-item,
.recording-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.catalog-item.is-clickable {
  cursor: pointer;
}

.catalog-item:hover,
.recording-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.catalog-item.is-clickable:active {
  transform: scale(0.995);
}

.catalog-item.is-clickable:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.catalog-item-chevron {
  font-size: 18px;
  line-height: 1;
  color: var(--ink-muted);
  transition: transform var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.catalog-item.is-clickable:hover .catalog-item-chevron {
  color: var(--ink);
  transform: translateX(2px);
}

.catalog-item-main,
.recording-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.catalog-item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.catalog-item-title,
.recording-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.catalog-item-geez {
  font-family: var(--font-geez);
  font-size: 13px;
  color: var(--ink-secondary);
}

.catalog-item-meta,
.recording-item-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.catalog-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.empty-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.empty-state-box {
  padding: 18px 16px;
  border-radius: var(--radius-s);
  border: 1px dashed var(--border-strong);
  background: var(--surface-subtle);
  text-align: center;
}

/* Notes Import Form */
.import-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.75fr;
  gap: 10px;
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--bg-canvas);
  color: var(--ink);
  font-size: 13.5px;
}

.textarea-input {
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
  min-height: 92px;
}

.file-upload-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface-control);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.file-upload-btn:hover {
  background: var(--surface-hover);
}

.form-error {
  margin: 0;
  padding: 8px 11px;
  border-radius: var(--radius-s);
  background: var(--danger-subtle);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.notes-preview-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.notes-preview-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.notes-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-card);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.take-preview-section {
  padding: 14px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.take-media audio,
.take-media video {
  width: 100%;
  border-radius: var(--radius-s);
  display: block;
}

.take-meta,
.take-status {
  margin: 0;
  font-size: 13px;
  color: var(--ink-secondary);
}

.about-copy p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.about-small {
  font-size: 13px;
  color: var(--ink-muted) !important;
}

/* ==========================================================================
   Guided Spotlight Tour
   ========================================================================== */

.tour-dialog {
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.tour-dialog::backdrop {
  background: transparent;
}

.tour-spotlight {
  position: fixed;
  border-radius: var(--radius-m);
  box-shadow: 0 0 0 9999px var(--backdrop), 0 0 0 2px var(--brass);
  pointer-events: none;
  transition: top var(--dur-med) var(--ease-out),
    left var(--dur-med) var(--ease-out),
    width var(--dur-med) var(--ease-out),
    height var(--dur-med) var(--ease-out);
}

.tour-card {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  padding: 16px 18px;
  border-radius: var(--radius-m);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-step-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
}

.tour-title {
  margin: 4px 0 6px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
}

.tour-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Sightline's neutral surfaces and control proportions, shared by both themes. */
:root {
  --font-sans: "Inter", "Noto Sans Ethiopic", "Segoe UI", sans-serif;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 12px;
  --bg-canvas: #0b0b0b;
  --bg-stage-radial: #0b0b0b;
  --surface-bar: #0f0f0f;
  --surface-card: #171717;
  --surface-subtle: #1b1b1b;
  --surface-control: #222;
  --surface-hover: #292929;
  --border: #272727;
  --border-strong: #404040;
  --ink: #f5f5f5;
  --ink-secondary: #b5b5b5;
  --ink-muted: #999;
  --accent: #f26628;
  --accent-hover: #ff7d44;
  --accent-subtle: #f266281a;
  --focus-ring: #f26628;
  --shadow-sm: none;
  --f-thumb: #e9866e;
  --f-index: #e7bd5d;
  --f-middle: #83ba95;
  --f-ring: #8faedf;
  --f-pinky: #baa0d2;
}
:root[data-theme="light"] {
  --bg-canvas: #f6f6f7;
  --bg-stage-radial: #f6f6f7;
  --surface-bar: #fff;
  --surface-card: #fff;
  --surface-subtle: #f1f1f3;
  --surface-control: #ededf0;
  --surface-hover: #e8e8eb;
  --border: #e6e6e9;
  --border-strong: #cbcbcf;
  --ink: #18181b;
  --ink-secondary: #52525b;
  --ink-muted: #67676f;
  --accent: #c64b16;
  --accent-hover: #a93b0c;
  --accent-subtle: #f2662814;
  --focus-ring: #df6227;
  --shadow-sm: none;
}
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font-sans); }
.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-canvas);
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: auto auto minmax(0,1fr);
}
.topbar {
  padding: 10px 24px;
  gap: 18px;
  background: var(--surface-bar);
  backdrop-filter: none;
  box-shadow: none;
}
.brand-latin { font-family: var(--font-sans); font-size: 16px; font-weight: 600; letter-spacing: -.5px; }
.brand-geez { font-size: 22px; }
.brand-mark { display: none; }
.status-line { font-size: 11px; font-weight: 400; }
.btn { border-radius: 6px; box-shadow: none; font-weight: 500; font-size: 12px; height: 36px; min-height: 36px; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg-canvas); }
.btn-primary:hover:not(:disabled) { background: var(--ink-secondary); border-color: var(--ink-secondary); color: var(--bg-canvas); }
.btn-primary[aria-pressed="true"] { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.btn-primary[aria-pressed="true"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 26%, var(--surface-card));
  border-color: var(--accent-hover);
  color: var(--ink);
}
.btn-icon { width: 36px; }
.btn-xs { height: 28px; min-height: 28px; padding: 0 9px; font-size: 11.5px; }
.control-group { gap: 4px; }
.control-group-utils { border-left: 1px solid var(--border); padding-left: 8px; }
.topbar-controls { gap: 12px; flex-wrap: nowrap; }
.lesson-bar {
  position: relative;
  padding: 14px 24px 16px;
  gap: 14px;
  background: var(--surface-bar);
  border-bottom: 1px solid var(--border);
  max-height: 35dvh;
}
.lesson-head { width: 100%; justify-content: center; position: relative; padding-inline: 220px; min-height: 32px; }
.lesson-identity { justify-content: center; gap: 8px 12px; }
.lesson-title { font-family: var(--font-sans); font-size: 15px; font-weight: 600; }
.lesson-badge { display: none; }
.lesson-progress { font-family: var(--font-sans); font-size: 11px; }
.lesson-actions { position: absolute; right: 0; gap: 2px; }
.lesson-actions .btn { height: 30px; min-height: 30px; padding-inline: 8px; font-size: 11px; }
.lesson-body { min-height: 0; width: 100%; flex-direction: column; justify-content: center; gap: 4px; }
.lesson-notes {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: center;
  align-content: start;
  gap: 14px 24px;
  padding: 8px 10px 10px;
  width: max-content;
  max-width: 100%;
  max-height: 19dvh;
  overflow-y: auto;
  overflow-x: hidden;
}
.lesson-phrase { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.lesson-note {
  justify-content: center;
  min-width: 32px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb,var(--finger) 75%,transparent);
  border-radius: 6px;
  background: var(--finger);
  color: #171717;
  font-family: var(--font-sans);
  font-weight: 650;
  font-size: 15px;
  transition: opacity 140ms, transform 140ms, box-shadow 140ms;
}
.lesson-note.is-current {
  background: var(--finger);
  color: #111;
  border-color: var(--finger);
  outline: none;
  box-shadow: 0 0 0 2px var(--surface-bar), 0 0 0 4px var(--ink);
  transform: translateY(-1px);
  z-index: 1;
}
.lesson-note.is-past { background: var(--finger); opacity: .3; }
.lesson-note.is-gap { background: transparent; color: var(--ink-muted); border: 0; min-width: 15px; padding: 0; }
.lesson-note.is-wrong {
  box-shadow: 0 0 0 2px var(--surface-bar), 0 0 0 4px #ef4444, 0 0 14px rgba(239, 68, 68, 0.65);
  animation: note-shake 220ms ease;
  z-index: 2;
}
.stage { height: 100%; min-height: 0; padding: 14px 24px 0; gap: 0; }
.stage-workspace {
  height: 100%; width: 100%; min-height: 0; min-width: 0;
  container-type: size;
}
.begena-instrument,
.app-shell[data-show-strings="true"] .begena-instrument {
  width: min(100cqw, calc(100cqh * 680 / 620), 900px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 680 / 620;
}
.begena-body { filter: drop-shadow(0 8px 6px var(--lyre-shadow)); }
.stage-context { padding: 8px 0; border-top: 1px solid var(--border); background: transparent; gap: 12px; min-height: 48px; }
.context-btn { border-radius: 5px; font-family: var(--font-sans); font-size: 11px; min-height: 32px; }
.context-mono,.readout-hz { font-size: 11px; }
.note-readout { gap: 8px; background: none; border: 0; font-size: 11px; min-height: 30px; }
.readout-note { font-family: var(--font-sans); font-size: 12px; }
.readout-dot { display: none; }
.tuning-tray {
  position: absolute; inset: auto 0 48px; z-index: 18;
  background: var(--surface-card); border-top: 1px solid var(--border);
  max-height: min(42dvh,300px); overflow: auto;
}
.tuning-grid { min-width: 0; }
.touch-keys { display: none; }
.string-badge { background: none; border: none; box-shadow: none; }
.string-badge .string-num,.string-badge .string-key { display: none; }
.string-note { font-family: var(--font-sans); font-size: 13px; font-weight: 500; }
.string-finger-marker { box-shadow: none; }
.drawer-dialog,.modal-dialog { box-shadow: var(--shadow-md); border-color: var(--border); }
.dialog-title { font-family: var(--font-sans); font-size: 18px; font-weight: 600; }
.preset-card,.skin-card,.catalog-item,.text-input,.select-input,.textarea-input { border-radius: 6px; }
.tour-title { font-family: var(--font-sans); }
@media (max-width: 1100px) {
  .status-line { display: none; }
  .topbar { padding-inline: 16px; }
  .lesson-head { padding-inline: 0; justify-content: space-between; }
  .lesson-identity { justify-content: start; }
  .lesson-actions { position: static; }
}
@media (max-width: 700px) {
  .topbar { padding: 8px 12px; display: grid; grid-template-columns: 1fr auto; gap: 6px; }
  .topbar-brand { grid-row: 1; grid-column: 1; }
  .brand-latin { font-size: 14px; }
  .brand-geez { font-size: 20px; }
  .topbar-controls { display: contents; }
  .control-group-utils { grid-row: 1; grid-column: 2; padding-left: 0; border-left: 0; gap: 0; }
  .control-group-utils .btn { padding-inline: 8px; }
  .control-group-utils .btn-icon { width: 32px; }
  .control-group-primary { grid-row: 2; grid-column: 1; }
  .control-group-modes { grid-row: 2; grid-column: 2; justify-content: end; gap: 0; }
  .control-group-modes .btn { padding-inline: 8px; gap: 4px; }
  .control-group-primary .btn { padding-inline: 12px; }
  .btn { min-height: 36px; }
  .lesson-bar { padding: 8px 12px 10px; gap: 9px; max-height: 34dvh; }
  .lesson-head { gap: 4px; }
  .lesson-identity { width: 100%; justify-content: center; gap: 3px 8px; }
  .lesson-title { font-size: 13px; }
  .lesson-progress { font-size: 10px; }
  .lesson-actions { width: 100%; justify-content: center; }
  .lesson-actions .btn { height: 26px; min-height: 26px; padding-inline: 10px; }
  .lesson-notes { gap: 10px 18px; max-height: 13dvh; }
  .lesson-phrase { gap: 3px; }
  .lesson-note { min-width: 25px; height: 30px; padding-inline: 5px; font-size: 13px; border-radius: 5px; }
  .stage { padding: 8px 12px 0; }
  .stage-context { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 5px 0 8px; gap: 2px; }
  .context-btn { font-size: 10px; padding: 0 5px; min-height: 28px; }
  .context-group { gap: 2px; }
  .note-readout { display: none; }
  .touch-keys { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; width: 100%; padding-top: 4px; }
  .touch-keys button { min-height: 40px; display: grid; place-items: center; border-radius: 6px; border: 0; background: var(--finger); color: #171717; font: 600 16px var(--font-sans); cursor: pointer; }
  .touch-keys button strong,.touch-key-finger { display: none; }
  .touch-key-num { width: auto; height: auto; background: none; color: inherit; font-size: inherit; }
  .touch-keys button.is-plucked { box-shadow: inset 0 0 0 2px var(--ink); }
  .touch-keys button:disabled { opacity: .3; }
  .drawer-dialog { width: 100vw; border-radius: 0; }
  .modal-dialog { width: calc(100vw - 16px); max-height: 92dvh; }
  .tuning-grid { grid-template-columns: repeat(10,108px); }
  .tuning-tray { bottom: 88px; padding-inline: 12px; }
  .record-wrap .pop-menu { right: 0; left: auto; max-width: calc(100vw - 24px); }
  .status-line.is-notice { display: block; position: fixed; left: 12px; bottom: 100px; max-width: calc(100vw - 24px); z-index: 40; padding: 8px 12px; background: var(--surface-card); border: 1px solid var(--border); border-radius: 6px; }
}
@media (max-height: 550px) and (min-width: 701px) {
  .topbar { padding-block: 5px; }
  .lesson-bar { padding-block: 7px; gap: 6px; }
  .lesson-notes { max-height: 16dvh; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms!important; transition-duration: .01ms!important; }
}

.string-target[data-role="played"] .string-marker {
  border-radius: 5px;
  box-shadow: none;
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.string-target.is-target::before { background: color-mix(in srgb,var(--finger) 8%,transparent); border-radius: 5px; }
.string-target.is-plucked::before { box-shadow: none; }
.string-target.is-target .string-marker {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-canvas), 0 0 0 4px var(--ink);
}
.string-target.is-hit .string-marker {
  outline: none;
  box-shadow: 0 0 18px 5px rgba(34, 197, 94, 0.55);
  transform: scale(1.1);
}
.string-target.is-wrong .string-marker {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-canvas), 0 0 0 4px #ef4444, 0 0 18px 4px rgba(239, 68, 68, 0.78);
  animation: marker-shake 240ms ease;
}
@keyframes marker-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Segmented control high-contrast active state (dark & light) */
.segmented {
  background: #121214;
  border-color: var(--border);
  padding: 3px;
}
.segmented button {
  color: var(--ink-muted);
}
.segmented button:hover:not([aria-checked="true"]):not(:disabled) {
  color: var(--ink-secondary);
}
.segmented button[aria-checked="true"] {
  background: #2c2c31;
  color: #ffffff;
  border: 1px solid #484852;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
:root[data-theme="light"] .segmented {
  background: #ebebef;
  border-color: #dcdce2;
}
:root[data-theme="light"] .segmented button[aria-checked="true"] {
  background: #ffffff;
  color: #18181b;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Icon-only button helpers & active states */
.btn-record.is-recording {
  width: auto;
  padding-inline: 10px;
  gap: 6px;
}
#lesson-demo-btn .icon-pause { display: none; }
#lesson-demo-btn[data-active="true"] .icon-play { display: none; }
#lesson-demo-btn[data-active="true"] .icon-pause { display: block; }
#lesson-demo-btn[data-active="true"],
.context-btn-toggle[aria-expanded="true"] {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}
#lesson-demo-btn[data-active="true"]:hover:not(:disabled),
.context-btn-toggle[aria-expanded="true"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 26%, var(--surface-card));
  border-color: var(--accent-hover);
  color: var(--ink);
}
.btn-record.is-recording:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-card));
  border-color: var(--danger);
  color: var(--ink);
}
.lesson-actions .btn-icon {
  width: 30px;
  padding: 0;
}
.context-btn-icon {
  width: 32px;
  padding: 0;
  justify-content: center;
}

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("./fonts/inter-latin.woff2") format("woff2"); }

.lesson-phrase { flex-wrap: wrap; max-width: 100%; justify-content: center; row-gap: 6px; }
.string-target[data-role="rest"] .string-note-label { opacity: .35; }
@media(max-height: 600px) and (max-width: 700px) {
  .lesson-actions .btn { min-height: 24px; height: 24px; }
  .lesson-bar { padding-block: 6px; gap: 6px; max-height: 37dvh; }
  .lesson-notes { max-height: 13dvh; }
}

.string-key { display: none; }
@media(max-width: 360px) {
  .lesson-notes { gap: 10px 8px; }
  .lesson-phrase { gap: 2px; }
  .lesson-note { min-width: 21px; padding-inline: 4px; font-size: 12px; height: 28px; }
}

.lesson-bar:focus-visible { outline: none; }
@media(max-height:600px) and (max-width:700px) { .lesson-notes { max-height: 14dvh; } }

/* Aligned Ge'ez / Amharic syllable labels directly beneath lesson note pills */
.lesson-notes.has-lyrics {
  max-height: 24dvh;
  gap: 12px 16px;
  padding: 8px 10px 10px;
}
.lesson-line-lyric {
  margin: 0;
  font-family: var(--font-geez);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-align: center;
  line-height: 1.35;
}
.lesson-bar:has(.lesson-notes.has-lyrics) {
  max-height: 40dvh;
}
.lesson-step {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}
.lesson-syllable {
  font-family: var(--font-geez);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  min-height: 16px;
  color: var(--ink-secondary);
  text-align: center;
  white-space: nowrap;
  transition: color 140ms, opacity 140ms;
}
.lesson-step.is-current .lesson-syllable {
  color: var(--ink);
  font-weight: 700;
}
.lesson-step.is-past .lesson-syllable {
  opacity: 0.35;
}
.lesson-step.is-wrong .lesson-syllable {
  color: #ef4444;
  font-weight: 700;
}
.lesson-syllable.is-empty {
  opacity: 0.28;
}
.lesson-syllable.is-instrumental {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-muted);
  opacity: 0.72;
}
.lesson-step.is-current .lesson-syllable.is-instrumental {
  color: var(--ink);
  opacity: 1;
}
[data-seek-index] {
  cursor: pointer;
}
.lesson-note.is-seekable:hover:not(.is-current),
.lesson-step.is-seekable:hover:not(.is-current) .lesson-note {
  transform: translateY(-1px);
  filter: brightness(1.06);
}
.lesson-step.is-seekable:focus-visible,
.lesson-note.is-seekable:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 6px;
}
@media (max-width: 700px) {
  .lesson-notes.has-lyrics { max-height: 18dvh; }
  .lesson-syllable { font-size: 12px; min-height: 14px; }
}

/* Practice Session Report Dialog */
.report-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}
.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.report-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}
.report-stat-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.report-stat-val.is-good { color: #22c55e; }
.report-stat-val.is-mid { color: #e7bd5d; }
.report-stat-val.is-low { color: #ef4444; }
.report-stat-label {
  font-size: 11px;
  color: var(--ink-muted);
}
.report-focus {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-secondary);
}
.report-focus.is-clean {
  border-color: color-mix(in srgb, #22c55e 40%, var(--border));
  color: #22c55e;
}
.report-keys {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-key-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-s);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}
.report-key-row.has-misses {
  border-color: color-mix(in srgb, #ef4444 35%, var(--border));
}
.report-key-pill {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--finger);
  color: #171717;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.report-key-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.report-key-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.report-bar-track {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-control);
  overflow: hidden;
}
.report-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--finger);
}
.report-key-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
