/* Soul portal, shared design system (evondev ui-ux skill, brand kept by colour ROLE).
   Porcelain paper, ink, ONE cobalt accent (the wheel rims), the stage gradient behind the robot,
   Be Vietnam Pro. The eye blue #7fc8ff appears only inside the robot's face screen.
   Shape: hairline cards without shadow, radius by height (controls >= 40px -> 12px, cards 16px),
   44px targets, shadow only on floating layers (menus, dialogs, sheets, the settings save bar).
   Every page links this file first; its own css keeps only page-specific rules.
   The brand tokens live HERE and nowhere else. */

/* ===== BRAND TOKENS (the only place; change the accent in both blocks) ===== */
:root {
  --paper: #eef1f4;
  --paper-2: #e3e8ed;
  --surface: #fbfcfd;
  --surface-overlay: #fbfcfd;                                 /* menus */
  --ink: #111a22;
  --muted: #5a6672;
  --line: #d6dde3;                                            /* controls: inputs, outline buttons */
  --hairline: color-mix(in srgb, var(--line) 55%, var(--surface)); /* card edges and dividers */
  --accent: #2b5bd7;
  --accent-hover: color-mix(in oklab, var(--accent) 88%, var(--surface));
  --accent-ink: #f7f9ff;
  --accent-soft: #dfe7fb;
  --ring: color-mix(in srgb, var(--accent) 16%, transparent);
  --success: #1f9d63;                                         /* live state: online, moving */
  --danger: #b4321f;
  --danger-line: #d0503c;                                     /* invalid input edge */
  --danger-ring: color-mix(in srgb, #bf3b2c 12%, transparent);
  --danger-bg: color-mix(in srgb, #bf3b2c 10%, transparent);
  --danger-bg-hover: color-mix(in srgb, #bf3b2c 16%, transparent);
  --hover: color-mix(in srgb, var(--ink) 5%, transparent);
  --secondary: color-mix(in srgb, var(--ink) 6%, var(--surface));
  --secondary-hover: color-mix(in srgb, var(--ink) 10%, var(--surface));
  --track-off: color-mix(in srgb, var(--muted) 45%, var(--surface)); /* switch off */
  --stage: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #e7ecf1 55%, #d9e0e7 100%);
  --floor: rgba(17, 26, 34, 0.22);
  --scrim: rgb(17 26 34 / 0.4);
  --segment-track: inset 0 0 0 1px rgb(17 26 34 / 0.05), inset 0 1px 2px rgb(17 26 34 / 0.04);
  --segment-thumb: 0 0 0 1px rgb(17 26 34 / 0.04), 0 1px 2px rgb(17 26 34 / 0.06), 0 2px 6px -2px rgb(17 26 34 / 0.08);
  --elevation-float: 0 10px 15px -3px rgb(17 26 34 / 0.1), 0 4px 6px -4px rgb(17 26 34 / 0.1);
  --elevation-modal: 0 20px 25px -5px rgb(17 26 34 / 0.12), 0 8px 10px -6px rgb(17 26 34 / 0.1);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sheet-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "Be Vietnam Pro", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --paper: #0d1318;
    --paper-2: #121a20;
    --surface: #151d24;
    --surface-overlay: #1a232b;
    --ink: #e6ecf1;
    --muted: #94a1ac;
    --line: #2c3943;
    --hairline: #222c35;
    --accent: #7c9fff;
    --accent-ink: #0b1221;
    --accent-soft: #1b2843;
    --success: #4fd18f;
    --danger: #ff8f80;
    --danger-line: #e0705f;
    --danger-ring: color-mix(in srgb, #ff8f80 16%, transparent);
    --danger-bg: color-mix(in srgb, #ff8f80 12%, transparent);
    --danger-bg-hover: color-mix(in srgb, #ff8f80 18%, transparent);
    --hover: color-mix(in srgb, #ffffff 6%, transparent);
    --secondary: color-mix(in srgb, #ffffff 7%, var(--surface));
    --secondary-hover: color-mix(in srgb, #ffffff 11%, var(--surface));
    --track-off: #3a4853;
    --stage: radial-gradient(120% 90% at 50% 0%, #26323c 0%, #18212a 55%, #121a20 100%);
    --floor: rgba(0, 0, 0, 0.55);
    --scrim: rgb(0 0 0 / 0.6);
    --segment-track: inset 0 0 0 1px var(--hairline), inset 0 1px 2px rgb(0 0 0 / 0.4);
    --segment-thumb: 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / 0.06), 0 1px 2px rgb(0 0 0 / 0.5);
    --elevation-float: 0 10px 24px -4px rgb(0 0 0 / 0.55), 0 0 0 1px rgb(255 255 255 / 0.04);
    --elevation-modal: 0 20px 32px -6px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.04);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1318;
    --paper-2: #121a20;
    --surface: #151d24;
    --surface-overlay: #1a232b;
    --ink: #e6ecf1;
    --muted: #94a1ac;
    --line: #2c3943;
    --hairline: #222c35;
    --accent: #7c9fff;
    --accent-ink: #0b1221;
    --accent-soft: #1b2843;
    --success: #4fd18f;
    --danger: #ff8f80;
    --danger-line: #e0705f;
    --danger-ring: color-mix(in srgb, #ff8f80 16%, transparent);
    --danger-bg: color-mix(in srgb, #ff8f80 12%, transparent);
    --danger-bg-hover: color-mix(in srgb, #ff8f80 18%, transparent);
    --hover: color-mix(in srgb, #ffffff 6%, transparent);
    --secondary: color-mix(in srgb, #ffffff 7%, var(--surface));
    --secondary-hover: color-mix(in srgb, #ffffff 11%, var(--surface));
    --track-off: #3a4853;
    --stage: radial-gradient(120% 90% at 50% 0%, #26323c 0%, #18212a 55%, #121a20 100%);
    --floor: rgba(0, 0, 0, 0.55);
    --scrim: rgb(0 0 0 / 0.6);
    --segment-track: inset 0 0 0 1px var(--hairline), inset 0 1px 2px rgb(0 0 0 / 0.4);
    --segment-thumb: 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / 0.06), 0 1px 2px rgb(0 0 0 / 0.5);
    --elevation-float: 0 10px 24px -4px rgb(0 0 0 / 0.55), 0 0 0 1px rgb(255 255 255 / 0.04);
    --elevation-modal: 0 20px 32px -6px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.04);
    color-scheme: dark;
}
/* ================================================================================== */

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 400 14px/1.5 var(--font); -webkit-tap-highlight-color: transparent;
}
h1, h2, p, ul, ol { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
.icon { width: 20px; height: 20px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Keyboard focus stays visible on every control (project rule, over the skill's "no ring").
   Text fields show focus with their accent border + ring instead of a second outline. */
:focus-visible { outline: 2px solid var(--accent) !important; outline-offset: 2px; }
.input:focus-visible, .field input:focus-visible, textarea:focus-visible { outline: none !important; }

@keyframes spin { to { rotate: 360deg; } }

/* ---------- buttons: outline (default), primary (one per page), secondary, danger tint, icon ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 1.2; text-align: center; text-decoration: none;
  cursor: pointer; touch-action: manipulation;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn .icon { width: 16px; height: 16px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--secondary); color: var(--ink); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-icon {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border-radius: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn-icon.btn-outline { border: 1px solid var(--line); background: var(--surface); }
.btn-icon[aria-expanded="true"] { background: var(--hover); }
@media (hover: hover) {
  /* Touch screens keep :hover after a tap, which would leave the button looking pressed. */
  .btn-outline:not([disabled]):hover { background: var(--paper); }
  .btn-primary:not([disabled]):hover { background: var(--accent-hover); }
  .btn-secondary:not([disabled]):hover { background: var(--secondary-hover); }
  .btn-danger:not([disabled]):hover { background: var(--danger-bg-hover); }
  .btn-icon:hover { background: var(--hover); }
  .btn-icon.btn-outline:hover { background: var(--paper); }
}
/* Busy: the label keeps the button's width and focus, a spinner sits on top of it. */
.btn[aria-busy="true"] { color: transparent !important; cursor: progress; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid var(--busy, var(--accent-ink)); border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.btn-outline[aria-busy="true"], .btn-secondary[aria-busy="true"] { --busy: var(--ink); }
.btn-danger[aria-busy="true"] { --busy: var(--danger); }

/* ---------- brand: the robot's dark face screen with two eye-blue eyes ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; min-height: 44px; }
.brand-mark {
  display: inline-block; flex: none; width: 32px; height: 24px;
  background: url("/assets/logo-mark.svg?v=02e742fbdf83") center / contain no-repeat;
}

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(1120px, 100%); margin: 0 auto; padding: 8px 16px;
}

/* ---------- app header: shared by the signed-in home and games ---------- */
.top.app .avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 14px; font-weight: 600; object-fit: cover; overflow: hidden;
}

/* The avatar opens the account page; keep it a proper touch target. */
.top.app .avatar-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: 999px; }
.top.app .avatar-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top.app .brand { text-decoration: none; }
.top.app .brand-logo { display: block; width: 32px; height: 32px; flex: none; object-fit: contain; }

/* Keep navigation and account actions in separate groups. */
.top.app .top-inner { width: min(1360px, 100%); gap: 24px; }
.top.app .home-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.top.app .home-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; white-space: nowrap; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.top.app .home-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.top.app .me { display: flex; align-items: center; border-left: 1px solid var(--line); padding-left: 16px; gap: 12px; }
.top.app .avatar-link { gap: 8px; color: var(--ink); text-decoration: none; }
/* Keep a filled avatar circle until account data arrives. */
.top.app .avatar-link:has(> #avatar:not([hidden]), > #initial:not([hidden])) > .avatar-placeholder { display: none; }
.top.app .account-label { font-size: 14px; font-weight: 500; }
/* Preserve target widths when the active label becomes bold. */
.top.app .home-nav a:first-child { width: 124px; }
.top.app .home-nav a:last-child { width: 112px; }
@media (max-width: 719px) {
  .top.app .top-inner { flex-wrap: wrap; gap: 4px 12px; }
  .top.app .home-nav { order: 3; width: 100%; margin: 0; border-top: 1px solid var(--line); padding-top: 4px; }
  .top.app .home-nav a { flex: 1; width: auto; justify-content: center; }
  .top.app .me { margin-left: auto; border-left: 0; padding-left: 0; gap: 4px; }
  .top.app .account-label { display: none; }
}

.top.app .home-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

/* ---------- page, page head, two-column layout ---------- */
.page { width: min(1120px, 100%); margin: 0 auto; padding: 4px 16px calc(40px + env(safe-area-inset-bottom)); }
.page-head { display: grid; gap: 4px; margin-bottom: 20px; }
.page-head h1 { font-size: 20px; line-height: 1.3; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
.page-head p { color: var(--muted); max-width: 60ch; text-wrap: pretty; }
.layout { display: grid; gap: 12px; }
.col-main { display: grid; gap: 12px; min-width: 0; align-content: start; }
@media (min-width: 640px) {
  .page, .top-inner { padding-left: 24px; padding-right: 24px; }
}
@media (min-width: 1024px) {
  .layout { grid-template-columns: 420px minmax(0, 1fr); gap: 24px; align-items: start; }
  .col-main { gap: 16px; }
}

/* ---------- card: hairline, no shadow ---------- */
.card {
  margin: 0; min-width: 0; padding: 16px; border-radius: 16px;
  border: 1px solid var(--hairline); background: var(--surface);
  display: grid; gap: 12px; align-content: start;
}
@media (min-width: 640px) { .card { padding: 20px; } }
.card-title { display: block; font-size: 16px; line-height: 1.4; font-weight: 600; text-wrap: balance; }
.card-desc { color: var(--muted); max-width: 60ch; }
.field-label { font-size: 14px; font-weight: 500; }
.hint { color: var(--muted); font-size: 12px; }
.count { justify-self: end; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- rows in one frame, divided by hairlines (list-row.md) ---------- */
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.rows > * + * { border-top: 1px solid var(--hairline); }
.row-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--paper); color: var(--accent);
}
.row-text { display: grid; flex: 1; min-width: 0; }
.row-text b { font-weight: 500; }
.row-text small { color: var(--muted); font-size: 14px; }

/* ---------- inputs (input.md): surface fill, 12px radius, accent border + ring on focus ---------- */
.field { display: grid; gap: 6px; }
.field label { justify-self: start; font-weight: 500; cursor: pointer; }
.input, .field input, textarea {
  display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; /* 16px: iOS does not zoom on focus */
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input, .field input { height: 44px; padding: 0 14px; }
textarea { min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.input::placeholder, .field input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.input:focus, .field input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.input[aria-invalid="true"], .field input[aria-invalid="true"] { border-color: var(--danger-line); }
.input[aria-invalid="true"]:focus, .field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 2px var(--danger-ring); }
/* The note line under a field keeps its height, so fields below do not jump when an error comes and goes. */
.note { min-height: 18px; font-size: 12px; line-height: 18px; }
.note .hint { color: var(--muted); }
.field .error, .note .error { color: var(--danger); font-weight: 500; }
.field .error:empty { display: none; }

/* ---------- segmented tabs (small-controls.md): sunken track, raised thumb that slides ---------- */
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border-radius: 12px; background: var(--paper-2); box-shadow: var(--segment-track);
}
.segmented::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 6px);
  border-radius: 8px; background: var(--surface); box-shadow: var(--segment-thumb);
  transition: translate 0.25s var(--ease);
}
.segmented:has(> :last-child[aria-selected="true"])::before { translate: calc(100% + 4px) 0; }
.segmented button {
  position: relative; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  font-weight: 500; color: color-mix(in srgb, var(--ink) 60%, transparent); cursor: pointer; touch-action: manipulation;
  transition: color 0.15s var(--ease);
}
.segmented button:hover, .segmented button[aria-selected="true"] { color: var(--ink); }

/* ---------- messages: error banner (banner.md, error tone, no close) and status line ---------- */
.alert {
  padding: 12px 14px; border-radius: 12px; background: var(--danger-bg); color: var(--danger);
  font-weight: 500; text-wrap: pretty; overflow-wrap: anywhere;
}
.page-error { width: min(720px, calc(100% - 32px)); margin: 16px auto; }
.status { color: var(--muted); font-size: 12px; }
.status:empty { display: none; }

/* ---------- menu: floating layer that grows from its button (closed menus stay in the DOM, inert) ---------- */
.menu {
  position: absolute; z-index: 5; min-width: 208px; padding: 4px 0; border-radius: 16px;
  border: 1px solid var(--hairline); background: var(--surface-overlay); box-shadow: var(--elevation-float);
  opacity: 0; scale: 0.95; visibility: hidden;
  transition: opacity 0.1s ease-in, scale 0.1s ease-in, visibility 0s linear 0.1s;
}
.menu.open {
  opacity: 1; scale: 1; translate: 0 0; visibility: visible;
  transition: opacity 0.15s ease-out, scale 0.15s ease-out, translate 0.15s ease-out;
}
.menu-up { right: 8px; bottom: 60px; transform-origin: bottom right; }      /* opens above its button */
.menu-down { right: 0; top: calc(100% + 4px); transform-origin: top right; } /* opens below its button */
@starting-style {
  .menu-up.open { opacity: 0; scale: 0.95; translate: 0 4px; }
  .menu-down.open { opacity: 0; scale: 0.95; translate: 0 -4px; }
}
.menu-group { margin: 0; padding: 0 4px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; outline-offset: -2px;
}
.menu-item .icon { width: 18px; height: 18px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
/* Dangerous items look like the rest until pointed at (I4). */
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger-bg); color: var(--danger); }
.menu-item.danger:hover .icon, .menu-item.danger:focus-visible .icon { color: var(--danger); }
.menu-sep { margin: 4px 0; border: 0; border-top: 1px solid var(--hairline); }

/* ---------- dialogs: confirm (centred, overlay.md) and sheet (bottom sheet on phones, dialog from 640px) ---------- */
dialog { color: var(--ink); }
dialog::backdrop { background: var(--scrim); }
dialog.confirm {
  width: min(448px, calc(100vw - 32px)); max-width: none; padding: 24px; border-radius: 16px;
  border: 1px solid var(--hairline); background: var(--surface); box-shadow: var(--elevation-modal);
}
.confirm-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 16px; }
.confirm-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: var(--danger-bg); color: var(--danger);
}
dialog h2 { font-size: 18px; line-height: 1.4; font-weight: 600; }
.confirm-grid p { grid-column: 1 / -1; margin-top: 8px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.confirm-grid p b { font-weight: 500; color: var(--ink); }
/* Footer: stacked full width on phones (main action on top), right-aligned from 640px. */
.dialog-actions { display: flex; flex-direction: column-reverse; gap: 8px; }
dialog.confirm .dialog-actions { margin-top: 24px; }
@media (min-width: 640px) {
  .confirm-grid p { grid-column: 2; margin-top: 2px; }
  .dialog-actions { flex-direction: row; justify-content: flex-end; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.confirm[open] { animation: pop 0.15s ease-out; }
  @keyframes pop { from { opacity: 0; scale: 0.95; } }
}

dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 440px; max-height: calc(100dvh - 24px); padding: 0;
  border: 1px solid var(--hairline); border-bottom: 0; border-radius: 16px 16px 0 0;
  background: var(--surface); box-shadow: var(--elevation-modal);
  translate: 0 100%;
  transition: translate 0.35s var(--sheet-ease), display 0.35s allow-discrete, overlay 0.35s allow-discrete;
}
dialog.sheet[open] { translate: 0 0; transition-duration: 0.5s; }
@starting-style { dialog.sheet[open] { translate: 0 100%; } }
dialog.sheet::backdrop {
  background: transparent;
  transition: background-color 0.35s var(--sheet-ease), display 0.35s allow-discrete, overlay 0.35s allow-discrete;
}
dialog.sheet[open]::backdrop { background: var(--scrim); transition-duration: 0.5s; }
@starting-style { dialog.sheet[open]::backdrop { background: transparent; } }
@media (min-width: 640px) {
  dialog.sheet {
    margin: auto; border-bottom: 1px solid var(--hairline); border-radius: 16px;
    translate: none; opacity: 0; scale: 0.95;
    transition: opacity 0.1s ease-in, scale 0.1s ease-in, display 0.1s allow-discrete, overlay 0.1s allow-discrete;
  }
  dialog.sheet[open] { translate: none; opacity: 1; scale: 1; transition: opacity 0.15s ease-out, scale 0.15s ease-out, display 0.15s allow-discrete, overlay 0.15s allow-discrete; }
  @starting-style { dialog.sheet[open] { opacity: 0; scale: 0.95; } }
  dialog.sheet::backdrop { transition-duration: 0.1s; }
  dialog.sheet[open]::backdrop { transition-duration: 0.15s; }
}
.sheet form { display: grid; gap: 16px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .sheet form { padding: 24px; } }
.sheet .dialog-actions { margin-top: 4px; }
.grabber { justify-self: center; width: 36px; height: 4px; border-radius: 999px; background: var(--line); }
@media (min-width: 640px) { .grabber { display: none; } }

/* ---------- robot figure (robot-figure.js): product shot with live eyes ---------- */
.robot-fig { position: relative; width: 100%; }
.robot-fig::after { /* contact shadow on the desk */
  content: ""; position: absolute; left: 12%; right: 10%; bottom: -3%; height: 10%; z-index: -1;
  background: radial-gradient(closest-side, var(--floor), transparent); filter: blur(2px);
}
.robot-fig__inner { position: absolute; left: 0; top: 0; transform: scale(var(--s, 0)); transform-origin: 0 0; }
.robot-fig__inner img { display: block; width: 100%; height: 100%; }
.robot-fig__face { position: absolute; left: 0; top: 0; width: 320px; height: 240px; transform-origin: 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .robot-fig.idle .robot-fig__inner { animation: hover 5s var(--ease) infinite; }
  @keyframes hover { 50% { translate: 0 -1.2%; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- switch (shared: tools rows, robot settings) ---------- */
.switch-hit { flex: none; display: grid; place-items: center; width: 52px; height: 44px; cursor: pointer; }
.switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 44px; height: 24px; margin: 0;
  border-radius: 999px; background: var(--track-off); cursor: pointer; outline: none;
  transition: background-color 0.2s var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 999px;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: translate 0.2s var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { translate: 20px 0; }
.switch:disabled { opacity: 0.5; cursor: progress; }

/* ---------- option cards (shared: robot settings, account settings) ---------- */
.options { display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 12px 8px 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.option:hover { background: color-mix(in srgb, var(--ink) 2.5%, var(--surface)); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--ring); }
.option-text { display: grid; flex: 1; min-width: 0; }
.option-text b { font-weight: 500; }
.option-text small { color: var(--muted); font-size: 14px; }
.option:has(input:checked) .option-text small { color: color-mix(in srgb, var(--ink) 72%, transparent); }

/* ---------- save bar (shared: robot settings, account settings) ---------- */
.savebar {
  position: fixed; z-index: 20; left: 50%; translate: -50% 0; bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(1072px, calc(100vw - 24px)); padding: 8px 8px 8px 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--elevation-float);
}
@media (min-width: 640px) { .savebar { width: min(1072px, calc(100vw - 48px)); } }
.save-state { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-weight: 500; }
.dirty-dot { flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--line); transition: background-color 0.15s var(--ease); }
.savebar:has(#save:not([disabled])) .dirty-dot { background: var(--accent); }
.savebar:has(#save:not([disabled])) .save-state { color: var(--ink); }
