/*
 * REBOT vezérlő v2 — base.css
 * Font, reset, typography, app shell (top bar, nav, rail) and ALL shared components (UI §8).
 * Component class names + HTML snippets are documented in DEV-NOTES.md. View CSS goes to css/<view>.css.
 */

/* ===================================================================== font */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============================================================ shell tokens */

:root {
  --safe-b: env(safe-area-inset-bottom, 0px);
  --rail-w: 0px;
  --np-h: 0px;             /* reserved height of the floating now-playing bar (or a view's claimed bar) */
  --content-max: 1240px;
  --pad-x: 16px;
}
:root.has-np { --np-h: 64px; }

@media (min-width: 640px) { :root { --pad-x: 24px; } }
@media (min-width: 1024px) {
  :root { --bottomnav-h: 0px; --pad-x: 32px; }
  :root.has-np { --np-h: 80px; }
}
/* Landscape phone: left rail instead of the bottom nav, compact top bar. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  :root { --topbar-h: 48px; --bottomnav-h: 0px; --rail-w: 76px; --pad-x: 16px; }
  :root.has-np { --np-h: 56px; }
}

/* ==================================================================== reset */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
  /* WCAG 2.4.11: focused elements scroll clear of the bottom nav, the now-playing bar and a visible toast. */
  scroll-padding-bottom: calc(var(--bottomnav-h) + var(--safe-b) + var(--np-h) + var(--toast-h, 0px) + 12px);
}
html.has-sheet { overflow: hidden; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1.5px, transparent 1.6px);
  background-size: 24px 24px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-title); text-wrap: balance; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p, ul, ol, figure { margin: 0; }
a { color: var(--brand-ink); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--brand-tint); color: var(--brand-ink); }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; vertical-align: middle; }

/* ================================================================ utilities */

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: var(--gap, 12px); }
.row { display: flex; align-items: center; gap: var(--gap, 8px); min-width: 0; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 8px); }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-block: 2px; }
.text-sm { font-size: var(--fs-sm); }
.only-fine { display: none; }
@media (pointer: fine) { .only-fine { display: revert; } }

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-weight: var(--fw-button); box-shadow: var(--sh-2);
}
.skip-link:focus { top: 8px; }

/* ================================================================== top bar */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: var(--sp-2); flex: none;
  min-height: 48px; padding-right: 4px; border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none;
}
.wordmark { font-size: 1.25rem; font-weight: var(--fw-display); letter-spacing: .06em; line-height: 1.2; }
@media (max-width: 399px) { .wordmark { display: none; } }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.topbar .lang-btn { flex: none; gap: 6px; padding-inline: 10px; }
.lang-btn-code { display: none; }
@media (max-width: 639px) { .lang-btn-name { display: none; } .lang-btn-code { display: inline; } }
@media (max-width: 399px) { .topbar .lang-btn { gap: 4px; padding-inline: 6px; } }

.seg-nav { display: none; }
@media (min-width: 1024px) {
  .topbar {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4);
    padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right));
  }
  .seg-nav {
    display: flex; justify-self: center; gap: var(--sp-1); padding: var(--sp-1);
    background: var(--surface-2); border-radius: var(--r-pill);
  }
  .seg-nav a {
    display: flex; align-items: center; gap: var(--sp-2); height: 44px; padding: 0 14px;
    border-radius: var(--r-pill); color: var(--ink-2); text-decoration: none; white-space: nowrap;
    font-weight: var(--fw-label); transition: background var(--dur-2), color var(--dur-2);
  }
  .seg-nav .icon { width: 20px; height: 20px; }
  .seg-nav a:hover { color: var(--ink); background: var(--surface-3); }
  .seg-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
  .seg-nav a[aria-current="page"] .icon { color: var(--brand); }
  .topbar-actions { margin-left: 0; justify-self: end; }
}
@media (min-width: 1024px) and (max-width: 1199px) { .wordmark { display: none; } }
@media (min-width: 1200px) { .seg-nav a { padding: 0 18px; } }
@media (min-width: 1360px) { .topbar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); } }

/* Mascot (UI §9): sizes + antenna light per connection state */
.mascot { display: inline-block; flex: none; width: 36px; height: 36px; line-height: 0; }
.mascot svg { width: 100%; height: 100%; overflow: visible; }
.mascot-md { width: 64px; height: 64px; }
.mascot-lg { width: 104px; height: 104px; }
@media (min-width: 640px) { .mascot-lg { width: 112px; height: 112px; } }
#brand-mascot { --mascot-light: var(--line-strong); }
#brand-mascot[data-conn="connecting"] { --mascot-light: var(--brand); }
#brand-mascot[data-conn="connected"] { --mascot-light: var(--go); }
#brand-mascot[data-conn="lost"], #brand-mascot[data-conn="unsupported"] { --mascot-light: var(--stop); }
#brand-mascot[data-conn="connecting"] .mascot-light { animation: antenna-pulse 1s ease-in-out infinite; }
#brand-mascot.is-bouncing svg { animation: mascot-bounce 400ms var(--ease-pop); transform-origin: 50% 90%; }
@keyframes antenna-pulse { 50% { opacity: .3; } }
@keyframes mascot-bounce { 50% { transform: scale(1.12); } }

/* Robot chip: 5 states (UI §8.3). Disconnected = primary button. */
.robot-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; max-width: 100%;
  min-height: 44px; padding: 0 14px 0 12px; border-radius: var(--r-pill); border: var(--bw) solid transparent;
  background: var(--surface-2); color: var(--ink-2);
  font-size: var(--fs-md); font-weight: var(--fw-button); line-height: 1.2; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.robot-chip.btn { min-height: 44px; padding: 0 16px 0 12px; }
