/* Fork Fortune - sleek dark/light theme with accessibility options */
:root {
  --metal-tex: url(/assets/metal-overlay.webp);
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --text-scale: 1;
  --radius: 16px;
}

/* Dark (default) */
:root, [data-theme="dark"] {
  --bg: #0B0D10; --surface: #15181D; --surface2: #1C2027; --border: #2A2F37; --border-strong: #3A404A;
  --text: #F3F4F6; --muted: #A9B0BA; --machine: #121519; --window: #0A0C0F; --reel: #171B21;
  --reel-shade: #000000AA; --ok: #4ADE80; --warn: #FBBF24; --bad: #F87171;
  --shadow: 0 20px 40px #00000066; --scrim: #000000A0;
  --accent: #5B9BFF; --accent-ink: #0B0D10; --accent-text: #7DB0FF;
}
[data-theme="light"] {
  --bg: #F5F6F8; --surface: #FFFFFF; --surface2: #F0F2F5; --border: #D9DDE3; --border-strong: #B9C0CA;
  --text: #0F1115; --muted: #4B5563; --machine: #FFFFFF; --window: #EEF0F3; --reel: #FFFFFF;
  --reel-shade: #0F111530; --ok: #15803D; --warn: #A16207; --bad: #B91C1C;
  --shadow: 0 18px 36px #0F111522; --scrim: #0F111566;
  --accent: #2563EB; --accent-ink: #FFFFFF; --accent-text: #1D4ED8;
}
/* Accents (dark values first, light overrides) */
[data-accent="emerald"] { --accent: #34D399; --accent-ink: #0B0D10; --accent-text: #5EE0AE; }
[data-accent="amber"] { --accent: #FBBF24; --accent-ink: #0B0D10; --accent-text: #FCD34D; }
[data-accent="violet"] { --accent: #A78BFA; --accent-ink: #0B0D10; --accent-text: #C4B5FD; }
[data-theme="light"][data-accent="blue"] { --accent: #2563EB; --accent-ink: #FFFFFF; --accent-text: #1D4ED8; }
[data-theme="light"][data-accent="emerald"] { --accent: #047857; --accent-ink: #FFFFFF; --accent-text: #047857; }
[data-theme="light"][data-accent="amber"] { --accent: #B45309; --accent-ink: #FFFFFF; --accent-text: #B45309; }
[data-theme="light"][data-accent="violet"] { --accent: #6D28D9; --accent-ink: #FFFFFF; --accent-text: #6D28D9; }
/* Color-blind safe (Okabe-Ito blue/orange) */
[data-cb="1"] { --accent: #E69F00; --accent-ink: #0B0D10; --accent-text: #F0B429; --ok: #56B4E9; --bad: #E69F00; }
[data-theme="light"][data-cb="1"] { --accent: #B35C00; --accent-ink: #FFFFFF; --accent-text: #9A4F00; --ok: #0072B2; --bad: #B35C00; }
/* High contrast */
[data-hc="1"] {
  --bg: #000000; --surface: #000000; --surface2: #000000; --border: #FFFFFF; --border-strong: #FFFFFF;
  --text: #FFFFFF; --muted: #FFFFFF; --machine: #000000; --window: #000000; --reel: #000000; --reel-shade: transparent;
  --ok: #FFFFFF; --warn: #FFFFFF; --bad: #FFFFFF; --accent: #FFE600; --accent-ink: #000000; --accent-text: #FFE600;
  --shadow: none;
}
[data-hc="1"] .card, [data-hc="1"] .bar > button, [data-hc="1"] .result-card,
[data-hc="1"] .btn, [data-hc="1"] .chip, [data-hc="1"] .seg { border-width: 2px !important; }

[data-text="2"] { --text-scale: 1.15; }
[data-text="3"] { --text-scale: 1.3; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* iPhone flashes a blue box on every tap by default; replaced by a small press-in instead. Keyboard focus rings stay. */
button:not(.lever):active, label:active, .chip:active { transform: scale(.97); }
[data-motion="1"] button:active, [data-motion="1"] label:active, [data-motion="1"] .chip:active { transform: none; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body);
  font-size: calc(15px * var(--text-scale)); line-height: 1.4; min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }

.app { max-width: 480px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 16px calc(6px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; min-height: 100dvh; }
main { display: flex; flex-direction: column; gap: 10px; flex: 1; outline: none; }

/* Header */
.top { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.brand h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: calc(21px * var(--text-scale)); letter-spacing: -.5px; color: var(--text); }
.top-actions { display: flex; gap: 6px; align-items: center; }
.pill { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: .85em; font-weight: 700; }
.pill.in-room { border-color: var(--accent); color: var(--accent-text); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; padding: 0; }

/* Location + filter bar */
.bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }
.bar > button { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; text-align: left; min-width: 0; }
.bar-loc svg { flex: none; color: var(--accent-text); }
.bar-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bar-label { font-size: .7em; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.bar-text > span:last-child { font-weight: 700; font-size: .88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-cta { flex: none; font-weight: 700; font-size: .82em; padding: 8px 10px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }

/* Machine: drawn in code so it matches the cards; the lever is Scenario art in 3 positions (up / mid / down). */
.machine-wrap { position: relative; z-index: 3; display: flex; align-items: stretch; }
.machine { flex: 1; min-width: 0; background: var(--machine); border: 1px solid var(--border); border-radius: 20px; padding: 8px 10px 9px; box-shadow: inset 0 1px 0 #FFFFFF14, var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.leds { display: flex; gap: 4px; padding: 0 4px; }
.leds i { flex: 1; height: 4px; border-radius: 2px; background: var(--accent); opacity: .2; }
.leds-bottom { margin-top: 1px; }
[data-lights-bottom="0"] .leds-bottom { display: none; }
.machine.spinning .leds i { animation: led 1.1s ease-in-out infinite; }
.machine.won .leds i { animation: led .35s ease-in-out 4; }
@keyframes led { 0%, 100% { opacity: .3; } 40% { opacity: 1; } }
.reel-labels { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px; font-size: .68em; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); text-align: center; }
.reels { position: relative; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px; background: var(--window); border: 1px solid var(--border); border-radius: 16px; padding: 6px; height: calc(94px * var(--text-scale)); }
.reel { position: relative; overflow: hidden; background: var(--reel); border-radius: 10px; box-shadow: inset 0 14px 12px -10px var(--reel-shade), inset 0 -14px 12px -10px var(--reel-shade); }
.strip { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 0 4px; text-align: center; }
.strip .row { font-size: .78em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.strip .row.mid { font-family: var(--font-display); font-weight: 700; font-size: .95em; color: var(--text); padding: 6px 0; white-space: normal; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.strip.moving { animation: blur .08s linear infinite; filter: blur(1.4px); }
.strip.fade { animation: fade .35s ease both; }
@keyframes blur { 0% { transform: translateY(-3px); } 50% { transform: translateY(3px); } 100% { transform: translateY(-3px); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.payline { position: absolute; left: 6px; right: 6px; top: 50%; height: calc(40px * var(--text-scale)); transform: translateY(-50%); border: 2px solid var(--accent); border-radius: 10px; pointer-events: none; }
.payline-arrow { position: absolute; left: -9px; top: 50%; transform: translateY(-50%); border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 8px solid var(--accent); }
.empty-reel { color: var(--muted); font-size: .8em; }

/* Lever: the art is 120 x 560 (14px of room on the left so the pulled-down knob is not cut off); hub center 47% down, knob top 1%. Sized so the hub sits 62% down the machine
   Sized from the machine height (--mh, set in app.js) so the knob top lines up with the machine top. */
.lever { position: relative; flex: none; width: calc(var(--mh, 300px) * 0.255); margin-left: -1px; padding: 0; background: none; border: none; touch-action: none; -webkit-user-select: none; user-select: none; }
.lever-art { position: absolute; left: -13.2%; width: 113.2%; top: calc(var(--mh, 300px) * -0.012); aspect-ratio: 120 / 560; pointer-events: none; filter: drop-shadow(0 8px 12px #00000059); }
.l-frame { position: absolute; inset: 0; display: none; }
.machine-wrap[data-lever="up"] .f-up, .machine-wrap[data-lever="mid"] .f-mid, .machine-wrap[data-lever="down"] .f-down { display: block; }
.l-frame img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* The knob glows in the accent color (painted through the glow mask), so it follows every theme. */
.l-color { position: absolute; inset: 0; background: var(--accent); -webkit-mask: var(--glow) center / 100% 100% no-repeat; mask: var(--glow) center / 100% 100% no-repeat; }
.l-frame .l-shine { mix-blend-mode: overlay; opacity: .9; }

/* Result card */
.result:empty { display: none; }
.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; animation: rise .45s cubic-bezier(.2,.9,.3,1) both; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.rc-kick-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: -4px; }
.rc-tools { display: flex; flex: none; margin-right: -8px; }
.rc-tool { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: none; border-radius: 12px; color: var(--muted); padding: 0; }
.rc-tool[aria-pressed="true"] { color: var(--accent-text); }
.rc-kicker { font-size: .72em; font-weight: 700; letter-spacing: 1.5px; color: var(--accent-text); }
.rc-name { margin: 0; min-width: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.45em; letter-spacing: -.5px; line-height: 1.15; }
.rc-open { flex: none; display: flex; align-items: center; gap: 4px; font-size: .8em; font-weight: 700; color: var(--ok); }
.rc-open.soon { color: var(--warn); }
.rc-meta { color: var(--muted); font-size: .88em; margin: 0; }
.rc-drive { display: flex; align-items: center; gap: 8px; font-size: .9em; font-weight: 700; }
.rc-drive small { font-weight: 500; color: var(--muted); }
.rc-links { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 2px; }
.rc-links a, .rc-links button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 10px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 700; font-size: .85em; text-align: center; }
.rc-links .main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rc-small { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.linkish { background: none; border: none; padding: 8px 4px; min-height: 44px; color: var(--muted); font-size: .82em; text-decoration: underline; text-underline-offset: 3px; }
.linkish[aria-pressed="true"] { color: var(--accent-text); font-weight: 700; }
.notice { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 16px; padding: 14px; text-align: center; color: var(--muted); }
.notice b { color: var(--text); display: block; margin-bottom: 4px; font-family: var(--font-display); }
.notice .btn { margin-top: 10px; }

/* Bottom actions */
.actions { display: flex; flex-wrap: wrap; gap: 2px 8px; position: sticky; bottom: 0; padding: 10px 0 calc(4px + env(safe-area-inset-bottom)); margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: linear-gradient(to bottom, transparent, var(--bg) 14px); z-index: 5; }
.btn { min-height: 50px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-quiet { flex: 1; }
.btn-spin { flex: 2; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-family: var(--font-display); font-weight: 800; font-size: 1.1em; }
.btn-go { flex: 1; background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-wide { width: 100%; flex: none; }
.sheet-sub { margin: 10px 0 0; font-size: .8em; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.powered { flex-basis: 100%; margin: -2px 0 0; text-align: center; font-size: .72em; color: var(--muted); }

/* Sheets */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: 520px; margin: 0 auto; max-height: 88dvh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-bottom: none; border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); gap: 12px; animation: sheetUp .28s cubic-bezier(.2,.9,.3,1); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.3em; }
.sheet-body { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; padding-bottom: 4px; }
.sheet-foot { padding-top: 4px; }
fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.legend-note { font-weight: 500; color: var(--muted); font-size: .85em; margin-left: 4px; }
.seg { display: flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 44px; border: none; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 500; font-size: .9em; }
.seg button[aria-checked="true"] { background: var(--text); color: var(--bg); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; font-size: .88em; display: inline-flex; align-items: center; gap: 4px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 800; }
.chip[aria-pressed="true"]::before { content: '✓'; }
.radius-row { display: flex; align-items: center; gap: 12px; }
.radius-row input[type=range] { flex: 1; accent-color: var(--accent); height: 44px; }
.radius-num { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.radius-num input { width: 64px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-align: center; font: inherit; font-weight: 700; }
.toggles { display: flex; flex-direction: column; }
.toggle { display: flex; align-items: center; gap: 10px; background: none; border: none; border-bottom: 1px solid var(--border); padding: 10px 0; min-height: 60px; text-align: left; }
.toggle:last-of-type { border-bottom: none; }
.t-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.t-text small { color: var(--muted); font-size: .82em; }
.t-state { width: 28px; text-align: right; font-size: .8em; font-weight: 700; color: var(--muted); }
.t-state::after { content: 'Off'; }
.toggle[aria-pressed="true"] .t-state { color: var(--text); }
.toggle[aria-pressed="true"] .t-state::after { content: 'On'; }
.switch { width: 48px; height: 28px; flex: none; border-radius: 999px; background: var(--border); border: 2px solid var(--border-strong); position: relative; }
.switch span { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: left .15s ease; }
.toggle[aria-pressed="true"] .switch { background: var(--text); border-color: var(--text); }
.toggle[aria-pressed="true"] .switch span { left: 22px; background: var(--bg); }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field { flex: 1; display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .9em; }
.field input { min-height: 50px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 12px; font: inherit; font-weight: 500; font-size: 16px; }
.field-row .btn, #customForm .btn { min-height: 50px; flex: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.hint { margin: 0; font-size: .82em; color: var(--muted); }
.error { margin: 0; color: var(--bad); font-weight: 700; font-size: .9em; }
.error:empty { display: none; }
h3 { margin: 4px 0 -4px; font-size: .75em; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
#customForm { flex-direction: row; align-items: flex-end; }
.mini-label { margin: 0; font-weight: 700; font-size: .88em; }
.accents { display: flex; gap: 8px; }
.accents button { flex: 1; min-height: 56px; border-radius: 12px; background: var(--bg); border: 2px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: .78em; }
.accents button[aria-checked="true"] { border-color: var(--text); font-weight: 800; }
.accents .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #0B0D10; font-weight: 800; }
.size-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.sizes { display: flex; gap: 4px; }
.sizes button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); font-family: var(--font-display); font-weight: 800; }
.sizes button[aria-checked="true"] { background: var(--text); color: var(--bg); }
.preview { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border); }
.preview > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.preview small { font-size: .7em; letter-spacing: 1.5px; font-weight: 700; color: var(--muted); }
.preview b { font-family: var(--font-display); font-size: 1.3em; }
.preview span { color: var(--muted); font-size: .85em; }
.preview .preview-btn { background: var(--accent); color: var(--accent-ink); border-radius: 12px; padding: 10px 16px; font-family: var(--font-display); font-weight: 800; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 8px; min-height: 48px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row a { color: var(--accent-text); font-weight: 700; font-size: .85em; }
.list-empty { color: var(--muted); font-size: .88em; margin: 0; }
.tabs { display: flex; gap: 6px; }
.tabs .chip { flex: 1; justify-content: center; }
.report-list { gap: 8px; }
.room-code { font-family: var(--font-display); font-weight: 800; font-size: 2em; letter-spacing: 6px; text-align: center; padding: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.members { display: flex; flex-wrap: wrap; gap: 6px; }
.member { padding: 6px 10px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); font-size: .85em; font-weight: 700; }
.qr { align-self: center; background: #FFFFFF; padding: 10px; border-radius: 12px; line-height: 0; }
.qr svg { width: 180px; height: 180px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: .9em; opacity: 0; pointer-events: none; transition: all .25s ease; max-width: calc(100% - 32px); z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Reduce motion: from settings or the phone's own setting */
[data-motion="1"] *, [data-motion="1"] *::before, [data-motion="1"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
[data-motion="1"] .strip.moving { filter: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (min-width: 700px) {
  .app { padding-top: 32px; }
}

/* Big text or narrow phones: stack the location/filter boxes, keep buttons on one line */
[data-text="2"] .bar, [data-text="3"] .bar { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 360px) { .bar { grid-template-columns: minmax(0, 1fr); } .brand h1 { font-size: 18px; } }
.btn { white-space: nowrap; }
[data-text="3"] .btn-spin { font-size: 1em; }
[data-text="3"] .actions .btn { padding: 0 10px; }
.actions .btn { min-width: 0; }
.actions .btn-quiet, .actions .btn-go { padding: 0 10px; }

/* ---------- Depth (Oct 26): brushed-metal look that matches the app icon ----------
   Lit top edge, shadowed bottom, sunken reel windows, soft accent glow. Colors still come
   from the theme + accent, and high contrast turns all of it off (flat, solid borders). */
:root, [data-theme="dark"] {
  --face-top: #20242C; --face-mid: #161A20; --face-bot: #101318;
  --edge-hi: #FFFFFF1F; --edge-lo: #00000080; --drop: 0 8px 18px #00000073, 0 2px 4px #00000059;
  --brush: repeating-linear-gradient(90deg, #FFFFFF03 0 1px, transparent 1px 3px);
  --sunk: inset 0 3px 9px #000000C0, inset 0 -1px 0 #FFFFFF12;
  --reel-a: #0B0D11; --reel-b: #20252E;
}
[data-theme="light"] {
  --face-top: #FFFFFF; --face-mid: #F7F8FA; --face-bot: #E9ECF0;
  --edge-hi: #FFFFFFFF; --edge-lo: #0F11151F; --drop: 0 8px 18px #0F11151C, 0 1px 3px #0F111526;
  --brush: repeating-linear-gradient(90deg, #0F111503 0 1px, transparent 1px 3px);
  --sunk: inset 0 3px 8px #0F111533, inset 0 -1px 0 #FFFFFF;
  --reel-a: #E4E7EC; --reel-b: #FFFFFF;
}
.bar > button, .result-card, .pill, .icon-btn, .machine {
  background: var(--brush), linear-gradient(180deg, var(--face-top), var(--face-mid) 55%, var(--face-bot));
  box-shadow: inset 0 1px 0 var(--edge-hi), inset 0 -1px 0 var(--edge-lo), var(--drop);
}
.bar-cta, .rc-links a:not(.main) {
  background: linear-gradient(180deg, var(--face-top), var(--face-bot));
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 1px 2px var(--edge-lo);
}
.machine {
  box-shadow: inset 0 1px 0 var(--edge-hi), inset 0 -2px 0 var(--edge-lo), var(--drop),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 10px 34px color-mix(in srgb, var(--accent) 20%, transparent);
}
.reels { background: var(--window); box-shadow: var(--sunk); border-color: transparent; }
.reel { background: linear-gradient(180deg, var(--reel-a), var(--reel-b) 50%, var(--reel-a)); }
.leds i { opacity: .3; }
.machine .leds i { box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 55%, transparent); }
.payline { box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 0 8px color-mix(in srgb, var(--accent) 20%, transparent); }
.btn-spin, .rc-links .main {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #FFFFFF), var(--accent) 60%, color-mix(in srgb, var(--accent) 85%, #000000));
  box-shadow: inset 0 1px 0 #FFFFFF59, 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-quiet { background: linear-gradient(180deg, var(--face-top), var(--face-bot)); box-shadow: inset 0 1px 0 var(--edge-hi), var(--drop); }
.brand-icon { width: 34px; height: 34px; border-radius: 9px; display: block; box-shadow: 0 0 0 1px #FFFFFF14, 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
[data-hc="1"] .bar > button, [data-hc="1"] .result-card, [data-hc="1"] .pill, [data-hc="1"] .icon-btn, [data-hc="1"] .machine,
[data-hc="1"] .bar-cta, [data-hc="1"] .rc-links a, [data-hc="1"] .btn, [data-hc="1"] .reel, [data-hc="1"] .reels {
  background: #000000; box-shadow: none;
}
[data-hc="1"] .btn-spin, [data-hc="1"] .rc-links .main { background: var(--accent); }
[data-hc="1"] .reels { border-color: #FFFFFF; }
[data-hc="1"] .leds i, [data-hc="1"] .payline, [data-hc="1"] .brand-icon { box-shadow: none; }

/* ---------- Scenario art (Oct 26): machine frame + metal card panels ----------
   Scenario drew the metal with EMPTY grooves; every glow is drawn here in code so it follows
   the accent color and stays the same across the page. High contrast falls back to flat. */
:root, [data-theme="dark"] { --panel: url(/assets/panel-dark.webp); }
[data-theme="light"] { --panel: url(/assets/panel-light.webp); }
/* Bright accent for glows on the dark machine (same in light mode so it reads on dark metal). */
:root, [data-accent="blue"] { --glow: #5B9BFF; }
[data-accent="emerald"] { --glow: #34D399; } [data-accent="amber"] { --glow: #FBBF24; } [data-accent="violet"] { --glow: #A78BFA; }
[data-cb="1"] { --glow: #E69F00; }

.bar > button, .result-card, .pill, .icon-btn, .bar-cta, .rc-links a:not(.main), .btn-quiet, .sheet {
  background: transparent; border-color: transparent;

  box-shadow: none;
}
.bar > button, .result-card, .pill, .icon-btn { filter: drop-shadow(0 6px 10px #00000059); }
[data-theme="light"] .bar > button, [data-theme="light"] .result-card, [data-theme="light"] .pill, [data-theme="light"] .icon-btn { filter: drop-shadow(0 5px 9px #0F11152E); }
.result-card { animation: rise .45s cubic-bezier(.2,.9,.3,1) both; }

/* Machine: the Scenario frame (1391 x 564) with everything live laid over its slots and grooves. */
.machine {
  position: relative; aspect-ratio: 1391 / 564; padding: 0; gap: 0; display: block;
  background: url(/assets/machine-frame.webp) center / 100% 100% no-repeat; border: none; border-radius: 0;
  box-shadow: none; filter: drop-shadow(0 10px 18px #00000080) drop-shadow(0 0 18px color-mix(in srgb, var(--glow) 28%, transparent));
}
[data-theme="light"] .machine { filter: drop-shadow(0 10px 16px #0F111540) drop-shadow(0 0 16px color-mix(in srgb, var(--glow) 30%, transparent)); }
.machine .leds { position: absolute; left: 3.6%; right: 3.8%; top: 5.9%; height: 4.1%; padding: 0 2px; align-items: center; gap: 3px; }
.machine .leds-bottom { top: auto; bottom: 7.9%; margin: 0; }
.machine .leds i { height: 55%; min-height: 3px; border-radius: 3px; background: var(--glow); opacity: .4; box-shadow: 0 0 6px color-mix(in srgb, var(--glow) 70%, transparent); }
.machine .reels { position: absolute; inset: 0; display: block; height: auto; padding: 0; background: none; border: none; box-shadow: none; border-radius: 0; }
.machine .reel { position: absolute; top: 16.9%; height: 63.9%; border-radius: 9px; overflow: hidden;
  background: linear-gradient(180deg, #000000A6, transparent 32%, transparent 68%, #000000A6); box-shadow: none; }
.machine .reel:nth-child(1) { left: 3.9%; width: 44.0%; }
.machine .reel:nth-child(2) { left: 51.0%; width: 21.1%; }
.machine .reel:nth-child(3) { left: 75.2%; width: 20.7%; }
.reel-label { position: absolute; top: 4px; left: 0; right: 0; z-index: 2; text-align: center; font-size: .56em; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #9CA3AF; white-space: nowrap; }
.machine .strip { top: 12px; gap: 7px; }
.machine .strip .row { color: #A9B0BA; font-size: .72em; }
.machine .strip .row.mid { color: #F3F4F6; font-size: .9em; padding: 0; line-height: 1.1; }
.machine .empty-reel { color: #A9B0BA; }
.machine .payline { left: 3.2%; right: 3.4%; width: auto; top: calc(48.9% + 6px); height: calc(30px * var(--text-scale)); border-color: var(--glow);
  box-shadow: 0 0 10px color-mix(in srgb, var(--glow) 55%, transparent), inset 0 0 8px color-mix(in srgb, var(--glow) 25%, transparent); }
.machine .payline-arrow { border-left-color: var(--glow); }
[data-text="2"] .machine, [data-text="3"] .machine { aspect-ratio: auto; height: calc(180px * var(--text-scale)); }

/* High contrast: no images, flat black with white outlines. */
[data-hc="1"] .bar > button, [data-hc="1"] .result-card, [data-hc="1"] .pill, [data-hc="1"] .icon-btn, [data-hc="1"] .bar-cta,
[data-hc="1"] .rc-links a:not(.main), [data-hc="1"] .btn-quiet, [data-hc="1"] .sheet { border-image: none; border-color: #FFFFFF; background: #000000; filter: none; }
[data-hc="1"] .machine { background: #000000; border: 2px solid #FFFFFF; border-radius: 16px; filter: none; }
[data-hc="1"] .machine .reel { outline: 2px solid #FFFFFF; background: #000000; }
[data-hc="1"] { --glow: #FFE600; }
[data-hc="1"] .reel-label, [data-hc="1"] .machine .strip .row { color: #FFFFFF; }
[data-hc="1"] .btn-go { background: #000000; color: #FFFFFF; border: 2px solid #FFFFFF; }

/* ---------- One metal style for every card and button (Oct 26) ----------
   metal-overlay.webp is the Scenario panel turned into pure shading (brushed lines, lit top edge,
   shadowed bottom). It sits on top of a plain color, so every surface is the same metal in a
   different tint: graphite / aluminum for cards, the accent for Spin + Photos, silver for Let's go. */
:root, [data-theme="dark"] { --metal: #2B2E35; --metal-ink: #F3F4F6; --metal-alt: #D9DCE2; --metal-alt-ink: #0F1115; --frame: url(/assets/machine-frame.webp); --card-drop: 0 6px 12px #00000066; }
[data-theme="light"] { --metal: #E3E6EB; --metal-ink: #0F1115; --metal-alt: #2B2E35; --metal-alt-ink: #F3F4F6; --frame: url(/assets/machine-frame-light.webp); --card-drop: 0 4px 10px #0F11152B; }
.bar > button, .result-card, .pill, .icon-btn, .bar-cta, .rc-links a, .btn, .sheet {
  background: var(--metal); color: var(--metal-ink); border: 1px solid transparent; border-radius: 14px;
  border-image: var(--metal-tex) 22 fill / 14px stretch round;
  box-shadow: none; filter: drop-shadow(var(--card-drop));
}
.pill { border-radius: 14px; }
.icon-btn { border-radius: 14px; }
.sheet { border-radius: 22px 22px 0 0; filter: none; }
.bar-cta, .rc-links a { filter: drop-shadow(0 2px 3px #00000040); }
.result-card .rc-links a:not(.main), .bar-cta { background: color-mix(in srgb, var(--metal) 88%, var(--metal-ink)); }
.btn-spin, .rc-links .main { background: var(--accent); color: var(--accent-ink);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 40%, transparent)) drop-shadow(var(--card-drop)); }
.btn-go { background: var(--metal-alt); color: var(--metal-alt-ink); }
.btn-spin::before, .rc-links .main::before { content: none; }
.machine { background-image: var(--frame); }
[data-theme="light"] .machine { filter: drop-shadow(0 8px 14px #0F111533) drop-shadow(0 0 14px color-mix(in srgb, var(--glow) 25%, transparent)); }
[data-theme="light"] .reel-label { color: #B8BEC8; }
/* Header: icon and title the same height as the Friends / Settings buttons. */
.brand { gap: 10px; min-width: 0; }
.brand-icon { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.brand h1 { font-size: calc(24px * var(--text-scale)); white-space: nowrap; }
.pill { min-height: 44px; }
@media (max-width: 380px) { .brand h1 { font-size: calc(21px * var(--text-scale)); } .pill { padding: 0 10px; } }
/* High contrast: no texture, flat black, white outlines. */
[data-hc="1"] .bar > button, [data-hc="1"] .result-card, [data-hc="1"] .pill, [data-hc="1"] .icon-btn, [data-hc="1"] .bar-cta,
[data-hc="1"] .rc-links a, [data-hc="1"] .btn, [data-hc="1"] .sheet { border-image: none; background: #000000; color: #FFFFFF; border: 2px solid #FFFFFF; filter: none; }
[data-hc="1"] .btn-spin, [data-hc="1"] .rc-links .main { background: var(--accent); color: #000000; border-color: var(--accent); }
/* Sheets (Settings, Filters, Friends…): plain dark backdrop so the metal cards inside stand out;
   the inner groups, preview and chosen options get the same metal as the main page. */
.sheet { background: var(--bg); border-image: none; border: 1px solid var(--border); border-bottom: none; }
.card, .preview { background: var(--metal); color: var(--metal-ink); border: 1px solid transparent; border-radius: 14px;
  border-image: var(--metal-tex) 22 fill / 14px stretch round; filter: drop-shadow(var(--card-drop)); }
.seg { background: color-mix(in srgb, var(--metal) 70%, #000000); border-color: transparent; }
[data-theme="light"] .seg { background: color-mix(in srgb, var(--metal) 85%, #000000); }
.seg button[aria-checked="true"] { background: var(--metal-alt); color: var(--metal-alt-ink); border-image: var(--metal-tex) 22 fill / 10px stretch; border: 1px solid transparent; }
.accents button { background: color-mix(in srgb, var(--metal) 70%, #000000); }
[data-theme="light"] .accents button { background: color-mix(in srgb, var(--metal) 88%, #000000); }
.preview .preview-btn { border: 1px solid transparent; border-image: var(--metal-tex) 22 fill / 10px stretch; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 40%, transparent)); }
[data-hc="1"] .card, [data-hc="1"] .preview { border-image: none; background: #000000; color: #FFFFFF; border: 2px solid #FFFFFF; filter: none; }
[data-hc="1"] .seg button[aria-checked="true"], [data-hc="1"] .preview .preview-btn { border-image: none; background: #FFFFFF; color: #000000; filter: none; }
[data-hc="1"] .seg, [data-hc="1"] .accents button { background: #000000; }
/* Owner's choice (Oct 26): only Spin is the accent color; Photos and Let's go are plain metal like the rest. */
.rc-links .main, .btn-go { background: var(--metal); color: var(--metal-ink); filter: drop-shadow(var(--card-drop)); }
.result-card .rc-links .main { background: color-mix(in srgb, var(--metal) 88%, var(--metal-ink)); filter: drop-shadow(0 2px 3px #00000040); }
[data-hc="1"] .rc-links .main, [data-hc="1"] .btn-go { background: #000000; color: #FFFFFF; border: 2px solid #FFFFFF; }
.result-card .rc-links a, .result-card .rc-links a.main { background: color-mix(in srgb, var(--metal) 88%, var(--metal-ink)); color: var(--metal-ink); box-shadow: none; filter: drop-shadow(0 2px 3px #00000040); }
.result-card .rc-links a.main::before { content: none; }
[data-hc="1"] .result-card .rc-links a { background: #000000; color: #FFFFFF; border: 2px solid #FFFFFF; filter: none; }
.machine .reel:nth-child(3) .reel-label { letter-spacing: 0; font-size: .52em; }
