/* Vayu — one stylesheet on the AeroGyan family tokens (AeroGyan-Go docs/design-family-2026.md). Accent: sky blue for
   action and focus, deep indigo as the second brand colour. No inline styles anywhere (CSP style-src 'self'); JS sets
   sizes only through the CSSOM. Contrast (WCAG AA) is checked by tests/ui.mjs in both themes. */
:root {
  --ag-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Noto Sans", sans-serif;
  --ag-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ag-radius-sm: 8px; --ag-radius: 12px; --ag-radius-lg: 16px; --ag-radius-xl: 24px;
  --ag-ease: cubic-bezier(.2, .8, .2, 1);
  /* dark (default) */
  --ag-accent: #5eb8ff; --ag-accent-2: #3730a3; --ag-accent-contrast: #04162b; --ag-accent-hover: #7fc7ff;
  --ag-bg: #0b0f17; --ag-surface: #121826; --ag-raised: #182033; --ag-line: rgba(255, 255, 255, .08); --ag-line-2: rgba(255, 255, 255, .15);
  --ag-text: #e8ecf4; --ag-muted: #98a2b8; --ag-hover: rgba(255, 255, 255, .055); --ag-press: rgba(255, 255, 255, .09);
  --ag-accent-ink: #7cc6ff; --ag-accent2-ink: #a5b4fc; --ag-accent-soft: rgba(94, 184, 255, .14); --ag-glass: rgba(18, 24, 38, .82);
  --ag-ok: #4ade80; --ag-warn: #fbbf24; --ag-err: #f87171; --ag-info: #60a5fa;
  --ag-shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 1px rgba(0, 0, 0, .2);
  --ag-shadow-2: 0 12px 32px -8px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
  --canvas-bg: #0d121b; --body-fill: #3b4458; --body-line: #c8d2e3;
  --plot-bg: #0f1522; --plot-grid: rgba(255, 255, 255, .07); --plot-fg: #98a2b8; --plot-axis: rgba(255, 255, 255, .22);
  --s-0: #7cc6ff; --s-1: #fbbf24; --s-2: #f472b6; --s-3: #4ade80; --s-4: #a5b4fc; --s-5: #fb923c; --ref: #e8ecf4;
  --left-w: 320px; --right-w: 380px;
  font-family: var(--ag-font); font-size: 14px; line-height: 1.5; color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="light"] {
  --ag-accent: #0369a1; --ag-accent-contrast: #ffffff; --ag-accent-hover: #075985;
  --ag-bg: #f7f8fb; --ag-surface: #ffffff; --ag-raised: #ffffff; --ag-line: rgba(15, 23, 42, .08); --ag-line-2: rgba(15, 23, 42, .16);
  --ag-text: #0f172a; --ag-muted: #5b6478; --ag-hover: rgba(15, 23, 42, .045); --ag-press: rgba(15, 23, 42, .08);
  --ag-accent-ink: #0369a1; --ag-accent2-ink: #3730a3; --ag-accent-soft: rgba(3, 105, 161, .09); --ag-glass: rgba(255, 255, 255, .86);
  --ag-ok: #15803d; --ag-warn: #b45309; --ag-err: #dc2626; --ag-info: #1d6fe0;
  --ag-shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --ag-shadow-2: 0 8px 24px -6px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
  --canvas-bg: #eef2f7; --body-fill: #94a3b8; --body-line: #1e293b;
  --plot-bg: #ffffff; --plot-grid: #e8ebf1; --plot-fg: #5b6478; --plot-axis: #cbd2dd;
  --s-0: #0369a1; --s-1: #b45309; --s-2: #be185d; --s-3: #15803d; --s-4: #3730a3; --s-5: #c2410c; --ref: #0f172a;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ag-bg); color: var(--ag-text); }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:lang(hi) { line-height: 1.6; }
a { color: var(--ag-accent-ink); }
kbd { font: 500 11px/1 var(--ag-font-mono); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--ag-line-2); background: var(--ag-hover); color: var(--ag-muted); white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; height: 100vh; color: var(--ag-muted); font-size: 16px; }
:focus-visible { outline: 2px solid var(--ag-accent-ink); outline-offset: 2px; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i .f { fill: currentColor; stroke: none; }
.spacer { flex: 1; }
.muted { color: var(--ag-muted); }
.mono { font-family: var(--ag-font-mono); font-size: 12.5px; }

/* ---------- layout ---------- */
.app { display: grid; height: 100vh; height: 100dvh; width: 100%; overflow: hidden; position: relative;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "top top top" "left center right" "status status status" "pbar pbar pbar"; }
.app.no-left { grid-template-columns: 0 minmax(0, 1fr) var(--right-w); }
.app.no-right { grid-template-columns: var(--left-w) minmax(0, 1fr) 0; }
.app.no-left.no-right { grid-template-columns: 0 minmax(0, 1fr) 0; }
.app.no-left .left, .app.no-right .right { display: none; }
.app > * { min-width: 0; }
.left { grid-area: left; background: var(--ag-surface); border-right: 1px solid var(--ag-line); overflow: auto; min-height: 0; }
.center { grid-area: center; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--canvas-bg); }
.right { grid-area: right; background: var(--ag-surface); border-left: 1px solid var(--ag-line); overflow: auto; min-height: 0; }
.status { grid-area: status; display: flex; align-items: center; gap: 14px; padding: 4px 12px; min-height: 28px; font-size: 12px; color: var(--ag-muted); background: var(--ag-surface); border-top: 1px solid var(--ag-line); overflow: hidden; white-space: nowrap; }
.status b { color: var(--ag-text); font-weight: 600; }
.status .chip { padding: 1px 8px; border-radius: 999px; border: 1px solid var(--ag-line-2); }
.status .chip.gpu { border-color: color-mix(in srgb, var(--ag-accent-ink) 55%, transparent); color: var(--ag-accent-ink); }
.phone-bar { grid-area: pbar; display: none; }
.phone-only { display: none !important; }

