/* HomeDeck — White Glass / Black Glass.
   One ink color for primary actions, one calm accent for state, frosted layers over a soft ambient light.
   Contrast first: every text token passes WCAG AA on the worst-case surface (see docs/ACCESSIBILITY.md). */

:root, [data-theme="light"] {
  --bg: #eceef3;
  --amb-1: rgba(110, 150, 255, .46);   /* ambient light behind the glass */
  --amb-2: rgba(255, 176, 140, .34);
  --amb-3: rgba(110, 215, 195, .26);
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .86);
  --solid: #ffffff;
  --line: rgba(15, 20, 30, .08);         /* hairlines */
  --edge: rgba(255, 255, 255, .85);      /* top highlight on glass */
  --field-border: rgba(15, 20, 30, .28);
  --text: #0c0e13; --muted: #535a67; --dim: #6b7280;
  --ink: #12151b; --on-ink: #ffffff;     /* primary buttons */
  --accent: #2459d6; --on-accent: #ffffff; --accent-soft: rgba(36, 89, 214, .11);
  --ok: #157347; --warn: #8a5300; --bad: #c0271b;
  --ok-soft: rgba(21, 115, 71, .12); --warn-soft: rgba(196, 128, 0, .15); --bad-soft: rgba(192, 39, 27, .11);
  --on-status: #ffffff;
  --key-top: rgba(255, 255, 255, .92); --key-bot: rgba(255, 255, 255, .62); --key-solid: #ffffff;
  --shadow-sm: 0 1px 1px rgba(15, 20, 30, .04), 0 2px 6px -2px rgba(15, 20, 30, .10);
  --shadow: 0 1px 1px rgba(15, 20, 30, .03), 0 10px 30px -10px rgba(15, 20, 30, .18);
  --shadow-key: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 -1px 0 rgba(15, 20, 30, .04) inset, 0 6px 14px -6px rgba(15, 20, 30, .22), 0 1px 2px rgba(15, 20, 30, .06);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #08090c;
  --amb-1: rgba(64, 110, 255, .26);
  --amb-2: rgba(150, 90, 255, .12);
  --amb-3: rgba(20, 190, 170, .12);
  --glass: rgba(30, 32, 39, .58);
  --glass-strong: rgba(36, 38, 46, .88);
  --solid: #1b1d23;
  --line: rgba(255, 255, 255, .08);
  --edge: rgba(255, 255, 255, .09);
  --field-border: rgba(255, 255, 255, .30);
  --text: #f3f4f7; --muted: #a8aebb; --dim: #8f96a3;
  --ink: #f3f4f7; --on-ink: #0b0d12;
  --accent: #86b4ff; --on-accent: #08101f; --accent-soft: rgba(134, 180, 255, .14);
  --ok: #5fd896; --warn: #f2c25a; --bad: #ff8b80;
  --ok-soft: rgba(95, 216, 150, .14); --warn-soft: rgba(242, 194, 90, .14); --bad-soft: rgba(255, 139, 128, .14);
  --on-status: #0b0d12;
  --key-top: rgba(255, 255, 255, .10); --key-bot: rgba(255, 255, 255, .035); --key-solid: #24262d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 14px 34px -12px rgba(0, 0, 0, .6);
  --shadow-key: 0 1px 0 rgba(255, 255, 255, .10) inset, 0 -1px 0 rgba(0, 0, 0, .35) inset, 0 8px 18px -8px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- base */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg);
  font: 17px/1.42 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.011em; -webkit-text-size-adjust: 100%;
}
/* Ambient light the glass refracts. Fixed so scrolling feels like glass sliding over a room. */
body::before {
  content: ""; position: fixed; inset: -20vh -20vw; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vmax 42vmax at 12% 8%, var(--amb-1), transparent 70%),
    radial-gradient(38vmax 38vmax at 92% 38%, var(--amb-2), transparent 70%),
    radial-gradient(40vmax 40vmax at 30% 96%, var(--amb-3), transparent 70%);
}
main { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 10px) 18px calc(112px + env(safe-area-inset-bottom)); outline: none; }
main#view:focus, main#view:focus-visible { outline: none; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 34px; line-height: 1.1; letter-spacing: -.03em; font-weight: 750; margin: 0; text-wrap: balance; }
h1.h-sm { font-size: 20px; letter-spacing: -.02em; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
h2 { font-size: 22px; letter-spacing: -.02em; margin: 6px 0 12px; text-wrap: balance; }
.sec { font-size: 15px; font-weight: 650; letter-spacing: -.01em; color: var(--muted); margin: 28px 6px 10px; display: flex; gap: 8px; align-items: center; }
p { margin: 8px 0; text-wrap: pretty; }
code { font: 14.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--accent-soft); padding: 2px 6px; border-radius: 7px; }
img { outline: 1px solid var(--line); outline-offset: -1px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 15px; } .center { text-align: center; }
.hidden { display: none !important; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: var(--solid); padding: 10px 14px; border-radius: 12px; }
.warn-text { color: var(--warn); font-weight: 650; }
.eyebrow { font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
b, strong { font-weight: 650; }
.count, .meter-num, .code, .tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- glass */
.glass {
  background: var(--glass); border: 0; border-radius: 24px; position: relative;
  box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), var(--shadow);
  -webkit-backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(28px) saturate(1.8);
}
[data-solid="1"] .glass, [data-solid="1"] .tabbar, [data-solid="1"] .toast { background: var(--solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass, .tabbar, .toast { background: var(--solid); } }
@media (prefers-reduced-transparency: reduce) { .glass, .tabbar, .toast, .rk, .chip, .btn, .iconbtn { background: var(--solid) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; } }

.ic { width: 22px; height: 22px; flex: none; stroke-width: 1.8; }
.ic.big { width: 30px; height: 30px; }
.ic.on { color: var(--accent); fill: currentColor; }

/* ---------- header */
.top { display: flex; align-items: center; gap: 10px; min-height: 60px; margin: 2px 0 10px; }
.top > div:first-child:not(.top-actions) { flex: 1; min-width: 0; }
.top h1:not(.h-sm) { flex: 1; }
.top-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- pressables (shared tactile behaviour) */
.btn, .iconbtn, .chip, .rk, .qa, .tile, .li.pick, .seg button, .mini, .tabbar a {
  transition-property: transform, background-color, box-shadow, color, opacity;
  transition-duration: 160ms; transition-timing-function: cubic-bezier(.2, .8, .2, 1);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled), .iconbtn:active, .chip:active, .qa:active, .tile:active, .li.pick:active, .mini:active, .tabbar a:active { transform: scale(.96); transition-duration: 70ms; }

.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; color: var(--text);
  background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), var(--shadow-sm);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); }