.robot-chip .icon { width: 20px; height: 20px; }
.robot-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-block: 2px; }
.robot-chip-caret.icon { width: 16px; height: 16px; }
.robot-chip-dot {
  width: 10px; height: 10px; flex: none; border-radius: 50%;
  background: var(--go); box-shadow: 0 0 0 4px color-mix(in srgb, var(--go) 25%, transparent);
}
.robot-chip[data-state="connected"] { background: var(--go-tint); color: var(--go-ink); }
.robot-chip[data-state="connected"]:hover { border-color: color-mix(in srgb, var(--go) 45%, transparent); }
.robot-chip[data-state="connecting"] { background: var(--brand-tint); color: var(--brand-ink); cursor: progress; }
.robot-chip[data-state="lost"] { background: var(--stop-tint); color: var(--stop-ink); border-color: var(--stop); }
.robot-chip[data-state="unsupported"] { background: var(--warn-tint); color: var(--warn-ink); }

/* Global STOP (top bar): pill ≥400 px, 48 px round icon-only below. */
.stop-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); flex: none;
  min-height: 44px; padding: 0 16px 0 12px; margin-bottom: var(--lip);
  border: 0; border-radius: var(--r-pill); background: var(--stop); color: var(--on-stop);
  box-shadow: 0 var(--lip) 0 var(--stop-lip);
  font-size: var(--fs-md); font-weight: var(--fw-display); letter-spacing: .04em; line-height: 1;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background var(--dur-2);
}
.stop-btn .icon { width: 20px; height: 20px; }
.stop-btn:hover { background: var(--stop-hover); }
.stop-btn:active { transform: translateY(calc(var(--lip) - 1px)); box-shadow: 0 1px 0 var(--stop-lip); }
@media (max-width: 399px) {
  .stop-btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; }
  .stop-btn .icon { width: 24px; height: 24px; }
  .stop-btn-label { display: none; }
}

/* ============================================================== main + nav */

.main {
  display: block; width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: var(--sp-4) max(var(--pad-x), env(safe-area-inset-right)) calc(var(--bottomnav-h) + var(--safe-b) + var(--np-h) + var(--sp-6)) max(var(--pad-x), env(safe-area-inset-left));
}
.main:focus { outline: none; }
@media (min-width: 1024px) { .main { padding-top: var(--sp-8); } }
.view:focus { outline: none; }

.view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.view-title { font-size: var(--fs-2xl); font-weight: var(--fw-title); min-width: 0; }
.section-title { font-size: var(--fs-xl); font-weight: var(--fw-title); }
.view-narrow { max-width: 720px; margin-inline: auto; }

/* Phone/tablet bottom nav (UI §8.4): 4 items, pill 56×32, labels 14/700 never wrap. */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(var(--bottomnav-h) + var(--safe-b));
  padding: 0 env(safe-area-inset-right, 0px) var(--safe-b) env(safe-area-inset-left, 0px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.bottom-nav a {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0;
  color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); font-weight: var(--fw-label); line-height: 1.25;
  -webkit-tap-highlight-color: transparent; border-radius: var(--r-sm);
}
.bottom-nav a:focus-visible { outline-offset: -3px; }
.nav-pill { display: grid; place-items: center; width: 56px; height: 32px; border-radius: var(--r-pill); transition: background var(--dur-2), color var(--dur-2); }
.bottom-nav .icon { width: 24px; height: 24px; }
.nav-label { white-space: nowrap; }
.bottom-nav a:hover .nav-pill { background: var(--surface-2); }
.bottom-nav a[aria-current="page"] { color: var(--ink); }
.bottom-nav a[aria-current="page"] .nav-pill { background: var(--brand-tint); color: var(--brand-ink); }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  .bottom-nav {
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); right: auto; bottom: 0;
    width: calc(var(--rail-w) + env(safe-area-inset-left, 0px)); height: auto;
    padding: var(--sp-2) 0 var(--safe-b) env(safe-area-inset-left, 0px);
    grid-template-columns: 1fr; grid-auto-rows: 64px; align-content: start;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .bottom-nav a { font-size: var(--fs-xs); }
  .nav-pill { width: 52px; height: 30px; }
  .main { padding-left: calc(var(--rail-w) + env(safe-area-inset-left, 0px) + var(--pad-x)); padding-top: var(--sp-3); }
  .wordmark { font-size: 1.125rem; }
  .mascot#brand-mascot { width: 32px; height: 32px; }
  .topbar .robot-chip, .topbar .robot-chip.btn, .topbar .icon-btn { min-height: 38px; height: auto; }
  .topbar .robot-chip.btn, .stop-btn { margin-bottom: 3px; box-shadow: 0 3px 0 var(--b-lip, var(--stop-lip)); }
  .stop-btn { min-height: 38px; }
  .topbar .icon-btn { height: 44px; }
}

/* ================================================================== buttons */

