:root {
  --bg: #16283a;
  --bg2: #1d3a50;
  --ink: #1d2430;
  --paper: #fbf6e6;
  --paper2: #efe6cc;
  --line: #2a3346;
  --accent: #ff7a59;
  --teal: #38b0a8;
  --common: #4fa83a;
  --epic: #8a4ff0;
  --legendary: #e0a210;
  --s: 3;
  --px: 'Press Start 2P', monospace;
  --ui: 'Pixelify Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 30% -10%, #2a5470, transparent), var(--bg);
  color: #eaf2f8;
  font-family: var(--ui);
  font-size: 17px;
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
kbd { font-family: var(--px); font-size: 9px; background: #0005; border: 1px solid #fff3; border-radius: 4px; padding: 2px 4px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.brand { font-family: var(--px); font-size: 18px; letter-spacing: 1px; }
.brand-mark { color: #ffd34d; text-shadow: 3px 3px 0 #b3471f; }
.brand-sub { color: #9fe3dc; text-shadow: 3px 3px 0 #1f5f5a; }
.card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .tc { display: flex; align-items: center; gap: 10px; background: var(--paper); color: var(--ink); border: 3px solid var(--line); border-radius: 10px; padding: 6px 12px; box-shadow: 0 3px 0 #0006; }
.card .tc small { font-family: var(--px); font-size: 8px; color: #6a7080; display: block; }
.card .tc b { font-family: var(--px); font-size: 12px; }
.card .casts { background: #ffd34d; border: 2px solid var(--line); border-radius: 8px; padding: 4px 8px; font-family: var(--px); font-size: 12px; }
.card button, .side button.act, .mbtns button { background: var(--accent); color: #fff; border: 3px solid var(--line); border-radius: 10px; padding: 7px 14px; font-weight: 700; box-shadow: 0 3px 0 #0006; }
.card button.ghost, .mbtns .ghost { background: #ffffff22; color: inherit; }
.card button:active, .mbtns button:active { transform: translateY(2px); box-shadow: 0 1px 0 #0006; }

.ticker { margin: 0 20px; display: flex; gap: 10px; align-items: center; background: #0d1a26; border: 2px solid #ffffff18; border-radius: 10px; padding: 6px 10px; font-size: 15px; overflow: hidden; white-space: nowrap; }
.tk-label { font-family: var(--px); font-size: 8px; background: #e04848; color: #fff; padding: 4px 6px; border-radius: 4px; }
#tickerText { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.console, .side { min-width: 0; }
body { overflow-x: hidden; }

.wrap { display: grid; grid-template-columns: minmax(0, auto) minmax(300px, 1fr); gap: 20px; padding: 16px 20px; align-items: start; }
@media (max-width: 1100px) { .wrap { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .ab button { width: 52px; height: 52px; } .dpad { grid-template: repeat(3, 38px) / repeat(3, 38px); } .bezel { padding: 10px 8px 14px; border-radius: 18px 18px 40px 18px; } .wrap, .top { padding-left: 10px; padding-right: 10px; } .ticker, .feedbox { margin-left: 10px; margin-right: 10px; } }

/* Handheld shell (original design) */
.console { display: flex; flex-direction: column; align-items: center; }
.bezel { background: linear-gradient(#5a4fd0, #3d34a8); border: 4px solid #241d6a; border-radius: 26px 26px 60px 26px; padding: 14px 18px 18px; box-shadow: inset 0 3px 0 #8f86ff, 0 10px 0 #0005; }
.bezel-top { display: flex; align-items: center; gap: 8px; font-family: var(--px); font-size: 8px; color: #cfcaff; margin: 0 4px 10px; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #444; box-shadow: inset 0 0 2px #000; }
.led.on { background: #ff5a5a; box-shadow: 0 0 8px #ff5a5a; }
.mute { margin-left: auto; background: #241d6a; color: #cfcaff; border: 0; border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.mute.off { opacity: .45; text-decoration: line-through; }
.screen-wrap { position: relative; width: calc(240px * var(--s)); height: calc(160px * var(--s)); background: #000; border: 6px solid #15123a; border-radius: 8px; overflow: hidden; outline: none; }
#screen { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

.hud { position: absolute; top: calc(4px * var(--s)); right: calc(4px * var(--s)); font-family: var(--px); font-size: calc(5px * var(--s)); background: #fbf6e6ee; color: var(--ink); border: calc(1px * var(--s)) solid var(--line); border-radius: calc(3px * var(--s)); padding: calc(2px * var(--s)) calc(4px * var(--s)); display: flex; gap: calc(3px * var(--s)); align-items: center; }
.hud b { color: #d0402a; }

.dialog { position: absolute; left: calc(3px * var(--s)); right: calc(3px * var(--s)); bottom: calc(3px * var(--s)); height: calc(44px * var(--s)); background: var(--paper); color: var(--ink); border: calc(2px * var(--s)) solid #3a6fb0; outline: calc(1px * var(--s)) solid var(--line); border-radius: calc(4px * var(--s)); box-shadow: inset 0 0 0 calc(1px * var(--s)) #a8cff0; padding: calc(6px * var(--s)) calc(8px * var(--s)); font-family: var(--px); font-size: calc(5.5px * var(--s)); line-height: 1.6; white-space: pre-wrap; }
.dialog .more { position: absolute; right: calc(6px * var(--s)); bottom: calc(3px * var(--s)); color: #d0402a; animation: blink .8s steps(2) infinite; font-size: calc(5px * var(--s)); }
@keyframes blink { 50% { opacity: 0; } }
.choice { position: absolute; right: calc(4px * var(--s)); bottom: calc(50px * var(--s)); background: var(--paper); color: var(--ink); border: calc(2px * var(--s)) solid #3a6fb0; outline: calc(1px * var(--s)) solid var(--line); border-radius: calc(4px * var(--s)); padding: calc(4px * var(--s)) calc(8px * var(--s)) calc(4px * var(--s)) calc(12px * var(--s)); font-family: var(--px); font-size: calc(5.5px * var(--s)); line-height: 2; }
.choice div { position: relative; cursor: pointer; }
.choice div.sel::before { content: '▶'; position: absolute; left: calc(-9px * var(--s)); color: var(--ink); }

.reveal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(3px * var(--s)); font-family: var(--px); color: #fff; text-align: center; background: radial-gradient(circle at 50% 45%, #3c7ad8, #142a5c); overflow: hidden; }
.reveal.epic { background: radial-gradient(circle at 50% 45%, #a46cff, #2a1260); }
.reveal.legendary { background: radial-gradient(circle at 50% 45%, #ffd34d, #a2420c); }
.rv-rays { position: absolute; inset: -50%; background: repeating-conic-gradient(#ffffff18 0 10deg, transparent 10deg 20deg); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rv-banner { position: relative; font-size: calc(10px * var(--s)); padding: calc(3px * var(--s)) calc(8px * var(--s)); border: calc(2px * var(--s)) solid #fff; border-radius: calc(4px * var(--s)); background: var(--common); text-shadow: calc(1px * var(--s)) calc(1px * var(--s)) 0 #0006; animation: pop .5s cubic-bezier(.2, 2, .4, 1); }
.reveal.epic .rv-banner { background: var(--epic); }
.reveal.legendary .rv-banner { background: var(--legendary); color: #3a1a00; text-shadow: none; }
#rvFish { position: relative; width: calc(56px * var(--s)); height: calc(56px * var(--s)); image-rendering: pixelated; animation: bob 1.2s ease-in-out infinite; filter: drop-shadow(0 calc(2px * var(--s)) 0 #0005); }
@keyframes bob { 50% { transform: translateY(calc(-3px * var(--s))); } }
@keyframes pop { from { transform: scale(.2); } }
.rv-name { position: relative; font-size: calc(6.5px * var(--s)); text-shadow: calc(1px * var(--s)) calc(1px * var(--s)) 0 #0008; }
.rv-prize { position: relative; font-size: calc(5px * var(--s)); background: #fbf6e6; color: var(--ink); border: calc(1px * var(--s)) solid var(--line); border-radius: calc(3px * var(--s)); padding: calc(3px * var(--s)) calc(6px * var(--s)); display: flex; flex-direction: column; gap: calc(2px * var(--s)); max-width: 90%; }
.rv-prize b { font-size: calc(6.5px * var(--s)); color: #b3301a; }
.rv-hint { position: relative; font-size: calc(4.5px * var(--s)); opacity: .85; animation: blink 1.2s steps(2) infinite; }
.rv-sparks { position: absolute; inset: 0; pointer-events: none; }
.rv-sparks i { position: absolute; width: calc(3px * var(--s)); height: calc(3px * var(--s)); background: #fff; animation: fall linear forwards; }
@keyframes fall { from { transform: translateY(-20px) rotate(0); } to { transform: translateY(calc(180px * var(--s))) rotate(720deg); } }

.pad { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 0 8px; user-select: none; -webkit-user-select: none; touch-action: none; }
.dpad { display: grid; grid-template: repeat(3, 42px) / repeat(3, 42px); }
.dpad button, .dpad .d-mid { background: #232032; border: 0; box-shadow: inset 0 -4px 0 #0007; }
.dpad button:active, .dpad button.on { background: #35304a; box-shadow: inset 0 2px 0 #0007; }
.d-up { grid-area: 1 / 2; border-radius: 8px 8px 0 0; }
.d-left { grid-area: 2 / 1; border-radius: 8px 0 0 8px; }
.d-mid { grid-area: 2 / 2; }
.d-right { grid-area: 2 / 3; border-radius: 0 8px 8px 0; }
.d-down { grid-area: 3 / 2; border-radius: 0 0 8px 8px; }
.ab { display: flex; gap: 16px; transform: rotate(-20deg); }
.ab button { width: 58px; height: 58px; border-radius: 50%; border: 3px solid #241d6a; background: #e04870; color: #ffe1ea; font-family: var(--px); font-size: 14px; box-shadow: inset 0 -5px 0 #0005, 0 3px 0 #0005; }
.ab .btn-b { margin-top: 26px; }
.ab button:active, .ab button.on { transform: translateY(3px); box-shadow: inset 0 2px 0 #0005; }
.keys { opacity: .7; font-size: 14px; text-align: center; }
@media (hover: hover) and (pointer: fine) and (min-width: 900px) { .pad { display: none; } }

/* Side panels */
.side { background: var(--paper); color: var(--ink); border: 4px solid var(--line); border-radius: 14px; box-shadow: 0 6px 0 #0006; min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; border-bottom: 3px solid var(--line); }
.tabs button { flex: 1; background: var(--paper2); border: 0; border-right: 2px solid #d6caa6; padding: 10px 6px; font-weight: 700; color: #50586a; }
.tabs button:first-child { border-top-left-radius: 10px; }
.tabs button:last-child { border-right: 0; border-top-right-radius: 10px; }
.tabs button.on { background: var(--paper); color: var(--ink); box-shadow: inset 0 -4px 0 var(--accent); }
.panel { padding: 14px 16px; max-height: 560px; overflow: auto; }
.empty { color: #6a7080; text-align: center; padding: 24px 8px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.catch { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; background: #fff; border: 2px solid #e1d6b6; border-left: 6px solid var(--common); border-radius: 10px; padding: 6px 10px; }
.catch.epic { border-left-color: var(--epic); }
.catch.legendary { border-left-color: var(--legendary); background: #fff8e0; }
.catch img { width: 44px; height: 44px; image-rendering: pixelated; }
.catch .fn { font-weight: 700; }
.catch .pz { font-size: 15px; color: #444c5c; }
.catch .meta { font-size: 13px; color: #7a8090; }
.pill { font-family: var(--px); font-size: 7px; padding: 4px 6px; border-radius: 6px; color: #fff; background: var(--common); white-space: nowrap; }
.pill.epic { background: var(--epic); }
.pill.legendary { background: var(--legendary); color: #3a1a00; }
.status { font-size: 13px; font-weight: 700; color: #a06a00; }
.status.ok { color: #2d8a3a; }
.status.no { color: #b3301a; }
.t-common { color: var(--common); font-weight: 700; }
.t-epic { color: var(--epic); font-weight: 700; }
.t-legendary { color: var(--legendary); font-weight: 700; }
.bang { font-family: var(--px); color: #d0402a; }
.payinfo { white-space: pre-wrap; background: #fff; border: 2px dashed #d6caa6; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.form { display: grid; gap: 10px; background: #fff; border: 2px solid #e1d6b6; border-radius: 10px; padding: 12px; }
.form label, .mbox label { display: grid; gap: 4px; font-weight: 600; font-size: 15px; }
.form input, .mbox input { font: inherit; padding: 8px 10px; border: 2px solid #c9bd98; border-radius: 8px; background: #fffdf6; }
.form .row { display: grid; grid-template-columns: 100px 1fr; gap: 10px; }
.msg { min-height: 1.2em; font-size: 15px; margin: 0; }
.msg.err { color: #b3301a; }
.msg.ok { color: #2d8a3a; }
.req { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; padding: 6px 0; border-bottom: 1px dashed #d6caa6; }
.tier { border: 2px solid #e1d6b6; border-radius: 12px; background: #fff; padding: 10px 12px; margin-bottom: 10px; }
.tier h4 { margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; font-family: var(--px); font-size: 10px; }
.tier .odds { font-family: var(--px); font-size: 10px; }
.tier .fishes { display: flex; gap: 6px; margin: 4px 0 6px; }
.tier .fishes img { width: 36px; height: 36px; image-rendering: pixelated; }
.tier ul { margin: 0; padding-left: 18px; }
.tier.off { opacity: .5; }
.steps { padding-left: 20px; display: grid; gap: 10px; margin: 0; }
.fine { font-size: 14px; color: #6a7080; }
h3 { margin: 6px 0 10px; }

.feedbox { margin: 0 20px 20px; }
.feedbox h2 { font-family: var(--px); font-size: 11px; color: #9fe3dc; }
.feed { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.feed li { display: flex; gap: 10px; align-items: center; background: #0d1a26; border: 2px solid #ffffff14; border-left: 5px solid var(--common); border-radius: 10px; padding: 6px 10px; font-size: 15px; }
.feed li.epic { border-left-color: var(--epic); }
.feed li.legendary { border-left-color: var(--legendary); background: #2a2208; }
.feed img { width: 32px; height: 32px; image-rendering: pixelated; }
.feed small { color: #8aa0b0; display: block; }
.foot { text-align: center; padding: 20px; opacity: .7; font-size: 14px; }
.foot a { color: #9fe3dc; }

.modal { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 20; padding: 16px; }
.mbox { width: min(380px, 100%); background: var(--paper); color: var(--ink); border: 4px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 10px; box-shadow: 0 8px 0 #0006; }
.mtabs { display: flex; gap: 6px; }
.mtabs button { flex: 1; background: var(--paper2); border: 2px solid #d6caa6; border-radius: 8px; padding: 6px; font-weight: 700; }
.mtabs button.on { background: var(--teal); color: #fff; border-color: var(--line); }
.merr { color: #b3301a; min-height: 1.2em; margin: 0; }
.mbtns { display: flex; justify-content: flex-end; gap: 8px; }
.mbtns .ghost { color: var(--ink); background: var(--paper2); }

.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 30; width: min(440px, 92vw); }
.toast { background: var(--paper); color: var(--ink); border: 3px solid var(--line); border-left: 8px solid var(--teal); border-radius: 10px; padding: 10px 12px; box-shadow: 0 4px 0 #0006; animation: toastIn .3s ease-out; font-weight: 600; }
.toast.epic { border-left-color: var(--epic); }
.toast.legendary { border-left-color: var(--legendary); background: #fff4cc; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } }
