:root {
  --bg: #0e1320;
  --bg2: #141b2b;
  --card: #1b2336;
  --card2: #232d44;
  --line: #2f3b56;
  --text: #f4f1e8;
  --muted: #a8b1c5;
  --yellow: #ffd23f;
  --coral: #ff6b57;
  --mint: #4ee0a8;
  --sky: #5ab8ff;
  --head: "Trebuchet MS", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--body); }
a { color: var(--sky); }
a:hover { color: #9fd6ff; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--yellow); color: #111; padding: 8px 12px; border-radius: 8px; z-index: 300; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* header */
.top { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 16px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.brand { font: italic 900 22px/1 var(--head); color: var(--yellow); text-decoration: none; letter-spacing: -0.5px; text-shadow: 2px 2px 0 #b3301f; white-space: nowrap; }
.brand span { color: #fff; }
.top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.top nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { background: var(--card2); }
.lang-pick { position: relative; flex: none; }
.lang-pick summary { display: flex; align-items: center; gap: 5px; list-style: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--text); }
.lang-pick summary::-webkit-details-marker { display: none; }
.lang-pick summary:hover, .lang-pick[open] summary { background: var(--card2); }
.lang-pick ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 200; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); max-height: 70vh; overflow-y: auto; min-width: 190px; }
.lang-pick li a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; }
.lang-pick li a:hover, .lang-pick li a[aria-current] { background: var(--card2); }
@media (min-width: 521px) {
  .lang-pick ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 4px; min-width: 330px; }
}
@media (max-width: 520px) {
  .top { gap: 8px; padding: 0 10px; }
  .brand { font-size: 19px; }
  .top nav a { padding: 6px 7px; font-size: 13px; }
  .top nav a[href$="/yesterday/"] { display: none; }
  .lang-pick summary { padding: 6px 4px; }
  .lang-pick summary span { display: none; }
}

