/* Fine-tune, the quiz, the garage, sharing, and rooms (host, join, the
   player's companion). Same house rules as the rest of the client: solid
   near-black panels, 1 px lines, one accent, Russo One for headings and
   numbers, Chakra Petch for everything else. Phone first. */

/* ============================================================ shared bits */

.btn.small, .flow-actions .btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-danger { color: #fff; background: #dc2626; border: 0; font-size: 15px; min-height: 44px; padding: 0 14px; }
.btn[disabled], .btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn.small { width: 38px; height: 38px; border-radius: 10px; font-family: var(--display); font-size: 18px; color: var(--text); }
.icon-btn.small svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.link-btn { padding: 4px 2px; border: 0; background: none; color: var(--accent); font: 700 14px var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
.text-input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: 700 17px var(--body); box-sizing: border-box;
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.field { display: grid; gap: 6px; margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend { padding: 0; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.form-error { min-height: 1.2em; margin: 6px 0 0; color: #fca5a5; font-size: 14px; font-weight: 700; }
.fine-print { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.empty-line { margin: 12px 0; padding: 14px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); font-size: 14px; text-align: center; }
.side-title { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-family: var(--display); font-weight: 400; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.side-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.small-title { font-size: 20px; margin-top: 18px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.conn-line { margin: 0 0 8px; padding: 6px 12px; border-radius: 8px; background: #78350f; color: #fde68a; font-size: 13px; font-weight: 700; text-align: center; }
.rx-num { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, .08); font-family: var(--display); font-size: 14px; color: var(--muted); }
.row-tools { display: flex; gap: 4px; flex: none; }
.flash { animation: row-flash 1.6s var(--out); }
@keyframes row-flash { 0%, 30% { box-shadow: 0 0 0 2px var(--accent), 0 0 24px color-mix(in srgb, var(--accent) 50%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Tabs (the editor's and the room's). */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"] {
  flex: 1 1 0; min-width: max-content; min-height: 40px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: 400 14px var(--display); letter-spacing: .02em; cursor: pointer; transition: background-color .2s, color .2s;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 420px) { .tabs [role="tab"] { font-size: 13px; padding: 0 6px; } }
.tabs [role="tab"]:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* "What changed" chips. */
.change-chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 45%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  color: var(--text); font: 700 12px var(--body); white-space: nowrap; cursor: pointer; animation: chip-in .35s var(--spring);
}
span.change-chip { cursor: default; }
.change-chip.k-slider { --c: #22d3ee; }
.change-chip.k-reflex { --c: #c084fc; }
.change-chip.k-gear { --c: #facc15; }
.change-chip.k-targets { --c: #f87171; }
.change-chip.k-taunt { --c: #34d399; }
.change-more { color: var(--muted); font-size: 12px; font-weight: 700; align-self: center; }
@keyframes chip-in { from { opacity: 0; transform: scale(.85); } }

/* Toast and the return pill. */
.toast {
  position: fixed; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px)); z-index: 90; display: flex; align-items: center; gap: 12px;
  max-width: min(92vw, 440px); padding: 10px 14px; border-radius: 12px; background: #1b1830; border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55); color: var(--text); font-size: 14px; font-weight: 700;
  opacity: 0; transform: translate(-50%, 14px); pointer-events: none; transition: opacity .25s var(--out), transform .3s var(--out);
}
.toast.in { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast[data-tone="warn"] { border-color: #f59e0b; }
.toast a { color: var(--accent); white-space: nowrap; }
.return-pill {
  position: fixed; top: max(env(safe-area-inset-top), 10px); left: 50%; z-index: 60; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 999px;
  background: #2e1065; border: 1px solid #a78bfa; color: #ede9fe; font-size: 13px; font-weight: 700; text-decoration: none;
  box-shadow: 0 8px 26px rgba(124, 58, 237, .45); white-space: nowrap;
}
.return-pill b { padding: 4px 10px; border-radius: 999px; background: #a78bfa; color: #1e0b4a; font-weight: 700; }
body[data-screen="tune"] .return-pill, body[data-screen="result"] .return-pill { top: auto; bottom: max(96px, calc(env(safe-area-inset-bottom) + 90px)); }

/* The free server waking up (dist/play/api-base.js). */
.waking {
  position: fixed; left: 50%; top: calc(max(env(safe-area-inset-top), 10px) + 62px); z-index: 95; display: flex; align-items: center; gap: 12px;
  width: min(calc(100vw - 32px), 440px); box-sizing: border-box; padding: 10px 16px; border-radius: 14px; background: #120f25; border: 1px solid var(--accent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55); font-size: 13px; color: var(--muted);
  opacity: 0; transform: translate(-50%, -12px); pointer-events: none; transition: opacity .3s var(--out), transform .3s var(--out);
}
.waking.in { opacity: 1; transform: translate(-50%, 0); }
.waking b { display: block; color: var(--text); font-size: 15px; }
.waking .spinner { flex: none; width: 24px; height: 24px; }

/* Sheets: a bottom sheet on a phone, a centred panel on a desktop. */
.sheet-root { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(4, 3, 10, .7); opacity: 0; transition: opacity .22s; }
.sheet {
  position: relative; max-height: 88dvh; display: grid; grid-template-rows: auto 1fr; border-radius: 20px 20px 0 0;
  background: #0d0b19; border: 1px solid var(--line); border-bottom: 0; transform: translateY(100%); transition: transform .3s var(--out);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-root.in .sheet-backdrop { opacity: 1; }
.sheet-root.in .sheet { transform: none; }
.sheet-root.out .sheet { transform: translateY(100%); }
.sheet-root.out .sheet-backdrop { opacity: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font: 400 20px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow: auto; padding: 12px 16px 18px; overscroll-behavior: contain; }
@media (min-width: 760px) {
  .sheet-root { align-items: center; justify-items: center; }
  .sheet { width: min(760px, 92vw); border-radius: 20px; border-bottom: 1px solid var(--line); transform: translateY(24px) scale(.98); opacity: 0; transition: transform .28s var(--out), opacity .2s; }
  .sheet-root.in .sheet { opacity: 1; }
  .sheet-root.out .sheet { opacity: 0; transform: translateY(24px) scale(.98); }
}

/* ============================================================ fine-tune */

.tune-body { min-height: 0; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 10px; padding-bottom: 8px; }
.tune-bot { display: flex; align-items: center; gap: 12px; }
.tb-por { flex: none; width: 56px; height: 56px; border-radius: 14px; overflow: hidden; border: 2px solid var(--accent); background: radial-gradient(circle at 50% 30%, rgba(34, 211, 238, .4), #0b0918); }
.tb-por img { width: 100%; height: 100%; object-fit: cover; }
.tb-main { display: grid; gap: 2px; min-width: 0; }
.tb-name { font: 400 22px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-trait { color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tune-diff { display: grid; gap: 6px; }
.tune-changes-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tune-changes { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-height: 0; }
.tune-changes:empty { display: none; }
.tune-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px 16px; scrollbar-width: thin; }
.tune-panel:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; border-radius: 10px; }
.panel-lede { margin: 2px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.panel-count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; }

/* Dials: a five-step range with words at both ends. */
.dials { display: grid; gap: 10px; }
.dial { padding: 12px 14px 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.dial-head { display: grid; gap: 2px; margin-bottom: 8px; }
.dial-word { font: 400 18px var(--display); color: var(--accent); }
.dial-text { color: var(--muted); font-size: 13px; }
.dial input[type="range"] {
  --fill: 50%;
  width: 100%; height: 34px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.dial input[type="range"]:focus { outline: none; }
.dial input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--fill), rgba(255, 255, 255, .12) var(--fill)),
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 2px), rgba(255, 255, 255, .3) calc(25% - 2px) 25%);
}
.dial input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
.dial input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--accent); }
.dial input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff;
  border: 4px solid var(--accent); box-shadow: 0 4px 12px rgba(0, 0, 0, .5); transition: transform .15s var(--spring);
}
.dial input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }
.dial input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.dial input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(255, 255, 255, .6); }
.dial-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* Reflex sentences. */
.reflex-list, .target-list, .buy-list, .priority-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.reflex {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "num when tools" "num do tools";
  align-items: center; gap: 6px 10px; padding: 10px 10px 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.reflex .rx-num { grid-area: num; align-self: start; margin-top: 18px; background: color-mix(in srgb, #c084fc 25%, transparent); color: #e9d5ff; }
.rx-part { display: grid; gap: 2px; min-width: 0; }
.rx-part:first-of-type { grid-area: when; }
.rx-part:last-of-type { grid-area: do; }
.rx-arrow { display: none; }
.rx-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.reflex select {
  width: 100%; min-height: 42px; padding: 0 34px 0 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .14);
  background: #171428 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9a4c9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  color: var(--text); font: 700 15px var(--body); -webkit-appearance: none; appearance: none; text-overflow: ellipsis;
}
.reflex select:focus { outline: none; border-color: var(--accent); }
.reflex select option, .reflex select optgroup { background: #171428; color: var(--text); }
.reflex .row-tools { grid-area: tools; flex-direction: column; }

/* Targets. */
.target, .buy, .priority { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.target:first-child .rx-num { background: #f87171; color: #2a0707; }
.target-main, .buy-main, .priority-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.target-main b, .buy-main b, .priority-main b { font-size: 15px; }
.target-main span, .buy-main span, .priority-main span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Gear. */
.gear-title { margin: 18px 0 4px; font: 400 17px var(--display); }
.gear-title:first-of-type { margin-top: 4px; }
.gear-sub { display: flex; justify-content: space-between; gap: 8px; margin: 14px 0 2px; font: 400 15px var(--display); }
.gear-cost { color: var(--muted); font: 700 12px var(--body); }
.gear-lede { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.gear-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gear-tile {
  display: grid; justify-items: start; align-content: start; gap: 3px; padding: 10px; border-radius: 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--body); cursor: pointer;
  transition: border-color .2s, transform .12s var(--out), background-color .2s;
}
.gear-tile img { width: 40px; height: 40px; }
.gear-tile .gt-name { font: 400 15px var(--display); }
.gear-tile .gt-line { color: var(--muted); font-size: 12px; line-height: 1.35; }
.gear-tile .gt-line.bad { color: #fca5a5; }
.gear-tile[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); box-shadow: 0 0 0 1px var(--accent) inset; }
.gear-tile:active { transform: scale(.97); }
.gear-tile:focus-visible, .shop-item:focus-visible, .taunt-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.buy img { width: 30px; height: 30px; }
.buy-price { color: var(--gold); font: 400 14px var(--display); }
.shop { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.shop-item {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px 0 6px; border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, .22); background: transparent; color: var(--text); font: 700 13px var(--body); cursor: pointer;
}
.shop-item img { width: 24px; height: 24px; }
.shop-item span { color: var(--gold); font-size: 12px; }
.shop-item::before { content: '+'; color: var(--accent); font: 400 16px var(--display); }
.shop-item:disabled { opacity: .35; cursor: not-allowed; }
.comeback { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.switch { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; top: 0; left: 0; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch-ui { flex: none; position: relative; width: 48px; height: 28px; margin-top: 2px; border-radius: 14px; background: rgba(255, 255, 255, .16); transition: background-color .2s; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .25s var(--spring); }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid #fff; outline-offset: 2px; }
.switch b { display: block; font: 400 16px var(--display); }

/* Taunts. */
.taunt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.taunt-chip {
  min-height: 38px; padding: 0 12px; border-radius: 10px 10px 10px 2px; border: 1px solid var(--line); background: #fff; color: #111;
  font: 400 13px var(--display); letter-spacing: .03em; cursor: pointer; opacity: .55; transition: opacity .2s, transform .15s var(--spring);
}
.taunt-chip.none { background: transparent; color: var(--muted); border-style: dashed; border-radius: 10px; font-family: var(--body); font-weight: 700; }
.taunt-chip[aria-checked="true"] { opacity: 1; transform: scale(1.06); box-shadow: 0 0 0 2px var(--accent); }

@media (min-width: 960px) {
  .flow.tune { max-width: 1180px; }
  .tune-body { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 32px; }
  .tune-bot { grid-column: 1; grid-row: 1; }
  .tb-por { width: 88px; height: 88px; border-radius: 18px; }
  .tb-name { font-size: 26px; }
  .tune-diff { grid-column: 1; grid-row: 2; }
  .tune-changes { flex-wrap: wrap; overflow: visible; }
  .tabs:not(.room-tabs) { grid-column: 1; grid-row: 3; align-self: start; flex-direction: column; }
  .tabs:not(.room-tabs) [role="tab"] { flex: none; justify-content: flex-start; text-align: left; min-height: 48px; padding: 0 16px; font-size: 16px; }
  .tune-panel { grid-column: 2; grid-row: 1 / 4; padding-right: 10px; }
  .dials { grid-template-columns: 1fr 1fr; }
  .reflex { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto; grid-template-areas: "num when arrow do tools"; }
  .reflex .rx-num { margin-top: 16px; }
  .rx-arrow { display: block; grid-area: arrow; margin-top: 16px; color: var(--muted); font: 400 20px var(--display); }
  .reflex .row-tools { flex-direction: row; margin-top: 16px; }
}

/* ============================================================ result extras */

.result-changes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 auto 6px; max-width: 420px; width: 100%; }
.rc-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.rc-chips { display: contents; }
.place-sub[data-tone="up"] { color: #6ee7b7; font-weight: 700; }
.place-sub[data-tone="down"] { color: #fca5a5; font-weight: 700; }
.tips { margin: 6px auto 0; padding: 0; list-style: none; display: grid; gap: 6px; max-width: 420px; width: 100%; }
.tip { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); font-size: 14px; line-height: 1.4; }
.tip span { flex: 1; }
.tip .btn { flex: none; }
.result-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 8px auto 0; max-width: 420px; }
.tips-title { display: none; }
@media (max-width: 959px) {
  .result .side-title { display: none; }
  .result-body { justify-content: safe center; }
  .result-side .story li:nth-child(n+3) { display: none; }
  .result-side .tips .tip:nth-child(n+2) { display: none; }
  .result-body { overflow-y: auto; }
}
@media (min-width: 960px) {
  .tips-title:not([hidden]) { display: flex; }
  .tips, .result-changes, .result-more { max-width: none; margin-left: 0; }
  .result-more { justify-content: flex-start; }
}
.style-note { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; background: #422006; color: #fde68a; font-size: 13px; font-weight: 700; }
.style .flow-actions { grid-template-columns: auto 1fr; }
.more-links { display: flex; justify-content: center; gap: 10px; margin: 12px 0 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.more-links a { color: var(--text); text-underline-offset: 3px; }
@media (min-width: 960px) { .more-links { justify-content: flex-start; } }

/* ============================================================ quiz */

.quiz-body { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 12px; padding-bottom: 10px; }
.quiz-art { margin: 0; border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 2; max-height: 34dvh; border: 1px solid var(--line); background: #0b0918; }
.quiz-art img { width: 100%; height: 100%; object-fit: cover; display: block; animation: art-in .6s var(--out); }
@keyframes art-in { from { transform: scale(1.06); opacity: .4; } }
.quiz-kicker { margin: 0; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.quiz-q .step-title { font-size: 24px; }
.quiz-answers { display: grid; gap: 8px; }
.quiz-answer {
  display: grid; gap: 2px; padding: 12px 16px; border-radius: 14px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--body);
  transition: border-color .2s, background-color .2s, transform .12s var(--out);
}
.quiz-answer b { font: 400 18px var(--display); }
.quiz-answer span { color: var(--muted); font-size: 13px; }
.quiz-answer[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); transform: scale(1.01); }
.quiz-answer:active { transform: scale(.98); }
.quiz-answer:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.priority img { width: 72px; height: 48px; object-fit: cover; border-radius: 8px; }
.priority:first-child .rx-num { background: var(--accent); color: var(--accent-ink); }
.quiz-keeps { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-align: center; }
@media (min-width: 960px) {
  .flow.quiz { max-width: 1100px; }
  .quiz-body[data-kind="scene"] { grid-template-columns: 1.2fr 1fr; grid-template-rows: 1fr auto auto 1fr; column-gap: 36px; row-gap: 14px; }
  .quiz-body[data-kind="scene"] .quiz-art { grid-column: 1; grid-row: 2 / 4; align-self: center; max-height: min(62dvh, 520px); }
  .quiz-body[data-kind="scene"] .quiz-q { grid-column: 2; grid-row: 2; }
  .quiz-body[data-kind="scene"] .quiz-answers { grid-column: 2; grid-row: 3; }
  .quiz-body[data-kind="order"] { max-width: 640px; margin: 0 auto; width: 100%; }
  .quiz-q .step-title { font-size: 30px; }
}

/* ============================================================ garage + share */

.garage-body { min-height: 0; overflow-y: auto; padding-bottom: 12px; }
.unsaved, .backup-nudge { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.unsaved span { flex: 1; font-size: 14px; }
.backup-nudge { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 8%, var(--panel)); }
.backup-nudge img { width: 56px; height: 56px; }
.backup-nudge p { flex: 1; margin: 0; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.backup-nudge b { color: #fde68a; font-size: 15px; }
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.bot-card {
  position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "art main" "actions actions" "confirm confirm";
  gap: 10px 12px; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); animation: card-in .4s var(--out) both;
}
.bot-card.current { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.bc-badge { position: absolute; top: -9px; right: 12px; padding: 1px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font: 400 11px var(--display); }
.bc-art { grid-area: art; width: 96px; height: 96px; border-radius: 12px; background: radial-gradient(circle at 50% 60%, rgba(34, 211, 238, .3), #0b0918 70%); overflow: hidden; }
.bc-art img { width: 100%; height: 100%; object-fit: contain; }
.bc-main { grid-area: main; display: grid; align-content: center; gap: 3px; min-width: 0; }
.bc-name { font: 400 20px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-trait { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.bc-record { color: var(--muted); font-size: 13px; }
.bc-record em { color: #fbbf24; font-style: normal; }
.bc-actions { grid-area: actions; display: flex; gap: 6px; }
.bc-actions .btn { flex: 1; }
.bc-confirm { grid-area: confirm; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; background: #450a0a; color: #fecaca; font-size: 14px; font-weight: 700; }
.garage-empty { display: grid; justify-items: center; gap: 8px; margin-top: 30px; color: var(--muted); text-align: center; }
.garage-empty img { width: 180px; height: 180px; }
.share-card { display: grid; place-items: center; min-height: 200px; }
.share-canvas { width: min(100%, 300px); height: auto; border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .55); }
.share-actions { display: grid; gap: 10px; margin-top: 12px; }
.share-block { padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.share-block h3 { margin: 0; font: 400 16px var(--display); }
.share-block p { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }
.share-block .row { display: flex; flex-wrap: wrap; gap: 8px; }
.code-box { display: flex; align-items: center; gap: 8px; }
.code-box code { flex: 1; min-width: 0; padding: 10px; border-radius: 10px; background: #050409; font: 700 13px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .04em; overflow-wrap: anywhere; color: #a5f3fc; user-select: all; }
.code-form { display: flex; gap: 8px; }
.code-form .text-input { font-family: ui-monospace, Consolas, monospace; font-size: 15px; text-transform: uppercase; }
.file-pick { display: inline-flex; cursor: pointer; }
@media (min-width: 760px) {
  .sheet .share-card + .share-actions { margin-top: 0; }
  .sheet-body:has(.share-card) { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
}
@media (min-width: 960px) { .flow.garage { max-width: 1180px; } }

/* ============================================================ rooms: host */

.host-body, .join-body, .room-body { min-height: 0; overflow-y: auto; padding-bottom: 14px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.preset {
  display: grid; gap: 2px; padding: 12px; border-radius: 14px; text-align: left; cursor: pointer; background: var(--panel);
  border: 1px solid var(--line); color: var(--text); font-family: var(--body);
}
.preset b { font: 400 17px var(--display); }
.preset span { color: var(--muted); font-size: 12px; }
.preset em { color: var(--gold); font-style: normal; font-size: 12px; font-weight: 700; }
.preset[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); box-shadow: 0 0 0 1px var(--accent) inset; }
.custom-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.stepper { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.stepper span { flex: 1; font-weight: 700; font-size: 14px; }
.stepper output { min-width: 2ch; text-align: center; font: 400 20px var(--display); color: var(--accent); }
.estimates { display: grid; gap: 4px; margin-top: 14px; }
.estimate { margin: 0; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); color: var(--muted); font-size: 13px; }
.estimate b { color: var(--text); }
.join-panel { display: grid; justify-items: center; gap: 4px; padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.jp-kicker { margin: 6px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.join-url { margin: 0; font: 700 16px var(--body); color: var(--text); overflow-wrap: anywhere; }
.host .room-code { margin: 0; font: 400 clamp(44px, 14vw, 80px)/1 var(--display); letter-spacing: .14em; margin-right: -.14em; white-space: nowrap; color: var(--accent); text-shadow: 0 0 30px rgba(34, 211, 238, .55); }
.qr { width: min(60vw, 230px); height: auto; margin: 10px 0; border-radius: 14px; background: #fff; padding: 6px; }
.lobby-side { min-width: 0; margin-top: 16px; }
.lobby-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.lobby-title { flex: 1 1 100%; }
.lobby-count { margin: 0; font: 400 20px var(--display); color: var(--accent); }
.lobby-hint { margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; }
.lobby-plan { margin: 8px 0 0; font-size: 14px; color: var(--text); }
.lobby-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 14px; }
.lobby-player { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.lobby-player.new { animation: join-pop .6s var(--spring); }
@keyframes join-pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
.lobby-player img { width: 64px; height: 64px; border-radius: 12px; border: 2px solid rgba(34, 211, 238, .6); }
.lobby-player span { max-width: 100%; font: 400 13px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-player .kick { position: absolute; top: 4px; right: 4px; padding: 2px 6px; border-radius: 6px; border: 0; background: rgba(0, 0, 0, .65); color: #fca5a5; font: 700 11px var(--body); cursor: pointer; opacity: 0; transition: opacity .2s; }
.lobby-player:hover .kick, .lobby-player:focus-within .kick { opacity: 1; }
@media (hover: none) { .lobby-player .kick { opacity: .85; } }
.lobby-empty { display: grid; justify-items: center; gap: 4px; margin-top: 20px; color: var(--muted); text-align: center; }
.lobby-empty img { width: 120px; height: 120px; }
.host-running, .host-ready, .host-error, .room-running, .room-gone { display: grid; justify-items: center; gap: 10px; padding-top: 6dvh; text-align: center; }
.host-running img, .room-running img { width: 160px; height: 160px; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.run-bar { width: min(100%, 460px); height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.run-bar i { display: block; height: 100%; background: linear-gradient(90deg, #22d3ee, #ec4899); transform-origin: left; transform: scaleX(0); transition: transform .4s var(--out); }
.run-text { color: var(--muted); font-weight: 700; }
.ready-logo { width: min(80vw, 420px); height: auto; }
.host-error img, .room-gone img { width: 150px; height: 150px; }
@media (min-width: 960px) {
  .flow.host { max-width: 1320px; }
  .host-lobby:not([hidden]) { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 36px; align-items: start; }
  .join-panel { position: sticky; top: 0; padding: 24px; }
  .qr { width: 260px; }
  .lobby-side { margin-top: 0; }
  .lobby-players { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .host-setup { max-width: 860px; }
}

/* ============================================================ rooms: join + player */

.code-input { font: 400 34px var(--display); letter-spacing: .3em; text-align: center; text-transform: uppercase; min-height: 64px; }
.code-input::placeholder { color: rgba(255, 255, 255, .15); }
.join-bots { display: grid; gap: 8px; margin-top: 8px; }
.join-bot {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--body);
}
.join-bot img { width: 56px; height: 56px; border-radius: 12px; }
.join-bot > span { display: grid; gap: 1px; min-width: 0; }
.join-bot b { font: 400 17px var(--display); }
.join-bot span span { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.join-bot em { color: var(--muted); font-size: 12px; font-style: normal; }
.join-bot[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); box-shadow: 0 0 0 1px var(--accent) inset; }
.join-bot:focus-visible, .free-fighter:focus-visible, .preset:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.join-none { display: grid; justify-items: center; gap: 4px; margin-top: 12px; color: var(--muted); text-align: center; }
.join-none img { width: 120px; height: 120px; }
.join-fix { margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px solid #f59e0b; background: color-mix(in srgb, #f59e0b 8%, var(--panel)); }
.join-fix label, .join-fix p { display: block; margin: 0 0 8px; font-weight: 700; color: #fde68a; }
.free-fighters { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; max-height: 240px; overflow-y: auto; }
.free-fighter { padding: 2px; border-radius: 10px; border: 2px solid transparent; background: #0b0918; cursor: pointer; }
.free-fighter img { width: 100%; height: auto; display: block; border-radius: 8px; }
.free-fighter[aria-checked="true"] { border-color: var(--accent); }
@media (min-width: 960px) { .flow.join, .flow.room { max-width: 760px; } }

.room-name { margin: 0 0 6px; }
.bar-title .room-code { color: var(--accent); letter-spacing: .12em; }
.room-loading { display: grid; place-items: center; padding-top: 20dvh; }
.you-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.you-card img { width: 72px; height: 72px; border-radius: 14px; }
.you-card > span { display: grid; gap: 2px; }
.you-card em { color: var(--accent); font-style: normal; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.you-card b { font: 400 24px var(--display); }
.you-trait { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lobby-status { font-size: 22px; margin-top: 16px; }
.room-players { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.room-players li { display: grid; justify-items: center; gap: 4px; padding: 6px 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font: 400 11px var(--display); text-align: center; animation: join-pop .5s var(--spring); }
.room-players li.me { border-color: var(--accent); }
.room-players img { width: 48px; height: 48px; border-radius: 10px; }
.room-players span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-card { display: grid; gap: 4px; padding: 14px; border-radius: 16px; background: #120f25; border: 1px solid rgba(239, 68, 68, .5); box-shadow: 0 0 28px -12px rgba(239, 68, 68, .8); }
.now-kicker { display: inline-flex; align-items: center; gap: 6px; color: #fca5a5; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.now-kicker::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: live 1.8s var(--out) infinite; }
.now-line { font: 400 19px var(--display); }
.now-you { color: var(--accent); font-weight: 700; font-size: 14px; }
.now-card .btn { justify-self: start; margin-top: 6px; }
.champ { display: grid; justify-items: center; gap: 2px; margin-top: 12px; padding: 14px; border-radius: 18px; background: radial-gradient(circle at 50% 40%, rgba(250, 204, 21, .3), var(--panel) 70%); border: 1px solid var(--gold); text-align: center; }
.champ img { width: 160px; height: 160px; object-fit: contain; }
.champ-kicker { color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.champ-name { font: 400 28px var(--display); }
.room-tabs { margin-top: 14px; }
.room-panel { padding-top: 4px; }
.verdict { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; font: 400 16px var(--display); }
.verdict.up { background: color-mix(in srgb, #34d399 18%, var(--panel)); color: #6ee7b7; }
.verdict.out { background: rgba(255, 255, 255, .05); color: var(--muted); }
.table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 14px; }
.table th, .table td { padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.table thead th { color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.table tbody th { text-align: left; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.table tbody tr > * { background: var(--panel); }
.table tbody tr > :first-child { border-radius: 10px 0 0 10px; text-align: center; font-family: var(--display); color: var(--muted); }
.table tbody tr > :last-child { border-radius: 0 10px 10px 0; font-family: var(--display); }
.table tbody img { width: 30px; height: 30px; border-radius: 8px; }
.table tbody em { padding: 0 5px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font: 400 10px var(--display); font-style: normal; }
.table tr.me > * { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.table tr.through > :first-child { color: #34d399; }
.table tr.house { opacity: .6; }
.table-note { margin: 2px 0 10px; color: var(--muted); font-size: 12px; }
.map-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.map-list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.map-list li.live { border-color: #ef4444; }
.ml-map { flex: none; width: 52px; font: 400 13px var(--display); color: var(--muted); }
.ml-main { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ml-main img { width: 28px; height: 28px; border-radius: 8px; }
.ml-main.muted { color: var(--muted); }
.ml-text { display: grid; min-width: 0; }
.ml-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-text em { color: var(--muted); font-style: normal; font-size: 12px; }
.ml-main .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: live 1.8s var(--out) infinite; }
.br-round + .br-round { margin-top: 8px; }
.br-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.br-group { padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.br-group b { font: 400 13px var(--display); color: var(--muted); }
.br-group ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.br-group li { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-group li img { width: 22px; height: 22px; border-radius: 6px; }
.br-group li.me { color: var(--accent); }
.br-group li.through { color: #6ee7b7; }
.br-group li.house { opacity: .55; }
.tbd { color: var(--muted); font-weight: 500; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .change-chip, .lobby-player.new, .room-players li, .bot-card, .quiz-art img { animation: none; }
  .host-running img, .room-running img { animation: none; }
}