/* ---------- top bar ---------- */
.topbar { grid-area: top; display: flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 52px; background: var(--ag-surface); border-bottom: 1px solid var(--ag-line); position: relative; z-index: 30; }
@supports (backdrop-filter: blur(12px)) { .topbar { background: var(--ag-glass); backdrop-filter: blur(12px) saturate(1.2); } }
.brand { display: flex; align-items: center; gap: 8px; margin-right: 6px; background: none; border: 0; padding: 4px 6px 4px 2px; border-radius: var(--ag-radius-sm); cursor: pointer; flex: none; text-decoration: none; color: inherit; }
.brand:hover { background: var(--ag-hover); }
.brand img { border-radius: 8px; display: block; }
.b-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.b-hi { color: var(--ag-accent-ink); font-size: 14px; font-weight: 600; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--ag-bg); border: 1px solid var(--ag-line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent; color: var(--ag-muted); cursor: pointer; font-weight: 550; white-space: nowrap; }
.seg button:hover { color: var(--ag-text); background: var(--ag-hover); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--ag-raised); color: var(--ag-text); box-shadow: var(--ag-shadow-1); }
.seg button[aria-pressed="true"] .i, .seg button[aria-selected="true"] .i { color: var(--ag-accent-ink); }
.tb-run { display: flex; align-items: center; gap: 6px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--ag-line); }
.tb-right { display: flex; align-items: center; gap: 4px; }
.cmd-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 10px; border-radius: 10px; border: 1px solid var(--ag-line-2); background: var(--ag-bg); color: var(--ag-muted); cursor: pointer; min-width: 0; }
.cmd-btn:hover { border-color: var(--ag-accent-ink); color: var(--ag-text); }
.cmd-btn .tx { min-width: 7em; text-align: left; }
.lang-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 4px; gap: 2px; border-radius: 10px; border: 1px solid var(--ag-line); background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ag-muted); }
.lang-btn span { padding: 3px 7px; border-radius: 7px; }
.lang-btn span.on { background: var(--ag-accent-soft); color: var(--ag-accent-ink); }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: linear-gradient(135deg, var(--ag-accent), var(--ag-accent-2)); color: #ffffff; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; background: var(--ag-surface); border: 1px solid var(--ag-line-2); border-radius: 10px; padding: 0 13px; cursor: pointer; white-space: nowrap; font-weight: 500; text-decoration: none; color: var(--ag-text);
  transition: background .15s var(--ag-ease), border-color .15s var(--ag-ease), transform .12s var(--ag-ease), box-shadow .15s var(--ag-ease); }
