:root { --bg: #0d1020; --panel: #1a2140; --card: #26305c; --border: rgba(255,255,255,0.2); --text: #f3f0e2; --muted: #aab4e0; --accent: #ffd451; --accent-dark: #c79a1a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hidden { display: none !important; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; touch-action: none; }

#btns { position: fixed; top: calc(2px + env(safe-area-inset-top)); right: calc(4px + env(safe-area-inset-right)); display: flex; z-index: 5;
  background: rgba(20,26,44,0.85); border: 1px solid var(--border); border-radius: 10px; padding: 1px; }
.icon-btn { background: none; border: none; font-size: 17px; cursor: pointer; padding: 4px 6px; border-radius: 8px; text-decoration: none; line-height: 1; touch-action: manipulation; color: inherit; }
.icon-btn:hover { background: rgba(255,255,255,0.12); }

#special { display: none; position: fixed; right: calc(22px + env(safe-area-inset-right)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid rgba(244,240,224,0.7); background: rgba(90,100,150,0.55); color: #fff; font: 800 13px system-ui, sans-serif; letter-spacing: 0.5px;
  touch-action: none; -webkit-tap-highlight-color: transparent; z-index: 5; padding: 0; overflow: hidden; }
#special.ready { background: rgba(255,200,60,0.75); color: #2a2000; }
#special.down { filter: brightness(1.25); }
body.touch #special { display: block; }
#stick, #knob { position: fixed; border-radius: 50%; pointer-events: none; z-index: 4; display: none; }
#stick { width: 90px; height: 90px; margin: -45px 0 0 -45px; border: 3px solid rgba(255,255,255,0.35); background: rgba(255,255,255,0.08); }
#knob { width: 40px; height: 40px; margin: -20px 0 0 -20px; background: rgba(255,255,255,0.5); }
#rotate { display: none; position: fixed; left: 0; right: 0; bottom: calc(130px + env(safe-area-inset-bottom)); text-align: center; color: #ffe566; font-weight: 700; font-size: 14px; pointer-events: none; z-index: 4; }
@media (orientation: portrait) { body.touch #rotate { display: block; } }

.btn { font: inherit; background: var(--accent); color: #2a2000; border: none; border-radius: 12px; padding: 8px 14px; font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 0 var(--accent-dark), 0 6px 14px rgba(0,0,0,0.2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; touch-action: manipulation; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn.big { font-size: 18px; padding: 11px 16px; width: 100%; margin-top: 12px; }
.btn.alt { background: #d9d2f0; box-shadow: 0 3px 0 #9a94b8; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; text-decoration: underline; font: inherit; font-size: 13px; padding: 0; }
.close-x { display: block; margin: 12px auto 0; }

#modal { position: fixed; inset: 0; background: rgba(5,8,30,0.6); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 10px; }
#modal-box { border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); background: linear-gradient(180deg, #2a3470, #181e4c);
  padding: 16px 18px; max-width: 680px; width: 100%; max-height: 94vh; max-height: 94dvh; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; -webkit-user-select: text; user-select: text; }
#modal-box h2 { margin: 0 0 8px; color: #ffe69a; }
#modal-box h3 { margin: 12px 0 6px; color: #ffe69a; font-size: 16px; }
#modal-box ol { padding-left: 20px; line-height: 1.45; margin: 6px 0; }
#modal-box p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.big-score { font-size: 26px; font-weight: 800; color: var(--accent); margin: 4px 0; }

.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.pick { font: inherit; text-align: left; color: var(--text); background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: 8px 10px; cursor: pointer; touch-action: manipulation; }
.pick:hover:not(:disabled) { border-color: var(--accent); }
.pick:disabled { opacity: 0.55; cursor: not-allowed; }
.pick > b { display: block; font-size: 15px; }
.pick small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; margin-top: 2px; }
.pick .em { font-size: 26px; float: left; margin-right: 8px; line-height: 1.1; }
.pick.on { border-color: var(--accent); }
.cards { display: grid; gap: 8px; margin-top: 10px; }
.card { font: inherit; text-align: left; color: var(--text); background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: 10px 12px; cursor: pointer; display: flex; gap: 12px; align-items: center; touch-action: manipulation; }
.card:hover, .card:focus-visible { border-color: var(--accent); outline: none; }
.card .em { font-size: 28px; }
.card b { font-size: 16px; } .card small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.card .lv { margin-left: auto; color: var(--accent); font-weight: 800; font-size: 12px; white-space: nowrap; }
.card kbd { background: rgba(255,255,255,0.15); border-radius: 4px; padding: 0 5px; font-size: 11px; margin-right: 4px; }
#toasts { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 6px; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--accent); color: #2a2000; border-radius: 14px; padding: 8px 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.4); transition: opacity 0.5s, transform 0.5s; text-align: center; font-weight: 800; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@media (max-width: 640px) { .picks { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .picks { grid-template-columns: 1fr; } #modal-box { padding: 14px; } }