.iconbtn.primary { background: var(--ink); color: var(--on-ink); }
.iconbtn .ic { width: 21px; height: 21px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 16px; border: 0; cursor: pointer;
  font: inherit; font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; color: var(--text); text-decoration: none;
  background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), var(--shadow-sm); }
.btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 8px 20px -8px rgba(10, 12, 18, .45); }
.btn.danger { color: var(--bad); }
.btn.danger:not(.ghost) { background: var(--bad); color: var(--on-status); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:active { background: var(--accent-soft); }
.btn.big { min-height: 56px; font-size: 17.5px; border-radius: 18px; }
.btn.xl { min-height: 76px; font-size: 19px; border-radius: 22px; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 14px; }
.btn.wide { width: 100%; margin: 14px 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn .ic { width: 20px; height: 20px; }
label.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.row { display: flex; align-items: center; } .row.gap { gap: 10px; margin: 12px 0; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; gap: 10px; }
.row.gap > input { flex: 1; }
.row.gap > .btn:not(.small) { flex: 1; }
.stack { display: grid; gap: 10px; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---------- cards & lists (iOS inset-grouped) */
.card { padding: 18px; margin: 12px 0; }
.card.check, label.check { display: flex; gap: 14px; align-items: center; min-height: 58px; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--ink); flex: none; }
.list { overflow: hidden; margin: 12px 0; padding: 0; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; color: var(--text); text-decoration: none; width: 100%;
  border: 0; background: none; font: inherit; text-align: left; cursor: pointer; position: relative; }
.list > .li + .li::before, .sheet-body .list .li + .li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }
a.li:active, button.li:active { background: var(--accent-soft); }
.li-main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.li-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 620; }
.li.pick .li-main b { white-space: normal; }
.li input { flex: 1; }
.pad { padding: 16px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; position: relative; }
.kv + .kv::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line); }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; font-weight: 550; }
.notes { white-space: pre-wrap; color: var(--muted); }
details > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 10px; justify-content: space-between; font-weight: 650; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(45deg) translate(-2px, -2px); transition: transform 200ms ease; flex: none; }
details[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
details > summary b { margin-left: auto; color: var(--muted); font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); }
.thumb-img { width: 44px; height: 44px; border-radius: 14px; object-fit: cover; flex: none; }
.hero-img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 26px; box-shadow: var(--shadow); }

/* ---------- chips, badges, pills */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 12px -18px; padding: 2px 18px 6px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 15.5px; font-weight: 620; color: var(--text); text-decoration: none;
  background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), var(--shadow-sm); }
.chip.big { min-height: 48px; font-size: 16px; }
.chip.on, .chip.primary { background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-sm); }
.chip.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }
.chip.edit { padding-right: 4px; gap: 2px; }
.chip .ic { width: 18px; height: 18px; }
.mini { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: inline-grid; place-items: center; cursor: pointer; font: inherit; }
.mini:active { background: var(--accent-soft); }
.mini .ic { width: 17px; height: 17px; }
.count { font-size: 13px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--text); }
.chip.on .count, .seg button.on .count { background: rgba(127, 127, 127, .22); color: inherit; }
.badge, .tag, .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: 0; }
.badge, .pill { background: rgba(127, 127, 127, .13); color: var(--muted); }
.badge::before, .pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.live, .badge.verified, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.badge.live::before, .pill.ok::before { box-shadow: 0 0 0 3px var(--ok-soft); }
.badge.logged, .badge.fixtures { background: var(--accent-soft); color: var(--accent); }
.badge.stale, .badge.planned, .badge.via-hub, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.badge.unknown { color: var(--muted); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.tag.demo, .pill.demo, .badge.demo { background: var(--warn-soft); color: var(--warn); }
.tag { padding: 3px 8px; font-size: 12px; letter-spacing: .02em; }
.tag.plus { background: linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--ink) 70%, var(--accent))); color: var(--on-ink); }
.legend { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 2px 14px; }