.btn:hover { border-color: var(--ag-accent-ink); background: var(--ag-hover); }
.btn:active, .ibtn:active, .seg button:active, .card:active, .chip-btn:active { transform: scale(.98); }
.btn.primary { background: var(--ag-accent); color: var(--ag-accent-contrast); border-color: transparent; font-weight: 650; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, var(--ag-shadow-1); }
.btn.primary:hover { background: var(--ag-accent-hover); }
.btn.danger { border-color: color-mix(in srgb, var(--ag-err) 60%, transparent); color: var(--ag-err); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--ag-hover); }
.btn.small { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn.lg { min-height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ag-accent-contrast); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ibtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--ag-muted); cursor: pointer; flex: none; }
.ibtn:hover { background: var(--ag-hover); color: var(--ag-text); }
.ibtn[aria-pressed="true"], .ibtn[aria-expanded="true"] { background: var(--ag-accent-soft); color: var(--ag-accent-ink); }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; background: transparent; border: 0; border-radius: 8px; cursor: pointer; color: var(--ag-muted); }
.icon-btn:hover { background: var(--ag-hover); color: var(--ag-text); }

/* ---------- panels and forms ---------- */
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; position: sticky; top: 0; background: var(--ag-surface); z-index: 2; border-bottom: 1px solid var(--ag-line); }
.panel-head h2 { margin: 0; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--ag-muted); font-weight: 650; }
:lang(hi) .panel-head h2 { text-transform: none; letter-spacing: 0; font-size: 14px; }
.sect { padding: 10px 14px 14px; border-bottom: 1px solid var(--ag-line); }
.sect > h3 { margin: 2px 0 10px; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.sect > h3 .i { color: var(--ag-accent-ink); width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.f-label { font-size: 12px; color: var(--ag-muted); font-weight: 550; }
.f-text, .f-select { height: 40px; width: 100%; padding: 0 10px; border-radius: 10px; border: 1px solid var(--ag-line-2); background: var(--ag-bg); color: var(--ag-text); }
.f-text:focus, .f-select:focus { outline: none; border-color: var(--ag-accent-ink); box-shadow: 0 0 0 3px var(--ag-accent-soft); }
.f-text[aria-invalid="true"] { border-color: var(--ag-err); }
.f-err { color: var(--ag-err); font-size: 12px; }
.f-hint { color: var(--ag-muted); font-size: 12px; margin: 4px 0 0; }
.f-range { display: flex; align-items: center; gap: 10px; }
.f-range input[type="range"] { flex: 1; accent-color: var(--ag-accent); }
.f-range output { min-width: 4.5em; text-align: right; font-family: var(--ag-font-mono); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ag-accent); }
.units { display: grid; grid-template-columns: auto 1fr 1fr; gap: 3px 10px; font-size: 12px; margin-top: 4px; }
.units .h { color: var(--ag-muted); font-weight: 600; }
.units .v { font-family: var(--ag-font-mono); font-size: 12px; text-align: right; }
.warnbox { margin-top: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ag-warn) 45%, transparent); background: color-mix(in srgb, var(--ag-warn) 9%, transparent); font-size: 12.5px; }
.warnbox p { margin: 2px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--ag-line-2); background: var(--ag-bg); cursor: pointer; font-size: 12.5px; }
.chip-btn[aria-pressed="true"] { border-color: var(--ag-accent-ink); background: var(--ag-accent-soft); color: var(--ag-accent-ink); }

/* ---------- field view ---------- */
.viewbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--ag-surface); border-bottom: 1px solid var(--ag-line); flex-wrap: wrap; }
.viewbar .f-select { height: 34px; width: auto; max-width: 220px; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.stage canvas.field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.tool-probe, .stage.tool-line { cursor: crosshair; }
.stage.tool-pan { cursor: grab; }
.colorbar { position: absolute; right: 12px; top: 12px; bottom: 12px; width: 64px; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; }
.colorbar canvas { width: 14px; flex: 1 1 0; min-height: 0; border-radius: 4px; border: 1px solid var(--ag-line-2); }
.cb-ticks { position: absolute; right: 20px; top: 0; bottom: 0; font: 11px var(--ag-font-mono); color: var(--ag-text); text-shadow: 0 0 3px var(--canvas-bg), 0 0 3px var(--canvas-bg); }
.cb-ticks span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.cb-title { position: absolute; right: 22px; top: -2px; font-size: 11px; color: var(--ag-muted); white-space: nowrap; }
.overlay-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 460px; text-align: center; padding: 18px 22px; border-radius: var(--ag-radius-lg); background: var(--ag-glass); border: 1px solid var(--ag-line); box-shadow: var(--ag-shadow-2); }
.readout { position: absolute; left: 12px; bottom: 12px; padding: 6px 10px; border-radius: 10px; background: var(--ag-glass); border: 1px solid var(--ag-line); font: 12px var(--ag-font-mono); pointer-events: none; }
.toasts-anchor { position: absolute; }