/* text pages */
.doc { max-width: 820px; margin: 0 auto; padding: 24px 18px 40px; }
.doc h1 { font: 900 clamp(28px, 6vw, 40px)/1.15 var(--head); margin: 8px 0 12px; }
.doc h2 { font: 800 22px/1.25 var(--head); margin: 30px 0 8px; color: var(--yellow); }
.lede { font-size: 18px; color: #dfe4ee; }
.steps { padding-left: 20px; }
.steps li { margin: 6px 0; }
.note { color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 30px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 8px 0 2px; color: #dfe4ee; }
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; }
.foot { border-top: 1px solid var(--line); padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.foot .fine { max-width: 720px; margin: 8px auto 0; font-size: 12.5px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--line); background: var(--card2); color: var(--text); font: 700 16px/1.1 var(--head); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #4a5a80; color: var(--text); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: #1b1300; box-shadow: 0 4px 0 #b88a00; }
.btn.primary:hover { background: #ffe06e; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b88a00; }
.btn.big { width: 100%; min-height: 54px; font-size: 20px; }
.btn.ghost { background: transparent; width: 100%; }
.link { background: none; border: 0; color: var(--sky); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.row .btn { flex: 1 1 130px; }

/* game stage */
.stage { position: relative; width: 100%; height: calc(100svh - 52px); min-height: 520px; max-height: 760px; background: #0b0f19; overflow: hidden; user-select: none; -webkit-user-select: none; }
@media (min-width: 900px) {
  .stage { max-width: 1180px; margin: 16px auto 0; height: min(calc(100vh - 120px), 720px); border-radius: 18px; border: 1px solid var(--line); }
}
html.playing, html.playing body { overflow: hidden; overscroll-behavior: none; }
html.playing .stage { position: fixed; inset: 0; z-index: 200; height: 100%; max-height: none; max-width: none; min-height: 0; margin: 0; border-radius: 0; border: 0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.menu, .ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: radial-gradient(ellipse at center, rgba(8,11,22,0.35), rgba(8,11,22,0.75)); z-index: 5; }
.menu[hidden], .ov[hidden], .hud[hidden], .bossbar[hidden] { display: none; }
.panel { width: min(500px, 100%); max-height: 100%; overflow-y: auto; background: rgba(20, 27, 43, 0.95); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); text-align: center; }
.panel h2 { font: 900 24px/1.2 var(--head); margin: 2px 0 6px; }
.panel.small { width: auto; padding: 18px 26px; }
.logo { margin: 0; font: italic 900 clamp(34px, 9vw, 48px)/1 var(--head); color: var(--yellow); letter-spacing: -1px; text-shadow: 3px 3px 0 #b3301f, 0 0 24px rgba(255, 210, 63, 0.25); }
.logo span { color: #fff; font-size: 0.62em; letter-spacing: 0; text-shadow: 2px 2px 0 #b3301f; }
.sub { margin: 6px 0 10px; color: var(--muted); font-size: 14px; }
.daily-tag { margin: 0 0 8px; font: 800 14px/1.3 var(--head); color: var(--mint); text-transform: uppercase; letter-spacing: 0.6px; }
.today { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; text-align: left; }
.today-mon { width: 88px; height: 88px; image-rendering: pixelated; background: radial-gradient(circle, rgba(255,210,63,0.25), transparent 70%); border-radius: 50%; flex: none; }
.chips { display: grid; gap: 6px; flex: 1; }
.chip { background: var(--card2); border-radius: 10px; padding: 6px 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.chip span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; min-width: 48px; }
.chip b { font: 800 15px/1.2 var(--head); }
.chip small { flex-basis: 100%; color: #cdd5e4; font-size: 12.5px; line-height: 1.3; }
.mine { margin: 10px 0 6px; font-size: 14px; color: var(--muted); }
.mine b { color: var(--text); }
.next { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.panel .btn + .btn { margin-top: 8px; }
.board { margin-top: 10px; text-align: left; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 8px 12px; }
.board h2 { font-size: 15px; margin: 0 0 4px; color: var(--yellow); }
.board h2 small { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 6px; }
.board p { margin: 4px 0; font-size: 14px; }
.lb { list-style: none; margin: 4px 0; padding: 0; font-size: 14px; }
.lb li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.lb li.me { color: var(--yellow); }
.lb .rk { width: 20px; color: var(--muted); text-align: right; }
.lb .nk { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .st { color: var(--muted); font-size: 12.5px; }

/* free run picker */
.pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mon { min-width: 0; background: var(--card2); border: 2px solid transparent; border-radius: 12px; padding: 4px 2px 5px; color: var(--text); cursor: pointer; font: 700 11px/1.15 var(--head); min-height: 44px; overflow-wrap: anywhere; }
.mon img { width: 100%; max-width: 72px; height: auto; aspect-ratio: 1; image-rendering: pixelated; display: block; margin: -10% auto -8%; }
.mon.on { border-color: var(--yellow); background: #332d1a; }
.mon:disabled { cursor: not-allowed; color: var(--muted); font-weight: 600; font-size: 9.5px; }
.mon:disabled img { filter: brightness(0) opacity(0.45); }
.pick-info { font-size: 13.5px; margin: 8px 0; color: #dfe4ee; }
.arenas { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.arena { border: 2px solid transparent; border-radius: 999px; padding: 6px 12px; min-height: 36px; background: color-mix(in srgb, var(--g) 45%, #1b2336); color: #fff; font: 700 13px/1.1 var(--head); cursor: pointer; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.arena.on { border-color: var(--yellow); }
.arena:disabled { background: var(--card); color: var(--muted); cursor: not-allowed; font-weight: 600; font-size: 12px; text-shadow: none; }
.mon span { display: block; overflow-wrap: normal; }
.mon:disabled span { overflow-wrap: anywhere; }
@media (max-width: 420px) { .pick { gap: 4px; } .mon { font-size: 9.5px; letter-spacing: -0.2px; } .mon:disabled { font-size: 9px; } }

/* HUD */
.hud { position: absolute; left: 0; right: 0; top: 0; z-index: 3; pointer-events: none; padding: max(6px, env(safe-area-inset-top)) 10px 0; }
.xp { height: 10px; background: rgba(5,8,18,0.7); border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; overflow: hidden; }
.xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5ab8ff, #8ff0ff); }
.hud-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; font: 800 15px/1 var(--head); text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.lvl { color: #8ff0ff; min-width: 52px; }
.timer { flex: 1; text-align: center; font-size: 24px; letter-spacing: 1px; }
.timer.warn { color: var(--coral); }
.kos { min-width: 60px; text-align: right; }
.hud-btns { display: flex; gap: 6px; pointer-events: auto; }
.hb { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.3); background: rgba(10,14,28,0.6); color: #fff; font: 800 16px/1 var(--head); cursor: pointer; }
.build { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; max-width: 60%; }
.slot { position: relative; width: 30px; height: 30px; border-radius: 8px; background: rgba(10,14,28,0.65); border: 2px solid var(--c); display: grid; place-items: center; font-size: 15px; }
.slot i { font-style: normal; }
.slot b { position: absolute; right: -4px; bottom: -5px; font: 900 10px/1 var(--head); background: #111827; color: #fff; border-radius: 6px; padding: 2px 3px; }
.bossbar { margin: 6px auto 0; width: min(420px, 80%); text-align: center; font: 800 13px/1.2 var(--head); text-shadow: 0 1px 3px #000; }
.bb { height: 9px; background: rgba(5,8,18,0.75); border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; overflow: hidden; margin-top: 2px; }
.bb i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff4d5e, #ffa24d); }
.banner { position: absolute; left: 50%; top: 96px; transform: translate(-50%, -10px); z-index: 4; opacity: 0; pointer-events: none; background: rgba(10,14,28,0.85); border: 1px solid var(--line); color: #fff; padding: 8px 16px; border-radius: 12px; font: 800 16px/1.3 var(--head); text-align: center; max-width: 92%; transition: opacity 0.25s, transform 0.25s; }
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.banner.boss { border-color: var(--coral); color: #ffd0c8; }
.banner.evo { border-color: var(--yellow); color: var(--yellow); }
.menu-panel { position: relative; }
.help-btn { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: 900 18px/1 var(--head); cursor: pointer; }
.help-btn:hover, .help-btn:focus-visible { border-color: var(--yellow); color: var(--yellow); }

/* tutorial (site/js/tutorial.js): everything inside .pokebonk-tut, which sits in the game container */
.pokebonk-tut { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.pokebonk-tut-hole { position: absolute; box-shadow: 0 0 0 200vmax rgba(5, 8, 18, 0.55); outline: 3px solid var(--yellow, #ffd23f); outline-offset: 2px; animation: pokebonk-tut-ring 1.4s ease-in-out infinite; }
.pokebonk-tut-hole[hidden] { display: none; }
@keyframes pokebonk-tut-ring { 50% { outline-color: rgba(255, 210, 63, 0.35); outline-offset: 6px; } }
.pokebonk-tut-box { position: absolute; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100% - 20px)); pointer-events: auto; background: rgba(20, 27, 43, 0.97); border: 2px solid var(--yellow, #ffd23f); border-radius: 16px; padding: 10px 14px 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55); color: var(--text, #f4f1e8); text-align: left; animation: pokebonk-tut-in 0.25s ease-out; }
.pokebonk-tut-box.pokebonk-tut-top { bottom: auto; top: calc(max(6px, env(safe-area-inset-top)) + 64px); }
@keyframes pokebonk-tut-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.pokebonk-tut-count { display: flex; justify-content: space-between; gap: 8px; margin: 0; font: 800 12px/1.3 var(--head); color: var(--muted, #a8b1c5); }
.pokebonk-tut-count small { font-weight: 600; text-align: right; }
.pokebonk-tut-ok .pokebonk-tut-count span { color: var(--mint, #4ee0a8); }
.pokebonk-tut-title { margin: 2px 0 2px; font: 900 19px/1.2 var(--head); color: var(--yellow, #ffd23f); }
.pokebonk-tut-text { margin: 0 0 10px; font-size: 15px; line-height: 1.4; }
.pokebonk-tut-row { display: flex; gap: 8px; align-items: center; }
.pokebonk-tut-btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line, #2f3b56); background: var(--card2, #232d44); color: var(--text, #f4f1e8); font: 800 15px/1 var(--head); cursor: pointer; }
.pokebonk-tut-btn[hidden] { display: none; }
.pokebonk-tut-btn:focus-visible { outline: 3px solid var(--sky, #5ab8ff); outline-offset: 2px; }
.pokebonk-tut-skip { margin-right: auto; padding: 0 8px; border-color: transparent; background: none; color: var(--muted, #a8b1c5); text-decoration: underline; }
.pokebonk-tut-next { border-color: var(--yellow, #ffd23f); }
.pokebonk-tut-primary { background: var(--yellow, #ffd23f); color: #111; }
.pokebonk-tut-still .pokebonk-tut-hole, .pokebonk-tut-still .pokebonk-tut-box { animation: none; }

/* level up */
.levelup { width: min(460px, 100%); }
.lv-title { color: var(--yellow); }
.cards { display: grid; gap: 8px; margin-top: 8px; }
.card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; min-height: 64px; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, #1b2336); color: var(--text); cursor: pointer; font: inherit; }
.card:hover, .card:focus-visible { border-color: var(--c); background: color-mix(in srgb, var(--c) 24%, #1b2336); }
.card > i { font-style: normal; font-size: 28px; width: 40px; text-align: center; flex: none; }
.ct { display: grid; flex: 1; }
.ct small { color: var(--c); font: 800 11px/1.2 var(--head); text-transform: uppercase; letter-spacing: 0.6px; }
.ct b { font: 800 17px/1.25 var(--head); }
.ct span { font-size: 13.5px; color: #d3dae7; line-height: 1.35; }
.card kbd { font: 700 12px/1 var(--head); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
@media (pointer: coarse) { .card kbd { display: none; } }

/* pause & results */
.build-list, .panel ul.build { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; text-align: left; font-size: 14px; max-width: none; }
.panel ul.build li { background: var(--card2); border-radius: 8px; padding: 5px 8px; }
.panel ul.build i { font-style: normal; margin-right: 4px; }
.panel ul.build b { color: var(--muted); font-size: 12px; }
.toggles label { display: inline-flex; gap: 6px; align-items: center; min-height: 40px; padding: 0 8px; font-size: 14px; }
.toggles input { width: 18px; height: 18px; accent-color: var(--yellow); }
.res-title { color: #ffd0c8; }
.res-title.win { color: var(--yellow); }
.res-top { display: flex; align-items: center; justify-content: center; gap: 14px; }
.res-top img { width: 88px; height: 88px; image-rendering: pixelated; }
.score { margin: 0; font: 900 40px/1 var(--head); color: var(--yellow); }
.res-top p { margin: 2px 0; text-align: left; }
.res-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.res-stats .chip { flex-direction: column; align-items: center; padding: 6px 4px; }
.res-stats .chip span { min-width: 0; font-size: 11px; }
.unlock { background: #1f3a2c; border: 1px solid #2f6b4c; border-radius: 10px; padding: 8px; font-size: 14px; margin: 8px 0; }
.post { text-align: left; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.post .rank { margin: 2px 0 4px; font-weight: 700; }
.nick label { font-size: 14px; font-weight: 700; }
.nick input { flex: 1 1 150px; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: #0e1424; color: var(--text); padding: 0 12px; font-size: 16px; }
.share-preview { margin: 8px 0 0; padding: 8px 10px; background: #0e1424; border-radius: 10px; font: 13px/1.45 ui-monospace, Consolas, monospace; text-align: left; white-space: pre-wrap; color: #dfe4ee; }
.loading { margin: 0; font: 700 16px/1.3 var(--head); }

/* yesterday */
.y-setup { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.y-setup img { width: 88px; height: 88px; image-rendering: pixelated; flex: none; }
.y-setup ul { list-style: none; padding: 0; margin: 0; }
.y-table { margin-top: 14px; }
.y-table td:first-child { color: var(--muted); width: 32px; }

/* contact form */
form[data-feedback-form] { display: grid; gap: 12px; margin-top: 16px; }
.fb-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .fb-row { grid-template-columns: 1fr; } }
.fb-field { display: grid; gap: 4px; }
.fb-field label { font-weight: 700; font-size: 14px; }
.fb-hint { color: var(--muted); font-weight: 400; }
.fb-field input, .fb-field textarea { width: 100%; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: #0e1424; color: var(--text); padding: 8px 12px; font: 16px/1.4 var(--body); }
.fb-field textarea { min-height: 150px; resize: vertical; }
form[data-feedback-form] .btn { justify-self: start; }

@media (prefers-reduced-motion: reduce) {
  .banner { transition: none; }
  .btn.primary:active { transform: none; }
  .pokebonk-tut-hole, .pokebonk-tut-box { animation: none; }
}
