/* BitWorld — "Sunny Handheld" theme. Tokens first; dark theme overrides them. */
:root {
  --font: "Pixelify Sans", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #8fd16a;
  --bg2: #5fb04a;
  --surface: #fff8e8;
  --surface2: #f3e7cc;
  --ink: #2a2238;
  --ink2: #5b5470;
  --line: #2a2238;
  --inner: #ffffff;
  --accent: #d23f39;   /* white text on it ≥ 4.5:1 (WCAG AA) */
  --err: #b8322d;      /* red text on light surfaces */
  --link: #3a72c0;
  --accent-ink: #fff;
  --blue: #3a72c0;
  --gold: #f8c030;
  --good: #3aa070;
  --chip: rgba(255, 248, 232, 0.94);
  --pad: #fff8e8;
  --shadow: 0 4px 0 rgba(42, 34, 56, 0.35);
  --radius: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b2a3a; --bg2: #13202e; --surface: #24223a; --surface2: #2e2c48; --ink: #f4eedc; --ink2: #b8b2cc;
    --line: #0c0a18; --inner: #4a4870; --chip: rgba(36, 34, 58, 0.94); --pad: #5a5880; --shadow: 0 4px 0 rgba(0, 0, 0, 0.45); color-scheme: dark;
    --err: #ff8a80; --link: #8db8ff;
  }
}
:root[data-theme="dark"] {
  --bg: #1b2a3a; --bg2: #13202e; --surface: #24223a; --surface2: #2e2c48; --ink: #f4eedc; --ink2: #b8b2cc;
  --line: #0c0a18; --inner: #4a4870; --chip: rgba(36, 34, 58, 0.94); --pad: #5a5880; --shadow: 0 4px 0 rgba(0, 0, 0, 0.45); color-scheme: dark;
  --err: #ff8a80; --link: #8db8ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { font-size: calc(100% * var(--text-scale, 1)); }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
body[data-screen="game"] { overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h3 { font-size: 1rem; margin-top: 1em; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ------------------------------------------------------------ buttons / inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em; min-height: 44px; padding: .45em 1em;
  background: var(--surface); color: var(--ink); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), var(--shadow); cursor: pointer; font-weight: 600; text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.btn:hover:not(:disabled) { background: var(--surface2); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .12), 0 1px 0 rgba(42, 34, 56, .35); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #f0645e; }
.btn.big { min-height: 54px; font-size: 1.15rem; padding: .5em 1.4em; }
.btn.sm { min-height: 34px; padding: .2em .7em; font-size: .9rem; border-width: 2px; box-shadow: 0 2px 0 rgba(42, 34, 56, .3); }
.btn.choice { justify-content: flex-start; text-align: left; }
.btn.choice.sel { background: var(--gold); color: #2a2238; }
.icon-btn { background: none; border: 0; font-size: 1.3rem; cursor: pointer; min-width: 40px; min-height: 40px; border-radius: 8px; color: var(--ink); }
.icon-btn:hover { background: var(--surface2); }
.input {
  font: inherit; color: var(--ink); background: var(--inner); border: 3px solid var(--line); border-radius: var(--radius);
  padding: .55em .8em; min-height: 46px; width: 100%; min-width: 0;
}
:root[data-theme="dark"] .input { background: #1a1830; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .input { background: #1a1830; } }
.input.big { font-size: 1.25rem; }
.field { display: grid; gap: .3em; margin: .8em 0; }
.field > span { font-weight: 600; }
.row { display: flex; gap: .6em; align-items: center; margin-top: .8em; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; }
.sub { color: var(--ink2); margin: .2em 0 .8em; line-height: 1.35; }
.small { font-size: .8rem; }
.err { color: var(--err); font-weight: 600; min-height: 1em; }
.empty { color: var(--ink2); font-style: italic; }
.badge { display: inline-block; padding: .1em .55em; border-radius: 99px; background: var(--surface2); font-size: .85rem; }
.badge.online { background: #c9f2d9; color: #1b5e3c; }
.badge-dot { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; text-align: center; border: 2px solid var(--line); }
.toggle { display: flex; gap: .6em; align-items: center; margin: .8em 0; cursor: pointer; line-height: 1.3; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.big-emoji { font-size: 2rem; line-height: 1; }
.progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 1em; }
.progress span { width: 10px; height: 10px; border-radius: 3px; background: var(--surface2); border: 2px solid var(--line); }
.progress span.done { background: var(--good); }
.progress span.cur { background: var(--gold); transform: scale(1.25); }
.code { font-family: ui-monospace, Menlo, monospace; font-weight: 700; letter-spacing: .08em; }

/* ------------------------------------------------------------ landing / loading / creator */
.screen { min-height: 100%; }
#landing, #creator, #loading {
  min-height: 100dvh; padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .35) 0 60px, transparent 61px),
    repeating-linear-gradient(45deg, transparent 0 22px, rgba(0, 0, 0, .04) 22px 44px), var(--bg);
  display: grid; place-items: start center;
}
.landing-inner { width: 100%; max-width: 640px; display: grid; gap: 14px; text-align: center; padding-top: 3vh; }
.logo { font-size: clamp(3rem, 14vw, 5.5rem); font-weight: 700; line-height: 1; letter-spacing: .02em; text-shadow: 0 5px 0 var(--line); animation: logo 3s ease-in-out infinite; }
.logo .l1 { color: #fff8e8; -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; }
.logo .l2 { color: var(--gold); -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; }
@keyframes logo { 50% { transform: translateY(-6px); } }
.tagline { font-size: 1.15rem; margin: 0; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.play-card, .creator-card, .modal-card, .nearby-card {
  background: var(--surface); border: 4px solid var(--line); border-radius: 14px; box-shadow: inset 0 0 0 3px var(--inner), 0 6px 0 rgba(42, 34, 56, .35);
  padding: 18px; display: grid; gap: 10px; text-align: left;
}
.link-note { margin: 0; font-weight: 700; color: var(--link); }
.more summary { cursor: pointer; font-weight: 600; padding: .3em 0; }
.chosen { display: flex; gap: .6em; align-items: center; flex-wrap: wrap; margin: .5em 0; }
.chosen b { font-size: 1.2rem; }
.watch { display: flex; gap: .6em; align-items: center; justify-content: center; flex-wrap: wrap; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.watch a { color: #fff; }
.watch .row { margin: 0; }
.foot { color: #fff; opacity: .9; font-size: .9rem; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.nearby-card { display: flex; gap: .5em; flex-wrap: wrap; align-items: center; }
.loader { margin-top: 30vh; text-align: center; color: #fff; font-size: 1.2rem; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.spinner { width: 48px; height: 48px; margin: 0 auto 12px; background: var(--gold); border: 4px solid var(--line); animation: spin 1s steps(8) infinite; border-radius: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.creator-card { width: 100%; max-width: 560px; margin-top: 3vh; }
.cstep h2 { font-size: 1.6rem; }
.q { font-size: 1.3rem; font-weight: 600; margin: .4em 0 .8em; }
.choices { display: grid; gap: 8px; }
.cstep form { display: grid; gap: 10px; }
.look-picker { display: grid; gap: 12px; grid-template-columns: auto 1fr; align-items: start; }
@media (max-width: 480px) { .look-picker { grid-template-columns: 1fr; } }
.preview-wrap { display: grid; gap: 8px; justify-items: center; }
.preview { width: 120px; height: 120px; image-rendering: pixelated; background: #7ccf5b; border: 4px solid var(--line); border-radius: 12px; }
.look-rows { display: grid; gap: 8px; }
.look-row { display: grid; gap: 4px; }
.lbl { font-size: .85rem; color: var(--ink2); font-weight: 600; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 8px; border: 3px solid var(--line); cursor: pointer; }
.swatch.on { outline: 3px solid var(--gold); outline-offset: 1px; transform: scale(1.08); }
.style-btn { min-height: 34px; padding: 0 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface2); cursor: pointer; text-transform: capitalize; }
.style-btn.on { background: var(--gold); color: #2a2238; }

/* US map */
.usmap-wrap { width: 100%; }
.usmap { width: 100%; height: auto; display: block; }
.usmap .land { fill: #a8de86; stroke: var(--line); stroke-width: 3; stroke-linejoin: round; }
:root[data-theme="dark"] .usmap .land { fill: #2c4a3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .usmap .land { fill: #2c4a3a; } }
.usmap .road { stroke: #c9a660; stroke-width: 3; stroke-dasharray: 2 5; stroke-linecap: round; }
.usmap .rail { stroke: #6a7a96; stroke-width: 2; stroke-dasharray: 8 4; opacity: .7; }
.usmap .city circle { fill: #fff8e8; stroke: var(--line); stroke-width: 3; }
.usmap .city.station circle { fill: var(--blue); }
.usmap .city.here circle { fill: var(--accent); stroke-width: 4; }
.usmap .city text { font: 700 15px var(--font); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.usmap .city text.code { font: 700 11px ui-monospace, Menlo, monospace; fill: var(--ink2); }
.usmap .city text.mark { font-size: 14px; stroke: none; }
.usmap .city[role="button"] { cursor: pointer; }
.usmap .city[role="button"]:hover circle { fill: var(--gold); }

/* ------------------------------------------------------------ game */
#game { position: fixed; inset: 0; background: #1d6b30; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; outline: none; }
#hud {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 6px calc(10px + var(--safe-l)); pointer-events: none;
}
#hud > * { pointer-events: auto; }
#hud .spacer { flex: 1; }
.chip, .chip-btn {
  position: relative; display: inline-flex; align-items: center; gap: .4em; height: 38px; padding: 0 .75em; border-radius: 12px;
  background: var(--chip); color: var(--ink); border: 3px solid var(--line); font-weight: 700; font-size: .95rem; white-space: nowrap; box-shadow: 0 3px 0 rgba(42, 34, 56, .3);
}
.chip-btn { cursor: pointer; }
.chip-btn:active { transform: translateY(2px); }
.chip-btn.round { width: 42px; justify-content: center; padding: 0; font-size: 1.2rem; }
#hud-city .place { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
#hud-city .code { background: var(--gold); color: #2a2238; border-radius: 6px; padding: 0 .35em; font-size: .8rem; }
.chip-btn.train { background: #dbe8ff; color: #1c3a70; }
.chip-btn.train.urgent { background: var(--gold); animation: pulse 1s ease-in-out infinite; }
.chip.job { background: #ffe4a8; color: #5a3a00; }
@keyframes pulse { 50% { transform: scale(1.05); } }
@media (max-width: 560px) { #hud-clock { display: none; } .chip, .chip-btn { height: 36px; font-size: .88rem; } }

#toasts { position: absolute; top: calc(58px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: grid; gap: 6px; width: min(92vw, 440px); pointer-events: none; z-index: 30; }
.toast {
  display: flex; gap: .5em; align-items: center; background: var(--surface); border: 3px solid var(--line); border-radius: 12px; padding: .5em .8em;
  box-shadow: 0 4px 0 rgba(42, 34, 56, .3); font-weight: 600; animation: toastIn .22s cubic-bezier(.2, 1.4, .5, 1);
}
.toast.notify { background: #dff3ff; color: #1c3a70; }
.toast .ti { font-size: 1.3rem; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
#conn { position: absolute; top: calc(56px + var(--safe-t)); right: 12px; background: var(--accent); color: #fff; border: 3px solid var(--line); border-radius: 10px; padding: .3em .8em; font-weight: 700; z-index: 40; }

#toolbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); display: flex; gap: 8px; z-index: 5; }
#toolbar button { display: grid; justify-items: center; gap: 0; width: 56px; height: 56px; font-size: 1.35rem; background: var(--chip); border: 3px solid var(--line); border-radius: 14px; cursor: pointer; box-shadow: 0 3px 0 rgba(42, 34, 56, .3); }
#toolbar button small { font-size: .65rem; font-weight: 700; margin-top: -2px; }
#toolbar button:active { transform: translateY(2px); }

#controls { display: none; }
@media (pointer: coarse) {
  #controls { display: block; position: absolute; inset: auto 0 0 0; height: 0; z-index: 6; }
  #toolbar { bottom: calc(150px + var(--safe-b)); gap: 6px; }
  #toolbar button { width: 48px; height: 48px; font-size: 1.15rem; }
  #toolbar #tb-help { display: none; }
}
#dpad {
  position: absolute; left: calc(14px + var(--safe-l)); bottom: calc(18px + var(--safe-b)); width: 132px; height: 132px; touch-action: none;
  background:
    linear-gradient(var(--pad), var(--pad)) center / 44px 100% no-repeat,
    linear-gradient(var(--pad), var(--pad)) center / 100% 44px no-repeat;
  filter: drop-shadow(0 3px 0 rgba(42, 34, 56, .35));
}
#dpad::before { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--line), var(--line)) center / 50px 100% no-repeat, linear-gradient(var(--line), var(--line)) center / 100% 50px no-repeat; z-index: -1; border-radius: 6px; }
#dpad span { position: absolute; font-size: 14px; color: var(--ink2); pointer-events: none; }
#dpad .u { top: 8px; left: 50%; transform: translateX(-50%); } #dpad .d { bottom: 8px; left: 50%; transform: translateX(-50%); }
#dpad .l { left: 10px; top: 50%; transform: translateY(-50%); } #dpad .r { right: 10px; top: 50%; transform: translateY(-50%); }
#dpad[data-dir="up"] .u, #dpad[data-dir="down"] .d, #dpad[data-dir="left"] .l, #dpad[data-dir="right"] .r { color: var(--accent); transform-origin: center; scale: 1.4; }
#ab { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(26px + var(--safe-b)); width: 150px; height: 110px; }
#ab button { position: absolute; width: 66px; height: 66px; border-radius: 50%; border: 4px solid var(--line); font-weight: 700; font-size: 1.3rem; touch-action: none; box-shadow: 0 4px 0 rgba(42, 34, 56, .4); }
#btn-a { right: 0; top: 0; background: var(--accent); color: #fff; }
#btn-b { left: 0; bottom: 0; background: var(--pad); }
#ab button.down { transform: translateY(3px); box-shadow: 0 1px 0 rgba(42, 34, 56, .4); }
body:has(#dialog:not([hidden])) #controls #dpad, body:has(#sheet:not([hidden])) #controls, body:has(#phone:not([hidden])) #controls { display: none; }
body:has(#dialog:not([hidden])) #toolbar, body:has(#sheet:not([hidden])) #toolbar { display: none; }

#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 50; }
#fade.go { animation: fade .35s ease-out; }
@keyframes fade { 0% { opacity: .85; } 100% { opacity: 0; } }

/* ------------------------------------------------------------ dialog box (handheld RPG style) */
#dialog { position: absolute; left: 0; right: 0; bottom: calc(10px + var(--safe-b)); display: flex; justify-content: center; padding: 0 10px; z-index: 20; }
.dlg-box {
  position: relative; width: min(760px, 100%); background: var(--surface); color: var(--ink); border: 4px solid var(--line); border-radius: 12px;
  box-shadow: inset 0 0 0 3px var(--inner), inset 0 0 0 6px var(--surface2), 0 6px 0 rgba(42, 34, 56, .4); padding: 16px 18px 12px; cursor: pointer;
  animation: dlgIn .2s cubic-bezier(.2, 1.3, .5, 1);
}
@keyframes dlgIn { from { transform: translateY(30px); opacity: 0; } }
.dlg-name { position: absolute; top: -20px; left: 16px; background: var(--blue); color: #fff; border: 3px solid var(--line); border-radius: 8px; padding: .1em .7em; font-weight: 700; }
.dlg-row { display: flex; gap: 12px; align-items: flex-start; }
.portrait { image-rendering: pixelated; background: #9ad87a; border: 3px solid var(--line); border-radius: 8px; flex: none; }
.dlg-text { margin: 4px 0; font-size: 1.15rem; line-height: 1.4; min-height: 2.8em; flex: 1; white-space: pre-wrap; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; min-height: 20px; }
.dlg-next { animation: bob .7s ease-in-out infinite; color: var(--accent); font-size: 1.1rem; }
@keyframes bob { 50% { transform: translateY(4px); } }
.dlg-form { display: flex; gap: 8px; width: 100%; }

/* ------------------------------------------------------------ sheets */
#sheet { position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; }
.sheet-backdrop, .modal-backdrop, .ph-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 40, .45); opacity: 0; transition: opacity .18s; }
#sheet.open .sheet-backdrop { opacity: 1; }
.sheet-card {
  position: relative; width: min(540px, calc(100vw - 20px)); max-height: min(86dvh, 760px); display: flex; flex-direction: column;
  background: var(--surface); border: 4px solid var(--line); border-radius: 16px; box-shadow: inset 0 0 0 3px var(--inner), 0 8px 0 rgba(42, 34, 56, .4);
  transform: translateY(16px) scale(.98); opacity: 0; transition: transform .2s cubic-bezier(.2, 1.3, .5, 1), opacity .15s;
}
.sheet-card.wide { width: min(780px, calc(100vw - 20px)); }
.sheet-card.compact { width: min(420px, calc(100vw - 20px)); }
#sheet.open .sheet-card { transform: none; opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 18px; border-bottom: 3px dashed var(--surface2); }
.sheet-head h2 { margin: 0; font-size: 1.35rem; display: flex; gap: .4em; align-items: center; }
.sheet-body { padding: 12px 18px 18px; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 600px) {
  #sheet { align-items: flex-end; }
  .sheet-card, .sheet-card.wide, .sheet-card.compact { width: 100%; border-radius: 18px 18px 0 0; max-height: 88dvh; padding-bottom: var(--safe-b); border-bottom: 0; }
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.card-btn { display: grid; justify-items: center; gap: 4px; padding: 12px 8px; background: var(--surface2); border: 3px solid var(--line); border-radius: 12px; cursor: pointer; box-shadow: 0 3px 0 rgba(42, 34, 56, .3); position: relative; }
.card-btn:hover:not(:disabled):not(.static) { background: var(--gold); color: #2a2238; transform: translateY(-2px); }
.card-btn:disabled { opacity: .5; }
.card-btn.static { cursor: default; }
.card-btn .big-emoji { font-size: 2.4rem; }
.price { font-size: .85rem; color: var(--ink2); }
.have { position: absolute; top: 4px; right: 6px; font-size: .7rem; background: var(--good); color: #fff; border-radius: 6px; padding: 0 4px; }
.wallet-line { font-weight: 700; margin-bottom: 8px; }
.items { display: flex; flex-wrap: wrap; gap: 8px; }
.item { display: inline-flex; align-items: center; gap: .3em; padding: .35em .6em; background: var(--surface2); border: 3px solid var(--line); border-radius: 10px; cursor: grab; user-select: none; min-height: 44px; }
.item .ie { font-size: 1.4rem; } .item .in { font-weight: 600; font-size: .9rem; } .item .ic { color: var(--ink2); font-size: .85rem; }
.item.empty { opacity: .4; }
.item.sel { background: var(--gold); color: #2a2238; }
.item.dragging { opacity: .35; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; transform-origin: center; opacity: .95; box-shadow: 0 10px 20px rgba(0, 0, 0, .3); rotate: -4deg; }
.drop-over { outline: 4px dashed var(--accent) !important; outline-offset: 3px; background: #ffe9a8 !important; }

.bench { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px; background: #c99a6a; border: 4px solid var(--line); border-radius: 12px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15); }
.slot { width: 58px; height: 58px; display: grid; place-items: center; font-size: 2rem; background: #e8c9a0; border: 3px dashed #7a5030; border-radius: 10px; cursor: pointer; }
.slot.full { border-style: solid; background: #fff4dc; animation: pop .2s; }
@keyframes pop { 50% { transform: scale(1.15); } }
.bench-arrow { font-size: 1.6rem; color: #2a2238; }
.bench-out { width: 64px; height: 64px; display: grid; place-items: center; font-size: 2.2rem; background: #e8c9a0; border: 3px solid var(--line); border-radius: 12px; }
.bench-out.ready { background: var(--gold); animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(248, 192, 48, .45); } }
.bench .btn { margin-left: auto; }
.recipes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.recipe { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface2); border: 3px solid var(--line); border-radius: 12px; opacity: .8; }
.recipe.ok { opacity: 1; background: #e6f6dc; }
:root[data-theme="dark"] .recipe.ok { background: #233d2e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .recipe.ok { background: #233d2e; } }
.recipe .rinfo { flex: 1; display: grid; }
.needs { display: flex; gap: 6px; font-size: .95rem; }
.needs .miss { opacity: .5; } .needs .have { position: static; background: none; color: inherit; font-size: inherit; }

/* order card (jobs) */
#order { position: absolute; top: calc(58px + var(--safe-t)); right: 10px; z-index: 15; width: min(320px, calc(100vw - 20px)); animation: toastIn .25s; }
#order.out { opacity: 0; transform: translateY(-10px); transition: .25s; }
.order-card { background: var(--surface); border: 4px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: 0 5px 0 rgba(42, 34, 56, .35); display: grid; gap: 8px; }
.order-want { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border: 3px dashed var(--ink2); border-radius: 10px; }
.order-want .big-emoji { font-size: 2.4rem; }
.order-want.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.timer { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; border: 2px solid var(--line); }
.timer span { display: block; height: 100%; background: var(--good); animation: drain linear forwards; transform-origin: left; }
@keyframes drain { to { transform: scaleX(0); background: var(--accent); } }
.serve-row { display: flex; gap: 8px; justify-content: space-between; }
.serve { flex: 1; height: 56px; font-size: 1.9rem; background: var(--surface2); border: 3px solid var(--line); border-radius: 12px; cursor: pointer; }
.serve:active { transform: scale(.94); }

/* tickets */
.ticket { background: linear-gradient(90deg, #fff8e8 0 70%, #ffe9b0 70%); color: #2a2238; border: 3px solid var(--line); border-radius: 12px; padding: 10px 14px; display: grid; gap: 6px; position: relative; font-family: ui-monospace, Menlo, monospace; box-shadow: 0 4px 0 rgba(42, 34, 56, .3); }
.ticket::before, .ticket::after { content: ""; position: absolute; left: 70%; width: 16px; height: 16px; background: var(--surface); border: 3px solid var(--line); border-radius: 50%; transform: translateX(-50%); }
.ticket::before { top: -10px; } .ticket::after { bottom: -10px; }
.tk-head, .tk-foot { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; }
.tk-route { display: flex; align-items: center; gap: 12px; }
.tk-route b { font-size: 1.7rem; display: block; } .tk-route small { font-family: var(--font); }
.tk-arrow { font-size: 1.6rem; }
.tk-left { color: #c03030; }
.dest-list { display: grid; gap: 8px; }
.dest { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface2); border: 3px solid var(--line); border-radius: 12px; cursor: pointer; text-align: left; min-height: 52px; }
.dest .code { background: var(--blue); color: #fff; border-radius: 6px; padding: .1em .4em; }
.dest .go { margin-left: auto; font-weight: 700; color: var(--err); }
.dest.sel { background: #e6f6dc; color: #2a2238; }

/* people */
.person-head { display: flex; gap: 12px; align-items: center; }
.mood-card { display: flex; gap: 12px; align-items: center; background: var(--surface2); border-radius: 12px; padding: 10px; margin: 10px 0; }
.note { font-style: italic; }
.share { background: #eef6ff; color: #1c3a70; border-radius: 10px; padding: 8px 10px; }
.giftbox { display: grid; justify-items: center; gap: 4px; padding: 16px; border: 4px dashed var(--accent); border-radius: 14px; margin: 8px 0; background: #fff0ee; color: #2a2238; }
.giftbox.full { border-style: solid; background: #ffe9a8; animation: pop .25s; }
.giftbox > span { font-size: 2.6rem; }
.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.picker.yells { grid-template-columns: repeat(6, 1fr); }
.pick { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; background: var(--surface2); border: 3px solid var(--line); border-radius: 12px; cursor: pointer; min-height: 56px; }
.pick:hover { background: var(--gold); }
.pick:active { transform: scale(.92); }
.share .code-big { font: 700 3rem ui-monospace, Menlo, monospace; letter-spacing: .15em; text-align: center; }
.qr { display: block; margin: 8px auto; border: 4px solid var(--line); border-radius: 10px; background: #fff; image-rendering: pixelated; }
.away-line { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 2px dashed var(--surface2); }

#chatbar { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 22; display: flex; justify-content: center; }
#chatbar form { display: flex; gap: 8px; width: min(640px, 100%); background: var(--surface); padding: 8px; border: 4px solid var(--line); border-radius: 14px; }

/* check-in modal */
#modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 10px; }
#modal .modal-backdrop { opacity: 1; }
.modal-card { position: relative; width: min(560px, 100%); max-height: 94dvh; overflow-y: auto; animation: dlgIn .25s cubic-bezier(.2, 1.3, .5, 1); }
.checkin h2 { font-size: 1.5rem; }
.mood-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mood { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; background: var(--surface2); border: 3px solid var(--line); border-radius: 12px; cursor: pointer; transition: transform .1s; }
.mood .me { font-size: 2.2rem; } .mood .ml { font-size: .85rem; font-weight: 600; }
.mood[aria-checked="true"] { background: var(--gold); color: #2a2238; transform: scale(1.06); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { cursor: default; }
.chips .chip { height: 34px; cursor: pointer; font-size: .9rem; font-weight: 600; box-shadow: none; border-width: 2px; }
.chips .chip[aria-pressed="true"] { background: var(--blue); color: #fff; }

/* ------------------------------------------------------------ phone */
#phone { position: absolute; inset: 0; z-index: 28; display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px calc(14px + var(--safe-r)) calc(14px + var(--safe-b)); }
#phone.open .ph-backdrop { opacity: 1; }
.phone-device {
  position: relative; width: min(380px, 100%); height: min(700px, calc(100dvh - 24px)); background: #2a2238; border-radius: 34px; padding: 12px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px #4a4060; display: flex; flex-direction: column; color: var(--ink);
  transform: translateY(110%) rotate(4deg); transition: transform .3s cubic-bezier(.2, 1.1, .4, 1);
}
#phone.open .phone-device { transform: none; }
@media (max-width: 600px) { #phone { padding: 0; } .phone-device { width: 100%; height: 100dvh; border-radius: 0; padding: calc(8px + var(--safe-t)) 8px calc(8px + var(--safe-b)); } }
.ph-status { display: flex; justify-content: space-between; align-items: center; color: #fff; font-size: .85rem; padding: 2px 10px 6px; font-weight: 700; }
.ph-status .icon-btn { color: #fff; min-height: 30px; font-size: 1rem; }
.ph-title { display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 20px 20px 0 0; padding: 10px 12px 4px; }
.ph-title h2 { margin: 0; font-size: 1.3rem; }
.ph-screen { flex: 1; overflow-y: auto; background: var(--surface); padding: 6px 14px 14px; border-radius: 0 0 20px 20px; overscroll-behavior: contain; }
.ph-home { align-self: center; width: 110px; height: 6px; border-radius: 3px; background: #6a6080; border: 0; margin-top: 10px; cursor: pointer; }
.ph-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; padding-top: 10px; }
.app { position: relative; display: grid; justify-items: center; gap: 4px; background: none; border: 0; cursor: pointer; font-size: .8rem; font-weight: 600; padding: 4px; border-radius: 12px; }
.app:hover { background: var(--surface2); }
.app-icon { width: 60px; height: 60px; display: grid; place-items: center; font-size: 1.9rem; background: var(--surface2); border: 3px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 rgba(42, 34, 56, .3); }
.app .badge-dot { top: 0; right: 12px; }
.list { display: grid; gap: 6px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface2); margin-bottom: 6px; position: relative; }
.btnrow { width: 100%; border: 0; text-align: left; cursor: pointer; }
.btnrow:hover, .btnrow.sel { outline: 3px solid var(--gold); }
.pinfo { flex: 1; display: grid; min-width: 0; }
.pinfo small { color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pact { display: flex; gap: 4px; }
.prow .badge-dot { position: static; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #9a94b0; border: 2px solid var(--line); flex: none; }
.dot.on { background: #3ad07a; }
.thread { display: flex; flex-direction: column; height: 100%; }
.thread-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 0; min-height: 200px; }
.msg { max-width: 80%; align-self: flex-start; background: var(--surface2); border-radius: 14px 14px 14px 4px; padding: 6px 10px; display: grid; }
.msg.mine { align-self: flex-end; background: var(--blue); color: #fff; border-radius: 14px 14px 4px 14px; }
.msg small { opacity: .7; font-size: .7rem; justify-self: end; }
.thread-form { display: flex; gap: 6px; position: sticky; bottom: 0; background: var(--surface); padding-top: 6px; }
.locate-card { margin-top: 10px; padding: 10px; border: 3px solid var(--line); border-radius: 12px; }
.locate-card .ok { color: var(--good); font-weight: 700; }
.route { padding-left: 1.2em; } .route li { margin: 4px 0; }
.city-list { display: grid; gap: 4px; }
.city-row { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 0; background: var(--surface2); border-radius: 8px; cursor: pointer; text-align: left; }
.city-row small { margin-left: auto; color: var(--ink2); }
.balance { display: flex; align-items: baseline; gap: 8px; font-size: 1.4rem; justify-content: center; padding: 14px; background: var(--surface2); border-radius: 14px; }
.balance b { font-size: 2.6rem; }
.mem { padding-left: 1.1em; line-height: 1.35; } .mem li { margin: 4px 0; } .mem small { color: var(--ink2); }
.seg { display: flex; border: 3px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; min-height: 40px; border: 0; background: var(--surface2); cursor: pointer; font-weight: 600; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button.on { background: var(--gold); color: #2a2238; }

/* tasks, codes, roads */
.task { border: 3px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: var(--surface2); }
.task.ready { background: #e6f6dc; color: #2a2238; }
.task.done { opacity: .6; }
.task-head { display: flex; gap: 10px; align-items: center; }
.task-head small { display: block; color: var(--ink2); }
.task.ready .task-head small, .task.ready .sub { color: #3a5a3a; }
.task-progress { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.task-progress .bar { flex: 1; height: 10px; border: 2px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.task-progress .bar span { display: block; height: 100%; background: var(--good); transition: width .3s; }
.task .hint { display: block; color: var(--ink2); }
.task .ok, small.ok { color: var(--good); font-weight: 700; }
.my-code, .code-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; border: 3px dashed var(--line); border-radius: 12px; margin: 6px 0; }
.my-code .code, .code-line .code { font-size: 1.35rem; letter-spacing: .12em; background: var(--gold); color: #2a2238; padding: 0 .3em; border-radius: 6px; }
.input.code { text-transform: uppercase; letter-spacing: .1em; font-family: ui-monospace, Menlo, monospace; }
.usmap path.road { fill: none; }
.usmap .road.beach, .usmap .road.riverside, .usmap .road.marsh { stroke: #5aa8e8; }
.usmap .road.forest { stroke: #3a9a4a; }
.usmap .road.canyon, .usmap .road.desert { stroke: #d08a4a; }
.usmap .road.mountain { stroke: #8a8a9a; }
.roads ul { margin: .3em 0 0; padding-left: 1.1em; }

/* ------------------------------------------------------------ land, homes, partners */
#toolbar button.on { background: var(--gold); color: #2a2238; }
#toolbar .tb-ic { line-height: 1.1; }
.market { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 10px; border: 3px dashed var(--line); border-radius: 12px; font-weight: 600; font-size: .92rem; }
.area h3 small { font-weight: 500; color: var(--ink2); font-size: .8rem; }
.grid.plots { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.card-btn.plot { padding: 8px 6px; gap: 2px; }
.card-btn.plot b { font-size: 1.05rem; }
.card-btn.plot small { color: var(--ink2); font-size: .78rem; text-align: center; }
.card-btn.plot.mine { background: #fff1c4; color: #2a2238; }
.card-btn.plot.taken { opacity: .72; }
.card-btn.plot .row { margin-top: 4px; gap: 4px; }
.plot-card { border: 3px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 12px; background: var(--surface2); }
.plot-card h3 { margin-top: 0; }
.plot-card .options { display: grid; gap: 8px; }
.plot-card .recipe small { color: var(--ink2); font-size: .8rem; }
.plot-card .recipe .btn { max-width: 9.5em; white-space: normal; line-height: 1.15; }
.needs { flex-wrap: wrap; }
.seg.pay button { font-size: .9rem; padding: 0 .4em; }
.chips.rels { margin: 6px 0; }
.consent { text-align: center; }
.consent .row.center { justify-content: center; gap: 14px; }
.consent .big-emoji { font-size: 3rem; }
.items.drop { min-height: 56px; padding: 6px; border: 3px dashed var(--line); border-radius: 12px; }
.storage h3, .mystore h3 { margin-bottom: 6px; }
.mystore form .field { margin: 0; flex: 1 1 8em; }
details.more summary { cursor: pointer; font-weight: 600; margin: 8px 0; }

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) *:not(.timer > span), :root:not([data-motion="full"]) *::before { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
:root[data-motion="reduce"] *:not(.timer > span), :root[data-motion="reduce"] *::before { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }

/* ------------------------------------------------------------ safety & privacy */
.btn.quiet { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink2); }
.btn.quiet:hover, .btn.quiet:focus-visible { border-color: var(--line); color: var(--ink); }
.safety-row { justify-content: flex-end; margin-top: 4px; }
.report { display: grid; gap: 10px; }
.report h3 { margin: 4px 0 0; }
.report hr { border: 0; border-top: 2px dashed var(--surface2); width: 100%; margin: 6px 0; }
.report textarea { resize: vertical; min-height: 70px; font: inherit; }
.chips.reasons .chip { white-space: normal; height: auto; min-height: 34px; padding: 4px 10px; text-align: left; }
.chips .chip.sel, .chips .chip[aria-checked="true"] { background: var(--blue); color: #fff; }
.thread-tools { display: flex; justify-content: flex-end; }
.mem.answers { list-style: none; padding-left: 0; }
.mem.answers li { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.mem.answers li.private span { opacity: .55; text-decoration: line-through dotted; }
.icon-btn.sm { min-width: 34px; min-height: 34px; font-size: 1.1rem; }

/* ------------------------------------------------------------ trades, market, projects, friendship */
#hud-event { font-size: 1.2rem; }
.trade { display: grid; gap: 10px; }
.trade-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.trade-side { background: var(--surface2); border: 2px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.trade-side h3 { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trade-side .pt { display: inline-flex; }
.trade-offer { font-size: 1.1rem; margin: 0; overflow-wrap: anywhere; }
.badge.ok { background: #2d8040; color: #fff; }
.field.inline { display: inline-flex; align-items: center; gap: 6px; }
.field.inline .input { width: 6.5em; }
.market-board { display: grid; gap: 10px; }
.market-sell { background: var(--surface2); border-radius: 12px; padding: 10px; display: grid; gap: 8px; }
.market-sell h3 { margin: 0; }
.items.compact .item { min-height: 0; }
.item.sel, .item[aria-pressed="true"] { outline: 3px solid var(--blue); }
.market-list { display: grid; gap: 8px; }
.market-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; padding: 8px; border: 2px solid var(--surface2); border-radius: 12px; }
.market-row .offers { grid-column: 1 / -1; display: grid; gap: 4px; }
.market-row .offer { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.note { background: var(--surface2); border-radius: 10px; padding: 8px 10px; margin: 0; }
.chains { display: grid; gap: 10px; }
.chain { border: 2px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; background: var(--surface); }
.chain header { display: flex; gap: 10px; align-items: center; }
.chain header small { display: block; color: var(--ink2); }
.chain.done { opacity: .7; } .chain.locked { opacity: .55; }
.chain-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 2px; }
.chain-steps li.ok { text-decoration: line-through; color: var(--ink2); }
.chain-steps li.ok::marker { content: '✓ '; }
.chain-steps li.now { font-weight: 700; }
.recipe.event { outline: 2px dashed var(--gold, #ffd76a); }
.recipe .badge { margin-left: 6px; font-size: .75rem; }
.friend { display: grid; gap: 10px; }
.bond { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
.bond .task-progress { grid-column: 1 / -1; }
.bond small { display: block; color: var(--ink2); }

/* ------------------------------------------------------------ settings sliders */
.slider { display: grid; grid-template-columns: 7.5em 1fr 3.2em; gap: 10px; align-items: center; margin: 6px 0; }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 32px; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink2); }

/* ------------------------------------------------------------ getting started + help */
#guide {
  position: absolute; z-index: 14; top: calc(58px + var(--safe-t)); left: calc(10px + var(--safe-l));
  width: min(270px, calc(100vw - 20px)); background: var(--surface); color: var(--ink); border: 3px solid var(--line); border-radius: 14px;
  box-shadow: 0 4px 0 rgba(42, 34, 56, .3); overflow: hidden;
}
.guide-head { display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; background: none; border: 0; cursor: pointer; text-align: left; min-height: 40px; }
.guide-head b { flex: 1; }
.guide-count { font-size: .85rem; color: var(--ink2); font-variant-numeric: tabular-nums; }
.guide-body { padding: 0 10px 10px; display: grid; gap: 6px; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .9rem; }
.guide-steps li.ok { color: var(--ink2); text-decoration: line-through; }
.guide-steps li.now { font-weight: 700; }
.guide-text { margin: 0; font-size: .85rem; color: var(--ink2); line-height: 1.3; }
body:has(#sheet:not([hidden])) #guide, body:has(#phone:not([hidden])) #guide, body:has(#dialog:not([hidden])) #guide { display: none; }
.help { display: grid; gap: 10px; }
.help-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.help-tabs .chip { height: auto; min-height: 34px; cursor: pointer; }
.help-tabs .chip.sel { background: var(--blue); color: #fff; }
.help-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; line-height: 1.4; }
@media (max-width: 520px) { #guide { width: min(240px, calc(100vw - 20px)); } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* phones: the guide shows just the current step */
@media (max-width: 520px) {
  .guide-steps li:not(.now) { display: none; }
  .guide-body { gap: 4px; }
  .guide-text { font-size: .8rem; }
}

/* ------------------------------------------------------------ gatherings (phone → Events) */
.gatherings { display: grid; gap: 10px; }
.gatherings > .seg { flex-wrap: wrap; }
.glist { display: grid; gap: 8px; }
.gcard { border: 2px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 4px; background: var(--surface); }
.gcard header { display: flex; gap: 8px; align-items: center; }
.gcard header small { display: block; color: var(--ink2); }
.gcard p { margin: 0; }
.gcard.live { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.gcard.cancelled { opacity: .6; }
.gdesc { font-style: italic; }
.seg.sm button { padding: 4px 8px; font-size: .85rem; min-height: 32px; }
.ghost { display: grid; gap: 8px; }
.ghost .field { display: grid; gap: 4px; }
.gatherings > .seg button { height: auto; min-height: 40px; white-space: normal; line-height: 1.15; padding: 6px 4px; }
/* Settings → Notifications */
fieldset.plain { border: 0; margin: .4em 0; padding: 0; min-width: 0; }
fieldset.plain .toggle { margin: .5em 0; }
.row.quiet { align-items: center; gap: .5em; }
.row.quiet select { min-width: 6.5em; }
/* phone → Weather */
.wx-now { display: flex; gap: .8em; align-items: center; margin: .8em 0; }
.wx-now .wx-big { font-size: 2.6em; line-height: 1; }
.wx-now small { display: block; opacity: .8; }
.wx-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35em; }
.wx-list li { display: grid; grid-template-columns: 4.5em 1.8em 1fr; align-items: center; }
.wx-list .t { opacity: .75; font-variant-numeric: tabular-nums; }
/* phone → 🎨 Studio */
.studio .seg { margin-bottom: .8em; }
.studio-stage { display: flex; gap: .8em; align-items: flex-start; }
.studio-canvas { width: min(100%, 256px); aspect-ratio: 1; height: auto; image-rendering: pixelated; touch-action: none; border: 3px solid var(--ink, #2a2238); border-radius: 6px; cursor: crosshair; background: #ece6f0; }
.studio-canvas:focus-visible { outline: 3px solid var(--accent, #d23f39); outline-offset: 2px; }
.studio-preview { display: flex; flex-direction: column; gap: .4em; align-items: center; }
.design-thumb { image-rendering: pixelated; background: repeating-conic-gradient(#ece6f0 0 25%, #d8d0e0 0 50%) 0 0 / 8px 8px; border-radius: 4px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.2em, 1fr)); gap: .35em; margin: .8em 0; }
.swatch { aspect-ratio: 1; min-height: 2.2em; border: 2px solid var(--ink, #2a2238); border-radius: 6px; padding: 0; cursor: pointer; }
.swatch.on { outline: 3px solid var(--accent, #d23f39); outline-offset: 2px; }
.studio .tools button { min-height: 2.4em; }
.studio .tools button.on { background: var(--accent, #d23f39); color: #fff; }
.studio label.field { display: grid; gap: .3em; margin: .8em 0; }
.studio label.field input { font: inherit; padding: .5em; border-radius: 6px; border: 2px solid var(--ink, #2a2238); }
.design-row .pinfo small { display: block; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); gap: .8em; }
.design-card { display: grid; gap: .25em; justify-items: center; text-align: center; padding: .6em; border-radius: 8px; background: var(--card, rgba(255,255,255,.06)); }
.design-card small { opacity: .8; }
/* phone → 📮 Stamps */
.stamp-list { list-style: none; padding: 0; margin: 0 0 1em; display: grid; gap: .5em; }
.stamp { display: grid; grid-template-columns: 2.6em 1fr auto; gap: .6em; align-items: center; padding: .5em .6em; border-radius: 8px; border: 2px dashed var(--ink2, #5b5470); }
.stamp.earned { border-style: solid; border-color: var(--accent, #d23f39); background: rgba(210, 63, 57, .08); }
.stamp-emoji { font-size: 1.8em; text-align: center; filter: grayscale(1); opacity: .55; }
.stamp.earned .stamp-emoji { filter: none; opacity: 1; }
.stamp-info small { display: block; opacity: .85; }
.stamp .meter { height: .5em; border-radius: 1em; background: rgba(127,127,127,.3); margin-top: .3em; overflow: hidden; }
.stamp .meter span { display: block; height: 100%; background: var(--accent, #d23f39); }
.stamp .pin.on { outline: 2px solid var(--accent, #d23f39); }
.card-stamps { display: flex; flex-wrap: wrap; gap: .4em; }
.stamp-chip { padding: .15em .55em; border-radius: 1em; border: 2px solid var(--accent, #d23f39); font-size: .85em; }
/* phone → 🐾 Pets */
.pet-card { padding: .6em; border-radius: 8px; background: var(--card, rgba(255,255,255,.06)); margin-bottom: .6em; }
.pet-emoji { font-size: 2em; line-height: 1; }
.pet-card .meter { height: .5em; border-radius: 1em; background: rgba(127,127,127,.3); margin: .3em 0; overflow: hidden; }
.pet-card .meter span { display: block; height: 100%; background: var(--accent, #d23f39); }
.pet-card .pinfo small { display: block; }
.pets label.field { display: grid; gap: .3em; margin: .6em 0; }
.pets label.field input { font: inherit; padding: .5em; border-radius: 6px; border: 2px solid var(--ink, #2a2238); }
/* phone → 🏅 Clubs */
.club-chat { max-height: 14em; overflow-y: auto; padding: .5em; border-radius: 8px; background: var(--card, rgba(255,255,255,.06)); margin-bottom: .5em; }
.club-chat p { margin: .25em 0; overflow-wrap: anywhere; }
.club-chat small { opacity: .75; }
.clubs form.row input { flex: 1; min-width: 0; font: inherit; padding: .5em; border-radius: 6px; border: 2px solid var(--ink, #2a2238); }
.clubs label.field { display: grid; gap: .3em; margin: .6em 0; }
.clubs label.field input { font: inherit; padding: .5em; border-radius: 6px; border: 2px solid var(--ink, #2a2238); }
.emoji-pick { aspect-ratio: 1; min-height: 2.2em; font-size: 1.2em; border: 2px solid transparent; border-radius: 6px; background: var(--card, rgba(255,255,255,.08)); cursor: pointer; padding: 0; }
.emoji-pick.on { border-color: var(--accent, #d23f39); }
.wear-now { align-items: center; gap: .8em; margin-bottom: .6em; }
.wear-now .btn { display: block; margin: .3em 0; }
/* phone → 🏛️ Museum */
.exhibits { list-style: none; padding: 0; margin: 0 0 1em; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: .4em; }
.exhibits li { display: grid; grid-template-columns: 1.8em 1fr; align-items: center; gap: 0 .4em; padding: .4em .5em; border-radius: 8px; border: 2px dashed var(--ink2, #5b5470); }
.exhibits li.has { border-style: solid; border-color: var(--accent, #d23f39); }
.exhibits li:not(.has) .ex-emoji { filter: grayscale(1); opacity: .5; }
.exhibits .ex-emoji { grid-row: span 2; font-size: 1.4em; }
.exhibits small, .exhibits .btn { grid-column: 2; justify-self: start; }

/* Pet shows (M19) */
.petshow { display: grid; gap: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.petshow ul, .petshow ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.petshow .entries li { display: flex; gap: 8px; align-items: center; }
.petshow .grow { flex: 1; min-width: 0; }

/* Clubhouses (M20) */
.clubhouse input[type=number] { width: 5.5em; }
.club-chat p.note { font-style: italic; color: var(--ink2); }

/* Music (M22) */
.tune-scroll { overflow-x: auto; padding: 4px 0 8px; }
.tune-grid { display: grid; grid-template-columns: repeat(32, 22px); grid-auto-rows: 22px; gap: 2px; width: max-content; }
.tcell { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 0; min-width: 0; cursor: pointer; }
.tcell.beat { border-left: 3px solid var(--ink2); }
.tcell.on { background: var(--accent); border-color: var(--accent); }
.tcell.now { box-shadow: 0 0 0 2px var(--ink) inset; }
.music .keys { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 8px 0; }
.music .key { min-height: 44px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.music .key:active { background: var(--accent); color: #fff; }

/* connection readout (Settings → Show connection stats) */
#stats { position: absolute; right: calc(8px + var(--safe-r, 0px)); top: calc(58px + var(--safe-t)); z-index: 25; pointer-events: none; font: 600 12px/1.2 ui-monospace, Menlo, monospace; padding: 4px 8px; border-radius: 6px; background: rgba(42,34,56,.88); color: #fff8e8; border-left: 4px solid #8ac6ff; }
#stats[data-level="good"] { border-left-color: #6cc04f; }
#stats[data-level="ok"] { border-left-color: #f8c020; }
#stats[data-level="bad"] { border-left-color: #e8504a; }
.survey-nav { justify-content: space-between; margin-top: 1em; }
.version { opacity: .75; font-size: .8rem; margin: .2em 0 0; }