.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-border: var(--line-2); --b-lip: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-width: 0;
  min-height: var(--tap); padding: 0 var(--sp-5); margin-bottom: var(--lip);
  border-radius: var(--r-md); border: var(--bw) solid var(--b-border); background: var(--b-bg); color: var(--b-fg);
  box-shadow: 0 var(--lip) 0 var(--b-lip);
  font-size: var(--fs-md); font-weight: var(--fw-button); line-height: 1.25; text-align: center; white-space: nowrap; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background var(--dur-2), border-color var(--dur-2);
}
.btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-block: 2px; }
.btn .icon { width: 22px; height: 22px; }
.btn:hover { --b-bg: var(--surface-2); }
.btn:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(calc(var(--lip) - 1px)); box-shadow: 0 1px 0 var(--b-lip); }
.btn-secondary { /* default look, explicit name */ }
.btn-primary { --b-bg: var(--brand); --b-fg: var(--on-brand); --b-border: var(--brand); --b-lip: var(--brand-lip); }
.btn-primary:hover { --b-bg: var(--brand-hover); --b-border: var(--brand-hover); }
.btn-go { --b-bg: var(--go); --b-fg: var(--on-go); --b-border: var(--go); --b-lip: var(--go-lip); }
.btn-go:hover { --b-bg: var(--go-hover); --b-border: var(--go-hover); }
.btn-stop { --b-bg: var(--stop); --b-fg: var(--on-stop); --b-border: var(--stop); --b-lip: var(--stop-lip); }
.btn-stop:hover { --b-bg: var(--stop-hover); --b-border: var(--stop-hover); }
.btn-danger-soft { --b-fg: var(--stop-ink); }
.btn-ghost { --b-bg: transparent; --b-border: transparent; --b-lip: transparent; --b-fg: var(--ink-2); margin-bottom: 0; padding: 0 var(--sp-3); }
.btn-ghost:hover { --b-bg: var(--surface-2); --b-fg: var(--ink); }
.btn-lg { min-height: var(--tap-lg); font-size: var(--fs-lg); padding: 0 var(--sp-6); }
.btn-sm { min-height: 44px; padding: 0 var(--sp-4); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-icon.btn-lg { width: var(--tap-lg); }
/* Toggle button (e.g. „↻ Ismétlés”): aria-pressed="true" = on */
.btn[aria-pressed="true"] { --b-bg: var(--brand-tint); --b-fg: var(--brand-ink); --b-border: var(--brand); --b-lip: var(--brand-lip); }
.btn:disabled, .btn[aria-disabled="true"] {
  --b-bg: var(--surface-2); --b-fg: var(--ink-3); --b-border: var(--surface-2); --b-lip: transparent; cursor: not-allowed;
}
.btn-ghost:disabled, .btn-ghost[aria-disabled="true"] { --b-bg: transparent; --b-border: transparent; }
/* Two-line button (empty-state CTAs): label + <small> sub-line */
.btn-two-line { flex-direction: column; gap: 0; padding-block: var(--sp-2); white-space: normal; }
.btn-two-line small { font-size: var(--fs-sm); font-weight: var(--fw-label); opacity: .9; }

/* Icon button (UI §8.1): ghost 48×48 with aria-label + title */
.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: var(--tap); height: var(--tap); padding: 0;
  border: 0; border-radius: 14px; background: transparent; color: var(--ink-2); cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background var(--dur-2), color var(--dur-2);
}
.icon-btn .icon { width: 24px; height: 24px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled, .icon-btn[aria-disabled="true"] { color: var(--ink-3); opacity: .55; cursor: not-allowed; background: transparent; }
.icon-btn.is-bordered { border: var(--bw) solid var(--line-2); background: var(--surface); }

@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled), .stop-btn:active { transform: none; box-shadow: 0 var(--lip) 0 var(--b-lip, var(--stop-lip)); filter: brightness(.9); }
}

/* =================================================================== switch */

/* <label class="switch"><span class="switch-text"><span class="switch-label">…</span><span class="switch-sub">…</span></span>
     <input type="checkbox" role="switch"></label> — whole row is the hit area */
.switch {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  min-height: var(--tap); cursor: pointer; font-weight: var(--fw-label); -webkit-tap-highlight-color: transparent;
}
.switch-text { display: grid; min-width: 0; }
.switch-label { font-weight: var(--fw-label); }
.switch-sub { font-size: var(--fs-sm); font-weight: var(--fw-body); color: var(--ink-3); }
.switch input {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; margin: 0;
  width: 52px; height: 32px; border-radius: var(--r-pill); background: var(--line-strong); cursor: pointer;
  transition: background var(--dur-2);
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-1); transition: transform var(--dur-2) var(--ease-pop);
}
.switch input:checked { background: var(--go); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:disabled { opacity: .45; cursor: not-allowed; }
.switch:has(input:disabled) { cursor: not-allowed; color: var(--ink-3); }

/* ========================================================= segmented control */

/* Buttons: <div class="segmented" role="group"><button type="button" aria-pressed="true">Egyszer</button>…</div>
   Radios:  <div class="segmented" role="radiogroup"><label><input type="radio" class="sr-only" name="x" checked>Egyszer</label>…</div> */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: var(--r-md);
}
.segmented > button, .segmented > label {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; padding: 0 var(--sp-3);
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2);
  font-weight: var(--fw-label); line-height: 1.2; text-align: center; cursor: pointer;
  transition: background var(--dur-2), color var(--dur-2);
}
.segmented > button:hover, .segmented > label:hover { color: var(--ink); }
.segmented > button[aria-pressed="true"], .segmented > label:has(input:checked) {
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); outline: 2px solid var(--brand); outline-offset: -2px;
}
.segmented > label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.segmented > button:disabled, .segmented > label:has(input:disabled) { color: var(--ink-3); cursor: not-allowed; opacity: .6; }

/* =========================================== selectable item + radio cards */