/* ---------- results ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ag-line); background: var(--ag-bg); min-width: 0; }
.kpi .k { font-size: 11.5px; color: var(--ag-muted); }
.kpi .v { font: 600 19px/1.3 var(--ag-font-mono); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; }
.kpi .r { font-size: 11px; color: var(--ag-muted); }
.kpi.good .r { color: var(--ag-ok); }
.plot { position: relative; height: 200px; border-radius: 12px; border: 1px solid var(--ag-line); background: var(--plot-bg); overflow: hidden; }
.plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.plot.tall { height: 260px; }
.plot-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 6px; font-size: 12.5px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--ag-muted); margin-top: 4px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.dots { width: 8px; height: 8px; border-radius: 50%; border: 2px solid; background: transparent; }
.legend i.dash { height: 0; border-top: 2px dashed; }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--ag-line); position: sticky; top: 0; background: var(--ag-surface); z-index: 2; overflow-x: auto; }
.tabs button { height: 36px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ag-muted); cursor: pointer; font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ag-text); border-bottom-color: var(--ag-accent-ink); }
.tabpanel { padding: 10px 14px 18px; }
.datatable { width: 100%; border-collapse: collapse; font-size: 12px; }
.datatable th, .datatable td { padding: 5px 6px; border-bottom: 1px solid var(--ag-line); text-align: right; }
.datatable th:first-child, .datatable td:first-child { text-align: left; }
.datatable th { color: var(--ag-muted); font-weight: 600; }

/* ---------- learn ---------- */
.case-list { display: grid; gap: 8px; }
.card { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px; border-radius: var(--ag-radius-lg); border: 1px solid var(--ag-line); background: var(--ag-surface); cursor: pointer; color: var(--ag-text);
  transition: box-shadow .18s var(--ag-ease), transform .18s var(--ag-ease), border-color .18s; box-shadow: var(--ag-shadow-1); }
.card:hover { box-shadow: var(--ag-shadow-2); transform: translateY(-1px); border-color: var(--ag-line-2); }
.card .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--ag-accent-soft); color: var(--ag-accent-ink); }
.card b { display: block; font-size: 13.5px; }
.card small { display: block; color: var(--ag-muted); font-size: 12px; margin-top: 2px; }
.card .tag { display: inline-block; font-size: 10.5px; font-weight: 650; color: var(--ag-accent2-ink); margin-top: 4px; }
.lesson h3 { margin: 4px 0 6px; font-size: 15px; }
.lesson p { margin: 6px 0; }
.lesson ul { margin: 6px 0; padding-left: 20px; }
.lesson li { margin: 3px 0; }
.lesson .box { padding: 10px 12px; border-radius: 12px; background: var(--ag-accent-soft); margin: 10px 0; }

