@font-face { font-family: "Anton"; src: url("/fonts/Anton.woff2") format("woff2"); font-display: swap; }
:root {
  --bg: #050506;
  --ink: #f3f1ec;
  --soft: #d4d2cc;
  --mute: #9d9ba3;
  --dim: #6c6a72;
  --line: rgba(255, 255, 255, .1);
  --line2: rgba(255, 255, 255, .18);
  --glass: rgba(10, 10, 13, .72);
  --glass2: rgba(16, 16, 20, .86);
  --gold: #d9b45e;
  --gold-hi: #f0d28c;
  --gold-lo: #8a6f33;
  --teal: #46c6c4;
  --orange: #f08a2a;
  --red: #e2574c;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--body); overflow: hidden; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hidden { display: none !important; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
.eyebrow { font-weight: 600; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
a.back { color: var(--soft); text-decoration: none; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; padding: 8px 2px; white-space: nowrap; }
a.back:hover { color: var(--gold-hi); }

/* coins */
.coins { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 9px; border: 1px solid var(--line2); background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 700; font-size: 14px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.coins.sm { padding: 5px 10px 5px 7px; font-size: 13px; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1c2, var(--gold) 45%, #8a6a2a 100%); box-shadow: inset 0 0 0 2px rgba(120, 90, 30, .55), 0 0 10px rgba(217, 180, 94, .35); position: relative; }
.coin::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1px solid rgba(255, 245, 210, .6); }
.coins.bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.12); border-color: var(--gold); } }

/* buttons */
.btn { appearance: none; border: 1px solid var(--gold); background: var(--gold); color: #141109; padding: 12px 20px; font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; border-radius: 2px; transition: background .2s, color .2s, border-color .2s, transform .15s; min-height: 44px; }
.btn:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold-hi); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line2); background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 2px; font-size: 16px; }
.icon-btn:hover { border-color: var(--gold); }
.icon-btn .bars { width: 12px; height: 12px; border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line2); background: rgba(0, 0, 0, .4); border-radius: 2px; overflow: hidden; }
.seg button { appearance: none; border: 0; background: transparent; padding: 8px 12px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); border-right: 1px solid var(--line); min-height: 36px; transition: color .2s, background .2s; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: rgba(217, 180, 94, .16); color: var(--gold-hi); box-shadow: inset 0 -2px 0 var(--gold); }
.chip-btn { appearance: none; border: 1px solid var(--line2); background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 8px 12px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); border-radius: 2px; min-height: 36px; }
.chip-btn b { color: var(--gold-hi); font-weight: 700; }
.chip-btn:hover { border-color: var(--gold); color: var(--ink); }
.chip-btn[disabled] { opacity: .35; pointer-events: none; }
.chip-btn.on { border-color: var(--gold); color: var(--gold-hi); }

/* screens */
.screen { position: fixed; inset: 0; z-index: 20; }
#loader { display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #12131a, #050506 70%); z-index: 60; transition: opacity .8s ease; }
#loader.fade { opacity: 0; pointer-events: none; }
.loader-in { display: grid; justify-items: center; gap: 16px; }
.loader-in img { width: 180px; height: auto; }
.loader-in .bar { width: 220px; height: 2px; background: var(--line); overflow: hidden; }
.loader-in .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transition: width .3s ease; }