/* ---------- banners, empty, toast */
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--accent-soft); margin: 12px 0; font-size: 15.5px; }
.banner > span { flex: 1; }
.banner .ic { flex: none; }
.banner.ok { background: var(--ok-soft); color: var(--ok); } .banner.warn { background: var(--warn-soft); } .banner.bad { background: var(--bad-soft); }
.banner.warn > .ic { color: var(--warn); } .banner.bad > .ic { color: var(--bad); }
.banner.warn span, .banner.bad span, .banner.bad { color: var(--text); }
.empty { text-align: center; padding: 36px 22px 26px; margin-top: 18px; }
.empty .ic.big { width: 34px; height: 34px; color: var(--accent); }
.empty > .ic.big { box-sizing: content-box; padding: 20px; border-radius: 50%; background: var(--accent-soft); margin-bottom: 8px; }
.empty h2 { margin-top: 10px; }
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); z-index: 60; transform: translate(-50%, -16px) scale(.97); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; max-width: min(92vw, 520px); min-height: 52px; padding: 12px 18px 12px 14px; border-radius: 22px;
  background: var(--glass-strong); color: var(--text); font-weight: 620; font-size: 15.5px;
  box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), 0 18px 40px -12px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8);
  transition: opacity 180ms ease, transform 260ms cubic-bezier(.2, .9, .25, 1.2);
}
.toast::before { content: ""; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent) center / 16px no-repeat; }
.toast.ok::before { background-color: var(--ok); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.toast.bad::before { background-color: var(--bad); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 7v6M12 17h.01'/%3E%3C/svg%3E"); }
.toast.info::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 11v6M12 7h.01'/%3E%3C/svg%3E"); }
[data-theme="dark"] .toast.ok::before, [data-theme="dark"] .toast.bad::before, [data-theme="dark"] .toast.info::before { filter: invert(1) hue-rotate(180deg); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.netbar { position: sticky; top: 0; z-index: 30; padding: calc(env(safe-area-inset-top) + 8px) 16px 9px; background: var(--solid); color: var(--text); font-size: 14.5px; font-weight: 600; text-align: center; box-shadow: var(--shadow-sm); }

/* ---------- home */
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; min-height: 132px; color: var(--text); text-decoration: none; font: inherit; text-align: left; cursor: pointer; border: 0; }
.tile-main { display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none; flex: 1; }
.tile-main b, .tile > b { font-size: 16.5px; line-height: 1.25; }
.tile-main .ic, .tile > .ic { width: 26px; height: 26px; color: var(--accent); margin-bottom: 8px; }
.tile-actions { display: flex; gap: 8px; margin-top: 6px; }
.tile.routine { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--glass); }
.tile.pick { align-items: flex-start; justify-content: flex-end; min-height: 112px; }
.qa { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; padding: 10px 6px; color: var(--text); text-decoration: none; font-weight: 620; font-size: 14.5px; text-align: center; }
.qa .ic { width: 26px; height: 26px; color: var(--accent); }

/* ---------- forms */
.form { display: block; }
.field { display: grid; gap: 7px; margin: 14px 0; font-weight: 600; font-size: 15px; }
.field.inline { grid-template-columns: auto 1fr; align-items: center; gap: 14px; margin: 0 0 4px; }
.field > span { color: var(--muted); }
input, select, textarea { font: inherit; font-size: 17px; color: var(--text); background: var(--solid); border: 1px solid var(--field-border); border-radius: 14px;
  min-height: 50px; padding: 11px 14px; width: 100%; transition: border-color 150ms ease, box-shadow 150ms ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background: var(--solid) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") right 12px center / 18px no-repeat; }
textarea { resize: vertical; }
input[type="range"] { padding: 0; accent-color: var(--ink); min-height: 44px; border: 0; background: transparent; }
input[type="file"] { padding: 10px; font-size: 15px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 650; border: 0; border-radius: 10px; padding: 8px 12px; margin-right: 10px; background: var(--accent-soft); color: var(--text); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-radius: 18px; color: var(--muted); }
.search input { border: 0; background: transparent; min-height: 52px; padding: 0; box-shadow: none; }
.search:focus-within { box-shadow: inset 0 1px 0 var(--edge), 0 0 0 3px var(--accent), var(--shadow); }

/* Segmented control with a sliding thumb (--i = selected index, --n = count). */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 18px; margin: 12px 0;
  background: rgba(127, 127, 127, .14); box-shadow: inset 0 0 0 1px var(--line); }
.seg::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n, 3)); border-radius: 14px;
  transform: translateX(calc(var(--i, 0) * 100%)); background: var(--solid); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
  transition: transform 300ms cubic-bezier(.2, .8, .2, 1); }
.seg button { position: relative; z-index: 1; min-height: 44px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 650; white-space: nowrap; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { color: var(--text); }
.code { font: 700 32px ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .14em; text-align: center; padding: 16px; border-radius: 18px; background: var(--accent-soft); user-select: all; }

/* ---------- batteries */
.batt b { font-size: 17px; }
.batt > .row.between:first-child a { color: var(--text); text-decoration: none; }
.meter { height: 10px; border-radius: 999px; background: rgba(127, 127, 127, .18); overflow: hidden; margin: 14px 0 8px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 75%, white), var(--ok)); transition: width 400ms ease; }
.meter.low i { background: linear-gradient(90deg, color-mix(in srgb, var(--bad) 70%, white), var(--bad)); }
.meter.stale i { background: var(--dim); }

/* ---------- pairing */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 20px; }
.steps li { flex: 1; font-size: 12.5px; font-weight: 650; color: var(--dim); text-align: center; }
.steps li::before { content: ""; display: block; height: 5px; border-radius: 999px; margin-bottom: 7px; background: rgba(127, 127, 127, .22); transition: background-color 300ms ease; }
.steps li.done, .steps li.on { color: var(--text); }
.steps li.done::before { background: var(--ink); }
.steps li.on::before { background: var(--accent); }
.pair .tile { min-height: 112px; }
.pair ol { padding-left: 20px; } .pair ol li { margin: 6px 0; }

/* ---------- remote: core controls live in the bottom thumb zone */
.remote-top { gap: 8px; }
.picker { flex: 1; min-width: 0; }
.picker select { font-size: 19px; font-weight: 700; letter-spacing: -.02em; border-radius: 18px; min-height: 52px; text-overflow: ellipsis; border: 0;
  background-color: var(--glass-strong); box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), var(--shadow-sm); }
.remote-status { display: flex; gap: 10px; align-items: center; min-height: 34px; margin: 2px 2px 8px; flex-wrap: wrap; }
#lastcmd { font-variant-numeric: tabular-nums; }
#lastcmd:not(:empty)::before { content: "·"; margin-right: 8px; color: var(--dim); }
.remote { display: flex; flex-direction: column; gap: 14px; min-height: calc(100dvh - 270px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.shortcuts { display: flex; gap: 8px; flex-wrap: wrap; }

.rk { position: relative; display: grid; place-items: center; min-height: 64px; border-radius: 22px; border: 0; cursor: pointer; color: var(--text); font: inherit;
  background: linear-gradient(180deg, var(--key-top), var(--key-bot)); box-shadow: var(--shadow-key), inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6); }
[data-solid="1"] .rk { background: var(--key-solid); }
.rk .ic { width: 26px; height: 26px; }
.rk:active, .rk.down { transform: scale(.94); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .14), inset 0 0 0 1px var(--line); transition-duration: 60ms; }
.rk.danger { color: var(--bad); }
.rk.busy .ic, .rk.busy .ok-label { opacity: .55; }
/* Delivery feedback: a ring that confirms (green) or a small shake that refuses (red). */
.rk::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none; opacity: 0; box-shadow: 0 0 0 3px var(--ok); }
.rk.sent::after { animation: ring 520ms ease-out; }
.rk.fail::after { box-shadow: 0 0 0 3px var(--bad); animation: ring 700ms ease-out; }
.rk.fail { animation: shake 320ms ease-in-out; }
/* Shortcut chips + any tappable control: same instant "done" / "fail" feedback as remote keys. */
.chip.sent, .swatch.sent, .btn.sent, .li.sent { animation: pop 300ms ease-out; box-shadow: 0 0 0 2px var(--ok); }
.chip.fail, .swatch.fail, .btn.fail, .li.fail { animation: shake 320ms ease-in-out; box-shadow: 0 0 0 2px var(--bad); }
@keyframes pop { 0% { transform: scale(.95); } 55% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes ring { 0% { opacity: 1; transform: scale(.98); } 100% { opacity: 0; transform: scale(1.06); } }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -4px; } 75% { translate: 4px; } }
.rk.xl { min-height: 128px; border-radius: 28px; } .rk.xl .ic { width: 40px; height: 40px; }
.ok-label { font-weight: 800; font-size: 19px; letter-spacing: .04em; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row4 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.row4 .rk { min-height: 54px; border-radius: 18px; }
.row4 .rk .ic { width: 22px; height: 22px; }
.thumb { margin-top: auto; display: grid; grid-template-columns: 1fr 78px; grid-template-areas: "pad side" "nav nav"; gap: 16px; align-items: center; }
.dpad { grid-area: pad; position: relative; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 0; aspect-ratio: 1; max-width: 280px; width: 100%; justify-self: center;
  border-radius: 50%; padding: 6px; background: linear-gradient(180deg, var(--key-top), var(--key-bot)); box-shadow: var(--shadow-key), inset 0 0 0 1px var(--line); }
.dpad .rk { background: transparent; box-shadow: none; border-radius: 50%; min-height: 0; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--muted); }
.dpad .rk:active, .dpad .rk.down { background: rgba(127, 127, 127, .16); color: var(--text); }
.dpad .rk .ic { width: 30px; height: 30px; }
.d-up { grid-area: 1 / 2; } .d-left { grid-area: 2 / 1; } .d-right { grid-area: 2 / 3; } .d-down { grid-area: 3 / 2; }
.dpad .d-ok { grid-area: 2 / 2; background: var(--ink); color: var(--on-ink); box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .15); margin: 4px; }
.dpad .d-ok:active, .dpad .d-ok.down { background: var(--ink); color: var(--on-ink); }
.side { grid-area: side; }
.rocker { display: grid; grid-template-rows: 1fr auto 1fr; border-radius: 40px; overflow: hidden;
  background: linear-gradient(180deg, var(--key-top), var(--key-bot)); box-shadow: var(--shadow-key), inset 0 0 0 1px var(--line); }