/* Radio card (UX „Hogyan működjön?”, final-spec §5 #8):
   <label class="choice-card"><input type="radio" class="sr-only" name="mode" value="hold">
     <span class="choice-icon">ICON</span><span class="choice-text"><span class="choice-title">Nyomva tartva</span>
     <span class="choice-sub">Megy, amíg nyomod.</span></span><span class="choice-check">ICON check</span></label> */
.choice-group { display: grid; gap: var(--sp-2); }
@media (min-width: 480px) { .choice-group.is-2col { grid-template-columns: 1fr 1fr; } }
.choice-card {
  position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: var(--sp-3) var(--sp-4);
  border: var(--bw) solid var(--line-2); border-radius: var(--r-md); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur-2), background var(--dur-2);
}
.choice-card:hover { border-color: var(--line-strong); }
.choice-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); }
.choice-icon .icon { width: 24px; height: 24px; }
.choice-text { display: grid; min-width: 0; flex: 1; }
.choice-title { font-size: var(--fs-md); font-weight: var(--fw-button); line-height: 1.3; }
.choice-sub { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.35; }
.choice-check { display: none; flex: none; color: var(--brand-ink); }
.choice-check .icon { width: 22px; height: 22px; }
.choice-card:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.choice-card:has(input:checked) .choice-icon { background: var(--brand); color: var(--on-brand); }
.choice-card:has(input:checked) .choice-check { display: block; }
.choice-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* Selectable list row (UI §8.5): container + main button + trailing actions.
   <div class="list-item" aria-current="true"><button class="list-item-main"><span class="avatar">T</span>
   <span class="list-item-text"><span class="list-item-title">Tánc</span><span class="list-item-meta">4 lépés · 3,5 mp</span></span></button>
   <button class="icon-btn">…</button></div> */
.list { display: grid; gap: var(--sp-2); list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: var(--sp-1); min-height: 72px; padding: var(--sp-2) var(--sp-2) var(--sp-2) 0;
  border: var(--bw) solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: border-color var(--dur-2), background var(--dur-2);
}
.list-item:hover { border-color: var(--line-2); }
.list-item[aria-current="true"], .list-item.is-selected { border-color: var(--brand); background: var(--brand-tint); }
.list-item-main {
  display: flex; align-items: center; gap: var(--sp-3); flex: 1; min-width: 0; align-self: stretch;
  padding: 0 var(--sp-2) 0 var(--sp-3); border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: var(--r-sm);
}
.list-item-text { display: grid; min-width: 0; }
.list-item-title { font-size: var(--fs-lg); font-weight: var(--fw-title); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-block: 2px; }
.list-item-meta { font-size: var(--fs-sm); font-weight: var(--fw-label); color: var(--ink-3); }
.avatar {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px;
  background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-lg); font-weight: var(--fw-display);
}
.list-item[aria-current="true"] .avatar, .list-item.is-selected .avatar { background: var(--brand); color: var(--on-brand); }
/* Round play button used in rows (go-tint), 44 px inside a 48 px hit area */
.play-btn {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  background: var(--go-tint); color: var(--go-ink); cursor: pointer; touch-action: manipulation;
}
.play-btn .icon { width: 22px; height: 22px; }
.play-btn:hover { background: color-mix(in srgb, var(--go) 22%, var(--go-tint)); }
.play-btn.is-playing { background: var(--stop); color: var(--on-stop); }

/* ================================================================== sliders */

/* <div class="range-wrap is-bipolar"><input class="range" type="range" min="0" max="180" style="--c: var(--m1)"></div>
   Fill: R.rangeFill(input, {bipolar:true}) sets --lo / --hi (fractions). is-bipolar draws the centre tick. */
.range-wrap { position: relative; }
.range-wrap.is-bipolar::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 22px; margin: -11px 0 0 -1px;
  border-radius: 1px; background: var(--ink-3); pointer-events: none;
}
.range {
  --c: var(--brand); --lo: 0; --hi: 0; --thumb: 28px;
  -webkit-appearance: none; appearance: none; position: relative; z-index: 1;
  display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 8px; border-radius: var(--r-pill);
  background: linear-gradient(to right,
    var(--track) 0 calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--lo)),
    var(--c) 0 calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--hi)),
    var(--track) 0);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: var(--thumb); height: var(--thumb); margin-top: calc((8px - var(--thumb)) / 2);
  border-radius: 50%; background: #fff; border: 4px solid var(--c); box-shadow: var(--sh-2);
}
.range::-moz-range-track {
  height: 8px; border-radius: var(--r-pill);
  background: linear-gradient(to right,
    var(--track) 0 calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--lo)),
    var(--c) 0 calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--hi)),
    var(--track) 0);
}
.range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--c); box-shadow: var(--sh-2); }
.range:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.range:disabled { opacity: .5; cursor: not-allowed; }
.range-scale { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-label); color: var(--ink-3); }

/* ========================================================= stepper + value */

/* <div class="stepper"><button type="button" class="step-btn" aria-label="Kevesebb">ICON minus</button>
   <input class="value-box" type="text" inputmode="numeric" value="90" aria-label="…">
   <button type="button" class="step-btn" aria-label="Több">ICON plus</button></div>   (auto-repeat: R.holdRepeat) */