/* main menu */
#menu { pointer-events: none; }
#menu > * { pointer-events: auto; }
#menu::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5, 5, 6, .94) 0%, rgba(5, 5, 6, .78) 30%, rgba(5, 5, 6, .1) 58%, transparent 75%); pointer-events: none; }
.menu-top { position: absolute; top: calc(14px + var(--sa-t)); left: calc(22px + var(--sa-l)); right: calc(22px + var(--sa-r)); display: flex; justify-content: space-between; align-items: center; z-index: 2; }
.menu-panel { position: absolute; left: calc(clamp(20px, 5vw, 72px) + var(--sa-l)); top: 50%; transform: translateY(-50%); width: min(440px, 88vw); display: grid; gap: 22px; z-index: 2; animation: rise .9s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(calc(-50% + 18px)); } }
.brand { display: grid; gap: 6px; }
.brand-logo { width: 150px; height: auto; margin-bottom: 6px; }
.brand h1 { margin: 0; font-family: "Anton", var(--display); font-weight: 400; font-size: clamp(64px, 9vw, 112px); line-height: .9; letter-spacing: .01em; text-transform: uppercase; background: linear-gradient(180deg, #fff 0%, #f3e3b8 55%, var(--gold) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.modes { display: grid; gap: 10px; }
.mode-btn { appearance: none; display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 12px; text-align: left; width: 100%; padding: 15px 18px; border: 1px solid var(--line2); background: rgba(10, 10, 12, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 2px; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.mode-btn:hover { border-color: var(--gold); background: rgba(217, 180, 94, .08); transform: translateX(3px); }
.mode-btn.primary { border-color: rgba(217, 180, 94, .6); background: linear-gradient(90deg, rgba(217, 180, 94, .16), rgba(10, 10, 12, .55)); }
.mode-name { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .02em; text-transform: uppercase; font-stretch: 85%; }
.mode-sub { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.mode-btn .arrow { color: var(--gold); font-size: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-btn.half { grid-template-columns: 1fr; gap: 2px; }
.seg.diff { width: 100%; margin-top: -4px; }
.seg.diff button { flex: 1; }
.menu-links { display: flex; flex-wrap: wrap; gap: 8px; }
.link-btn { appearance: none; border: 1px solid var(--line); background: transparent; padding: 10px 14px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--soft); border-radius: 2px; min-height: 40px; }
.link-btn:hover { border-color: var(--gold); color: var(--gold-hi); }
.link-btn.gold { border-color: rgba(217, 180, 94, .55); color: var(--gold-hi); }
.link-btn .ic { margin-right: 8px; font-size: 9px; vertical-align: 1px; }
.menu-foot { position: absolute; bottom: calc(14px + var(--sa-b)); right: calc(22px + var(--sa-r)); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); z-index: 2; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud #toast, #hud #pockets, #hud #callHint, #hud #think, #hud #placeHint { pointer-events: none; }
.topbar { position: absolute; top: calc(10px + var(--sa-t)); left: calc(12px + var(--sa-l)); right: calc(12px + var(--sa-r)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.tb-left { display: flex; align-items: center; gap: 10px; }
.tb-right { display: flex; justify-content: flex-end; }
.scoreboard { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr); align-items: stretch; background: linear-gradient(180deg, rgba(14, 14, 17, .86), rgba(8, 8, 10, .78)); border: 1px solid var(--line2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 2px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.pl { padding: 8px 14px 9px; display: grid; gap: 6px; position: relative; transition: background .4s; }
.pl::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--gold); transform: scaleX(0); transition: transform .5s var(--ease); }
.pl.active::after { transform: scaleX(1); }
.pl.active { background: linear-gradient(180deg, rgba(217, 180, 94, .1), transparent); }
.pl.right { text-align: right; }
.pl-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pl.right .pl-name { justify-content: flex-end; }
.pl .nm { overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.turn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.pl.active .turn-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.pl-balls { display: flex; gap: 3px; min-height: 18px; align-items: center; }
.pl.right .pl-balls { justify-content: flex-end; }
.pl-balls .lbl { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.chip { width: 17px; height: 17px; border-radius: 50%; flex: none; position: relative; box-shadow: inset -2px -3px 4px rgba(0, 0, 0, .35), inset 2px 2px 3px rgba(255, 255, 255, .25); font-size: 8px; font-weight: 800; display: grid; place-items: center; color: #111; transition: opacity .4s, transform .4s; }
.chip span { width: 9px; height: 9px; border-radius: 50%; background: #f4f1e8; display: grid; place-items: center; line-height: 1; font-size: 6.5px; }
.chip.gone { opacity: .18; transform: scale(.82); filter: grayscale(.6); }
.sb-mid { display: grid; place-items: center; align-content: center; gap: 2px; padding: 6px 16px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.sb-mid img { width: 72px; height: auto; display: block; }
.sb-mode { font-size: 9px; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
#toast { position: absolute; top: calc(92px + var(--sa-t)); left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 6px; z-index: 3; }
.toast { padding: 9px 18px; background: rgba(8, 8, 10, .82); border: 1px solid var(--line2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; font-weight: 600; letter-spacing: .06em; white-space: nowrap; animation: tin .45s var(--ease) both; border-radius: 2px; }
.toast.gold { border-color: var(--gold); color: var(--gold-hi); }
.toast.foul { border-color: rgba(226, 87, 76, .7); color: #ffb3ab; }
.toast.big { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 12px 26px; font-stretch: 85%; }
.toast.out { animation: tout .5s ease both; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
@keyframes tout { to { opacity: 0; transform: translateY(-6px); } }
#think { position: absolute; bottom: calc(26px + var(--sa-b)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 9px 16px; background: rgba(8, 8, 10, .78); border: 1px solid var(--line2); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); font-weight: 600; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: dot 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 40% { transform: translateY(-4px); opacity: 1; } 0%, 80%, 100% { opacity: .35; } }
#placeHint, #callHint { position: absolute; bottom: calc(84px + var(--sa-b)); left: 50%; transform: translateX(-50%); padding: 8px 14px; background: rgba(8, 8, 10, .75); border: 1px solid rgba(217, 180, 94, .5); color: var(--gold-hi); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; white-space: nowrap; }
#pockets .pk { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; border: 2px dashed rgba(240, 210, 140, .55); pointer-events: auto; background: rgba(0, 0, 0, .15); transition: border-color .2s, background .2s, transform .2s; }
#pockets .pk.on { border: 2px solid var(--gold-hi); background: rgba(217, 180, 94, .25); box-shadow: 0 0 22px rgba(217, 180, 94, .6); transform: scale(1.08); }
#pockets .pk.on::after { content: "8"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px; }

/* power bar */
.power { position: absolute; right: calc(14px + var(--sa-r)); top: 50%; transform: translateY(-46%); width: 58px; height: min(52vh, 380px); display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 8px; padding: 10px 0; background: linear-gradient(180deg, rgba(14, 14, 17, .8), rgba(8, 8, 10, .7)); border: 1px solid var(--line2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); touch-action: none; cursor: ns-resize; border-radius: 2px; }
body.lefty .power { right: auto; left: calc(14px + var(--sa-l)); }
.pw-label, .pw-val { font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--mute); font-weight: 700; }
.pw-val { color: var(--gold-hi); font-size: 12px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.pw-track { position: relative; width: 14px; height: 100%; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); overflow: visible; }
.pw-fill { position: absolute; left: 0; right: 0; top: 0; height: 0; background: linear-gradient(180deg, #f0d28c, var(--gold) 40%, var(--orange) 75%, #e2574c); box-shadow: 0 0 14px rgba(240, 138, 42, .45); }
.pw-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 calc(10% - 1px), rgba(255, 255, 255, .16) calc(10% - 1px) 10%); pointer-events: none; }
.pw-cue { position: absolute; left: 50%; top: -6px; width: 34px; height: 12px; margin-left: -17px; background: linear-gradient(180deg, #f3eee2, #cdbf9f); border-radius: 2px; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.pw-cue::before { content: ""; position: absolute; left: 50%; top: -5px; width: 8px; height: 5px; margin-left: -4px; background: #2d5e9c; border-radius: 2px 2px 0 0; }
.power.charging { border-color: var(--gold); }
.power.disabled { opacity: .35; pointer-events: none; }

/* bottom-left controls */
.ctl-left { position: absolute; left: calc(12px + var(--sa-l)); bottom: calc(12px + var(--sa-b)); display: grid; gap: 8px; justify-items: start; }
body.lefty .ctl-left { left: calc(86px + var(--sa-l)); }
.ctl-row { display: flex; gap: 6px; flex-wrap: wrap; }
.seg.cams button { padding: 8px 14px; }

/* fine aim */
.fine { position: absolute; left: 50%; bottom: calc(12px + var(--sa-b)); transform: translateX(-50%); display: flex; align-items: stretch; height: 44px; border: 1px solid var(--line2); background: rgba(8, 8, 10, .7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 2px; touch-action: none; }
.fine-nudge { appearance: none; border: 0; background: transparent; width: 40px; font-size: 22px; color: var(--soft); }
.fine-nudge:hover { color: var(--gold-hi); }
.fine-strip { position: relative; width: min(280px, 34vw); overflow: hidden; border-left: 1px solid var(--line); border-right: 1px solid var(--line); cursor: ew-resize; touch-action: none; }
.fine-ticks { position: absolute; inset: 0 -40px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .28) 0 1px, transparent 1px 8px), repeating-linear-gradient(90deg, rgba(217, 180, 94, .6) 0 1px, transparent 1px 40px); background-size: auto 40%, auto 70%; background-repeat: repeat-x; background-position: 0 50%, 0 50%; -webkit-mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
.fine-strip span { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: 8px; letter-spacing: .26em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.fine-strip::after { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* spin mini */
.spin-mini { position: absolute; right: calc(86px + var(--sa-r)); bottom: calc(12px + var(--sa-b)); appearance: none; display: grid; justify-items: center; gap: 4px; padding: 8px 10px 6px; border: 1px solid var(--line2); background: rgba(8, 8, 10, .7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 2px; }
body.lefty .spin-mini { right: calc(12px + var(--sa-r)); }
.spin-mini:hover { border-color: var(--gold); }
.sm-ball { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff, #ece7da 45%, #b9b2a2 100%); position: relative; box-shadow: 0 3px 10px rgba(0, 0, 0, .5); }
.sm-ball i, #spinBig { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #d0242c; left: 50%; top: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .8); }
.sm-lbl { font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: var(--mute); font-weight: 700; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(3, 3, 4, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 16px; animation: fade .3s ease both; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(420px, 100%); background: linear-gradient(180deg, rgba(20, 20, 24, .97), rgba(10, 10, 12, .97)); border: 1px solid var(--line2); padding: 26px 26px 22px; border-radius: 2px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); display: grid; gap: 14px; animation: pop .4s var(--ease) both; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-card.wide { width: min(640px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.m-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .01em; text-transform: uppercase; font-stretch: 85%; line-height: 1; }
.m-title.big { font-family: "Anton", var(--display); font-weight: 400; font-size: 56px; background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stack { display: grid; gap: 8px; }
.stack.row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.fine-print { font-size: 12px; color: var(--mute); margin: 0; min-height: 1em; }
.over-sub { margin: 0; color: var(--soft); font-size: 14px; }
.earn { display: grid; gap: 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.earn:empty { display: none; }
.earn .ln { display: flex; justify-content: space-between; font-size: 13px; color: var(--soft); }
.earn .ln b { color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.earn .ln.tot { font-weight: 700; color: var(--ink); font-size: 15px; padding-top: 6px; border-top: 1px dashed var(--line); }

/* spin panel */
.spin-card { width: min(460px, 100%); }
.spin-wrap { display: grid; grid-template-columns: 1fr 140px; gap: 22px; align-items: center; }
.spin-ball { width: min(210px, 52vw); aspect-ratio: 1; border-radius: 50%; position: relative; background: radial-gradient(circle at 36% 30%, #ffffff, #efeadd 42%, #b7b0a0 100%); box-shadow: 0 16px 40px rgba(0, 0, 0, .55), inset -10px -14px 30px rgba(0, 0, 0, .18); cursor: crosshair; touch-action: none; justify-self: center; }
.spin-cross { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(rgba(0, 0, 0, .14), rgba(0, 0, 0, .14)) 50% 0 / 1px 100% no-repeat, linear-gradient(90deg, rgba(0, 0, 0, .14), rgba(0, 0, 0, .14)) 0 50% / 100% 1px no-repeat; }
.spin-lim { position: absolute; border-radius: 50%; border: 1px dashed rgba(0, 0, 0, .3); left: 50%; top: 50%; transform: translate(-50%, -50%); }
#spinBig { width: 22px; height: 22px; margin: -11px 0 0 -11px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 4px 10px rgba(0, 0, 0, .4); }
.elev { display: grid; gap: 10px; justify-items: center; }
.elev-arc { width: 120px; height: 70px; position: relative; border-bottom: 2px solid var(--line2); }
.elev-arc::before { content: ""; position: absolute; left: 6px; bottom: 0; width: 22px; height: 22px; border-radius: 50%; background: #efeadd; }
.elev-cue { position: absolute; left: 30px; bottom: 9px; width: 90px; height: 5px; background: linear-gradient(90deg, #2d5e9c 0 4px, #f3efe6 4px 9px, #e2cfa3 9px 60%, #3a1a10 60%); transform-origin: 0 50%; border-radius: 2px; }
.elev input { width: 120px; accent-color: var(--gold); }
.elev-val { font-size: 11px; color: var(--mute); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.spin-info { font-size: 13px; color: var(--soft); text-align: center; min-height: 1.2em; }

/* settings */
.set-list { display: grid; gap: 2px; }
.set { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); font-weight: 600; }
.set input[type=range] { width: 200px; accent-color: var(--gold); }
.nm-in { display: flex; gap: 8px; }
.nm-in input { width: 130px; background: rgba(0, 0, 0, .4); border: 1px solid var(--line2); color: var(--ink); padding: 9px 10px; font: inherit; font-size: 13px; border-radius: 2px; user-select: text; -webkit-user-select: text; }
.nm-in input:focus { border-color: var(--gold); outline: none; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: #0d0d10; padding: 14px; display: grid; gap: 4px; }
.stat b { font-family: var(--display); font-size: 28px; font-weight: 800; font-stretch: 85%; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); font-weight: 600; }

/* help */
.help-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px 22px; }
.help-cols h3 { margin: 0 0 4px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.help-cols p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--soft); }

/* shop */
#shop { pointer-events: none; }
#shop > * { pointer-events: auto; }
.shop-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(430px, 100vw); background: linear-gradient(90deg, rgba(6, 6, 8, .96), rgba(8, 8, 10, .9)); border-right: 1px solid var(--line); display: grid; grid-template-rows: auto auto 1fr; padding: calc(16px + var(--sa-t)) 0 0 var(--sa-l); animation: slidein .5s var(--ease) both; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } }
.shop-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 0 18px 14px; }
.shop-head h2 { margin: 2px 0 0; font-family: var(--display); font-weight: 800; font-size: 24px; text-transform: uppercase; font-stretch: 85%; line-height: 1; }
.tabs { display: flex; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; appearance: none; border: 0; background: transparent; padding: 13px 4px; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); border-right: 1px solid var(--line); min-height: 44px; }
.tabs button:last-child { border-right: 0; }
.tabs button.on { color: var(--gold-hi); box-shadow: inset 0 -2px 0 var(--gold); background: rgba(217, 180, 94, .06); }
.items { overflow-y: auto; padding: 12px 14px calc(18px + var(--sa-b)); display: grid; gap: 10px; align-content: start; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.item { appearance: none; text-align: left; display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); border-radius: 2px; transition: border-color .2s, background .2s; position: relative; }
.item:hover { border-color: var(--line2); background: rgba(255, 255, 255, .04); }
.item.sel { border-color: var(--gold); background: rgba(217, 180, 94, .07); }
.item .sw { width: 72px; height: 54px; border-radius: 2px; overflow: hidden; border: 1px solid var(--line); background: #111 center / cover no-repeat; }
.item .sw canvas { width: 100%; height: 100%; display: block; }
.item .nm { font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.item .tg { font-size: 12px; color: var(--mute); margin-top: 2px; }
.item .st { display: flex; gap: 8px; margin-top: 6px; align-items: center; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.item .price { color: var(--gold-hi); display: inline-flex; align-items: center; gap: 5px; }
.item .price .coin { width: 12px; height: 12px; }
.item .own { color: var(--teal); }
.item .eq { color: #141109; background: var(--gold); padding: 2px 6px; }
.item .legend-tag { color: #ffd77a; border: 1px solid rgba(255, 215, 122, .5); padding: 1px 5px; }
.shop-detail { position: absolute; right: calc(18px + var(--sa-r)); bottom: calc(18px + var(--sa-b)); width: min(380px, calc(100vw - 470px)); background: linear-gradient(180deg, rgba(16, 16, 20, .9), rgba(8, 8, 10, .88)); border: 1px solid var(--line2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 18px; display: grid; gap: 12px; border-radius: 2px; animation: pop .4s var(--ease) both; }
.shop-detail h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 24px; text-transform: uppercase; font-stretch: 85%; line-height: 1; }
.shop-detail p { margin: 0; font-size: 13px; color: var(--soft); }
.bars { display: grid; gap: 7px; }
.statbar { display: grid; grid-template-columns: 70px 1fr 22px; gap: 10px; align-items: center; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); font-weight: 700; }
.statbar .tr { height: 6px; background: rgba(255, 255, 255, .07); position: relative; }
.statbar .tr i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); }
.statbar .tr i.up { box-shadow: 0 0 8px rgba(70, 198, 196, .6); background: linear-gradient(90deg, #2d8a88, var(--teal)); }
.statbar b { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.detail-actions { display: flex; gap: 8px; }
.detail-actions .btn { flex: 1; }
.cant { font-size: 12px; color: #ffb3ab; }

#flash { position: fixed; inset: 0; pointer-events: none; z-index: 50; background: radial-gradient(ellipse at center, rgba(217, 180, 94, .18), transparent 60%); opacity: 0; transition: opacity .6s ease; }
#flash.on { opacity: 1; transition: none; }
.float-coin { position: fixed; z-index: 30; pointer-events: none; font-weight: 800; color: var(--gold-hi); font-size: 14px; letter-spacing: .04em; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); animation: floatup 1.4s var(--ease) forwards; }
@keyframes floatup { to { transform: translateY(-34px); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .shop-detail { width: auto; left: calc(min(430px, 100vw) + 14px); }
}
@media (max-height: 520px) {
  /* phone landscape */
  .menu-panel { gap: 10px; top: calc(50% + 14px); width: min(400px, 60vw); }
  .brand { grid-template-columns: auto 1fr; align-items: end; column-gap: 14px; }
  .brand-logo { width: 96px; margin: 0; grid-row: span 2; align-self: center; }
  .brand h1 { font-size: 48px; }
  .modes { gap: 6px; }
  .mode-btn { padding: 8px 14px; }
  .mode-name { font-size: 16px; }
  .seg button { min-height: 30px; padding: 6px 10px; }
  .link-btn { min-height: 32px; padding: 6px 10px; }
  .menu-foot { display: none; }
  .topbar { top: calc(6px + var(--sa-t)); }
  .pl { padding: 5px 10px 6px; gap: 4px; }
  .scoreboard { grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr); }
  .sb-mid img { width: 52px; }
  .chip { width: 14px; height: 14px; }
  .chip span { width: 7px; height: 7px; font-size: 5px; }
  .power { height: calc(100dvh - 120px); top: auto; bottom: calc(10px + var(--sa-b)); transform: none; width: 52px; }
  #toast { top: calc(64px + var(--sa-t)); }
  .toast { font-size: 12px; padding: 7px 14px; }
  .toast.big { font-size: 17px; padding: 9px 18px; }
  .fine { height: 38px; }
  .seg.cams button { padding: 6px 10px; }
  .chip-btn { min-height: 30px; padding: 6px 9px; }
  .spin-mini { right: calc(76px + var(--sa-r)); padding: 5px 8px 4px; }
  .sm-ball { width: 34px; height: 34px; }
  .modal-card { padding: 18px; gap: 10px; }
  .m-title.big { font-size: 40px; }
  .shop-panel { width: min(360px, 50vw); }
  .shop-head { padding-bottom: 8px; }
  .shop-head h2 { font-size: 18px; }
  .tabs button { min-height: 36px; padding: 8px 2px; }
  .item { grid-template-columns: 56px 1fr; padding: 8px; gap: 10px; }
  .item .sw { width: 56px; height: 42px; }
  .shop-detail { left: auto; width: min(320px, 44vw); padding: 12px; gap: 8px; right: calc(10px + var(--sa-r)); bottom: calc(10px + var(--sa-b)); }
  .shop-detail h3 { font-size: 18px; }
  .spin-wrap { grid-template-columns: 1fr 130px; }
  .spin-ball { width: min(150px, 40vh); }
}
@media (max-width: 700px) and (orientation: portrait) {
  #menu::before { background: linear-gradient(180deg, rgba(5, 5, 6, .55) 0%, rgba(5, 5, 6, .85) 45%, rgba(5, 5, 6, .96) 100%); }
  .menu-panel { top: auto; bottom: calc(18px + var(--sa-b)); transform: none; left: 16px; right: 16px; width: auto; gap: 14px; animation: none; }
  .brand h1 { font-size: 64px; }
  .brand-logo { width: 110px; }
  .menu-foot { display: none; }
  .topbar { grid-template-columns: auto 1fr; grid-template-rows: auto auto; left: 8px; right: 8px; }
  .tb-left .back { display: none; }
  .scoreboard { grid-column: 1 / -1; grid-row: 2; grid-template-columns: 1fr auto 1fr; }
  .tb-right { grid-column: 2; grid-row: 1; }
  .pl { padding: 6px 8px; }
  .pl .nm { max-width: 90px; }
  .sb-mid { padding: 4px 8px; }
  .sb-mid img { width: 44px; }
  .chip { width: 13px; height: 13px; }
  .chip span { width: 7px; height: 7px; font-size: 5px; }
  .pl-balls { gap: 2px; flex-wrap: wrap; }
  #toast { top: calc(122px + var(--sa-t)); }
  .power { height: 34vh; top: auto; bottom: calc(118px + var(--sa-b)); transform: none; width: 50px; right: 8px; }
  .fine { left: 8px; right: 8px; transform: none; bottom: calc(10px + var(--sa-b)); }
  .fine-strip { flex: 1; width: auto; }
  .ctl-left { bottom: calc(62px + var(--sa-b)); left: 8px; }
  .spin-mini { right: 8px; bottom: calc(62px + var(--sa-b)); }
  #placeHint, #callHint { bottom: calc(112px + var(--sa-b)); white-space: normal; text-align: center; width: max-content; max-width: 80vw; }
  #think { bottom: calc(112px + var(--sa-b)); }
  .shop-panel { width: 100vw; bottom: 46vh; border-right: 0; border-bottom: 1px solid var(--line); grid-template-rows: auto auto 1fr; }
  .shop-detail { left: 10px; right: 10px; width: auto; bottom: calc(10px + var(--sa-b)); }
  .spin-wrap { grid-template-columns: 1fr; }
  .stack.row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* chalk: heavy spin wears the tip; a worn tip can miscue */
.chalk-btn { position: absolute; right: calc(160px + var(--sa-r)); bottom: calc(12px + var(--sa-b)); appearance: none; display: grid; justify-items: center; gap: 4px; padding: 8px 10px 6px; border: 1px solid var(--line2); background: rgba(8, 8, 10, .7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 2px; cursor: pointer; }
body.lefty .chalk-btn { right: auto; left: calc(12px + var(--sa-l, 0px)); }
.chalk-btn:hover { border-color: var(--gold); }
.chalk-cube { width: 26px; height: 26px; border-radius: 3px; background: linear-gradient(145deg, #4f7fe8, #1f46b4 60%, #16348a); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 3px 10px rgba(0,0,0,.5); position: relative; }
.chalk-cube::after { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: radial-gradient(circle, #0c1f5a, #1a3a96); }
.chalk-meter { width: 34px; height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.chalk-meter i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #f05a4a, #f0c04a 40%, #5aa0ff); transition: width .3s; }
.chalk-btn.low { animation: chalkPulse 1.4s ease-in-out infinite; border-color: #f0a04a; }
@keyframes chalkPulse { 50% { box-shadow: 0 0 18px rgba(240,160,74,.6); } }
@media (max-width: 720px) { .chalk-btn { right: calc(132px + var(--sa-r)); padding: 5px 8px 4px; } .chalk-cube { width: 20px; height: 20px; } }

/* while the balls are rolling, the controls step back so you can watch the action */
#power, #fine, #chalkBtn, #spinMini, .cams, #btnGuides, #btnReplay { transition: opacity .45s ease; }
body.rolling #power, body.rolling #fine, body.rolling #chalkBtn, body.rolling #spinMini, body.rolling .cams, body.rolling #btnGuides, body.rolling #btnReplay { opacity: .14; pointer-events: none; }

/* ---------------------------------------------------------------------------------------------------------
   Phones held upright: one tidy control deck at the bottom, nothing sitting on the table.
     row 1 (bottom)  fine-aim strip, full width
     row 2           camera buttons on the left, chalk and spin on the right
     row 3           guides / replay / re-rack / move balls, one line that scrolls sideways if it has to
     above that      a slim slot for "computer is lining up" / "ball in hand" notes
   The power bar stands on the right edge. The overhead camera fits the table into the space that is left
   (see hudInsets in main.js), so the table never slides under any of this.
   --------------------------------------------------------------------------------------------------------- */
@media (max-width: 700px) and (orientation: portrait) {
  .topbar { top: calc(6px + var(--sa-t)); gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
  .fine { left: 8px; right: 8px; transform: none; bottom: calc(8px + var(--sa-b)); height: 42px; }
  .fine-nudge { width: 46px; }
  .ctl-left { left: 8px; right: 8px; bottom: calc(56px + var(--sa-b)); display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 6px; pointer-events: none; }
  .ctl-left > * { pointer-events: auto; }
  .cams { height: 44px; }
  .cams button { min-width: 54px; padding: 0 12px; font-size: 11px; }
  .ctl-row { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; gap: 6px; }
  .ctl-row::-webkit-scrollbar { display: none; }
  .ctl-row .chip-btn { flex: 0 0 auto; height: 32px; padding: 0 10px; font-size: 10px; letter-spacing: .1em; white-space: nowrap; }
  .spin-mini, .chalk-btn { bottom: calc(56px + var(--sa-b)); height: 44px; width: 52px; padding: 4px 0 3px; gap: 2px; align-content: center; }
  .spin-mini { right: 8px; }
  .chalk-btn { right: 66px; }
  .chalk-cube { width: 18px; height: 18px; }
  .chalk-meter { width: 30px; height: 3px; }
  .spin-mini .sm-ball { width: 22px; height: 22px; }
  .spin-mini .sm-ball i { width: 6px; height: 6px; margin: -3px 0 0 -3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .8); }
  .spin-mini .sm-lbl, .chalk-btn .sm-lbl { font-size: 7px; letter-spacing: .14em; }
  body.lefty .chalk-btn { left: auto; right: 66px; }
  .power { right: 6px; width: 44px; top: auto; bottom: calc(180px + var(--sa-b)); height: min(40dvh, 320px); transform: none; padding: 8px 0; gap: 6px; }
  body.lefty .power { right: auto; left: 6px; }
  .pw-label { font-size: 7px; letter-spacing: .12em; }
  #placeHint, #callHint, #think { bottom: calc(144px + var(--sa-b)); top: auto; padding: 5px 12px; font-size: 10px; letter-spacing: .12em; white-space: nowrap; max-width: calc(100vw - 16px); width: max-content; overflow: hidden; text-overflow: ellipsis; }
  #toast { top: calc(116px + var(--sa-t)); }
}

/* phones on their side: keep the fine-aim strip and the chip row from sharing the same spot */
@media (max-height: 520px) and (orientation: landscape) {
  .fine { left: auto; right: calc(244px + var(--sa-r)); transform: none; }
  .fine-strip { width: min(200px, 24vw); }
  .ctl-row { flex-wrap: nowrap; max-width: calc(100vw - 560px - var(--sa-l) - var(--sa-r)); min-width: 96px; overflow-x: auto; scrollbar-width: none; }
  .ctl-row::-webkit-scrollbar { display: none; }
  .ctl-row .chip-btn { flex: 0 0 auto; white-space: nowrap; }
  #placeHint, #callHint, #think { bottom: calc(58px + var(--sa-b)); }
}