.rocker .rk { background: transparent; box-shadow: none; border-radius: 0; min-height: 92px; -webkit-backdrop-filter: none; backdrop-filter: none; }
.rocker .rk:active, .rocker .rk.down { background: rgba(127, 127, 127, .16); transform: none; }
.rocker-label { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .14em; }
.nav { grid-area: nav; }
.bigpair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: auto; }

/* ---------- tab bar: floating glass capsule with a sliding highlight (--i set in app.js) */
.tabbar { position: fixed; left: 14px; right: 14px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: 532px; margin: 0 auto; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px; border-radius: 30px;
  background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1px var(--line), 0 16px 40px -14px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8); }
.tabbar::before { content: ""; position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 5); border-radius: 24px; background: var(--accent-soft);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 320ms cubic-bezier(.2, .8, .2, 1), opacity 200ms ease; }
.tabbar[data-none]::before { opacity: 0; }
.tabbar a { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; border-radius: 24px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 650; letter-spacing: 0; }
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }

/* ---------- sheets */
dialog#sheet { border: 0; padding: 0; background: transparent; width: 100%; max-width: 560px; margin: auto auto 0; color: var(--text); max-height: 90dvh; overflow: visible; }
dialog#sheet::backdrop { background: rgba(5, 8, 14, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog#sheet[open] .sheet-body { animation: sheet-in 300ms cubic-bezier(.2, .9, .25, 1); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-body { position: relative; padding: 26px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0; max-height: 90dvh; overflow: auto; background: var(--solid) !important; }
.sheet-body::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 999px; background: rgba(127, 127, 127, .35); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; } }
@media (max-width: 360px) { h1 { font-size: 30px; } .grid3 { gap: 6px; } .thumb { grid-template-columns: 1fr 66px; } }
details.legend { margin: 2px 4px 14px; }
details.legend > summary { min-height: 36px; font-weight: 600; color: var(--muted); justify-content: flex-start; }
details.legend > summary::after { margin-left: 4px; }
.legend-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; padding: 6px 0 4px; }
.legend-grid .badge { justify-self: start; }
.li-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.li-title b { min-width: 0; }
.li-title .tag { flex: none; }

/* ---------- visual review round 1 */
[data-theme="light"] { --bg: #e6e9ef; --line: rgba(15, 20, 30, .09); --seg-thumb: #ffffff;
  --shadow: 0 1px 1px rgba(15, 20, 30, .03), 0 6px 18px -10px rgba(15, 20, 30, .16); }
[data-theme="dark"] { --seg-thumb: #3a3d47; }
main { padding-bottom: calc(128px + env(safe-area-inset-bottom)); }
[data-route="pair"] .tabbar { display: none; }
[data-route="pair"] main { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.remote { min-height: calc(100dvh - 310px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.seg::before { background: var(--seg-thumb); }
.avatar { background: rgba(127, 127, 127, .13); color: var(--text); }
.btn.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 4px 12px -6px rgba(10, 12, 18, .35); }
.btn.tint { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.badge.low { background: var(--bad-soft); color: var(--bad); }
.badge.level { background: rgba(127, 127, 127, .13); color: var(--text); }
.badge.level::before { display: none; }
.li-main > .badge { align-self: flex-start; margin-top: 6px; }
/* Quick actions: one glass bar, hairline dividers */
.qabar { display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; margin: 18px 0 4px; }
.qabar .qa { min-height: 78px; border-radius: 18px; position: relative; }
.qabar .qa + .qa::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 1px; background: var(--line); }
.qabar .qa:active { background: var(--accent-soft); }
/* Routine tile */
.tile.routine { min-height: 0; justify-content: flex-start; }
.tile.routine .tag { vertical-align: 1px; }
.run-pill { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--ink); color: var(--on-ink); font-weight: 700; font-size: 15px; }
.run-pill .ic { width: 16px; height: 16px; }
/* Shortcuts: one scrolling row */
.shortcuts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px 6px; }
.shortcuts::-webkit-scrollbar { display: none; }
.shortcuts.editing { flex-wrap: wrap; overflow: visible; }
.chip.icon-only { width: 48px; padding: 0; justify-content: center; flex: none; }
/* iOS-style switch (Safari 17.4+ also understands the native `switch` attribute) */
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; min-height: 0; padding: 0; border: 0; border-radius: 999px; position: relative; cursor: pointer;
  background: rgba(127, 127, 127, .32); transition: background-color 200ms ease; }
input.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .18), 0 1px 1px rgba(0, 0, 0, .12); transition: transform 220ms cubic-bezier(.2, .8, .2, 1); }
input.switch:checked { background: var(--ok); }
input.switch:checked::before { transform: translateX(20px); }
.card.check .li-main { gap: 2px; }
/* When a banner explains a problem, let the remote flow naturally and shrink the pad so everything stays above the tab bar. */
.banner + .remote { min-height: 0; }
.banner + .remote .dpad { max-width: 236px; }
.banner + .remote .rocker .rk { min-height: 76px; }
.remote-top + .remote-status + .banner { padding: 10px 14px; font-size: 15px; }
/* Appliance remotes: big labelled keys */
.rk.labeled { grid-auto-flow: row; gap: 8px; align-content: center; font-weight: 700; font-size: 17px; }
.rk.labeled .ic { width: 32px; height: 32px; }
.single { display: grid; }
.single .rk.xl { min-height: 112px; }
.stack3 { display: grid; gap: 14px; margin-top: auto; }
.stack3 .rk.xl { min-height: 104px; }
.slider { display: grid; padding: 16px 18px; margin: 4px 0; }
.chips.modes { justify-content: center; }
.remote > .bigpair:first-child, .remote > .single:first-child { margin-top: auto; }
.remote > * + .bigpair, .remote > * + .single { margin-top: 0; }
.guess { margin: 2px 2px 0; color: var(--accent); font-weight: 600; min-height: 22px; }
details.adjust > summary { color: var(--muted); }
details.adjust[open] > summary { margin-bottom: 4px; }
.spinner { width: 34px; height: 34px; margin: 6px auto 4px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scanning-row { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; margin: 8px 0; }
.spinner.small { width: 20px; height: 20px; margin: 0; border-width: 2.5px; }
.kb-row { display: flex; gap: 10px; align-items: center; margin: 10px 0 4px; }
.kb-row input { flex: 1; font-size: 19px; min-height: 56px; }
.kb-mic { width: 56px; height: 56px; flex: none; }
.kb-mic.listening { background: var(--bad); color: #fff; box-shadow: 0 0 0 6px var(--bad-soft); }
.kb-status { min-height: 22px; color: var(--muted); }
.now { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0 0 12px; min-height: 56px; border-radius: 18px; }
.now-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.share-pick { cursor: pointer; }
.progress { height: 8px; border-radius: 999px; background: rgba(127, 127, 127, .2); overflow: hidden; margin: 6px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 200ms ease; }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.swatch { aspect-ratio: 1; min-height: 56px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); transition: transform 120ms ease; }
.swatch:active { transform: scale(.92); }
.bar-remote { display: grid; grid-template-columns: 1fr 96px 1fr; gap: 14px; align-items: center; margin-top: auto; }
.rocker.big .rk { min-height: 110px; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
input.warmth { background: linear-gradient(90deg, #ffa757, #fff4e8, #cfe0ff); border-radius: 999px; height: 10px; min-height: 10px; margin: 16px 0; appearance: none; -webkit-appearance: none; }
input.warmth::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
/* Light remote: brightness and warmth sit right under On/Off */
.remote > .bigpair:first-child { order: -2; }
.remote > .slider { order: -1; }
.badge.estimated { background: var(--accent-soft); color: var(--accent); opacity: .85; }
.bright-row { display: flex; align-items: center; gap: 12px; }
.bright-row input[type=range] { flex: 1; }
.pct { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text); }
.pct input { width: 78px; min-height: 46px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; padding: 8px; }
.batt-detail { margin: 2px 0 4px; font-weight: 650; font-variant-numeric: tabular-nums; }
.steps-list { padding-left: 20px; } .steps-list li { margin: 8px 0; }
.as-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pc-screen { display: grid; place-items: center; width: 100%; min-height: 120px; padding: 6px; border: 0; cursor: pointer; overflow: hidden; }
.pc-screen img { width: 100%; border-radius: 16px; display: block; }
/* Live PC screen: edge to edge, no tab bar */
[data-route="screen"] .tabbar, [data-route="camera"] .tabbar { display: none; }
[data-route="screen"] main, [data-route="camera"] main { max-width: none; padding: 0; }
.screen-wrap { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; }
#live { flex: 1; width: 100%; min-height: 0; object-fit: contain; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.screen-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-radius: 0; overflow-x: auto; }
.screen-kb { display: flex; gap: 8px; padding: 8px 12px; background: var(--solid); }
.screen-kb input { flex: 1; }
.pc-preview { position: relative; padding: 6px; overflow: hidden; }
.pc-preview img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 16px; display: block; }
.pc-full { position: absolute; right: 14px; bottom: 14px; }
#live { touch-action: none; }
/* PC temps / fans readout */
.sensors { padding: 14px; display: grid; gap: 10px; }
.sensors:empty { display: none; }
.sens-head { display: flex; justify-content: space-between; align-items: baseline; }
.gauge { display: grid; gap: 5px; }
.gauge .g-top { display: flex; justify-content: space-between; align-items: baseline; }
.g-bar { height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 28%, transparent); overflow: hidden; }
.g-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width .5s ease; }
.gauge.warm .g-bar i { background: var(--warn); }
.gauge.hot .g-bar i { background: var(--bad); }
.fanline { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.fanline svg { width: 16px; height: 16px; }
.fancard { padding: 14px; display: grid; gap: 10px; }
.fancard .sens-head svg { width: 18px; height: 18px; vertical-align: -3px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.bul { margin: 0 0 4px; padding-left: 20px; display: grid; gap: 6px; }
.bul li { line-height: 1.4; }
/* ---- Ask: living orb, aurora backdrop, glass chat */
:root { --g1: #4f7cff; --g2: #9b5cff; --g3: #ff4fa3; --g4: #ffb24f; --orb: conic-gradient(from 0deg, var(--g1), var(--g2), var(--g3), var(--g4), var(--g1)); }
@keyframes orb { to { transform: rotate(360deg); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(8vw, 6vh) scale(1.15); } 66% { transform: translate(-6vw, 3vh) scale(.9); } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes blink { 50% { opacity: .25; transform: translateY(-2px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(155, 92, 255, .55); } 100% { box-shadow: 0 0 0 18px rgba(155, 92, 255, 0); } }

/* center tab orb */
.tab-ask .orb { display: grid; place-items: center; width: 42px; height: 42px; margin-top: -3px; border-radius: 50%; color: #fff; position: relative; isolation: isolate; overflow: hidden;
  box-shadow: 0 8px 22px -6px rgba(140, 90, 255, .75), inset 0 1px 0 rgba(255, 255, 255, .55); }
.tab-ask .orb::before { content: ""; position: absolute; inset: -25%; z-index: -1; background: var(--orb); animation: orb 6s linear infinite; }
.tab-ask .orb .ic { width: 21px; height: 21px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.tabbar a.tab-ask[aria-current="page"] .orb::before { animation-duration: 2.5s; }
.tabbar a.tab-ask[aria-current="page"] { color: var(--text); }

/* page */
[data-route="ask"] main { padding-bottom: 200px; position: relative; }
[data-route="ask"] .tabbar::before { opacity: 0; }
.aurora { position: fixed; inset: 0; z-index: -1; pointer-events: none; --a: 34%;
  background: radial-gradient(70% 50% at 0% 0%, color-mix(in srgb, var(--g1) var(--a), transparent), transparent 70%),
    radial-gradient(60% 55% at 100% 45%, color-mix(in srgb, var(--g2) var(--a), transparent), transparent 70%),
    radial-gradient(70% 45% at 15% 100%, color-mix(in srgb, var(--g3) calc(var(--a) * .7), transparent), transparent 70%); }
.aurora span { display: none; }
[data-theme="dark"] .aurora { --a: 42%; }
.ask-top { display: flex; justify-content: flex-end; padding-top: 6px; margin-bottom: -24px; }
.iconbtn.glassy { background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.iconbtn.on { color: var(--g2); }

/* the orb */
.aorb { position: relative; border-radius: 50%; isolation: isolate; flex: none; }
.aorb i { position: absolute; inset: 0; border-radius: 50%; background: var(--orb); animation: orb 7s linear infinite; }
.aorb i + i { filter: blur(18px); opacity: .85; transform: scale(1.15); animation-direction: reverse; animation-duration: 11s; z-index: -1; }
.aorb b { position: absolute; inset: 9%; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .25) 22%, transparent 48%), radial-gradient(circle at 70% 78%, rgba(255, 255, 255, .25), transparent 45%);
  box-shadow: inset 0 -10px 24px rgba(40, 0, 90, .35); }
.aorb.big { width: 100px; height: 100px; margin: 0 auto 20px; animation: breathe 4.5s ease-in-out infinite; }
.aorb.mini { width: 26px; height: 26px; margin-top: 4px; }
.aorb.mini i + i { filter: blur(6px); }
.ask-hero { text-align: center; animation: rise 500ms cubic-bezier(.2, .8, .2, 1); }
.ask-hero h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 8px; }
.ask-hero p { color: var(--muted); max-width: 300px; margin: 0 auto 20px; line-height: 1.45; }

/* suggestion cards */
.ask-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ask-sugg { display: grid; gap: 4px; justify-items: start; align-content: start; text-align: left; padding: 14px; border: 0; border-radius: 22px; cursor: pointer; color: var(--text); font: inherit;
  background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line), 0 10px 30px -18px rgba(60, 40, 140, .5);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); animation: rise 520ms cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d); transition: transform 160ms ease; }
.ask-sugg:active { transform: scale(.96); }
.ask-sugg .sic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; margin-bottom: 4px; color: #fff;
  background: linear-gradient(135deg, var(--g1), var(--g2) 55%, var(--g3)); box-shadow: 0 6px 16px -6px rgba(155, 92, 255, .7); }