/* ---------- hero ---------- */
.hero { position: absolute; inset: 0; z-index: 20; overflow: auto; background: var(--ag-bg);
  background-image: radial-gradient(1200px 600px at 75% 20%, color-mix(in srgb, var(--ag-accent) 13%, transparent), transparent 70%),
    linear-gradient(var(--ag-line) 1px, transparent 1px), linear-gradient(90deg, var(--ag-line) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px; }
.hero-in { max-width: 1180px; margin: 0 auto; padding: 56px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 40px; align-items: center; min-height: 100%; }
.hero h1 { font-size: 46px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 14px; }
:lang(hi) .hero h1 { line-height: 1.3; font-size: 40px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--ag-accent-ink), var(--ag-accent2-ink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 17px; color: var(--ag-muted); max-width: 34em; margin: 0 0 22px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .facts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 26px; color: var(--ag-muted); font-size: 13px; }
.hero .facts span { display: inline-flex; align-items: center; gap: 6px; }
.hero .facts .i { color: var(--ag-accent-ink); }
.hero-visual { border-radius: var(--ag-radius-xl); overflow: hidden; border: 1px solid var(--ag-line-2); box-shadow: var(--ag-shadow-2); background: var(--canvas-bg); position: relative; aspect-ratio: 16 / 9; }
.hero-visual canvas { width: 100%; height: 100%; display: block; }
.hero-visual .cap { position: absolute; left: 12px; bottom: 10px; font: 12px var(--ag-font-mono); padding: 4px 8px; border-radius: 8px; background: var(--ag-glass); color: var(--ag-text); }

/* ---------- dialogs, menus, toasts, palette, apps ---------- */
.dlg-back { position: fixed; inset: 0; background: rgba(5, 8, 14, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s var(--ag-ease); }
.dlg { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--ag-raised); border: 1px solid var(--ag-line); border-radius: var(--ag-radius-lg); box-shadow: var(--ag-shadow-2); }
.dlg.wide { width: min(820px, 100%); }
.dlg-back.side { place-items: stretch end; padding: 0; }
.dlg.side { width: min(440px, 100%); max-height: 100vh; height: 100vh; border-radius: 0; display: flex; flex-direction: column; }
.dlg.side .dlg-body { flex: 1; overflow: auto; }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ag-line); }
.dlg-head h2 { margin: 0; font-size: 16px; flex: 1; }
.dlg-ic { color: var(--ag-accent-ink); display: inline-flex; }
.dlg-body { padding: 14px 16px; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--ag-line); }
@keyframes fade { from { opacity: 0; } }
.menu { position: fixed; z-index: 90; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--ag-raised); border: 1px solid var(--ag-line); box-shadow: var(--ag-shadow-2); }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; color: var(--ag-text); text-decoration: none; }
.menu button:hover, .menu button:focus-visible, .menu a:hover { background: var(--ag-hover); }
.menu hr { border: 0; border-top: 1px solid var(--ag-line); margin: 5px 4px; }
#toasts { position: fixed; right: 16px; bottom: 40px; display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 12px; background: var(--ag-raised); border: 1px solid var(--ag-line-2); box-shadow: var(--ag-shadow-2); max-width: 380px; transition: opacity .3s, transform .3s; }
.toast.ok { border-color: color-mix(in srgb, var(--ag-ok) 50%, transparent); }
.toast.error { border-color: color-mix(in srgb, var(--ag-err) 60%, transparent); }
.toast.out { opacity: 0; transform: translateY(6px); }
.pal-back { position: fixed; inset: 0; z-index: 120; background: rgba(5, 8, 14, .45); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.pal { width: min(620px, calc(100% - 24px)); background: var(--ag-raised); border: 1px solid var(--ag-line); border-radius: var(--ag-radius-lg); box-shadow: var(--ag-shadow-2); overflow: hidden; }
.pal-search { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--ag-line); color: var(--ag-muted); }
.pal-input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ag-text); min-width: 0; }
.pal-list { max-height: 52vh; overflow: auto; padding: 6px; }
.pal-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; color: var(--ag-muted); letter-spacing: .04em; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.pal-item.on { background: var(--ag-accent-soft); }
.pal-item .i { color: var(--ag-muted); }
.pal-item.on .i { color: var(--ag-accent-ink); }
.pal-label { flex: 1; min-width: 0; }
.pal-label small { display: block; color: var(--ag-muted); font-size: 11.5px; }
.pal-g { font-size: 11px; color: var(--ag-muted); }
.pal-empty { padding: 20px; color: var(--ag-muted); text-align: center; }
.pal-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--ag-line); font-size: 11.5px; color: var(--ag-muted); }
.apps-pop { position: fixed; z-index: 110; width: 360px; max-width: calc(100vw - 16px); padding: 12px; border-radius: var(--ag-radius-lg); background: var(--ag-raised); border: 1px solid var(--ag-line); box-shadow: var(--ag-shadow-2); }
.apps-head b { display: block; } .apps-head small { color: var(--ag-muted); font-size: 12px; }
.apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 10px 0; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; text-decoration: none; color: var(--ag-text); text-align: center; outline-offset: -2px; }
.app-tile:hover, .app-tile:focus-visible { background: var(--ag-hover); }
.app-tile.here { background: var(--ag-accent-soft); }
.app-tile b { font-size: 12.5px; } .app-tile small { font-size: 10.5px; color: var(--ag-muted); line-height: 1.25; }
.app-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.apps-all { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12.5px; text-decoration: none; padding: 6px; }
.answer { white-space: pre-wrap; line-height: 1.6; }
.answer h4 { margin: 10px 0 4px; }
.answer code { font-family: var(--ag-font-mono); font-size: 12.5px; background: var(--ag-hover); padding: 1px 4px; border-radius: 4px; }
.empty { text-align: center; color: var(--ag-muted); padding: 20px 10px; }
.empty svg { width: 120px; height: 72px; display: block; margin: 0 auto 8px; }
.draw-canvas { width: 100%; height: 320px; border-radius: 12px; border: 1px solid var(--ag-line-2); background: var(--canvas-bg); touch-action: none; cursor: crosshair; display: block; }
.skeleton { background: linear-gradient(90deg, var(--ag-hover), var(--ag-press), var(--ag-hover)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; height: 14px; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  :root { --left-w: 0px; --right-w: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "center" "status" "pbar"; }
  .app.no-left, .app.no-right, .app.no-left.no-right { grid-template-columns: minmax(0, 1fr); }
  .left, .right { display: none; }
  .app[data-area="setup"] .left, .app[data-area="results"] .right, .app[data-area="learn"] .right { display: block; grid-area: center; border: 0; }
  .app[data-area="setup"] .center, .app[data-area="results"] .center, .app[data-area="learn"] .center { display: none; }
  .phone-bar { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ag-surface); border-top: 1px solid var(--ag-line); padding-bottom: env(safe-area-inset-bottom); }
  .phone-bar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border: 0; background: transparent; color: var(--ag-muted); font-size: 11.5px; cursor: pointer; }
  .phone-bar button[aria-current="page"] { color: var(--ag-accent-ink); }
  .tb-hide-phone { display: none !important; }
  .phone-only { display: inline-grid !important; }
  .b-name { display: none; }
  .tb-run { margin-left: 2px; padding-left: 6px; }
  .topbar { gap: 2px; padding: 6px; }
  .btn, .ibtn, .f-text, .f-select, .seg button { min-height: 44px; }
  .ibtn { width: 44px; height: 44px; }
  .status { gap: 10px; font-size: 11px; }
  .status .hide-phone { display: none; }
  .hero-in { grid-template-columns: minmax(0, 1fr); padding: 28px 16px 40px; gap: 24px; }
  .hero h1 { font-size: 32px; }
  :lang(hi) .hero h1 { font-size: 29px; }
  .dlg-back { place-items: end stretch; padding: 0; }
  .dlg { width: 100%; border-radius: var(--ag-radius-lg) var(--ag-radius-lg) 0 0; max-height: 88vh; }
  .dlg.side { height: 88vh; border-radius: var(--ag-radius-lg) var(--ag-radius-lg) 0 0; }
  .dlg-back.side { place-items: end stretch; }
  .colorbar { width: 54px; right: 6px; }
  #toasts { left: 16px; right: 16px; bottom: 76px; align-items: center; }
  .viewbar .hide-phone { display: none; }
}
@media (min-width: 901px) and (max-width: 1180px) { :root { --left-w: 290px; --right-w: 320px; } .tb-hide-mid { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-property: opacity !important; } .card:hover { transform: none; } }