.stepper { display: inline-flex; align-items: center; gap: var(--sp-1); }
.step-btn {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: var(--bw) solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-2);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.step-btn .icon { width: 18px; height: 18px; }
.step-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.step-btn:active { background: var(--surface-2); }
.step-btn:disabled { opacity: .45; cursor: not-allowed; }
.value-box {
  width: 64px; min-width: 0; height: 44px; padding: 0 4px;
  border: var(--bw) solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-size: var(--fs-lg); font-weight: var(--fw-display); font-variant-numeric: tabular-nums; text-align: center;
  -moz-appearance: textfield;
}
.value-box.is-compact { width: 52px; }
.value-box.is-wide { width: 80px; }
.value-box::-webkit-outer-spin-button, .value-box::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.value-box:focus { border-color: var(--brand); }

/* ==================================================================== chips */

/* <button type="button" class="chip" aria-pressed="false">ICON(.chip-check) 1 mp</button> — 40 px tall, 48 px hit area */
.chip-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0;
  min-height: 40px; padding: 0 14px; border: var(--bw) solid transparent; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: var(--fw-label); line-height: 1.2; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background var(--dur-2), color var(--dur-2);
}
.chip::before { content: ""; position: absolute; inset: -4px 0; }
.chip .icon { width: 18px; height: 18px; }
.chip:hover { background: var(--surface-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-selected { background: var(--brand-tint); color: var(--brand-ink); border-color: var(--brand); }
.chip .chip-check { display: none; }
.chip[aria-pressed="true"] .chip-check, .chip.is-selected .chip-check { display: inline-block; }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.chip-lg { min-height: 44px; font-size: var(--fs-md); }
.tile .chip { background: var(--surface); }
.tile .chip[aria-pressed="true"] { background: var(--brand-tint); }
.chip-static { cursor: default; }
.chip-static:hover { background: var(--surface-2); color: var(--ink-2); }

/* Data badge (always paired with a letter/number): <span class="badge" data-c="m1">M1</span> */
.badge {
  display: inline-grid; place-items: center; flex: none; min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: var(--r-xs); background: var(--ink-2); color: var(--on-data);
  font-size: var(--fs-xs); font-weight: var(--fw-display); line-height: 1; letter-spacing: .02em;
}
.badge[data-c="m1"] { background: var(--m1); }
.badge[data-c="m2"] { background: var(--m2); }
.badge[data-c="m3"] { background: var(--m3); }
.badge[data-c="m4"] { background: var(--m4); }
.badge[data-c="a"] { background: var(--sensor-a); }
.badge[data-c="b"] { background: var(--sensor-b); }
.badge[data-c="btn1"] { background: var(--btn1); color: var(--on-btn1); }
.badge[data-c="btn2"] { background: var(--btn2); color: var(--on-btn2); }
.badge[data-c="btn3"] { background: var(--btn3); color: var(--on-btn3); }
.badge[data-c="led"] { background: var(--led); color: var(--on-led); }
.badge[data-c="brand"] { background: var(--brand); color: var(--on-brand); }

/* Status pill (UI §8.15): <span class="pill pill-go"><span class="dot"></span>BE</span> */
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: var(--fw-button); line-height: 1.2; white-space: nowrap;
}
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.pill .icon { width: 16px; height: 16px; }
.pill-go { background: var(--go-tint); color: var(--go-ink); }
.pill-brand { background: var(--brand-tint); color: var(--brand-ink); }
.pill-stop { background: var(--stop-tint); color: var(--stop-ink); }
.pill-warn { background: var(--warn-tint); color: var(--warn-ink); }

/* Keycap (desktop legend, pointer:fine only) */
.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px;
  border: 1.5px solid var(--line-strong); color: var(--ink-3); background: var(--surface);
  font-size: 12px; font-weight: var(--fw-display); line-height: 1;
}

/* Meter bar: <div class="meter" style="--v:.5; --c: var(--sensor-a)"><i></i></div> */
.meter { height: 12px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--c, var(--brand)); border-radius: inherit; transition: width 120ms linear; }

.spinner {
  display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================= inputs + select */

/* <div class="field"><label class="field-label" for="x">…</label><input class="input" id="x">
   <p class="field-hint">…</p><p class="field-error">ICON warning-circle …</p></div>
   Select: <div class="select-wrap"><select class="select">…</select></div> (keeps the native picker) */
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: var(--fs-md); font-weight: var(--fw-label); line-height: 1.3; }
.field-hint { font-size: var(--fs-sm); color: var(--ink-3); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-label); color: var(--stop-ink); }
.field-error .icon { width: 18px; height: 18px; }
.input, .select {
  display: block; width: 100%; min-width: 0; min-height: 48px; padding: 0 14px;
  border: var(--bw) solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-size: var(--fs-md); font-weight: var(--fw-body); line-height: 1.4;
}
.input::placeholder { color: var(--ink-3); opacity: 1; }
.input:focus, .select:focus { border-color: var(--brand); }
.input[aria-invalid="true"] { border-color: var(--stop); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; }
.select { appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer; text-overflow: ellipsis; }
.select-wrap { position: relative; min-width: 0; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; pointer-events: none;
  background: var(--ink-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 56px; }
.input-suffix-text { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: var(--fw-label); pointer-events: none; }

/* ============================================================ cards + tiles */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--sh-1); min-width: 0; }
@media (max-width: 639px) { .card { padding: var(--sp-4); } }
.card-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-lg); font-weight: var(--fw-title); line-height: 1.25; }
.card-title .icon { width: 22px; height: 22px; }
.card.is-go { border: var(--bw) solid var(--go); background: var(--go-tint); }
.card.is-brand { border: var(--bw) solid var(--brand); background: var(--brand-tint); }
.card.is-warn { background: var(--warn-tint); border-color: transparent; }
.tile { background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-3); min-width: 0; }
.eyebrow { font-size: var(--fs-sm); font-weight: var(--fw-label); color: var(--ink-3); }

