:root {
  --ink: #14161b; --panel: rgba(18, 20, 26, 0.9); --line: rgba(255, 255, 255, 0.1);
  --orange: #f08a24; --orange-d: #a9530c; --blue: #2f80dc; --blue-d: #1a4f91; --gold: #ffc83d; --purple: #8a4dff;
  --green: #37d67a; --red: #ff4d42; --cream: #fff6e5; --muted: #aab2c0;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --display: 'Lilita One', 'Arial Black', Impact, sans-serif; --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--cream); font-family: var(--body); }
body { position: fixed; inset: 0; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
[hidden] { display: none !important; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }

/* ---------- loading */
#loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; background: var(--ink); z-index: 50; transition: opacity .4s; }
#loading.out { opacity: 0; pointer-events: none; }
.load-text { color: var(--muted); font-weight: 800; }

/* ---------- logo */
.logo { font-family: var(--display); font-size: 54px; line-height: .92; color: var(--orange); letter-spacing: .5px;
  text-shadow: 0 4px 0 #7a3a06, 0 8px 18px rgba(0,0,0,.45); }
.logo span { color: var(--blue); text-shadow: 0 4px 0 #123a6b, 0 8px 18px rgba(0,0,0,.45); }
.logo.small { font-size: 38px; }

/* ---------- panels */
.panel { position: fixed; z-index: 20; left: calc(16px + var(--sl)); top: calc(16px + var(--st)); bottom: calc(16px + var(--sb));
  width: min(390px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; touch-action: pan-y;
  box-shadow: 0 20px 60px rgba(0,0,0,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: panelIn .35s cubic-bezier(.2,.9,.3,1.2); }
.panel.right { left: auto; right: calc(16px + var(--sr)); }
@keyframes panelIn { from { transform: translateX(-24px); opacity: 0 } to { transform: none; opacity: 1 } }
.panel.right { animation-name: panelInR; }
@keyframes panelInR { from { transform: translateX(24px); opacity: 0 } to { transform: none; opacity: 1 } }
.tag { margin: -2px 0 2px; color: var(--muted); font-weight: 800; }
.label { font-family: var(--display); color: var(--muted); letter-spacing: 1.5px; font-size: 15px; margin-top: 4px; }
.jobs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.job { text-align: left; background: rgba(255,255,255,.05); border: 2px solid var(--line); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 4px; transition: transform .12s, border-color .12s, background .12s; }
.job:active { transform: scale(.97); }
.job.on { border-color: var(--orange); background: rgba(240,138,36,.14); }
.job[data-job="catcher"].on { border-color: var(--blue); background: rgba(47,128,220,.16); }
.job-ico svg { width: 42px; height: 42px; }
.job-ico.lever svg { fill: var(--orange); }
.job-ico.catcher svg { fill: var(--blue); stroke: var(--cream); }
.job-name { font-family: var(--display); font-size: 24px; letter-spacing: .5px; }
.job-desc { font-size: 13px; color: var(--muted); font-weight: 800; line-height: 1.2; min-height: 32px; }
.job-lv { font-family: var(--display); color: var(--gold); font-size: 15px; }
.shift-line { text-align: center; color: var(--muted); font-weight: 800; font-size: 14px; }

.btn { font-family: var(--display); font-size: 22px; letter-spacing: 1px; color: #fff; background: var(--orange); border-radius: 16px; padding: 12px 18px;
  box-shadow: 0 5px 0 var(--orange-d), 0 10px 20px rgba(0,0,0,.25); transition: transform .08s, box-shadow .08s; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-d); }
.btn.big { font-size: 28px; padding: 14px 18px; }
.btn.small { font-size: 17px; padding: 9px 14px; border-radius: 12px; }
.btn.ghost { background: rgba(255,255,255,.08); box-shadow: 0 4px 0 rgba(0,0,0,.35); font-size: 19px; }
.btn.ghost:active { box-shadow: 0 0 0 rgba(0,0,0,.35); }
.link { color: var(--muted); font-weight: 800; text-decoration: underline; padding: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats div { background: rgba(255,255,255,.05); border-radius: 14px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; }
.stats b { font-family: var(--display); font-size: 22px; display: flex; align-items: center; gap: 6px; }
.stats div:first-child { flex-direction: column; }
.stats span { font-size: 12px; color: var(--muted); font-weight: 800; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle { flex: 1; background: rgba(255,255,255,.07); border-radius: 12px; padding: 9px 8px; font-weight: 900; font-size: 14px; white-space: nowrap; }
.toggle.off { opacity: .45; text-decoration: line-through; }
.roblox { color: var(--muted); font-weight: 800; font-size: 13px; text-align: center; text-decoration: none; margin-top: auto; padding-top: 4px; }
i.coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2b0, var(--gold) 45%, #c78a00); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); vertical-align: -3px; }
.stats i.coin { width: 16px; height: 16px; }

/* ---------- results */
.res-title { font-family: var(--display); font-size: 34px; color: var(--green); text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.res-title.fail { color: var(--red); }
.res-big { font-family: var(--display); font-size: 52px; line-height: 1; }
.res-big small { font-size: 22px; color: var(--muted); }
.res-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.res-stats span { background: rgba(255,255,255,.07); border-radius: 10px; padding: 5px 9px; font-weight: 900; font-size: 13px; }
.pay { display: flex; flex-direction: column; gap: 4px; }
.pay div { display: flex; justify-content: space-between; font-weight: 800; color: var(--muted); font-size: 15px; opacity: 0; transform: translateY(6px); animation: payIn .3s forwards; }
.pay div b { color: var(--cream); }
@keyframes payIn { to { opacity: 1; transform: none; } }
.pay-total { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; font-family: var(--display); font-size: 22px; }
.pay-total b { display: flex; gap: 8px; align-items: center; color: var(--gold); font-size: 30px; font-weight: normal; }
.res-next { font-weight: 900; text-align: center; color: var(--cream); background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px; }
.keys { color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.5; margin: 0; }

/* ---------- HUD (top band only) */
#hud { position: fixed; z-index: 10; left: 0; right: 0; top: 0; padding: calc(10px + var(--st)) calc(14px + var(--sr)) 0 calc(14px + var(--sl));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; pointer-events: none; }
.hud-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hud-side.right { justify-content: flex-end; }
.chip { font-family: var(--display); font-size: 17px; letter-spacing: .5px; background: rgba(14,16,21,.78); border: 1px solid var(--line); border-radius: 12px; padding: 6px 11px; display: flex; align-items: center; gap: 6px; }
.chip.dim { color: var(--muted); }
.chip.combo { transition: transform .15s; }
.chip.combo.x2 { color: var(--gold); border-color: rgba(255,200,61,.5); }
.chip.combo.x3 { color: #fff; background: linear-gradient(90deg, #ff7a1a, #ffb21a); border-color: transparent; }
.chip.pop { transform: scale(1.18); }
.icon-btn { pointer-events: auto; width: 40px; height: 40px; border-radius: 12px; background: rgba(14,16,21,.78); border: 1px solid var(--line); display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; fill: var(--cream); }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 5px; background: rgba(14,16,21,.78); border: 1px solid var(--line); border-radius: 16px; padding: 6px 16px 8px; min-width: 190px; }
.timer { font-family: var(--display); font-size: 30px; line-height: 1; letter-spacing: 1px; }
.timer.low { color: var(--red); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.quota { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 16px; }
.bar { width: 120px; height: 10px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--gold)); border-radius: 6px; transition: width .25s; }
.bar i.full { background: linear-gradient(90deg, #22b866, var(--green)); }

#banner { position: fixed; z-index: 11; top: calc(86px + var(--st)); left: 50%; transform: translateX(-50%); font-family: var(--display); font-size: 24px; letter-spacing: 1px;
  padding: 8px 18px; border-radius: 14px; background: rgba(14,16,21,.86); border: 2px solid var(--gold); color: var(--gold); white-space: nowrap; pointer-events: none;
  animation: bannerIn .25s cubic-bezier(.2,.9,.3,1.4); text-align: center; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
#banner.red { border-color: var(--red); color: #fff; background: rgba(150,20,14,.85); }
#banner.green { border-color: var(--green); color: var(--green); }
#banner.blue { border-color: var(--blue); color: #9cc8ff; }
#banner.count { font-size: 46px; border-color: transparent; background: none; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.4), 0 0 24px rgba(0,0,0,.5); }
#banner.flash { animation: flash .5s infinite alternate; }
@keyframes bannerIn { from { transform: translateX(-50%) scale(.6); opacity: 0 } to { transform: translateX(-50%); opacity: 1 } }
@keyframes flash { to { filter: brightness(1.5); } }

/* left column: ratings and notes */
#feed { position: fixed; z-index: 9; left: calc(14px + var(--sl)); top: calc(70px + var(--st)); width: 230px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.feed-item { font-family: var(--display); font-size: 20px; letter-spacing: .5px; padding: 5px 12px; border-radius: 12px; background: rgba(14,16,21,.8); border-left: 5px solid var(--cream); width: fit-content; max-width: 100%;
  animation: feedIn .22s cubic-bezier(.2,.9,.3,1.4), feedOut .4s 1.6s forwards; }
.feed-item small { font-family: var(--body); font-weight: 900; font-size: 13px; color: var(--muted); margin-left: 6px; }
.feed-item.perfect { border-color: var(--gold); color: var(--gold); font-size: 26px; }
.feed-item.good { border-color: var(--green); color: var(--green); }
.feed-item.bad { border-color: var(--red); color: #ff8a80; }
.feed-item.info { border-color: var(--blue); color: #bcd8ff; font-size: 17px; }
@keyframes feedIn { from { transform: translateX(-30px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes feedOut { to { opacity: 0; transform: translateY(-6px); } }

/* floating numbers over the bins / pads */
#floats { position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.float { position: absolute; left: 0; top: 0; font-family: var(--display); font-size: 28px; color: #fff; white-space: nowrap; will-change: transform, opacity;
  text-shadow: 0 3px 0 rgba(0,0,0,.5), 0 0 12px rgba(0,0,0,.4); }
.float.gold { color: var(--gold); } .float.red { color: #ff6b5f; } .float.green { color: var(--green); } .float.big { font-size: 38px; }

/* ---------- Gus (bottom band) */
#gus { position: fixed; z-index: 30; left: 50%; bottom: calc(14px + var(--sb)); transform: translateX(-50%); width: min(640px, calc(100vw - 260px));
  display: flex; align-items: center; gap: 12px; background: rgba(255,246,229,.97); color: #1c1d22; border-radius: 20px; padding: 10px 12px 10px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: gusIn .3s cubic-bezier(.2,.9,.3,1.3); pointer-events: auto; }
#gus.tip { width: min(560px, calc(100vw - 260px)); }
@keyframes gusIn { from { transform: translateX(-50%) translateY(30px); opacity: 0 } to { transform: translateX(-50%); opacity: 1 } }
.gus-face { width: 58px; height: 58px; flex: none; border-radius: 16px; background: #2b2f38; display: grid; place-items: center; }
.gus-face svg { width: 52px; height: 52px; }
.gus-body { flex: 1; min-width: 0; }
.gus-name { font-family: var(--display); font-size: 13px; color: #b0661c; letter-spacing: 1px; }
.gus-text { font-weight: 900; font-size: 17px; line-height: 1.25; }
.gus-text b { color: #b0561c; }
.gus-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#gus .link { color: #6b6f7a; font-size: 13px; padding: 2px; }
#gus.tip .gus-actions { display: none; }

/* ---------- lever buttons (right edge), scan (left edge) */
/* left thumb = A, right thumb = B */
#ctl-lever { position: fixed; z-index: 12; left: calc(20px + var(--sl)); right: calc(20px + var(--sr)); bottom: calc(22px + var(--sb)); display: flex; justify-content: space-between; pointer-events: none; }
#ctl-lever .lane-btn { pointer-events: auto; }
.lane-btn { width: 112px; height: 112px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; color: #fff;
  box-shadow: 0 7px 0 rgba(0,0,0,.35), 0 12px 26px rgba(0,0,0,.35), inset 0 -6px 0 rgba(0,0,0,.18); transition: transform .06s, box-shadow .06s; position: relative; }
.lane-btn svg { width: 44px; height: 44px; fill: #fff; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.lane-btn b { font-family: var(--display); font-size: 26px; line-height: .9; font-weight: normal; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.lane-btn.a { background: radial-gradient(circle at 40% 30%, #ffb05c, var(--orange) 60%, #c8650c); }
.lane-btn.b { background: radial-gradient(circle at 40% 30%, #6fb0ff, var(--blue) 60%, #1c5ead); }
.lane-btn.on::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 18px rgba(255,255,255,.7); }
.lane-btn.press { transform: translateY(5px) scale(.96); box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 -3px 0 rgba(0,0,0,.18); }
.lane-btn.locked { filter: grayscale(.85) brightness(.7); }
.lane-btn.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
.scan-btn { position: fixed; z-index: 12; left: calc(32px + var(--sl)); bottom: calc(160px + var(--sb)); width: 88px; height: 88px; border-radius: 50%; color: #fff;
  font-family: var(--display); font-size: 24px; letter-spacing: 1px; background: radial-gradient(circle at 40% 30%, #b58cff, var(--purple) 60%, #5a24c4);
  box-shadow: 0 7px 0 rgba(0,0,0,.35), 0 12px 26px rgba(0,0,0,.35); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.scan-btn { font-size: 19px; }
.scan-btn small { font-size: 26px; color: #ffe14d; }
.scan-btn.press { transform: translateY(5px) scale(.96); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.scan-btn.ready { animation: ready .6s infinite alternate; }
@keyframes ready { to { box-shadow: 0 7px 0 rgba(0,0,0,.35), 0 0 0 8px rgba(255,225,77,.55); } }

/* ---------- joystick */
#stick { position: fixed; z-index: 12; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; background: rgba(14,16,21,.35); border: 3px solid rgba(255,255,255,.35); pointer-events: none; }
#stick.idle { opacity: .55; }
#knob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #cfd6e2); box-shadow: 0 4px 10px rgba(0,0,0,.4); }

#toast { position: fixed; z-index: 40; left: 50%; bottom: calc(18px + var(--sb)); transform: translateX(-50%); background: rgba(14,16,21,.9); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; font-weight: 900; pointer-events: none; }

/* ---------- small screens / portrait */
@media (max-width: 760px), (max-height: 520px) {
  .lane-btn { width: 92px; height: 92px; }
  .scan-btn { width: 76px; height: 76px; bottom: calc(132px + var(--sb)); left: calc(28px + var(--sl)); }
  .lane-btn svg { width: 36px; height: 36px; }
  #gus { width: calc(100vw - 24px); bottom: calc(10px + var(--sb)); }
  .hud-mid { min-width: 150px; padding: 5px 10px 7px; }
  .timer { font-size: 24px; } .bar { width: 80px; }
  .chip { font-size: 14px; padding: 5px 8px; }
  #feed { width: 180px; } .feed-item { font-size: 16px; } .feed-item.perfect { font-size: 20px; }
}
@media (max-width: 760px) and (orientation: portrait) {
  .panel { top: auto; left: calc(10px + var(--sl)); right: calc(10px + var(--sr)); width: auto; max-height: 64vh; bottom: calc(10px + var(--sb)); }
  .panel.right { left: calc(10px + var(--sl)); }
  .logo { font-size: 40px; }
  #h-job { display: none; }
  #gus { bottom: auto; top: calc(120px + var(--st)); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .panel { padding: 14px 16px; gap: 8px; }
  .logo { font-size: 38px; }
  .job-desc { display: none; }
  #banner { top: calc(70px + var(--st)); font-size: 19px; }
  #gus { width: min(560px, calc(100vw - 260px)); }
}
