:root {
  --bg: #0d1024;
  --panel: #151a38;
  --panel-2: #1d2348;
  --line: #2e376b;
  --text: #e9edff;
  --muted: #98a3cf;
  --green: #4be38c;
  --red: #ff6572;
  --gold: #ffd24a;
  --blue: #6bb2ff;
  --ink: #090b1c;
  --display: Impact, "Haettenschweiler", "Arial Narrow Bold", "Arial Black", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.35 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
#app { height: 100vh; height: 100dvh; overflow: hidden; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }
button, select, textarea, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
img.mon { image-rendering: pixelated; display: block; user-select: none; }
small { font-size: 0.84em; }
.muted { color: var(--muted); }
.up { color: var(--green); }
.down-text, small.down, span.down, em.down { color: var(--red); }
.goldmark { color: var(--gold); }

/* ---- buttons ------------------------------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  font-weight: 700; text-align: center;
  transition: border-color 0.9s ease, background-color 0.9s ease, filter 0.9s ease;
}
.btn:hover:not(:disabled) { border-color: #5663ad; background: #252c5a; transition-duration: 0.6s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; }
.btn.primary { background: linear-gradient(#2fbf6d, #1d8f52); border-color: #6df0a4; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(#35c875, #21995a); border-color: #8ff5bb; }
.btn.danger { border-color: #8d3446; color: #ffb6bd; }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 0.86em; border-radius: 8px; white-space: nowrap; }
.btn.wide { width: 100%; }
.btn.big { min-height: 50px; padding: 10px 28px; font: 400 22px var(--display); font-style: italic; letter-spacing: 0.5px; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

select, textarea {
  background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 100%;
}
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* ---- shared pieces ------------------------------------------------------------------------------------------ */

.type {
  display: inline-block; padding: 0 6px; border-radius: 5px; white-space: nowrap;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.4px; line-height: 16px;
  color: #0b0d1e; background: var(--t);
}
.rating { display: inline-block; padding: 0 4px; border-radius: 4px; font: 800 10.5px/15px ui-monospace, Menlo, monospace; border: 1px solid currentColor; color: var(--muted); }
.rating.r2, .rating.r3 { color: #8fd0ff; }
.rating.r4 { color: #7dffb0; }
.rating.r5 { color: #d9a2ff; }
.rating.r6 { color: var(--gold); background: rgba(255,210,74,.14); }
.bar { display: block; height: 6px; background: rgba(0,0,0,.5); border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.bar i { display: block; height: 100%; background: var(--blue); transition: width 0.35s ease, background-color 0.35s; }
.bar.hp.good i { background: var(--green); }
.bar.hp.warn i { background: var(--gold); }
.bar.hp.bad i { background: var(--red); }
.bar.xp { height: 3px; }
.bar.xp i { background: #58c8ff; }
.bar.goal i { background: var(--gold); }
.face { width: 40px; height: 40px; border-radius: 10px; background: #232a56; object-fit: cover; border: 2px solid var(--c, var(--line)); flex: none; }
.face.pool { display: grid; place-items: center; font-size: 22px; color: #b88cff; }

/* ---- the frame ---------------------------------------------------------------------------------------------- */

.game { height: 100%; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.top {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: calc(6px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 6px calc(10px + env(safe-area-inset-left));
  background: linear-gradient(#1b2150, #141938); border-bottom: 1px solid var(--line);
}
.logo { font: italic 400 21px var(--display); letter-spacing: 0.5px; color: #fff; text-decoration: none; white-space: nowrap; }
.logo b { font-weight: 400; color: var(--green); }
.spacer { flex: 1; }
.mood-chip { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mood-chip.bull, .card.mood.bull { border-color: #2d9d61; }
.mood-chip.bear, .card.mood.bear { border-color: #a93c4b; }
.mood-chip.crypto, .card.mood.crypto { border-color: #b36b13; }
.mood-chip.mania, .card.mood.mania { border-color: #a9428f; }
.mood-chip.earnings, .card.mood.earnings { border-color: #3567ad; }
.mood-chip.inflows, .card.mood.inflows { border-color: #26867f; }
.mood-chip.printing, .card.mood.printing { border-color: #a4852a; }
.purse, .bags-chip { display: flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--ink); border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.purse .coin { color: var(--gold); font-size: 16px; }
.bags-chip span { display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; }
.bags-chip .sack { width: 18px; height: 18px; }
.icon { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--ink); flex: none; }
.icon .off { opacity: 0.35; filter: grayscale(1); }

.tape-wrap { flex: none; height: 22px; overflow: hidden; background: var(--ink); border-bottom: 1px solid var(--line); }
.tape { display: flex; width: max-content; animation: tape calc(var(--n) * 4s) linear infinite; }
.tape div { display: flex; }
.tape span { padding: 0 14px; font: 600 11.5px/22px ui-monospace, Menlo, monospace; white-space: nowrap; }
.tape span b { color: var(--text); margin-right: 5px; }
.tape span.up { color: var(--green); }
.tape span.down { color: var(--red); }
@keyframes tape { to { transform: translateX(-50%); } }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr); }

/* ---- the stage ---------------------------------------------------------------------------------------------- */

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { position: relative; flex: 1; min-height: 140px; overflow: hidden; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; background: #11152e; }
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.plate {
  position: absolute; top: 8px; width: min(232px, 44%); padding: 6px 9px 7px;
  background: rgba(11, 13, 34, 0.82); border: 1px solid rgba(150, 165, 255, 0.28); border-radius: 10px;
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.plate-body { display: flex; flex-direction: column; gap: inherit; }
.plate.me { left: 8px; }
.plate.foe { right: 8px; }
.plate-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.plate-top b { font: italic 400 16px var(--display); letter-spacing: 0.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-top small { color: var(--muted); white-space: nowrap; }
.plate-mid { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 16px; }
.plate-mid em { font-style: normal; font-size: 10px; font-weight: 800; }
.plate-mid em.up { color: var(--green); }
.plate-mid .new { font-size: 10px; font-weight: 900; color: var(--gold); }
.plate-mid .owned { font-size: 10px; color: var(--muted); }
.plate-num { font: 600 11px ui-monospace, Menlo, monospace; text-align: right; color: var(--muted); margin: -2px 0 -3px; }
.pips { display: inline-flex; gap: 3px; }
.plate .pips { margin-left: auto; }
.plate .pips i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.plate .pips i.down { background: #454b73; }
.log { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 5px; pointer-events: none; text-align: center; background: linear-gradient(transparent, rgba(7, 8, 24, 0.82)); }
.log p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.log p.old { font-size: 11.5px; color: var(--muted); }
.log p.new { font-weight: 700; font-size: 13px; }

.controls { flex: none; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.control-row { display: flex; align-items: center; gap: 8px; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex: none; }
.segmented button { padding: 5px 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--ink); min-height: 30px; white-space: nowrap; }
.segmented button.on { background: #2b3370; color: #fff; }
.hype { position: relative; flex: 1; min-width: 70px; height: 30px; border: 1px solid #6b5a1d; border-radius: 9px; background: var(--ink); overflow: hidden; user-select: none; }
.hype i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #7a4d0e, #d99a12); transition: width 0.15s; }
.hype span { position: relative; font: italic 400 14px var(--display); letter-spacing: 1px; white-space: nowrap; }
.hype.full { border-color: var(--gold); animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { filter: brightness(1.25); } }
.rule { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rule select { padding: 3px 4px; font-size: 12px; color: var(--text); }
.moves-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.move { text-align: left; padding: 5px 8px; border-radius: 9px; border: 1px solid var(--line); border-left: 4px solid var(--t); background: var(--panel-2); min-width: 0; transition: background-color 0.9s; }
.move:hover { background: #262e60; transition-duration: 0.6s; }
.move b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move small em { font-style: normal; font-weight: 800; }
.moves-row.waiting .move { border-color: #8b7a2c; border-left-color: var(--t); }
.move.chosen, .bag-btn.chosen, .swap.chosen { outline: 2px solid var(--gold); }
.extra-row { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.bag-btn, .swap { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--ink); }
.bag-btn .sack { width: 22px; height: 22px; }
.bag-btn small { font-size: 10px; line-height: 1; }
.swap img { width: 30px; height: 30px; }
.swap .bar { width: 32px; height: 3px; }
.swap.down { opacity: 0.35; }
.divider { width: 1px; height: 28px; background: var(--line); flex: none; }
.extra-row .run { margin-left: auto; }

.zone-strip { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #11152f; border-top: 1px solid var(--line); }
.zone-label { flex: 1; min-width: 0; text-align: left; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; }
.zone-label b { font: italic 400 16px var(--display); letter-spacing: 0.5px; white-space: nowrap; }
.zone-label small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-label .bar { grid-column: 1 / -1; height: 4px; margin-top: 3px; }
.challengers { display: flex; gap: 5px; overflow-x: auto; max-width: 66%; scrollbar-width: none; }
.challenger { display: flex; align-items: center; gap: 5px; flex: none; padding: 2px 9px 2px 2px; border-radius: 999px; border: 1px solid var(--c); background: var(--ink); font-size: 12px; font-weight: 800; }
.challenger .face { width: 26px; height: 26px; border-radius: 50%; border-width: 1px; }
.challenger.boss { background: #2a2340; box-shadow: 0 0 12px -3px var(--c); }
.challenger:disabled { opacity: 0.4; }

/* ---- the side panel ----------------------------------------------------------------------------------------- */

.side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
.tabs { display: flex; flex: none; background: var(--ink); border-bottom: 1px solid var(--line); }
.tabs button { position: relative; flex: 1; padding: 9px 2px; font-size: 12.5px; font-weight: 800; color: var(--muted); border-bottom: 2px solid transparent; transition: color 0.9s; }
.tabs button:hover { color: var(--text); transition-duration: 0.6s; }
.tabs button.on { color: #fff; border-bottom-color: var(--green); background: var(--panel); }
.dot { position: absolute; top: 6px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.panel { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 28px; overscroll-behavior: contain; }
.panel-head { margin-bottom: 8px; }
.panel-head h2 { font: italic 400 20px var(--display); letter-spacing: 0.6px; }
.panel-head h2 small { color: var(--muted); font-family: system-ui, sans-serif; font-style: normal; }
.panel-head p { color: var(--muted); font-size: 12.5px; }
.panel-head.sub { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.panel ul, .panel ol { list-style: none; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.note { color: var(--gold); font-size: 12.5px; margin-bottom: 6px; }
.empty-note { color: var(--muted); padding: 14px 4px; text-align: center; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: #2fbf6d; }
.field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; font-size: 13px; }
.field small { flex-basis: 100%; color: var(--muted); }

/* portfolio */
.team { display: flex; flex-direction: column; gap: 5px; }
.slot { display: flex; align-items: stretch; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; }
.slot.active { border-color: var(--green); }
.slot.gold, .tile.gold { border-color: #a8872a; background: linear-gradient(135deg, #2d2840, #1d2348); }
.slot.down .mon { filter: grayscale(1) brightness(0.65); }
.slot.empty { justify-content: center; padding: 10px; border-style: dashed; color: var(--muted); font-size: 12px; background: none; }
.slot-main { flex: 1; display: flex; align-items: center; gap: 8px; padding: 4px 6px; text-align: left; min-width: 0; }
.slot-main .mon { width: 52px; height: 52px; flex: none; }
.slot-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.slot-name { font-weight: 800; }
.slot-name small { color: var(--muted); font-weight: 600; }
.slot-tags { display: flex; gap: 5px; align-items: center; }
.out { font-size: 10px; color: var(--red); font-weight: 800; text-transform: uppercase; }
.slot-move { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.slot-move button { flex: 1; width: 28px; color: var(--muted); font-size: 10px; }
.slot-move button:disabled { opacity: 0.2; }
.filters { display: flex; gap: 12px; margin-bottom: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.filters select { padding: 3px 5px; font-size: 12px; color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; margin-bottom: 8px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; padding: 4px 3px 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; min-width: 0; transition: border-color 0.9s; }
.tile:hover { border-color: #6270c4; transition-duration: 0.6s; }
.tile .mon { width: 62px; height: 62px; }
.tile-name { font-size: 10.5px; font-weight: 800; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { font-size: 10.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.tile-flag { position: absolute; top: 2px; right: 5px; font-size: 10px; color: #ff9ab0; }
.tile.down .mon { filter: grayscale(1) brightness(0.65); }

/* map */
.zones { display: flex; flex-direction: column; gap: 7px; }
.zone { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.zone.here { border-color: var(--green); }
.zone-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: left; background-size: cover; background-position: center; }
.zone.closed .zone-head { filter: grayscale(1) brightness(0.6); }
.zone-num { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); font-weight: 900; font-size: 12px; flex: none; }
.zone-name { flex: 1; display: flex; flex-direction: column; text-shadow: 0 1px 3px #000; }
.zone-name b { font: italic 400 17px var(--display); letter-spacing: 0.5px; }
.zone-name small { color: #cdd4f5; }
.zone-flag { font-size: 11px; font-weight: 800; text-shadow: 0 1px 3px #000; }
.zone-flag i { font-style: normal; font-size: 18px; }
.zone-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.zone-wild { display: flex; flex-wrap: wrap; gap: 3px; }
.zone-wild button { position: relative; }
.zone-wild .mon { width: 40px; height: 40px; }
.zone-wild i { position: absolute; right: -1px; bottom: -1px; font-style: normal; font-size: 9px; color: var(--green); font-weight: 900; }
.zone-count { font-size: 12px; color: var(--muted); }
.trainer-list { display: flex; flex-direction: column; gap: 5px; }
.trainer-row { display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 10px; background: var(--ink); border: 1px solid transparent; }
.trainer-row.boss { border-color: var(--c); }
.trainer-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trainer-info b { font-size: 13px; color: var(--c); }
.trainer-info small { color: var(--muted); }
.trainer-state { font-size: 11.5px; color: var(--muted); white-space: nowrap; padding-right: 4px; }
.card.champion { border-color: var(--gold); margin-bottom: 10px; }

/* watchlist */
.milestones { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.milestones li { display: flex; gap: 5px; font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.milestones li.done { color: var(--green); border-color: #2d7a52; }
.dex { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.dex-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 3px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); transition: border-color 0.9s; }
.dex-cell:hover { border-color: #6270c4; transition-duration: 0.6s; }
.dex-cell.caught { background: var(--panel-2); }
.dex-cell.legendary.caught { border-color: #a8872a; }
.dex-cell .mon { width: 64px; height: 64px; }
.dex-cell .mon.faded { opacity: 0.55; filter: saturate(0.4); }
.dex-num { align-self: flex-start; padding-left: 3px; font: 600 10px ui-monospace, Menlo, monospace; color: var(--muted); }
.dex-name { font-size: 10.5px; font-weight: 800; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* exchange */
.card.mood small { color: var(--muted); }
.quotes { display: flex; flex-direction: column; gap: 4px; }
.quotes li { display: grid; grid-template-columns: minmax(0, 1fr) 60px 70px 82px; align-items: center; gap: 6px; padding: 3px 6px 3px 2px; border-radius: 10px; background: var(--panel-2); }
.quote-mon { display: flex; align-items: center; gap: 6px; min-width: 0; text-align: left; }
.quote-mon .mon { width: 40px; height: 40px; flex: none; }
.quote-mon span { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 2px; }
.quote-mon b { font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { width: 60px; height: 22px; }
.spark polyline { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark line { stroke: #4a5390; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.spark.up polyline { stroke: var(--green); }
.spark.down polyline { stroke: var(--red); }
.quote-price, .quote-sell { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.quote-price b { font-size: 12px; }
.quote-price small.up { color: var(--green); }
.quote-sell small { color: var(--muted); font-size: 10.5px; }

/* trading */
.offers { display: flex; flex-direction: column; gap: 8px; }
.offer { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.offer-who { display: flex; align-items: center; gap: 8px; color: var(--c); }
.offer-who .face { width: 32px; height: 32px; }
.offer-swap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.offer-swap button { display: flex; flex-direction: column; align-items: center; background: var(--ink); border-radius: 10px; padding: 4px; min-width: 0; }
.offer-swap .mon { width: 66px; height: 66px; }
.offer-swap small { color: var(--muted); }
.offer-swap em { color: var(--gold); font-style: normal; font-weight: 800; }
.offer-swap b { font-size: 12px; }
.arrow { font-size: 22px; color: var(--muted); }
.offer-note { font-size: 12px; color: var(--gold); }
.refresh { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.card.dark { border-color: #56397f; background: linear-gradient(135deg, #1b1236, #1d2348); }
details { width: 100%; }
summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.sent { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.sent li { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }

/* shop */
.buys { display: flex; flex-direction: column; gap: 5px; }
.buys li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); }
.buys .sack { width: 34px; height: 34px; flex: none; }
.buy-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.buy-info small { color: var(--muted); }
.buy-buttons { display: flex; flex-direction: column; gap: 4px; }
.buys .pips { display: flex; gap: 2px; }
.buys .pips i { width: 100%; max-width: 12px; height: 4px; border-radius: 2px; background: var(--ink); }
.buys .pips i.on { background: var(--green); }
.buys li.maxed { opacity: 0.65; }

/* settings */
.trainer-card { flex-direction: row; align-items: center; flex-wrap: wrap; border-color: var(--c); }
.trainer-card .face { width: 60px; height: 60px; }
.trainer-card p { flex: 1; min-width: 160px; font-size: 12.5px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; }
.stats div { background: var(--ink); border-radius: 8px; padding: 5px 8px; }
.stats dt { font-size: 10.5px; color: var(--muted); }
.stats dd { font-weight: 800; font-variant-numeric: tabular-nums; }
.help { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #c6cdf0; }
.panel .help { list-style: disc; padding-left: 18px; }
.chart { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 12px; }
.chart th { text-align: left; color: var(--muted); font-weight: 600; }
.chart td, .chart th { padding: 3px 0; }

/* ---- windows and notices ------------------------------------------------------------------------------------ */

.overlay { position: fixed; inset: 0; z-index: 20; display: flex; padding: 12px; background: rgba(5, 6, 18, 0.74); overflow-y: auto; }
.box { margin: auto; width: min(540px, 100%); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 16px; background: var(--panel); border: 1px solid #4a559c; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 10px; }
.box > * { flex: none; }
.box h2 { font: italic 400 24px var(--display); letter-spacing: 0.6px; }
.box h2 small { font: 600 14px system-ui, sans-serif; color: var(--muted); }
.box ul { list-style: none; }
.mon-head { display: flex; gap: 12px; align-items: flex-start; }
.mon-head > div:last-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mon-art { width: 144px; height: 144px; flex: none; border-radius: 14px; background: radial-gradient(circle at 50% 70%, #39447f, #141938 75%); display: grid; place-items: center; }
.mon-art .mon { width: 132px; height: 132px; }
.mon-art.gold { background: radial-gradient(circle at 50% 70%, #7b6123, #1e1930 75%); }
.hpline { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; font: 600 11px ui-monospace, Menlo, monospace; color: var(--muted); }
.rarity { font-size: 11px; font-weight: 800; }
.statline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.statline div { background: var(--ink); border-radius: 9px; padding: 6px; text-align: center; }
.statline dt { font-size: 10.5px; color: var(--muted); }
.statline dd { font: 800 17px ui-monospace, Menlo, monospace; }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.moves li { padding: 5px 8px; background: var(--panel-2); border-left: 4px solid var(--t); border-radius: 8px; display: flex; flex-direction: column; }
.moves b { font-size: 12.5px; }
.moves small { color: var(--muted); }
.basestats { display: flex; flex-direction: column; gap: 4px; }
.basestats li { display: grid; grid-template-columns: 62px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; }
.basestats b { text-align: right; font-family: ui-monospace, Menlo, monospace; }
.evo-line { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.evo-line button { display: flex; flex-direction: column; align-items: center; }
.evo-line .mon { width: 62px; height: 62px; }
.evo-line span { font-size: 11px; color: var(--muted); }
.gold-show { display: flex; align-items: center; gap: 10px; color: var(--gold); font-weight: 800; }
.gold-show .mon-art { width: 80px; height: 80px; }
.gold-show .mon { width: 72px; height: 72px; }
.away-catches { display: flex; flex-wrap: wrap; gap: 6px; }
.away-catches figure { display: flex; flex-direction: column; align-items: center; padding: 3px 5px; background: var(--ink); border-radius: 9px; border: 1px solid transparent; }
.away-catches figure.gold { border-color: var(--gold); }
.away-catches .mon { width: 56px; height: 56px; }
.away-catches figcaption { font-size: 10px; color: var(--muted); }
.celebrate { font-size: 52px; text-align: center; animation: ring 1.4s ease-in-out 3; transform-origin: 50% 10%; }
@keyframes ring { 20% { transform: rotate(18deg); } 50% { transform: rotate(-14deg); } 75% { transform: rotate(7deg); } }
.challenge { display: flex; align-items: center; gap: 14px; }
.challenge .face { width: 96px; height: 96px; border-radius: 16px; }
.challenge h2 { color: var(--c); }
.code { font-size: 11px; }

#toasts { position: fixed; z-index: 30; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(340px, 86vw); padding: 9px 14px; border-radius: 11px; background: #1f2552; border: 1px solid #5260ad; font-weight: 700; font-size: 13px; text-align: left; box-shadow: 0 8px 24px rgba(0,0,0,.45); animation: toast-in 0.45s ease; }
.toast.good { border-color: #3db977; }
.toast.bad { border-color: #c45262; }
.toast.gold { border-color: var(--gold); background: #3a3020; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- the first screen --------------------------------------------------------------------------------------- */

.title { height: 100dvh; overflow-y: auto; background-size: cover; background-position: center; display: grid; gap: 14px; padding: 16px max(16px, calc((100% - 1040px) / 2)) 30px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-areas: "head head" "trainers preview" "starters preview" "go go"; align-content: start; }
.title-head { grid-area: head; text-align: center; }
.kicker { font-weight: 900; letter-spacing: 5px; font-size: 12px; color: var(--gold); }
.title-head h1 { font: italic 400 clamp(46px, 9vw, 92px)/0.95 var(--display); letter-spacing: 2px; text-shadow: 0 5px 0 #0a0c22; }
.title-head h1 span { color: var(--green); }
.title section h2 { font: italic 400 19px var(--display); letter-spacing: 0.6px; margin-bottom: 8px; }
.title h2 i { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--green); color: var(--ink); font: 900 12px system-ui, sans-serif; margin-right: 6px; }
.pick-trainer { grid-area: trainers; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.roster button { display: flex; flex-direction: column; align-items: center; border: 2px solid var(--line); border-radius: 11px; background: rgba(17, 21, 48, 0.9); overflow: hidden; transition: border-color 0.9s; min-width: 0; }
.roster button:hover { border-color: var(--c); transition-duration: 0.6s; }
.roster button.on { border-color: var(--c); box-shadow: 0 0 0 2px var(--c); }
.roster img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.roster span { font-size: 9px; font-weight: 900; padding: 2px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pick-preview { grid-area: preview; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--c); border-radius: 16px; background: rgba(15, 18, 44, 0.86); text-align: center; align-self: start; position: sticky; top: 0; }
.pose { height: min(300px, 38vh); max-width: 100%; background-repeat: no-repeat; }
.pick-preview h3 { font: italic 400 28px var(--display); color: var(--c); letter-spacing: 0.6px; }
.looks { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.pick-starter { grid-area: starters; }
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.starters button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px; border-radius: 14px; border: 2px solid var(--line); background: rgba(17, 21, 48, 0.9); transition: border-color 0.9s; }
.starters button:hover { border-color: var(--c); transition-duration: 0.6s; }
.starters button.on { border-color: var(--c); box-shadow: 0 0 0 2px var(--c); }
.starters .mon { width: min(112px, 100%); height: auto; aspect-ratio: 1; }
.starters small { color: var(--muted); font-size: 10.5px; }
.title-go { grid-area: go; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.title-go p { flex-basis: 100%; text-align: center; font-size: 12px; }

/* ---- phones, upright ---------------------------------------------------------------------------------------- */

@media (max-width: 760px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .view { flex: none; height: clamp(190px, 32dvh, 330px); }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .tape-wrap { height: 18px; }
  .tape span { line-height: 18px; font-size: 10.5px; }
  .mood-chip { display: none; }
  .logo { font-size: 17px; }
  .top { gap: 5px; }
  .bags-chip span:not(:first-child) { display: none; }
  .moves-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-row { flex-wrap: wrap; }
  .rule { font-size: 0; }
  .rule select { font-size: 12px; }
  .plate { width: min(200px, 47%); top: 5px; padding: 4px 7px 5px; }
  .plate.me { left: 5px; }
  .plate.foe { right: 5px; }
  .plate-top b { font-size: 14px; }
  .log p.old { display: none; }
  .log p.new { font-size: 11.5px; }
  .title { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "trainers" "preview" "starters" "go"; padding: 12px 10px 24px; }
  .pick-preview { position: static; flex-direction: row; text-align: left; }
  .roster { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 5px; }
  .roster span { font-size: 8px; }
  .pose { height: 160px; flex: none; }
  .looks { justify-content: flex-start; }
  .starters .mon { width: 84px; }
}
@media (max-width: 430px) {
  .icon[data-action="toggle-music"] { display: none; }
  .segmented button { padding: 5px 7px; font-size: 11.5px; }
  .bags-chip { padding: 3px 7px; }
}

/* ---- short and wide: Discord's inline frame, phones on their side -------------------------------------------- */

@media (max-height: 500px) and (min-width: 600px) {
  .tape-wrap { display: none; }
  .top { padding-top: calc(3px + env(safe-area-inset-top)); padding-bottom: 3px; }
  .logo { font-size: 16px; }
  .icon { width: 26px; height: 26px; font-size: 12px; }
  .purse, .bags-chip, .mood-chip { padding-top: 1px; padding-bottom: 1px; }
  main { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
  .view { min-height: 90px; }
  .controls { padding: 3px 6px; gap: 3px; }
  .segmented button { min-height: 24px; padding: 2px 8px; }
  .hype { height: 24px; }
  .rule select { padding: 1px 3px; }
  .btn.small { min-height: 24px; }
  .move { padding: 2px 6px; }
  .move small { display: none; }
  .bag-btn, .swap { height: 30px; width: 40px; }
  .bag-btn .sack { width: 15px; height: 15px; }
  .swap img { width: 22px; height: 22px; }
  .zone-strip { padding: 3px 6px; }
  .zone-label .bar { margin-top: 1px; }
  .challenger .face { width: 20px; height: 20px; }
  .plate { top: 4px; padding: 3px 7px 4px; gap: 2px; width: min(200px, 40%); }
  .plate.me { left: 4px; }
  .plate.foe { right: 4px; }
  .plate-top b { font-size: 13px; }
  .plate-num, .log p.old { display: none; }
  .log { padding-top: 8px; padding-bottom: 2px; }
  .log p.new { font-size: 11px; }
  .tabs button { padding: 5px 1px; font-size: 11.5px; }
  .panel { padding: 6px 8px 20px; }
  .slot-main .mon { width: 40px; height: 40px; }
  .box { max-height: calc(100dvh - 12px); padding: 12px; }
  .overlay { padding: 6px; }
  .mon-art { width: 100px; height: 100px; }
  .mon-art .mon { width: 92px; height: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
