/* Mishi & Buddy — design system 2.1
   Liquid-glass controls (translucent, blurred, specular rim) over a soft
   ambient backdrop. Light and dark share one token set. */

@font-face { font-family: Montserrat; src: url('/assets/fonts/Montserrat-Regular.ttf'); font-weight: 400; font-display: swap; }
@font-face { font-family: Montserrat; src: url('/assets/fonts/Montserrat-SemiBold.ttf'); font-weight: 600; font-display: swap; }
@font-face { font-family: Montserrat; src: url('/assets/fonts/Montserrat_700Bold.ttf'); font-weight: 700; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --ink: #0c254b;
  --ink-soft: #3a4f6e;
  --muted: #66758a;
  --accent: #1b9aa3;
  --accent-ink: #116d74;
  --paper: #f7f5f0;
  --ambient-a: #c9f0ee;
  --ambient-b: #ffe6b5;
  --ambient-c: #e4ecff;

  /* glass */
  --glass-fill: linear-gradient(180deg, #ffffffb8 0%, #ffffff6b 100%);
  --glass-fill-strong: linear-gradient(180deg, #ffffffe0 0%, #ffffffa6 100%);
  --glass-border: #ffffffcc;
  --glass-edge: #0c254b14;
  --glass-highlight: #ffffff;
  --glass-shadow: 0 1px 1px #0c254b0d, 0 8px 24px #0c254b14, 0 24px 60px #0c254b0f;
  --glass-blur: blur(22px) saturate(180%);
  --inset-fill: #ffffff80;
  --inset-border: #0c254b12;

  /* tinted controls */
  --primary-fill: linear-gradient(180deg, #ffd56b 0%, #ffbe33 100%);
  --primary-ink: #3b2600;
  --primary-glow: 0 6px 18px #ffb2264d;
  --danger-fill: linear-gradient(180deg, #ff8a7a 0%, #f2604c 100%);
  --danger-ink: #ffffff;
  --selected-surface: linear-gradient(180deg, #ffffff 0%, #f3fbfb 100%);

  --pet-backdrop: radial-gradient(circle at 50% 38%, #ffffff 0%, #eaf8fb 55%, #d6eff5 100%);
  --pet-backdrop-shadow: 0 30px 70px #2c6a7a24, inset 0 0 0 1px #ffffffcc, inset 0 -18px 40px #b7dfe81f;
  --pet-floor: #0c254b2e;
  --voice-listen: #1fb5bf;
  --voice-speak: #ffb72e;
  --dot-idle: #9fb8a6;
  --focus: #1fb5bf;
  --radius-pill: 999px;
}

body[data-theme='dark'] {
  color-scheme: dark;
  --ink: #f2f5f9;
  --ink-soft: #c6d0dc;
  --muted: #8e9aab;
  --accent: #5fd4d9;
  --accent-ink: #8fe6e9;
  --paper: #0b0e13;
  --ambient-a: #0f3b40;
  --ambient-b: #3a2a0e;
  --ambient-c: #16203a;

  --glass-fill: linear-gradient(180deg, #ffffff1f 0%, #ffffff0a 100%);
  --glass-fill-strong: linear-gradient(180deg, #2a313cf0 0%, #1b2029eb 100%);
  --glass-border: #ffffff26;
  --glass-edge: #00000066;
  --glass-highlight: #ffffff40;
  --glass-shadow: 0 1px 1px #0006, 0 10px 30px #0008, 0 30px 70px #0006;
  --inset-fill: #ffffff0d;
  --inset-border: #ffffff14;

  --primary-fill: linear-gradient(180deg, #ffd06a 0%, #f2ad25 100%);
  --primary-ink: #2a1a00;
  --primary-glow: 0 6px 22px #f2ad2540;
  --danger-fill: linear-gradient(180deg, #ff7b6b 0%, #d9493a 100%);
  --selected-surface: linear-gradient(180deg, #ffffff2e 0%, #ffffff14 100%);

  --pet-backdrop: radial-gradient(circle at 50% 36%, #22414a 0%, #15262f 52%, #0d161d 100%);
  --pet-backdrop-shadow: 0 34px 80px #000a, inset 0 1px 0 #ffffff1f, inset 0 0 0 1px #ffffff12, inset 0 -30px 60px #00000040;
  --pet-floor: #00000070;
  --voice-listen: #5fd4d9;
  --voice-speak: #ffc24d;
  --dot-idle: #6f8b7c;
  --focus: #5fd4d9;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--paper); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(60vmax 50vmax at 8% 0%, var(--ambient-a) 0%, transparent 60%),
    radial-gradient(55vmax 45vmax at 100% 100%, var(--ambient-b) 0%, transparent 62%),
    radial-gradient(50vmax 40vmax at 90% 8%, var(--ambient-c) 0%, transparent 60%),
    var(--paper);
  background-attachment: fixed;
  font-family: Montserrat, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .3s ease;
}

button, select, textarea, input { color: inherit; font: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: var(--accent-ink); }

/* ---------- Liquid glass ---------- */
.glass {
  position: relative;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

.glass-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  box-shadow: 0 1px 2px #0c254b14, 0 4px 14px #0c254b12, inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .005em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, filter .2s ease, opacity .2s ease;
}

/* specular sheen across the top half */
.glass-button::before {
  content: "";
  position: absolute;
  inset: 1px 1px 50% 1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, #ffffff66 0%, #ffffff00 100%);
  pointer-events: none;
}
body[data-theme='dark'] .glass-button::before { background: linear-gradient(180deg, #ffffff1f 0%, #ffffff00 100%); }

.glass-button:hover:not(:disabled) { filter: brightness(1.04); box-shadow: 0 2px 4px #0c254b14, 0 8px 22px #0c254b1c, inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 var(--glass-edge); }
.glass-button:active:not(:disabled) { transform: scale(.965); }
.glass-button:disabled { opacity: .55; filter: saturate(.5); }

.glass-button.primary { background: var(--primary-fill); color: var(--primary-ink); border-color: #ffffff8c; box-shadow: var(--primary-glow), inset 0 1px 0 #ffffffb3, inset 0 -2px 0 #0000001a; }
.glass-button.danger { background: var(--danger-fill); color: var(--danger-ink); border-color: #ffffff59; box-shadow: 0 6px 18px #e2513d40, inset 0 1px 0 #ffffff80, inset 0 -2px 0 #0000001f; }
.glass-button.round { width: 52px; min-width: 52px; padding: 0; }
.glass-button.wide { width: 100%; }
.glass-button[aria-pressed='true']:not(.primary):not(.danger) { background: linear-gradient(180deg, var(--accent) 0%, var(--accent-ink) 100%); color: #fff; border-color: #ffffff59; }
body[data-theme='dark'] .glass-button[aria-pressed='true']:not(.primary):not(.danger) { color: #06262a; }

.button-icon { flex: 0 0 auto; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#mute .icon-mic-off, #mute[aria-pressed='true'] .icon-mic { display: none; }
#mute[aria-pressed='true'] .icon-mic-off { display: block; }

/* ---------- Splash ---------- */
.logo-splash { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; overflow: hidden; background: var(--paper); cursor: pointer; opacity: 1; transition: opacity 280ms ease; }
html[data-logo-splash='seen'] .logo-splash:not(.is-visible), .logo-splash[hidden] { display: none; }
.logo-splash.is-visible { display: grid; }
.logo-splash.is-leaving { pointer-events: none; opacity: 0; }
.logo-splash-animation { width: min(86vw, 640px); aspect-ratio: 1024 / 800; }
.logo-splash-animation svg { display: block; width: 100% !important; height: 100% !important; }
.logo-splash-mark { width: min(72vw, 420px); height: auto; }

/* ---------- Header ---------- */
.app-shell { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 8px max(28px, env(safe-area-inset-left));
}

.brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo { display: block; width: auto; height: 60px; object-fit: contain; filter: drop-shadow(0 6px 14px #0c254b1f); }

.top-actions { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--radius-pill); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); transition: background .2s ease, transform .15s ease; }
.icon-button:hover { background: #ffffff4d; }
body[data-theme='dark'] .icon-button:hover { background: #ffffff14; }
.icon-button:active { transform: scale(.94); }
.utility-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.companion-screen {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "stage ."
    "stage switch"
    "stage copy"
    "stage ."
    "dock dock";
  column-gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding: 0 max(28px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
}

.pet-stage { grid-area: stage; display: grid; place-items: center; min-height: 0; }
.face-switcher { grid-area: switch; justify-self: start; }
.companion-copy { grid-area: copy; }
.dock-wrap { grid-area: dock; justify-self: center; display: grid; justify-items: center; gap: 8px; margin-top: 8px; }

/* ---------- Segmented pet switcher ---------- */
.face-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 280px;
  padding: 5px;
  margin-bottom: 26px;
  border-radius: var(--radius-pill);
}

.switch-thumb {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc(50% - 5px);
  border-radius: var(--radius-pill);
  background: var(--selected-surface);
  border: 1px solid var(--glass-border);
  box-shadow: 0 2px 8px #0c254b1f, inset 0 1px 0 var(--glass-highlight);
  transition: transform .35s cubic-bezier(.3,1.25,.4,1);
}
body[data-pet='buddy'] .switch-thumb { transform: translateX(100%); }

.face-switcher button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  transition: color .25s ease;
}
.face-switcher button[aria-pressed='true'] { color: var(--ink); }
.face-switcher button:disabled { cursor: default; opacity: .6; }

.face-crop { position: relative; display: block; flex: 0 0 auto; width: 36px; height: 36px; overflow: hidden; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #ffffffcc, 0 2px 6px #0c254b26; }
body[data-theme='dark'] .face-crop { background: #1d242e; box-shadow: 0 0 0 2px #ffffff26, 0 2px 6px #0008; }
.face-crop img { position: absolute; display: block; max-width: none; }
.face-mishi img { top: -1.786%; left: -53.571%; width: 160.714%; height: 160.714%; }
.face-buddy img { top: 10.417%; left: -1.042%; width: 155.833%; height: 187.5%; }

/* ---------- Pet stage ---------- */
.pet {
  position: relative;
  width: min(100%, 540px, calc(100svh - 250px));
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
  isolation: isolate;
  cursor: pointer;
  touch-action: manipulation;
}
.pet:focus-visible { outline-offset: -6px; }

.pet-orbit { position: absolute; z-index: 0; inset: 7%; border-radius: 50%; background: var(--pet-backdrop); box-shadow: var(--pet-backdrop-shadow); }
.pet-orbit::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: 3.5%; height: 7%; border-radius: 50%; background: radial-gradient(closest-side, var(--pet-floor), transparent); }

.voice-ring { position: absolute; z-index: 1; inset: 5.5%; border-radius: 50%; pointer-events: none; opacity: 0; box-shadow: 0 0 0 2px var(--voice-listen), 0 0 40px 4px color-mix(in srgb, var(--voice-listen) 35%, transparent); transition: opacity .4s ease; }
body[data-phase='listening'] .voice-ring { opacity: .55; }
body[data-phase='speaking'] .voice-ring { opacity: .9; box-shadow: 0 0 0 2px var(--voice-speak), 0 0 46px 6px color-mix(in srgb, var(--voice-speak) 38%, transparent); animation: breathe 1.6s ease-in-out infinite; }
body[data-phase='connecting'] .voice-ring { opacity: .6; box-shadow: 0 0 0 2px var(--voice-speak); animation: breathe 1.2s ease-in-out infinite; }

.pet-media { position: absolute; z-index: 2; inset: 0; }
.pet-canvas, .pet-still, .pet-still-mouth { position: absolute; inset: 0; width: 100%; height: 100%; }
.pet-still, .pet-still-mouth { object-fit: contain; transform: scale(.965); opacity: 0; pointer-events: none; }
.pet-still-mouth { transition: opacity .06s linear; }
body[data-pet='mishi']:not([data-rig='live']) .pet-still[data-still='mishi'],
body[data-pet='buddy']:not([data-rig='live']) .pet-still[data-still='buddy'] { opacity: 1; }
body:not([data-rig='still']) .pet-still-mouth { display: none; }
body[data-pet='mishi'] .pet-still-mouth[data-still-mouth='buddy'],
body[data-pet='buddy'] .pet-still-mouth[data-still-mouth='mishi'] { display: none; }
body:not([data-rig='live']) .pet-canvas { visibility: hidden; }

/* ---------- Copy ---------- */
.companion-copy { max-width: 460px; }
.companion-heading h1 { margin: 0; font-size: clamp(48px, 5.4vw, 72px); font-weight: 700; line-height: .95; letter-spacing: -.02em; }
.companion-heading p { margin: 10px 0 0; color: var(--accent-ink); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.pet-description { margin: 18px 0 0; color: var(--ink-soft); font-size: 18px; line-height: 1.55; text-wrap: pretty; }

.state-copy { margin-top: 26px; }
.state-copy p { margin: 0; }
.state-line { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.state-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--dot-idle); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot-idle) 22%, transparent); transition: background .3s ease, box-shadow .3s ease; }
body[data-phase='listening'] .state-dot { background: var(--voice-listen); box-shadow: 0 0 0 4px color-mix(in srgb, var(--voice-listen) 25%, transparent); }
body[data-phase='speaking'] .state-dot, body[data-phase='connecting'] .state-dot { background: var(--voice-speak); box-shadow: 0 0 0 4px color-mix(in srgb, var(--voice-speak) 28%, transparent); animation: blinkdot 1.2s ease-in-out infinite; }
body[data-phase='error'] .state-dot { background: #e5604e; }
#detail { margin-top: 6px; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.45; }

.caption-panel { margin-top: 18px; padding: 14px 18px; border-radius: 20px; }
.captions { min-height: 24px; font-size: 17px; line-height: 1.5; }

/* ---------- Dock ---------- */
.dock { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 8px; border-radius: var(--radius-pill); }
.dock .primary { min-width: 230px; min-height: 56px; font-size: 17px; padding: 0 28px; }
.dock .glass-button { min-height: 56px; }
.dock .glass-button.round { width: 56px; min-width: 56px; }
.disclosure { margin: 0; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------- Sheets (dialogs) ---------- */
.sheet {
  width: min(560px, calc(100% - 24px));
  max-height: min(860px, calc(100svh - 32px));
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background: var(--glass-fill-strong);
  color: var(--ink);
  box-shadow: 0 40px 120px #0c254b40, inset 0 1px 0 var(--glass-highlight);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  overflow: hidden;
}
.sheet[open] { display: flex; animation: sheet-in .32s cubic-bezier(.2,.9,.25,1); }
.sheet::backdrop { background: #0b0e1352; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet form { display: flex; flex-direction: column; width: 100%; max-height: inherit; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 12px; }
.sheet-head h2 { margin: 2px 0 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.sheet-head .close { width: 40px; min-width: 40px; min-height: 40px; }
.sheet-head .close .button-icon { width: 18px; height: 18px; }
.sheet-body { flex: 1; display: grid; gap: 14px; padding: 8px 24px 16px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 24px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--inset-border); }

.glass-inset { display: grid; gap: 14px; padding: 16px; border-radius: 20px; background: var(--inset-fill); border: 1px solid var(--inset-border); }
.field { display: grid; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }

input[type='text'], select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--inset-border);
  border-radius: 14px;
  background: var(--glass-fill);
  box-shadow: inset 0 1px 2px #0c254b0f;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input[type='text']:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2366758a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), var(--glass-fill);
  background-repeat: no-repeat;
  background-position: right 16px center, 0 0;
  background-size: 12px 8px, auto;
}
select option { color: #0c254b; background: #fff; }

.settings-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.disclosure-group summary, .tech summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.demo-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.demo-actions .glass-button { flex: 1 1 200px; min-height: 46px; font-size: 15px; }
.about-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.about-head h3 { margin: 0; font-size: 17px; }
.about-head .glass-button { min-height: 40px; padding: 0 16px; font-size: 14px; }
#update-status { margin: 0; font-size: 14px; }
.tech dl { display: grid; gap: 6px; margin: 10px 0 0; font-size: 13px; }
.tech dl div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.tech dt { color: var(--muted); }
.tech dd { margin: 0; overflow-wrap: anywhere; }

/* welcome */
.welcome-dialog .sheet-head h2 { font-size: 26px; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; border: 0; }
.choice-row legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.choice { position: relative; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 6px 8px; border: 1px solid var(--inset-border); border-radius: 16px; background: var(--glass-fill); cursor: pointer; font-size: 15px; font-weight: 600; text-align: center; transition: border-color .2s ease, background .2s ease, transform .15s ease; }
.choice:active { transform: scale(.97); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--selected-surface); box-shadow: inset 0 0 0 1px var(--accent), 0 4px 12px color-mix(in srgb, var(--accent) 18%, transparent); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Older adults ---------- */
body[data-audience='elder'] .glass-button { font-size: 18px; }
body[data-audience='elder'] .dock .glass-button { min-height: 64px; }
body[data-audience='elder'] .dock .glass-button.round { width: 64px; min-width: 64px; }
body[data-audience='elder'] .state-line { font-size: 21px; }
body[data-audience='elder'] #detail { font-size: 17px; }
body[data-audience='elder'] .captions { font-size: 21px; }
body[data-audience='elder'] .disclosure { font-size: 15px; }

/* ---------- Motion ---------- */
@keyframes breathe { 50% { transform: scale(1.025); } }
@keyframes blinkdot { 50% { opacity: .45; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Tablet / phone: one centred column ---------- */
@media (max-width: 900px) {
  .topbar { padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left)); }
  .brand-logo { height: 50px; }
  .companion-screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "switch" "stage" "copy" "dock";
    row-gap: 14px;
    padding: 0 max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .face-switcher { justify-self: center; margin: 4px 0 0; width: min(320px, 100%); }
  .pet { width: min(100%, 560px, calc(100svh - 400px)); min-width: 240px; }
  .companion-copy { justify-self: center; max-width: 560px; text-align: center; }
  .companion-heading h1 { font-size: clamp(36px, 9vw, 52px); }
  .companion-heading p { margin-top: 6px; font-size: 12px; }
  .pet-description { display: none; }
  .state-copy { margin-top: 12px; }
  .state-line { justify-content: center; }
  #detail { padding-left: 0; }
  .dock-wrap { width: 100%; margin-top: 0; }
  .dock { display: flex; width: min(100%, 520px); }
  .dock .primary { flex: 1; min-width: 0; }
  .dock #mute, .dock #end { flex: 1; }
}

@media (max-width: 420px) {
  .brand-logo { height: 44px; }
  .icon-button { width: 40px; height: 40px; }
  .face-switcher button { height: 46px; font-size: 15px; }
  .face-crop { width: 32px; height: 32px; }
  .dock { gap: 8px; padding: 6px; }
  .dock .glass-button { min-height: 52px; padding: 0 16px; }
  .dock .glass-button.round { width: 52px; min-width: 52px; }
  .choice-row { gap: 6px; }
  .choice { min-height: 48px; padding: 6px 4px; font-size: 13.5px; line-height: 1.2; }
  .sheet-head, .sheet-body, .sheet-foot { padding-left: 18px; padding-right: 18px; }
}

@media (min-width: 901px) and (max-height: 720px) {
  .brand-logo { height: 48px; }
  .pet { width: min(100%, 460px, calc(100svh - 200px)); }
  .companion-heading h1 { font-size: clamp(42px, 4.6vw, 60px); }
  .face-switcher { margin-bottom: 18px; }
  .state-copy { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .logo-splash-animation { display: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .glass-button, .sheet { background: var(--glass-fill-strong); }
}

/* iOS-style disclosure rows */
.disclosure-group, .tech { display: block; }
.disclosure-group summary, .tech summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  list-style: none;
}
.disclosure-group summary::-webkit-details-marker, .tech summary::-webkit-details-marker { display: none; }
.disclosure-group summary::after, .tech summary::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .25s ease;
}
.disclosure-group[open] summary::after, .tech[open] summary::after { transform: rotate(45deg); }
.tech summary { font-size: 14px; }
.about-panel { gap: 10px; }