/* ---------- Install Vayu (install.js): the browser's own install, or "Install in 2 taps" — never nothing ---------- */
.inst-wrap { margin: 16px 0 4px; }
.inst-wrap[hidden], .inst-btn[hidden], .inst-done[hidden], .inst-big[hidden] { display: none; }
.btn.inst-big { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 440px; min-height: 60px; height: auto; padding: 10px 18px; text-align: left; white-space: normal; border-color: var(--ag-accent-ink); }
.inst-txt { display: grid; line-height: 1.25; }
.inst-txt b { font-size: 15.5px; }
.inst-txt small { font-size: 12.5px; color: var(--ag-muted); font-weight: 550; }
.inst-done { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.inst-ok { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ag-ok, var(--ag-accent-ink)); }
.inst-sheet ol { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 15px; }
.inst-sheet p { margin: 0 0 10px; }
.inst-sheet .btn.lg { display: flex; justify-content: center; width: 100%; min-height: 44px; margin-top: 10px; text-decoration: none; }
.inst-said { color: var(--ag-accent-ink); font-weight: 600; }
.inst-said:empty { display: none; }
.inst-sheet .inst-note { margin: 14px 0 0; font-size: 13px; color: var(--ag-muted); }
.inst-dlg .dlg-head .icon-btn { width: 44px; height: 44px; }
.inst-copy-field { position: fixed; top: 0; left: 0; opacity: 0; }