/* Disclosure „▸ Haladó: …”: <details class="disclosure"><summary>ICON(.disclosure-caret, caret-right)<span>…</span></summary>…</details> */
.disclosure > summary {
  display: flex; align-items: center; gap: var(--sp-2); min-height: 48px; list-style: none; cursor: pointer;
  font-weight: var(--fw-label); color: var(--brand-ink); border-radius: var(--r-xs);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure-caret { transition: transform var(--dur-2); }
.disclosure[open] > summary .disclosure-caret { transform: rotate(90deg); }

/* Numbered steps (welcome, connect explainer; reusable e.g. AI setup) */
.num-steps { list-style: none; padding: 0; display: grid; gap: var(--sp-3); counter-reset: num-step; }
.num-steps > li { counter-increment: num-step; display: flex; align-items: center; gap: var(--sp-3); min-height: 36px; font-weight: var(--fw-label); line-height: 1.35; }
.num-steps > li::before {
  content: counter(num-step); display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand-ink); font-weight: var(--fw-display);
}
.num-steps-icon { display: grid; place-items: center; flex: none; color: var(--ink-2); }
.num-steps-icon .icon { width: 24px; height: 24px; }
.bullet-list { padding-left: 1.3em; display: grid; gap: 4px; }

/* ============================================================ empty state */

.empty-state { display: grid; justify-items: center; gap: var(--sp-3); padding: var(--sp-6) var(--sp-2); text-align: center; }
.empty-title { font-size: var(--fs-xl); font-weight: var(--fw-title); max-width: 26ch; }
@media (min-width: 640px) { .empty-title { font-size: var(--fs-2xl); } }
.empty-text { color: var(--ink-2); max-width: 36ch; }
.empty-actions { display: grid; gap: var(--sp-2); width: 100%; max-width: 360px; margin-top: var(--sp-1); }

/* ========================================================== sheets/dialogs */

/* Native <dialog class="sheet"> built by R.ui.openSheet(): phone = bottom sheet, ≥640 = centred dialog. */
dialog.sheet {
  width: 100%; max-width: 100%; max-height: 100%; margin: auto 0 0; padding: 0;
  border: 0; background: transparent; color: var(--ink); overflow: visible;
}
dialog.sheet::backdrop { background: rgba(19, 17, 29, .5); }
.sheet-panel {
  display: flex; flex-direction: column; max-height: 90dvh; overflow: hidden;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--sh-3);
  padding-bottom: var(--safe-b);
}
dialog.sheet[open] .sheet-panel { animation: sheet-in var(--dur-3) var(--ease-out); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet-handle { flex: none; width: 40px; height: 5px; margin: var(--sp-2) auto 0; border-radius: 3px; background: var(--line-2); }
.sheet-head { flex: none; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-5); }
.sheet-head.is-hero { justify-content: flex-end; padding-block: 0; min-height: var(--sp-2); }
.sheet-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xl); font-weight: var(--fw-title); line-height: 1.25; outline: none; }
.sheet-title .icon { width: 26px; height: 26px; color: var(--brand); }
.sheet-close { margin-left: auto; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: var(--sp-1) var(--sp-5) var(--sp-5); }
.sheet-body:empty { display: none; }
.sheet-body:empty + .sheet-foot { border-top: 0; padding-top: var(--sp-2); } /* title-only confirm */
.sheet-foot { flex: none; padding: var(--sp-3) var(--sp-5) var(--sp-4); border-top: 1px solid var(--line); background: var(--surface); }
.sheet-actions { display: grid; gap: var(--sp-2); }
.sheet-text { color: var(--ink-2); }
.sheet-text + .sheet-text, .sheet-text + .sheet-label, .bullet-list + .sheet-text { margin-top: var(--sp-3); }
.sheet-label { font-weight: var(--fw-label); margin-bottom: var(--sp-1); }
.num-steps + .sheet-text, .num-steps + .disclosure { margin-top: var(--sp-4); }
.sheet-section { padding: var(--sp-4) 0; border-top: 1px solid var(--line); }
.sheet-section:first-child { border-top: 0; padding-top: 0; }
.sheet-hero { display: grid; justify-items: center; gap: var(--sp-3); padding: var(--sp-2) 0 var(--sp-5); text-align: center; }
.sheet-hero .sheet-title { justify-content: center; text-align: center; font-size: var(--fs-2xl); }
.sheet-welcome .num-steps { max-width: 320px; margin-inline: auto; }