.ask-sugg .sic .ic { width: 20px; height: 20px; }
.ask-sugg b { font-size: 15.5px; line-height: 1.25; }
.ask-sugg small { color: var(--muted); font-size: 13px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.msg { display: flex; gap: 8px; align-items: flex-start; max-width: 90%; }
.msg.me { align-self: flex-end; }
.msg.new { animation: rise 320ms cubic-bezier(.2, .8, .2, 1); }
.bubble { padding: 12px 16px; border-radius: 22px; line-height: 1.45; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.msg.ai .bubble { background: var(--glass-strong); border-top-left-radius: 8px; box-shadow: inset 0 0 0 1px var(--line), 0 10px 28px -20px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); }
.msg.me .bubble { color: #fff; border-top-right-radius: 8px; background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 10px 24px -12px rgba(110, 80, 255, .8); }
.dots { display: inline-flex; gap: 5px; padding: 4px 0; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--g1), var(--g3)); animation: blink 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }

/* answer card */
.ask-card { margin-top: 12px; display: grid; gap: 10px; justify-items: start; padding: 14px; border-radius: 18px; background: rgba(127, 127, 127, .07); --tone: var(--g2); }
.ask-card.ok { --tone: #18a058; } .ask-card.info { --tone: var(--g1); } .ask-card.warn { --tone: #e08a00; } .ask-card.bad { --tone: #e0444b; }
.ask-status { display: flex; align-items: center; gap: 10px; color: var(--tone); font-size: 15px; }
.ask-status .ring { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in srgb, var(--tone) 16%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 8%, transparent); }
.ask-status .ring .ic { width: 17px; height: 17px; }
.ask-card p { margin: 0; }
.ask-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14.5px; }
.ask-steps li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.ask-steps li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12.5px; font-weight: 800; color: #fff; background: var(--tone); }
.ask-go { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; font-weight: 700; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 8px 20px -10px rgba(110, 80, 255, .9); }
.ask-go.soft { color: var(--text); background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line); }
.ask-go .ic { width: 18px; height: 18px; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.achip { flex: none; padding: 10px 16px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-weight: 650; font-size: 15px; color: var(--text);
  background: var(--glass-strong); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--g2) 35%, transparent); animation: rise 400ms both; }

/* input bar with glowing gradient edge */
.ask-bar { position: fixed; left: 14px; right: 14px; bottom: calc(88px + env(safe-area-inset-bottom)); max-width: 532px; margin: 0 auto; z-index: 39;
  display: flex; gap: 8px; align-items: center; padding: 7px; border-radius: 30px; border: 1.5px solid transparent;
  background: linear-gradient(var(--solid), var(--solid)) padding-box, linear-gradient(120deg, var(--g1), var(--g2), var(--g3), var(--g4)) border-box;
  box-shadow: 0 14px 40px -16px rgba(110, 80, 255, .6); }
