:root {
  --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);
  --panel: rgba(6, 22, 40, 0.88); --line: rgba(120, 215, 255, 0.28);
  --cyan: #3fd0ff; --gold: #ffd84a; --coral: #ff6b6b; --warm: #ff9a3c; --text: #eaf6ff; --muted: #8fb3c9;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #02070d; color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Segoe UI", sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none;
  position: fixed; inset: 0; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
img.px { image-rendering: pixelated; image-rendering: crisp-edges; }
img.fi { max-width: none !important; max-height: none !important; object-fit: contain; flex: none; }
small { opacity: .75; font-weight: 500; }

#game {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  image-rendering: pixelated; image-rendering: crisp-edges; background: #02070d;
}

/* ───────── HUD ───────── */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud { position: absolute; inset: 0; }
.hud-left { position: absolute; top: calc(var(--st) + 10px); left: calc(var(--sl) + 12px); display: flex; flex-direction: column; gap: 6px; }
.o2 { display: flex; align-items: center; gap: 6px; }
.o2-label { font-weight: 900; font-size: 15px; color: #9ff0ff; text-shadow: 0 2px 0 #000; }
.bar { width: 190px; height: 15px; border-radius: 8px; background: rgba(0, 10, 20, 0.7); border: 2px solid rgba(255,255,255,0.75); overflow: hidden; box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.bar.sm { width: 80px; height: 8px; border-width: 1px; }
.fill { height: 100%; width: 100%; background: linear-gradient(180deg, #8ff6ff, #18a9e8 60%, #0b78c0); transition: width .15s linear; }
.fill.mid { background: linear-gradient(180deg, #fff59a, #f2c230 60%, #c08a10); }
.fill.low { background: linear-gradient(180deg, #ffb0a0, #ff4a3a 60%, #b01a10); animation: blink .5s infinite alternate; }
@keyframes blink { to { filter: brightness(1.6); } }
.o2-num { font-weight: 900; font-size: 17px; min-width: 36px; text-shadow: 0 2px 0 #000; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: rgba(0, 12, 24, 0.66); border: 1px solid rgba(255,255,255,.18); padding: 3px 9px; border-radius: 10px; font-size: 13px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.gold { color: var(--gold); }
.chip.warn { color: #ffd84a; border-color: #ffd84a; }
.chip.danger { color: #fff; background: rgba(200, 20, 30, .8); border-color: #ff8a8a; animation: blink .4s infinite alternate; }
.partner { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; background: rgba(0,12,24,.55); padding: 3px 8px; border-radius: 10px; width: max-content; }
.partner .ptag { color: #ff8fb0; }
.partner .ptag.p1 { color: #7fe3ff; }
.g-mark.par.p1 { border-right-color: #7fe3ff; }
.g-mark.me { border-left-color: #7fe3ff; }
body.p2 .g-mark.me { border-left-color: #ff8fb0; }
.partner.sos { background: rgba(200, 20, 30, .75); animation: blink .4s infinite alternate; }
#radar { position: absolute; right: calc(var(--sr) + 10px); top: calc(var(--st) + 54px); width: 84px; height: 84px; border-radius: 50%; }
.gauge { position: absolute; right: calc(var(--sr) + 104px); top: calc(var(--st) + 58px); height: 76px; width: 8px; }
.g-track { position: absolute; inset: 0; border-radius: 6px; border: 1px solid rgba(255,255,255,.5);
  background: linear-gradient(180deg, #46cbe3 0%, #1878bb 18%, #0f4f94 45%, #061b42 75%, #02050d 100%); }
.g-lim { position: absolute; left: -5px; right: -5px; height: 2px; background: #ff4a4a; box-shadow: 0 0 4px #ff4a4a; }
.g-mark { position: absolute; width: 0; height: 0; transform: translateY(-50%); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.g-mark.me { left: -11px; border-left: 10px solid #7fe3ff; filter: drop-shadow(0 1px 0 #000); }
.g-mark.par { right: -11px; border-right: 10px solid #ff8fb0; filter: drop-shadow(0 1px 0 #000); }
.boss { position: absolute; top: calc(var(--st) + 10px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 900; font-size: 13px; text-shadow: 0 2px 0 #000; }
.boss .bar { width: min(36vw, 320px); height: 10px; }
.boss .fill { background: linear-gradient(180deg, #ff9a8a, #e02a2a); }

.rest-top { position: absolute; top: calc(var(--st) + 10px); left: calc(var(--sl) + 12px); display: flex; gap: 6px; }
.rest-top .chip { font-size: 15px; padding: 4px 11px; }
.stock { position: absolute; top: calc(var(--st) + 44px); left: calc(var(--sl) + 12px); display: flex; gap: 5px; flex-wrap: wrap; max-width: 60vw; }
.stk { display: flex; align-items: center; gap: 2px; background: rgba(20, 8, 0, .6); border-radius: 8px; padding: 1px 6px 1px 2px; font-size: 12px; font-weight: 800; }
.stk img { height: 20px; }
.stk.out { opacity: .4; }
.chip.combo { color: #fff; background: linear-gradient(90deg, #ff7a2a, #ffcf3a); border-color: #fff3b0; animation: bump .3s; }
.rest-tip { position: absolute; bottom: calc(var(--sb) + 8px); left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: rgba(255,255,255,.8); background: rgba(20,8,0,.55); padding: 4px 12px; border-radius: 10px; white-space: nowrap; }

#btnPause { position: absolute; top: calc(var(--st) + 8px); right: calc(var(--sr) + 10px); pointer-events: auto; width: 40px; height: 40px; border-radius: 12px; border: 2px solid rgba(255,255,255,.4); background: rgba(0,12,24,.6); font-size: 17px; }
#banner { position: absolute; top: 22%; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; }
#banner .b-t { font-size: 34px; font-weight: 900; letter-spacing: 6px; color: #fff; text-shadow: 0 3px 0 #0a2a4a, 0 0 20px rgba(63, 208, 255, .6); }
#banner .b-s { font-size: 15px; font-weight: 700; color: #bfefff; text-shadow: 0 2px 0 #000; margin-top: 2px; }
#banner.show { animation: banner 2.6s ease forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); letter-spacing: 20px; } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
#toasts { position: absolute; top: calc(var(--st) + 54px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: 70vw; }
.toast { background: rgba(4, 18, 34, .9); border: 1px solid var(--line); padding: 7px 14px; border-radius: 12px; font-size: 14px; font-weight: 800; animation: tin .25s ease; transition: opacity .4s, transform .4s; text-align: center; }
.toast.warn { border-color: #ffb84a; color: #ffe0a0; }
.toast.good { border-color: #6aff9a; color: #c8ffd8; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast.bump { animation: bump .25s; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px) scale(.95); } }
@keyframes bump { 50% { transform: scale(1.08); } }
#catchPop { position: absolute; left: calc(var(--sl) + 12px); top: calc(var(--st) + 112px); display: flex; flex-direction: column; gap: 6px; }
.catch { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(10, 40, 70, .95), rgba(10, 40, 70, .6)); border-left: 4px solid var(--gold); padding: 6px 14px 6px 8px; border-radius: 0 14px 14px 0; animation: cin .35s cubic-bezier(.2,1.6,.4,1); transition: opacity .45s, transform .45s; }
.catch img { height: 26px; max-width: 64px; object-fit: contain; }
.catch.big { border-left-color: #ff6a4a; }
.catch.big img { height: 34px; max-width: 90px; }
.catch .cn { font-weight: 900; font-size: 15px; }
.catch .cw { font-size: 12px; color: var(--muted); font-weight: 700; }
.catch .new { background: #ff3a6a; color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 6px; margin-left: 4px; vertical-align: middle; animation: blink .3s infinite alternate; }
.catch.out { opacity: 0; transform: translateX(-30px); }
.catch.perfect { border-left-color: #fff27a; background: linear-gradient(90deg, rgba(90, 70, 10, .95), rgba(10, 40, 70, .6)); }
.stars { color: #ffd84a; font-size: 12px; letter-spacing: -1px; text-shadow: 0 1px 0 #000; }
.stars i { font-style: normal; color: rgba(255,255,255,.22); }
.qt { font-size: 11px; margin-left: 4px; }
.qt.q3 { color: #fff27a; } .qt.q1 { color: #ff9a8a; }
.qd { color: #ffd84a; font-size: 10px; margin-left: 2px; }
@keyframes cin { from { opacity: 0; transform: translateX(-60px); } }
#downOverlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.down-box { background: rgba(60, 0, 10, .82); border: 2px solid #ff6a6a; padding: 12px 22px; border-radius: 16px; font-weight: 900; font-size: 16px; animation: blink .6s infinite alternate; }
#boatWait { position: absolute; left: 50%; bottom: calc(var(--sb) + 26px); transform: translateX(-50%); background: rgba(0, 20, 40, .85); border: 1px solid var(--line); padding: 10px 18px; border-radius: 30px; font-weight: 800; }

/* ───────── touch controls ───────── */
#controls { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#stickZone { position: absolute; left: 0; top: 22%; bottom: 0; width: 48%; pointer-events: auto; touch-action: none; }
#stickBase { position: absolute; left: calc(var(--sl) + 92px); top: calc(100% - 92px); width: 116px; height: 116px; margin: -58px 0 0 -58px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.06), rgba(255,255,255,.14)); border: 2px solid rgba(255,255,255,.3); opacity: .5; transition: opacity .15s; }
#stickBase.on { opacity: 1; transition: none; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #ffffff, #b8d8ea); box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.cbtn { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; border: 3px solid rgba(255,255,255,.6); color: #fff; font-weight: 900;
  display: flex; align-items: center; justify-content: center; text-shadow: 0 2px 0 rgba(0,0,0,.5); box-shadow: 0 5px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.3); transition: transform .06s; }
.cbtn.down { transform: scale(.9); box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.3); }
/* attack pad: tap = auto-aim, drag = aim, release = fire, back to centre = cancel; hold while hooked = reel */
#atkZone { position: absolute; right: calc(var(--sr) + 18px); bottom: calc(var(--sb) + 16px); width: 134px; height: 134px; border-radius: 50%; pointer-events: auto; touch-action: none;
  background: radial-gradient(circle, rgba(255,140,60,.10), rgba(255,140,60,.22)); border: 2px solid rgba(255,200,160,.35); }
#atkRing { position: absolute; inset: 10px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.18); transition: border-color .1s; }
#atkKnob { position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; border-radius: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5);
  background: radial-gradient(circle at 35% 28%, #ffc078, #ff7a2a 55%, #c8401a); border: 3px solid rgba(255,255,255,.7); box-shadow: 0 5px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.3); }
#atkZone.down #atkKnob { box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.3); }
#atkZone.aiming { border-color: rgba(127, 227, 255, .8); background: radial-gradient(circle, rgba(127,227,255,.08), rgba(127,227,255,.25)); }
#atkZone.aiming #atkRing { border-color: rgba(127,227,255,.5); }
#atkZone.cancel { border-color: rgba(255, 80, 80, .9); }
#atkZone.cancel #atkKnob { background: radial-gradient(circle at 35% 28%, #ff9a9a, #d02a2a); }
#atkZone.reel #atkKnob { font-size: 15px; background: radial-gradient(circle at 35% 28%, #a8ffb0, #20b85a 60%, #0b6a30); }
#atkZone.reel.down #atkKnob { transform: translate(-50%, -50%) scale(.92) !important; }
#atkZone.warn #atkKnob { animation: warnp .12s infinite alternate; background: radial-gradient(circle at 35% 28%, #fff27a, #ff4a3a 60%, #a01a10); }
@keyframes warnp { to { filter: brightness(1.5); } }
#atkHint { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 800; color: rgba(255,255,255,.75); text-align: center; text-shadow: 0 1px 2px #000; display: none; }
body.newbie #atkHint { display: block; }
#btnBoost { width: 60px; height: 60px; right: calc(var(--sr) + 160px); bottom: calc(var(--sb) + 14px); font-size: 24px; background: radial-gradient(circle at 35% 28%, #a8f4ff, #2fb3e8 60%, #0b6aa0); }
#btnAct { right: calc(var(--sr) + 24px); bottom: calc(var(--sb) + 162px); height: 48px; min-width: 120px; padding: 0 18px; border-radius: 26px; font-size: 16px; white-space: nowrap;
  background: linear-gradient(180deg, #7aff9a, #20b85a); animation: pop .3s; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
#tapZone { position: absolute; inset: 0; display: none; pointer-events: auto; touch-action: none; }
#controls[data-mode="rest"] #tapZone { display: block; }
#controls[data-mode="rest"] #stickZone, #controls[data-mode="rest"] #btnBoost, #controls[data-mode="rest"] #atkZone, #controls[data-mode="rest"] #btnAct { display: none; }

/* ───────── screens ───────── */
#screens { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  padding: calc(var(--st) + 10px) calc(var(--sr) + 14px) calc(var(--sb) + 10px) calc(var(--sl) + 14px); }
.screen.on { display: flex; pointer-events: auto; }
.screen.overlay { background: rgba(1, 8, 16, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); z-index: 2; }
.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 16px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.08);
  max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
h2 { margin: 0 0 12px; font-size: 21px; font-weight: 900; }
h2 small { font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.muted.big { font-size: 16px; margin: 10px 0 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 9px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 14px; padding: 11px 16px; font-size: 15px; font-weight: 800; color: #fff;
  background: #1f3d58; box-shadow: 0 4px 0 rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.14); transition: transform .06s, box-shadow .06s; white-space: nowrap; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.14); }
.btn.primary { background: linear-gradient(180deg, #2fc4ff, #0b7fd6); }
.btn.warm { background: linear-gradient(180deg, #ffad5a, #e0552a); }
.btn.coop { background: linear-gradient(180deg, #b08aff, #6a3ad6); }
.btn.ghost { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); }
.btn.danger { background: linear-gradient(180deg, #ff6a6a, #b8262a); }
.btn.big { font-size: 18px; padding: 15px 22px; border-radius: 16px; }
.btn.sm { font-size: 13px; padding: 8px 11px; border-radius: 11px; }
.btn:disabled { opacity: .42; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.25); border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 8px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.wait-host { color: var(--muted); font-weight: 700; margin: 12px 0 4px; }

/* title */
#scrTitle { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 30%, rgba(0,6,14,.55)); }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
#logo { width: min(460px, 58vw); height: auto; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.tagline { font-weight: 800; color: #cfefff; text-shadow: 0 2px 0 #000; font-size: 15px; }
.save-info { font-size: 13px; font-weight: 800; color: var(--gold); text-shadow: 0 2px 0 #000; }
.menu-col { display: flex; flex-direction: column; gap: 0; width: min(400px, 74vw); margin-top: 8px; }
.menu-col .row2 { margin-top: 9px; }
.foot { margin-top: 8px; font-size: 11px; color: rgba(255,255,255,.5); }

/* lobby */
.lobby { text-align: center; min-width: min(420px, 80vw); }
.code-label { color: var(--muted); font-weight: 700; font-size: 13px; }
.code { font-size: 58px; font-weight: 900; letter-spacing: 14px; color: var(--gold); text-shadow: 0 4px 0 #3a2a00; margin: 2px 0 2px 14px; font-family: ui-monospace, Menlo, monospace; }
.code-in { font-size: 40px; font-weight: 900; text-align: center; letter-spacing: 12px; width: 240px; padding: 8px 0 8px 12px; border-radius: 14px; border: 2px solid var(--line); background: rgba(0,0,0,.35); color: var(--gold); text-transform: uppercase; font-family: ui-monospace, Menlo, monospace; -webkit-user-select: text; user-select: text; touch-action: manipulation; margin: 8px 0; }
.status { margin: 10px 0; font-weight: 700; color: #cfefff; min-height: 20px; }

/* hub */
.hub { width: 100%; height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar > div { background: rgba(0, 12, 24, .7); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 6px 12px; font-weight: 900; }
.topbar .day { font-size: 17px; } .topbar .day small { font-size: 13px; }
.topbar .money { color: var(--gold); }
.topbar .rep { color: #ffd84a; letter-spacing: 1px; }
.coop-badge { color: #d8c0ff; font-size: 13px; }
.hub-body { flex: 1; display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; padding-top: 10px; min-height: 0; }
.hub-main { display: flex; flex-direction: column; gap: 10px; min-width: min(300px, 44vw); }
.hub-title { font-weight: 800; color: #cfefff; }
.hub-side { width: min(300px, 40vw); display: flex; flex-direction: column; gap: 6px; }
.hub-side .row2 { margin-top: 2px; }
.side-h { font-weight: 900; }
.fridge { display: flex; flex-wrap: wrap; gap: 5px; max-height: 92px; overflow-y: auto; }
.fr-item { display: flex; align-items: center; gap: 3px; background: rgba(255,255,255,.07); border-radius: 8px; padding: 2px 7px 2px 3px; font-weight: 800; font-size: 13px; }
.fr-item img { height: 18px; max-width: 46px; object-fit: contain; }

/* results */
.result { min-width: min(520px, 86vw); max-width: 94vw; text-align: center; }
.result .res-cols:has(.res-col + .res-col) { min-width: min(660px, 88vw); }
.res-cols { display: flex; gap: 14px; justify-content: center; text-align: left; }
.res-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.res-who { font-weight: 900; margin-bottom: 2px; }
.res-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto; align-items: center; gap: 7px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 3px 9px; font-weight: 800; font-size: 14px; }
.res-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-row img { height: 22px; max-width: 44px; object-fit: contain; justify-self: center; }
.res-row .wt, .res-row .cnt { color: var(--muted); font-size: 12px; }
.res-row .sv { color: #7fffb0; font-size: 12px; }
.lost { color: #ff9a9a; font-weight: 800; font-size: 13px; margin-top: 4px; }
.res-gold { margin: 10px 0 2px; color: var(--gold); font-weight: 900; font-size: 17px; }
.result .btn { margin-top: 12px; min-width: 160px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-grid > div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; }
.stat-grid b { font-size: 22px; color: var(--gold); }
.stat-grid span { font-size: 12px; color: var(--muted); font-weight: 700; }
.rep-line { margin-top: 10px; font-weight: 900; color: #ffd84a; }
.stat-grid b.bad { color: #ff7a6a; }
.result.night .stat-grid { grid-template-columns: repeat(6, 1fr); }
.grade-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; text-align: left; }
.grade-row h2 { margin: 0; }
.grade { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 38px; font-weight: 900; font-style: italic; animation: gradeIn .6s cubic-bezier(.2,1.8,.4,1); }
.grade.gS { background: linear-gradient(135deg, #fff27a, #ff9a3c); color: #5a2a00; box-shadow: 0 0 24px rgba(255, 220, 80, .7); }
.grade.gA { background: linear-gradient(135deg, #7fe3ff, #2f73e8); color: #fff; }
.grade.gB { background: linear-gradient(135deg, #9affb0, #20a85a); color: #fff; }
.grade.gC { background: linear-gradient(135deg, #bbb, #666); color: #fff; }
.grade-txt { color: var(--muted); font-weight: 800; font-size: 13px; }
@keyframes gradeIn { from { transform: scale(3) rotate(-20deg); opacity: 0; } }
.q-done { margin-top: 8px; color: #a8ffb0; font-weight: 800; font-size: 13px; }
.q-done b { color: var(--gold); }
.quests { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.quest { background: rgba(255,255,255,.06); border-radius: 10px; padding: 4px 9px; }
.quest.done { opacity: .6; }
.q-t { font-weight: 800; font-size: 13px; }
.q-r { font-size: 11px; color: var(--muted); font-weight: 700; }
.q-bar { height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; margin-top: 2px; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7fe3ff, #6aff9a); }

/* prep */
.prep { width: min(720px, 94vw); }
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.dish-card { position: relative; background: rgba(255,255,255,.06); border: 2px solid rgba(255,255,255,.12); border-radius: 14px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dish-card img.dish { height: 34px; }
.dish-card .dn { font-weight: 900; font-size: 13px; }
.dish-card .dm { font-size: 11px; color: var(--muted); font-weight: 700; }
.dish-card .dp { font-size: 12px; color: var(--gold); font-weight: 800; }
.dish-card.sel { border-color: var(--gold); background: rgba(255, 216, 74, .14); }
.dish-card.sel::after { content: '✓'; position: absolute; top: 4px; right: 8px; color: var(--gold); font-weight: 900; }

/* shop / dex */
.shop, .dexp { width: min(780px, 94vw); }
.shop-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.shop-h h2 { margin: 0; flex: 1; }
.shop-h .money { font-weight: 900; color: var(--gold); }
.shop-h .x { width: 38px; padding: 8px 0; }
.upg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.upg { background: rgba(255,255,255,.06); border-radius: 14px; padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; }
.upg .un { font-weight: 900; }
.upg .ud { font-size: 11px; color: var(--muted); font-weight: 700; }
.upg .uv { font-size: 12px; font-weight: 800; }
.upg .uv b { color: #7fffb0; }
.pips { display: flex; gap: 3px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); }
.pips i.on { background: var(--cyan); }
.upg.max .pips i.on { background: var(--gold); }
.upg .btn { margin-top: 3px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px; }
.dex-card { background: rgba(255,255,255,.06); border-radius: 12px; padding: 7px 5px; text-align: center; }
.dex-img { height: 40px; display: flex; align-items: center; justify-content: center; }
.dex-img img { max-height: 36px; max-width: 92px; }
.dex-card.unk img { filter: brightness(0) opacity(.55); }
.dex-card .dn { font-weight: 900; font-size: 13px; }
.dex-card .dm { font-size: 11px; color: var(--muted); font-weight: 700; }
.pause { display: flex; flex-direction: column; gap: 9px; width: min(440px, 84vw); }
.pause .row2 { margin-top: 0; }
.help { font-size: 12px; color: var(--muted); line-height: 1.55; margin-top: 4px; }

#modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
.modal-box { text-align: center; min-width: min(360px, 80vw); }
.modal-text { font-weight: 800; font-size: 16px; line-height: 1.5; margin-bottom: 6px; }

#fade { position: fixed; inset: 0; background: #02070d; opacity: 0; pointer-events: none; z-index: 30; transition: opacity .5s ease; }
#fade.on { opacity: 1; transition: none; }
.a2hs { margin-top: 6px; font-size: 12px; font-weight: 700; color: #cfefff; background: rgba(0, 20, 40, .7); border: 1px dashed var(--line); padding: 6px 12px; border-radius: 12px; }
#rotate { position: fixed; inset: 0; z-index: 100; background: #04121f; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 900; font-size: 18px; text-align: center; }
.rot-icon { font-size: 54px; animation: rot 1.6s ease-in-out infinite; }
@keyframes rot { 50% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 700px) { #rotate { display: flex; } }

@media (max-height: 380px) {
  .panel { padding: 12px 14px; }
  h2 { font-size: 18px; margin-bottom: 8px; }
  .btn.big { padding: 12px 18px; font-size: 16px; }
  .code { font-size: 46px; }
  #logo { width: min(380px, 50vw); }
}