@media (min-width: 640px) {
  dialog.sheet { width: min(560px, calc(100% - 48px)); margin: auto; }
  dialog.sheet[data-size="sm"] { width: min(460px, calc(100% - 48px)); }
  dialog.sheet[data-size="lg"] { width: min(760px, calc(100% - 48px)); }
  .sheet-panel { max-height: min(86dvh, 820px); border-radius: var(--r-xl); padding-bottom: 0; }
  .sheet-handle { display: none; }
  .sheet-head { padding: var(--sp-4) var(--sp-3) var(--sp-2) var(--sp-6); }
  .sheet-body { padding: var(--sp-1) var(--sp-6) var(--sp-6); }
  .sheet-foot { padding: var(--sp-4) var(--sp-6) var(--sp-5); }
}
/* Side panel (e.g. rule editor on desktop, UX D3) */
@media (min-width: 1024px) {
  dialog.sheet[data-size="side"] { width: min(480px, 100%); height: 100dvh; margin: 0 0 0 auto; }
  dialog.sheet[data-size="side"] .sheet-panel { height: 100%; max-height: 100dvh; border-radius: var(--r-xl) 0 0 var(--r-xl); }
  dialog.sheet[data-size="side"][open] .sheet-panel { animation-name: side-in; }
  @keyframes side-in { from { transform: translateX(24px); opacity: 0; } }
}
/* Short screens (landscape phones): full-height sheets, compact hero, side-by-side footer buttons */
@media (max-height: 520px) {
  .sheet-panel { max-height: calc(100dvh - 8px); border-radius: var(--r-xl) var(--r-xl) 0 0; }
  dialog.sheet:not(.is-anchored) { width: min(600px, 100%); margin: auto auto 0; }
  .sheet-hero { padding-bottom: var(--sp-3); }
  .sheet-hero .mascot-lg { width: 56px; height: 56px; }
  .sheet-hero .sheet-title { font-size: var(--fs-xl); }
  .sheet-actions { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .sheet-foot { padding-block: var(--sp-2); }
}

/* Menus (R.ui.openMenu): bottom sheet on phones, popover under the anchor ≥640 px */
dialog.sheet.is-anchored { position: fixed; inset: var(--menu-top) var(--menu-right) auto auto; width: min(340px, calc(100vw - 16px)); margin: 0; }
dialog.sheet.is-anchored::backdrop { background: transparent; }
dialog.sheet.is-anchored .sheet-panel {
  max-height: calc(100dvh - var(--menu-top) - 12px); border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--sh-2);
}
dialog.sheet.is-anchored[open] .sheet-panel { animation: menu-in var(--dur-2) var(--ease-out); }
@keyframes menu-in { from { transform: translateY(-6px); opacity: 0; } }
dialog.sheet.is-anchored .sheet-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; }
dialog.sheet.is-anchored .sheet-close { display: none; }
dialog.sheet.is-anchored .sheet-body { padding: 6px; }
dialog.sheet[data-variant="menu"] .sheet-body { padding-inline: var(--sp-3); }
dialog.sheet.is-anchored[data-variant="menu"] .sheet-body { padding: 6px; }

.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: var(--sp-2) var(--sp-3);
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); text-align: left;
  font-size: var(--fs-md); font-weight: var(--fw-label); line-height: 1.3; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item:focus-visible { outline-offset: -3px; }
.menu-icon { display: grid; place-items: center; flex: none; width: 24px; color: var(--ink-2); }
.menu-icon .icon { width: 22px; height: 22px; }
.menu-text { display: grid; min-width: 0; }
.menu-sub { font-size: var(--fs-sm); font-weight: var(--fw-body); color: var(--ink-3); }
.menu-item.is-danger, .menu-item.is-danger .menu-icon { color: var(--stop-ink); }
.menu-item[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }
.menu-item[aria-disabled="true"] .menu-icon { color: var(--ink-3); }
.menu-sep { height: 1px; margin: 6px var(--sp-2); background: var(--line); }
.menu-status {
  display: flex; align-items: flex-start; gap: var(--sp-2); margin: 0 0 6px; padding: 10px var(--sp-3);
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: var(--fw-label); line-height: 1.35;
}
.menu-status .icon { width: 18px; height: 18px; margin-top: 1px; }
.menu-status .robot-chip-dot { margin: 4px 2px 0; }
.menu-status.is-go { background: var(--go-tint); color: var(--go-ink); }
.menu-status.is-warn { background: var(--warn-tint); color: var(--warn-ink); }

/* ================================================================== toasts */