.ask-bar input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 17px; padding: 10px 4px; color: inherit; outline: none; box-shadow: none; }
.ask-bar input::placeholder { color: var(--dim); }
.ask-bar .mic, .ask-bar .send { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; position: relative; isolation: isolate; overflow: hidden; color: #fff; }
.ask-bar .mic::before { content: ""; position: absolute; inset: -25%; z-index: -1; background: var(--orb); animation: orb 6s linear infinite; }
.ask-bar .mic.live { animation: pulse 1.1s ease-out infinite; }
.ask-bar .mic.live::before { animation-duration: 1s; }
.ask-bar .send { background: var(--text); color: var(--bg); width: 40px; height: 40px; transition: transform 160ms ease; }
.ask-bar .send:active, .ask-bar .mic:active { transform: scale(.92); }
@media (prefers-reduced-motion: reduce) { .aurora span, .aorb i, .aorb.big, .tab-ask .orb::before, .ask-bar .mic::before, .ask-sugg, .msg.new, .ask-hero, .achip { animation: none !important; } }
[data-solid="1"] .aurora { display: none; }


/* ---- whole-app glow + gradient accents */
body { background: transparent; }
.aurora { --a: 20%; }
[data-theme="dark"] .aurora { --a: 30%; }
[data-route="ask"] .aurora { --a: 34%; }
[data-theme="dark"][data-route="ask"] .aurora, [data-theme="dark"] [data-route="ask"] .aurora { --a: 42%; }
[data-route="screen"] .aurora, [data-route="camera"] .aurora { display: none; }
.btn.primary { background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; box-shadow: 0 10px 24px -12px rgba(110, 80, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .25); }
.dpad .d-ok, .dpad .d-ok:active, .dpad .d-ok.down { background: linear-gradient(135deg, var(--g1), var(--g2) 60%, var(--g3)); color: #fff; box-shadow: 0 12px 30px -10px rgba(140, 90, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .3); }
.tabbar::before { background: linear-gradient(135deg, color-mix(in srgb, var(--g1) 18%, transparent), color-mix(in srgb, var(--g2) 18%, transparent)); }
.tabbar a[aria-current="page"] { color: var(--g2); }
[data-theme="dark"] .tabbar a[aria-current="page"] { color: #b9a4ff; }
.ask-pill { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; margin: 4px 0 16px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 16px;
  border: 1.5px solid transparent; background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, linear-gradient(120deg, var(--g1), var(--g2), var(--g3), var(--g4)) border-box;
  box-shadow: 0 10px 30px -18px rgba(110, 80, 255, .7); }
.ask-pill span:nth-child(2) { flex: 1; }
.ask-pill .aorb.mini { width: 30px; height: 30px; margin: 0; }
.ask-pill > .ic { color: var(--g2); }
.scenes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
.scene { display: grid; justify-items: center; gap: 6px; padding: 14px 4px 12px; border: 0; border-radius: 22px; cursor: pointer; font: inherit; font-size: 13px; color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 12px 26px -16px rgba(60, 30, 140, .9), inset 0 1px 0 rgba(255, 255, 255, .3); transition: transform 160ms ease; }
.scene:active { transform: scale(.94); }
.scene .ic { width: 24px; height: 24px; }
.scene.s0 { background: linear-gradient(150deg, #3b3f9e, #7b4dff); }
.scene.s1 { background: linear-gradient(150deg, #ff4f8b, #ff9a4f); }
.scene.s2 { background: linear-gradient(150deg, #ffb84f, #ffd76a); color: #3a2400; }
.scene.s3 { background: linear-gradient(150deg, #2a2f3a, #555c6b); }
.scene.busy { opacity: .6; }

/* ---- Plus: plans, buy, redeem, owner keys */
.plus-status { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 22px; margin-bottom: 14px; background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line); }
.plus-status.on { background: linear-gradient(135deg, color-mix(in srgb, var(--g1) 20%, var(--glass-strong)), color-mix(in srgb, var(--g2) 22%, var(--glass-strong))); }
.plus-status div { display: grid; gap: 2px; } .plus-status span { color: var(--muted); font-size: 14px; }
.plus-status .aorb.mini { width: 34px; height: 34px; margin: 0; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { padding: 16px 14px; border-radius: 24px; }
.plan h2 { margin: 0; font-size: 18px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .plan h2 .pill { font-size: 11px; padding: 2px 8px; }
.plan .price { font-size: 28px; font-weight: 800; margin: 6px 0 10px; letter-spacing: -.02em; } .plan .price small { font-size: 14px; color: var(--muted); font-weight: 600; }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.3; }
.plan li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; color: var(--muted); } .plan li .ic { width: 16px; height: 16px; margin-top: 1px; }
.plan li.on { color: var(--text); } .plan li.on .ic { color: #18a058; }
.plan.pro { position: relative; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--g2) 55%, transparent), 0 16px 40px -22px rgba(110, 80, 255, .9); }
.plan.pro li .ic { color: var(--g2); }
.lockline { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; } .lockline .ic { width: 14px; height: 14px; }
.buy { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }
.buy-opt { position: relative; display: grid; gap: 2px; justify-items: center; padding: 16px 8px; border: 0; border-radius: 22px; cursor: pointer; font: inherit; color: #fff;
  background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 14px 30px -14px rgba(110, 80, 255, .9); }
.buy-opt.best { background: linear-gradient(135deg, var(--g2), var(--g3)); }
.buy-opt b { font-size: 22px; } .buy-opt span { font-size: 13px; opacity: .9; }
.buy-opt em { position: absolute; top: -9px; font-style: normal; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fff; color: #c13d8a; box-shadow: 0 4px 10px -4px rgba(0,0,0,.3); }
.buy-opt:disabled { opacity: .45; cursor: not-allowed; }
.redeem { padding: 14px; border-radius: 22px; margin: 14px 0; display: grid; gap: 8px; } .redeem label { font-weight: 700; }
.redeem input { flex: 1; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em; text-transform: uppercase; }
.owner summary { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; cursor: pointer; list-style: none; } .owner summary b { display: flex; align-items: center; gap: 8px; }
.keys-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; } .keys-form .wide { grid-column: 1 / -1; }
.fresh-keys { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: color-mix(in srgb, var(--g2) 12%, transparent); margin-bottom: 12px; }
.keyrow { display: flex; gap: 8px; align-items: center; } .keyrow code { flex: 1; font-size: 15px; padding: 8px 10px; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }
.keylist .li { gap: 8px; }
.lock-over { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; color: #fff; font-weight: 800; font-size: 18px; text-decoration: none;
  background: rgba(10, 8, 30, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); z-index: 5; border-radius: inherit; }
.lock-over span { font-weight: 600; font-size: 14px; opacity: .8; }

/* ==== Monochrome: sleek black & white. White theme = black accents, Black theme = white accents. ==== */
:root, [data-theme="light"] { --g1: #0a0a0a; --g2: #000; --g3: #3a3a3c; --g4: #6e6e73; --on-g: #fff; --accent: #000; --accent-soft: rgba(0, 0, 0, .07);
  --orb: conic-gradient(from 0deg, #000, #3a3a3c, #c7c7cc, #3a3a3c, #000); --lift: 0 12px 28px -16px rgba(0, 0, 0, .45); }
[data-theme="dark"] { --g1: #fff; --g2: #fff; --g3: #d1d1d6; --g4: #8e8e93; --on-g: #000; --accent: #fff; --accent-soft: rgba(255, 255, 255, .1);
  --orb: conic-gradient(from 0deg, #fff, #8e8e93, #2c2c2e, #8e8e93, #fff); --lift: 0 12px 28px -16px rgba(0, 0, 0, .9); }
.aurora { display: none; }
.btn.primary, .ask-go, .buy-opt, .buy-opt.best, .msg.me .bubble, .dpad .d-ok, .dpad .d-ok:active, .dpad .d-ok.down, .ask-sugg .sic, .ask-steps li::before {
  background: var(--g2); color: var(--on-g); box-shadow: var(--lift); }
.ask-go.soft { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.tab-ask .orb, .ask-bar .mic { color: var(--on-g); box-shadow: var(--lift); }
.tab-ask .orb .ic { filter: none; }
.ask-bar, .ask-pill { background: linear-gradient(var(--solid), var(--solid)) padding-box, linear-gradient(var(--line), var(--line)) border-box; border-color: transparent; box-shadow: var(--lift); }
.ask-bar .send { background: var(--g2); color: var(--on-g); }
.ask-pill > .ic, .iconbtn.on, .tabbar a[aria-current="page"], [data-theme="dark"] .tabbar a[aria-current="page"], .plan.pro li .ic { color: var(--text); }
.tabbar::before { background: var(--accent-soft); }
.scene, .scene.s0, .scene.s1, .scene.s2, .scene.s3 { background: var(--g2); color: var(--on-g); box-shadow: var(--lift); }
.scene.s1 { background: var(--g3); } .scene.s2 { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); } .scene.s3 { background: var(--g4); }
[data-theme="dark"] .scene.s1, [data-theme="dark"] .scene.s3 { color: #000; }
.plus-status.on { background: var(--glass-strong); box-shadow: inset 0 0 0 1.5px var(--text); }
.plan.pro { box-shadow: inset 0 0 0 1.5px var(--text), var(--lift); }
.buy-opt em { background: var(--on-g); color: var(--g2); }
.buy-opt.best { box-shadow: inset 0 0 0 2px var(--on-g), var(--lift); }
.achip { box-shadow: inset 0 0 0 1px var(--line); }
.ask-card { --tone: var(--text); } .ask-card.ok { --tone: #1f9d55; } .ask-card.bad { --tone: #d92d20; } .ask-card.warn { --tone: #b26b00; } .ask-card.info { --tone: var(--text); }
.ask-card.info .ask-status .ring { color: var(--text); }
.ask-steps li::before { background: var(--tone); color: var(--solid); box-shadow: none; }
.pill.info { background: var(--accent-soft); color: var(--text); }
.dots i { background: var(--muted); }
.fresh-keys { background: var(--accent-soft); }
.aorb i + i { opacity: .55; }
:root, [data-theme="light"] { --bg: #f2f2f2; --amb-1: rgba(255, 255, 255, .9); --amb-2: rgba(0, 0, 0, .03); --amb-3: rgba(255, 255, 255, .6); }
[data-theme="dark"] { --bg: #000; --amb-1: rgba(255, 255, 255, .06); --amb-2: rgba(255, 255, 255, .03); --amb-3: rgba(255, 255, 255, .02); }
.aorb b { box-shadow: inset 0 -8px 20px rgba(0, 0, 0, .35); }

/* ---- account screen */
[data-route="auth"] .tabbar { display: none; }
.auth { min-height: 88dvh; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 12px; max-width: 400px; margin: 0 auto; padding: 20px 4px; }
.auth h1 { margin: 0; font-size: 32px; letter-spacing: -.02em; } .auth > p { margin: 0 0 8px; }
.auth .aorb.big { margin: 0 auto 14px; width: 86px; height: 86px; }
.auth-seg { display: grid; grid-template-columns: 1fr 1fr; }
.auth-form { display: grid; gap: 12px; text-align: left; margin-top: 6px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; padding: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth-seg button[aria-pressed="true"] { color: var(--text); font-weight: 700; }

/* ---- Free vs Plus table */
.compare { border-radius: 22px; padding: 6px 4px; margin-bottom: 4px; }
.crow { display: grid; grid-template-columns: 1fr 74px 92px; gap: 8px; align-items: center; padding: 11px 12px; font-size: 14px; border-top: 1px solid var(--line); }
.crow:first-child { border-top: 0; }
.crow.head { font-weight: 800; font-size: 15px; } .crow span:nth-child(n+2) { text-align: center; }
.crow .no { color: var(--muted); }
.crow .pro { font-weight: 700; }
.crow.head .pro { background: var(--g2); color: var(--on-g); border-radius: 999px; padding: 4px 0; }
.scene.locked { opacity: .55; }
.scene.locked::after { content: "PLUS"; position: absolute; top: 6px; right: 8px; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.rk.labeled.sm { flex-direction: column; gap: 2px; font-size: 12px; font-weight: 700; } .rk.labeled.sm .ic { width: 20px; height: 20px; }
[data-route="reset"] .tabbar { display: none; }
/* PC camera view */
.cam-wrap #cam { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
.cam-wait { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); text-align: center; color: var(--muted); font-size: 15px; }
.cam-live { flex: 1; display: inline-flex; align-items: center; gap: 6px; justify-content: center; font-weight: 650; font-size: 14px; }
.cam-live .ic { width: 18px; height: 18px; color: #e0444b; }