.toast-host {
  position: fixed; z-index: 60; left: 0; right: 0;
  bottom: calc(var(--bottomnav-h) + var(--safe-b) + var(--np-h) + var(--sp-4));
  display: flex; justify-content: center; padding: 0 var(--sp-3); pointer-events: none;
}
.toast {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3);
  width: max-content; max-width: min(480px, 100%); min-height: 52px; padding: 10px 10px 10px var(--sp-4);
  border-radius: var(--r-md); background: var(--inverse); color: var(--ink-inverse); box-shadow: var(--sh-3);
  font-weight: var(--fw-label); pointer-events: auto; animation: toast-in var(--dur-3) var(--ease-out);
  transition: opacity 180ms;
}
.toast.is-leaving { opacity: 0; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
.toast-main { display: flex; align-items: center; gap: var(--sp-3); flex: 1 1 auto; min-width: 0; }
.toast-icon { display: grid; place-items: center; flex: none; }
.toast-icon .icon { width: 22px; height: 22px; }
.toast-msg { flex: 1 1 auto; min-width: 0; line-height: 1.35; padding-block: 4px; }
.toast-actions { display: flex; flex: none; gap: var(--sp-1); margin-left: auto; }
.toast-btn {
  min-height: 44px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm); background: transparent;
  color: #C4B8FF; font-size: var(--fs-md); font-weight: var(--fw-button); white-space: nowrap; cursor: pointer;
}
.toast-btn:hover { background: rgba(255, 255, 255, .1); }
.toast-btn:focus-visible { outline-color: #9FC0FF; }
.toast[data-type="success"] .toast-icon { color: #3DD6A6; }
.toast[data-type="error"] .toast-icon { color: #FF9A9D; }
.toast[data-type="info"] .toast-icon, .toast[data-type="undo"] .toast-icon { color: #C4B8FF; }
@media (prefers-color-scheme: dark) {
  .toast-btn { color: #4527B0; }
  .toast-btn:hover { background: rgba(0, 0, 0, .06); }
  .toast-btn:focus-visible { outline-color: #2563EB; }
  .toast[data-type="success"] .toast-icon { color: #087F56; }
  .toast[data-type="error"] .toast-icon { color: #D2333A; }
  .toast[data-type="info"] .toast-icon, .toast[data-type="undo"] .toast-icon { color: #5B3FD6; }
}
@media (min-width: 1024px) { .toast-host { bottom: calc(var(--sp-6) + var(--np-h)); } }
/* While a sheet is open the layer lives inside the <dialog>: phones show toasts at the top (the sheet is at the bottom). */
.live-layer.is-in-sheet .toast-host { top: calc(env(safe-area-inset-top, 0px) + var(--sp-3)); bottom: auto; }
@media (min-width: 640px) { .live-layer.is-in-sheet .toast-host { top: auto; bottom: calc(var(--bottomnav-h) + var(--safe-b) + var(--np-h) + var(--sp-4)); } }
@media (min-width: 1024px) { .live-layer.is-in-sheet .toast-host { bottom: calc(var(--sp-6) + var(--np-h)); } }
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  .toast-host { padding-left: calc(var(--rail-w) + var(--sp-3)); bottom: calc(var(--np-h) + var(--sp-3)); }
}

/* ================================================================= banners */

.banner-host { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.banner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon body close" "actions actions actions";
  align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-2) var(--sp-3) var(--sp-4);
  border: var(--bw) solid transparent; border-radius: var(--r-lg); background: var(--brand-tint); color: var(--brand-ink);
}
.banner-icon { grid-area: icon; display: grid; place-items: center; }
.banner-icon .icon { width: 24px; height: 24px; }
.banner-body { grid-area: body; min-width: 0; }
.banner-title { font-weight: var(--fw-title); font-size: var(--fs-md); line-height: 1.3; }
.banner-text { color: var(--ink); line-height: 1.4; }
.banner-title + .banner-text { color: var(--ink-2); }
.banner-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.banner-actions:empty { display: none; }
.banner-actions .btn { margin-bottom: var(--lip); }
.banner-close { grid-area: close; color: inherit; }
.banner:not(:has(.banner-close)) { padding-right: var(--sp-4); }
.banner[data-kind="alert"] { background: var(--stop-tint); color: var(--stop-ink); border-color: var(--stop); box-shadow: var(--sh-2); }
/* „Megszakadt a kapcsolat” stays in sight under the top bar even when the page is scrolled down. */
.banner-host:has(> .banner[data-kind="alert"]:not([hidden])) { position: sticky; z-index: 20; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + var(--sp-2)); }
.banner[data-kind="warn"] { background: var(--warn-tint); color: var(--warn-ink); }
@media (min-width: 640px) {
  .banner { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "icon body actions close"; }
  .banner-actions .btn { margin-block: 0 var(--lip); }
}

/* ======================================================= now-playing bar */

.np-bar {
  position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(var(--bottomnav-h) + var(--safe-b) + 8px);
  display: flex; align-items: center; gap: var(--sp-3); max-width: 640px; min-height: 56px; margin: 0 auto;
  padding: 4px 6px 4px var(--sp-3); overflow: hidden;
  border: var(--bw) solid var(--go); border-radius: var(--r-md); background: var(--go-tint); color: var(--go-ink); box-shadow: var(--sh-2);
}
.np-bar[data-tone="brand"] { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); }
.np-bar[data-tone="warn"] { border-color: var(--warn-ink); background: var(--warn-tint); color: var(--warn-ink); }
.np-icon { display: grid; place-items: center; flex: none; width: 24px; }
.np-icon .icon { width: 22px; height: 22px; }
.np-text { flex: 1; min-width: 0; }
.np-title, .np-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-title { color: var(--ink); font-size: var(--fs-md); font-weight: var(--fw-button); line-height: 1.3; }
.np-meta { font-size: var(--fs-sm); font-weight: var(--fw-label); line-height: 1.3; }
.np-stop {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin-bottom: 3px; padding: 0;
  border: 0; border-radius: 50%; background: var(--stop); color: var(--on-stop); box-shadow: 0 3px 0 var(--stop-lip);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-1), box-shadow var(--dur-1);
}
.np-stop .icon { width: 20px; height: 20px; }
.np-stop:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stop-lip); }
.np-live-off.btn { flex: none; min-height: 40px; padding: 0 12px; font-size: var(--fs-sm); margin-bottom: 4px; }
.np-progress {
  position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--np-progress, 0) * 100%);
  background: currentColor; opacity: .7; transition: width var(--dur-2) linear;
}
.np-bar:not(.has-progress) .np-progress { display: none; }
.eq { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.eq i { display: block; width: 4px; border-radius: 2px; background: currentColor; animation: eq 900ms ease-in-out infinite; }
.eq i:nth-child(1) { height: 60%; animation-delay: -150ms; }
.eq i:nth-child(2) { height: 100%; animation-delay: -450ms; }
.eq i:nth-child(3) { height: 40%; animation-delay: -700ms; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
@media (min-width: 1024px) { .np-bar { bottom: var(--sp-6); } }
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  .np-bar { left: calc(var(--rail-w) + 12px); bottom: 8px; max-width: 420px; min-height: 48px; padding-block: 2px; }
  .np-stop { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .eq i { animation: none; }
}
