@font-face {
  font-family: "Pokemon Solid";
  src: url("/pokemon/Pokemon Solid.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --yellow: #ffcb05;
  --yellow-soft: #ffe681;
  --blue: #2a75bb;
  --blue-dark: #15386b;
  --red: #e1494f;
  --ink: #090d1c;
  --panel: #17243d;
  --line: #41628a;
  --lcd: #b9cc82;
  --lcd-ink: #253221;
  --muted: #a9bfd7;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  color: #f7fbff;
  background:
    linear-gradient(rgba(7, 13, 30, .86), rgba(7, 13, 30, .94)),
    url("/pokemon/Pokemon-Banner-28.jpg") center / cover fixed;
  font-family: "Trebuchet MS", Arial, sans-serif;
}
button, input, a { font: inherit; letter-spacing: 0; }
button, a { cursor: pointer; }
button:focus-visible, input:focus-visible, canvas:focus-visible, a:focus-visible { outline: 3px solid white; outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 20px;
}

.topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.brand-lockup span, .modal-kicker, .screen-label {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}
.brand-lockup h1 {
  margin: 2px 0 0;
  color: var(--yellow);
  font: 400 34px/1 "Pokemon Solid", sans-serif;
  -webkit-text-stroke: 1px var(--blue-dark);
  text-shadow: 3px 3px 0 var(--blue-dark);
}
.wallet-strip { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ca-pill, .small-button, .primary-button {
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  color: white;
  background: #111a2d;
  text-decoration: none;
}
.primary-button { border-color: #f8df75; background: var(--yellow); color: #15120a; font-weight: 1000; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.world-panel, .pet-device {
  min-width: 0;
  border: 3px solid var(--blue);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 36, 61, .97), rgba(7, 12, 27, .98));
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.world-panel { overflow: hidden; }
.world-toolbar, .world-status {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
}
.world-toolbar > div:first-child { display: grid; }
.world-toolbar span { color: var(--yellow); font-weight: 1000; text-transform: uppercase; }
.world-toolbar strong { font-size: 13px; color: var(--muted); }
.world-help { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
kbd { min-width: 27px; padding: 4px 6px; border: 1px solid #7394bc; border-bottom-width: 3px; border-radius: 4px; color: white; background: #263b5d; text-align: center; }
.canvas-frame { position: relative; width: 100%; aspect-ratio: 640 / 352; background: #091426; overflow: hidden; }
#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.interaction-prompt {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  border: 2px solid white;
  border-radius: 4px;
  padding: 7px 12px;
  color: #10182a;
  background: var(--yellow-soft);
  font-size: 13px;
  font-weight: 1000;
  white-space: nowrap;
}
.dialogue-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.dialogue-box {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  min-height: 112px;
  border: 4px solid #58d7d0;
  border-radius: 8px;
  padding: 19px 24px 17px;
  color: #263242;
  background: #fbfff5;
  box-shadow: 0 0 0 4px #f7ffff, 0 0 0 7px #183b6d, 0 8px 18px rgba(0, 0, 0, .42);
  font-family: "Trebuchet MS", Arial, sans-serif;
  pointer-events: auto;
  cursor: pointer;
}
.dialogue-speaker {
  position: absolute;
  top: -15px;
  left: 15px;
  min-width: 82px;
  border: 3px solid #f7ffff;
  border-radius: 4px;
  padding: 3px 10px;
  color: #fff;
  background: #285fa0;
  box-shadow: 0 0 0 2px #183b6d;
  font-size: 12px;
  font-weight: 1000;
  text-align: center;
  text-transform: uppercase;
}
.dialogue-text {
  min-height: 54px;
  margin: 0;
  font-size: clamp(15px, 1.7vw, 21px);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0;
}
.dialogue-next {
  position: absolute;
  right: 16px;
  bottom: 8px;
  color: #d7434a;
  font-size: 14px;
  animation: dialogue-bounce .75s steps(2, end) infinite;
}
.dialogue-choices {
  position: absolute;
  right: 24px;
  bottom: 142px;
  z-index: 2;
  min-width: 142px;
  border: 4px solid #f7ffff;
  border-radius: 6px;
  padding: 7px;
  background: #fbfff5;
  box-shadow: 0 0 0 3px #183b6d, 0 7px 16px rgba(0, 0, 0, .4);
  pointer-events: auto;
}
.dialogue-choice {
  position: relative;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 3px;
  padding: 6px 12px 6px 31px;
  color: #263242;
  background: transparent;
  font-size: 17px;
  font-weight: 900;
  text-align: left;
}
.dialogue-choice.is-selected { color: #173e78; background: #dff7ef; }
.dialogue-choice.is-selected::before {
  content: "\25B6";
  position: absolute;
  left: 10px;
  color: #d7434a;
}
.dialogue-choice:disabled { opacity: .55; cursor: wait; }
@keyframes dialogue-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}
.battle-layer {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}
.battle-hud {
  position: absolute;
  top: 10px;
  right: 12px;
  left: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.battle-hud > div {
  width: min(190px, 44%);
  padding: 6px 8px;
  border: 3px solid #f7ffff;
  border-radius: 4px;
  background: #f4f7ee;
  box-shadow: 0 0 0 3px #173e78;
  color: #1f3040;
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}
.battle-hud span {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.battle-hud i {
  display: block;
  height: 8px;
  border: 2px solid #1f3040;
  background: #c9d0a6;
}
.battle-hud b {
  display: block;
  width: 100%;
  height: 100%;
  background: #55b968;
}
.battle-box {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 32%);
  gap: 12px;
  padding: 14px;
  border: 4px solid #f7ffff;
  border-radius: 6px;
  background: linear-gradient(180deg, #f6fbff, #d9f1ff);
  box-shadow: 0 0 0 4px #3aa6d7, 0 0 0 7px #173e78;
  color: #1f3040;
  pointer-events: auto;
}
.battle-box p {
  margin: 0;
  align-self: center;
  font-size: clamp(14px, 1.55vw, 19px);
  font-weight: 900;
  line-height: 1.35;
}
.battle-moves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.battle-move {
  min-height: 34px;
  border: 2px solid #173e78;
  border-radius: 4px;
  background: #fffdf0;
  color: #173e78;
  font-weight: 1000;
  text-transform: uppercase;
}
.battle-move.is-selected {
  background: var(--yellow);
  color: #07101f;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.22);
}
.battle-move:disabled {
  opacity: .62;
}
.battle-finish {
  grid-column: 1 / -1;
  min-height: 42px;
  cursor: pointer;
}
.world-status { min-height: 46px; border-top: 2px solid var(--line); border-bottom: 0; color: var(--yellow-soft); font-weight: 800; }

.modal-panel {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(390px, calc(100% - 28px));
  border: 3px solid var(--yellow);
  border-radius: 7px;
  padding: 20px;
  color: white;
  background: rgba(9, 15, 34, .96);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}
.login-panel {
  margin-bottom: 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #0d172a;
}
.login-panel label {
  display: grid;
  gap: 4px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.login-panel input {
  width: 100%;
  min-height: 34px;
  border: 2px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
  color: white;
  background: #080f1e;
}
.login-panel .primary-button { width: 100%; min-height: 36px; margin-top: 2px; }
.modal-panel h2 { margin: 4px 0 16px; font-size: 22px; }
.modal-panel label { display: grid; gap: 5px; margin: 10px 0; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.modal-panel input, #nickname {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  color: white;
  background: #0a1020;
}
.modal-panel .primary-button { width: 100%; margin-top: 6px; }
.form-error { min-height: 18px; margin: 8px 0 0; color: #ff8c8c; font-size: 12px; }
.modal-close { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; color: white; background: #18243e; font-size: 22px; }
.casino-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.casino-actions button { min-height: 46px; border: 2px solid var(--yellow); border-radius: 4px; color: white; background: var(--blue-dark); font-weight: 900; }
.modal-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.modal-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(1, 2, 10, .78);
  backdrop-filter: blur(5px);
}
.modal-layer[hidden],
.machine-game[hidden] { display: none !important; }
.machine-modal {
  width: min(1280px, 94vw);
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 3px solid var(--yellow);
  border-radius: 8px;
  padding: 16px 20px 18px;
  background: linear-gradient(145deg, rgba(15, 24, 52, .98), rgba(6, 5, 25, .98));
  box-shadow: 0 30px 100px rgba(0, 0, 0, .65), inset 0 0 0 2px rgba(40, 88, 184, .65);
}
.machine-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}
.machine-header small {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}
.machine-header h2 {
  margin: 4px 0 8px;
  color: var(--yellow);
  font-family: "Pokemon Solid", sans-serif;
  font-size: 1.65rem;
  line-height: 1;
  -webkit-text-stroke: 1px var(--blue);
}
.machine-close {
  width: 42px;
  height: 42px;
  border: 2px solid var(--line);
  border-radius: 6px;
  color: white;
  background: #18243e;
  font-weight: 1000;
}
.machine-close:disabled { opacity: .4; cursor: not-allowed; }
.machine-subtitle,
.machine-wallet-type {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 900;
  line-height: 1.35;
}
.machine-wallet-type { margin-top: 4px; color: #f7fbff; }
.machine-wallet-type strong { color: var(--yellow); letter-spacing: .08em; }
.machine-body {
  min-height: 0;
  display: grid;
  gap: 16px;
}
.machine-playfield,
.machine-actions {
  min-width: 0;
  min-height: 0;
}
.machine-actions {
  display: grid;
  gap: 12px;
  align-content: start;
}
.machine-layer.is-roulette .machine-body,
.machine-layer.is-blackjack .machine-body {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  align-items: center;
}
.machine-layer.is-roulette .machine-actions,
.machine-layer.is-blackjack .machine-actions { align-content: center; }
.machine-layer.is-slots .machine-body { grid-template-rows: minmax(0, auto) auto; }
.machine-layer.is-slots .machine-actions {
  grid-template-columns: minmax(260px, .95fr) minmax(300px, 1.15fr) minmax(220px, .75fr);
  align-items: stretch;
  gap: 10px;
}
.machine-layer.is-slots .coin-bet-panel,
.machine-layer.is-slots .machine-result,
.machine-layer.is-slots .machine-spin { min-height: 82px; }
.machine-layer.is-slots .machine-help {
  grid-column: 1 / -1;
  margin: 0;
}
.machine-layer:not(.is-roulette) .roulette-picks { display: none; }
.coin-bet-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 203, 5, .45);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(18, 27, 58, .9), rgba(4, 7, 21, .95));
}
.coin-bet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: #dce7fc;
  font-size: .74rem;
  font-weight: 1000;
  text-transform: uppercase;
}
.coin-bet-head strong { color: var(--yellow); text-align: right; }
.coin-bet-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}
.coin-bet-chips button,
.roulette-picks button,
.machine-spin {
  min-height: 42px;
  border: 2px solid rgba(255, 203, 5, .72);
  border-radius: 10px;
  background: #0b1024;
  color: white;
  font-weight: 1000;
  text-transform: uppercase;
}
.coin-bet-chips button.is-active,
.machine-spin {
  background: var(--yellow);
  color: #090716;
}
.coin-bet-chips button:disabled,
.machine-spin:disabled { opacity: .5; cursor: not-allowed; }
.prototype-slot-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border: 7px solid var(--yellow);
  background: #0b1125;
}
.prototype-reel {
  position: relative;
  height: clamp(250px, calc(100vh - 500px), 360px);
  min-height: 240px;
  overflow: hidden;
  border: 3px solid #d19f14;
  background: radial-gradient(circle, #26375d, #070b18);
}
.prototype-reel::before,
.prototype-reel::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  height: 18px;
  pointer-events: none;
}
.prototype-reel::before { top: 0; background: linear-gradient(#050817, rgba(5, 8, 23, 0)); }
.prototype-reel::after { bottom: 0; background: linear-gradient(rgba(5, 8, 23, 0), #050817); }
.prototype-reel-strip {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  display: grid;
  gap: 8px;
  transform: translateY(calc(-50% + var(--reel-nudge, 0px)));
  transition: transform 120ms linear;
}
.prototype-reel-strip img {
  width: 100%;
  height: clamp(110px, calc((100vh - 520px) / 2.2), 165px);
  min-height: 108px;
  object-fit: contain;
  opacity: .72;
  filter: saturate(.95) brightness(.9);
}
.prototype-reel-strip img.is-active {
  opacity: 1;
  filter: none;
  transform: scale(1.04);
}
.prototype-slot-board.is-spinning .prototype-reel-strip { animation: reel-roll 160ms linear infinite; }
.prototype-slot-board.is-spinning img { filter: blur(1.8px) brightness(1.2); }
@keyframes reel-roll {
  0% { transform: translateY(calc(-50% - 42px)); }
  100% { transform: translateY(calc(-50% + 42px)); }
}
.prototype-roulette-wrap {
  --roulette-size: min(650px, calc(100vh - 145px), calc(94vw - 450px));
  position: relative;
  width: var(--roulette-size);
  height: var(--roulette-size);
  margin: 0 auto;
}
.prototype-roulette-wheel {
  position: absolute;
  inset: 0;
  border: 10px solid #f4d164;
  border-radius: 50%;
  background: var(--prototype-roulette-gradient, conic-gradient(#d92d44 0 20deg, #1d2333 20deg 40deg));
  box-shadow: inset 0 0 0 10px rgba(4, 6, 18, .55);
  transition: transform 4.6s cubic-bezier(.15, .78, .17, 1);
}
.prototype-roulette-pockets { position: absolute; inset: 0; border-radius: 50%; }
.prototype-pocket {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(26px, calc(var(--roulette-size) * .08), 34px);
  height: clamp(26px, calc(var(--roulette-size) * .08), 34px);
  margin: calc(clamp(26px, calc(var(--roulette-size) * .08), 34px) / -2);
  transform: rotate(var(--angle)) translateY(calc(var(--roulette-size) * -.39));
}
.prototype-pocket img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  transform: rotate(calc(var(--angle) * -1));
}
.prototype-roulette-hub {
  position: absolute;
  inset: 38%;
  border: 7px solid #11182a;
  border-radius: 50%;
  background: radial-gradient(circle, white 0 20%, #dd3946 21% 52%, white 53% 66%, #11182a 67%);
}
.prototype-ball-track {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  pointer-events: none;
  transition: transform 4.2s cubic-bezier(.18, .72, .2, 1);
}
.prototype-ball-track span {
  position: absolute;
  top: 2px;
  left: 50%;
  width: 13px;
  height: 13px;
  margin-left: -6px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px white;
}
.blackjack-table {
  min-height: min(650px, calc(100vh - 145px));
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  gap: 18px;
  padding: clamp(16px, 3vw, 28px);
  border: 8px solid #f4d164;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 203, 5, .18), transparent 34%), linear-gradient(145deg, #12532d, #071b14 68%);
  box-shadow: inset 0 0 0 5px rgba(4, 6, 18, .45), 0 24px 50px rgba(0, 0, 0, .28);
}
.blackjack-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
}
.blackjack-row > span,
.blackjack-row > strong,
.blackjack-table-center span {
  color: #dce7fc;
  font-size: .72rem;
  font-weight: 1000;
  text-transform: uppercase;
}
.blackjack-row > strong {
  color: var(--yellow);
  text-align: right;
  font-size: 1.1rem;
}
.blackjack-hand {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.blackjack-card {
  width: clamp(48px, 7.2vw, 72px);
  aspect-ratio: .7;
  display: grid;
  align-content: space-between;
  justify-items: start;
  padding: 8px;
  border: 2px solid rgba(10, 14, 29, .35);
  border-radius: 8px;
  background: #fffaf0;
  color: #101827;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .25);
  font-weight: 1000;
}
.blackjack-card strong { font-size: clamp(1rem, 2vw, 1.45rem); line-height: 1; }
.blackjack-card span { justify-self: end; font-size: clamp(1.05rem, 2vw, 1.5rem); line-height: 1; }
.blackjack-card.is-red { color: #d92d44; }
.blackjack-card.is-black { color: #111827; }
.blackjack-card--back {
  place-content: center;
  justify-items: center;
  background: repeating-linear-gradient(45deg, #193a8a 0 8px, #244db1 8px 16px);
  color: #f8d748;
}
.blackjack-table-center {
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
}
.blackjack-table-center img {
  width: 58px;
  height: 58px;
  image-rendering: pixelated;
}
.blackjack-table-center strong {
  color: var(--yellow);
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  text-transform: uppercase;
}
.roulette-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.roulette-picks button { min-height: 58px; }
.roulette-picks button:first-child.is-active { background: #d92d44; }
.roulette-picks button:last-child.is-active { background: #111827; border-color: #b7c4df; }
.machine-result {
  min-height: 72px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  border: 2px solid rgba(255, 203, 5, .45);
  background: rgba(2, 3, 13, .82);
  color: var(--yellow);
  font-weight: 1000;
  text-align: center;
  text-transform: uppercase;
}
.machine-result.is-win { border-color: #43d17a; color: #b8ffd0; }
.machine-result.is-loss { border-color: #e95263; color: #ffd1d5; }
.machine-result.is-push { border-color: var(--yellow); color: #fff1a8; }
.roulette-result-card,
.blackjack-result-card {
  width: 100%;
  display: grid;
  gap: 8px;
}
.roulette-result-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 203, 5, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
}
.roulette-result-row span {
  color: #aebce0;
  font-size: .66rem;
}
.roulette-result-row strong {
  min-width: 0;
  color: #fff;
  font-size: clamp(.86rem, 1.35vw, 1.08rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.roulette-result-row.is-red strong { color: #ffd9df; }
.roulette-result-row.is-black strong { color: #e4ecff; }
.roulette-result-row.is-bonus strong,
.roulette-result-row.is-coin strong { color: var(--yellow); }
.roulette-result-row.is-win { border-color: rgba(67, 209, 122, .65); background: rgba(67, 209, 122, .12); }
.roulette-result-row.is-loss { border-color: rgba(233, 82, 99, .72); background: rgba(233, 82, 99, .12); }
.slots-result-card {
  width: 100%;
  display: grid;
  gap: 8px;
  align-content: center;
}
.slots-result-card > strong {
  color: #fff;
  font-size: clamp(1rem, 1.5vw, 1.28rem);
  line-height: 1;
}
.slots-result-card > strong span { color: var(--yellow); }
.slots-result-card > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.slots-result-card > div span {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid rgba(255, 203, 5, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  color: #aebce0;
  font-size: .64rem;
  text-transform: uppercase;
}
.slots-result-card b {
  display: block;
  margin-top: 2px;
  color: var(--yellow);
  font-size: .82rem;
  line-height: 1;
}
.machine-spin {
  width: 100%;
  min-height: 64px;
}
.machine-help {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: .82rem;
}

.pet-device {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  border-color: var(--yellow);
  padding: 16px 14px 18px;
  border-radius: 34px 34px 28px 28px;
  background:
    radial-gradient(circle at 30% 7%, rgba(255,255,255,.38) 0 13px, transparent 15px),
    radial-gradient(circle at 74% 6%, rgba(255,255,255,.22) 0 10px, transparent 12px),
    linear-gradient(145deg, #ffcf35 0%, #f25b83 45%, #2f83d6 100%);
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.2), inset 0 -14px 0 rgba(0,0,0,.18), 0 16px 40px rgba(0,0,0,.38);
}
.pet-device.is-critical { animation: device-alert 1s steps(2, end) infinite; }
@keyframes device-alert { 50% { filter: saturate(1.4) brightness(1.12); } }
.device-header { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; margin-bottom: 9px; }
.device-header > div { display: grid; gap: 2px; }
.device-header span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.device-header strong { color: var(--yellow); }
.reward-mini { text-align: right; }
.pet-screen {
  border: 10px solid #29322b;
  border-radius: 14px;
  padding: 9px;
  min-height: 376px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  color: var(--lcd-ink);
  background-color: var(--lcd);
  background-image: linear-gradient(rgba(43,65,38,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(43,65,38,.12) 1px, transparent 1px);
  background-size: 8px 8px;
  box-shadow: inset 0 0 0 3px #65734d;
}
.vitals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.vitals-grid > div { display: grid; grid-template-columns: 36px 1fr 25px; align-items: center; gap: 5px; font: 700 10px/1 monospace; text-transform: uppercase; }
.vitals-grid i { height: 8px; border: 1px solid var(--lcd-ink); background: rgba(37,50,33,.15); }
.vitals-grid b { display: block; height: 100%; width: 0; background: var(--lcd-ink); }
.pet-stage { min-height: 210px; display: grid; place-items: center; margin-top: 4px; }
#adoption-view.pet-stage { grid-template-rows: 18px 96px 24px 34px 32px; }
#active-view.pet-stage { grid-template-rows: 16px 126px 24px auto auto; gap: 5px; }
.pet-stage img {
  width: 108px;
  height: 108px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: saturate(.75) contrast(1.08) brightness(.9) opacity(.92);
}
#active-view #pet-art {
  width: 126px;
  height: 126px;
  filter: saturate(.82) contrast(1.1) brightness(.92) opacity(.94);
}
.pet-stage > strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 900 18px/1 monospace; text-transform: uppercase; }
.adopt-controls { display: grid; grid-template-columns: 42px 1fr 42px; gap: 6px; width: 100%; }
.adopt-controls button { min-height: 32px; border: 2px solid var(--lcd-ink); border-radius: 3px; color: var(--lcd-ink); background: rgba(255,255,255,.18); font-weight: 1000; }
#nickname { min-height: 32px; padding: 5px 8px; border-color: var(--lcd-ink); color: var(--lcd-ink); background: rgba(255,255,255,.17); }
.pet-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; font: 800 11px monospace; text-transform: uppercase; }
.pet-meta span { border: 1px solid var(--lcd-ink); padding: 6px; text-align: center; }
.pet-inventory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  font: 900 9px monospace;
  text-transform: uppercase;
}
.pet-inventory span {
  min-width: 0;
  border: 1px solid var(--lcd-ink);
  padding: 4px 3px;
  text-align: center;
}
.device-message {
  min-height: 28px;
  margin: 0;
  border: 2px solid var(--lcd-ink);
  padding: 5px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 900 10px/1.1 monospace;
}

.map-layer {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 8, 18, .42);
}
.map-layer[hidden] { display: none; }
.map-panel {
  width: calc(100% - 36px);
  height: calc(100% - 32px);
  border: 8px solid #29322b;
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  color: var(--lcd-ink);
  background-color: var(--lcd);
  background-image: linear-gradient(rgba(43,65,38,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(43,65,38,.12) 1px, transparent 1px);
  background-size: 8px 8px;
  box-shadow: inset 0 0 0 3px #65734d, 0 18px 40px rgba(0,0,0,.44);
}
.map-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font: 1000 13px/1 monospace;
  text-transform: uppercase;
}
.map-panel header span { font-size: 10px; opacity: .76; }
.map-panel canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid var(--lcd-ink);
  image-rendering: pixelated;
  object-fit: contain;
  filter: grayscale(1) sepia(.2) contrast(1.18) brightness(.86);
  opacity: .88;
}

.shop-layer { z-index: 36; }
.shop-modal {
  width: min(620px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 28px));
  overflow: auto;
  border: 3px solid var(--yellow);
  border-radius: 10px;
  padding: 16px;
  color: white;
  background: #071124;
  box-shadow: 0 20px 70px rgba(0,0,0,.55);
}
.shop-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.shop-header small {
  color: var(--yellow);
  font-size: .76rem;
  font-weight: 1000;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.shop-header h2 { margin: 2px 0 0; font-size: 1.5rem; line-height: 1; }
.shop-balance {
  min-width: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  background: #101b31;
  text-align: right;
}
.shop-balance span { color: var(--muted); font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.shop-balance strong { color: var(--yellow); font-size: 1.1rem; }
.shop-items { display: grid; gap: 8px; }
.shop-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 84px 96px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #111d34;
}
.shop-item strong { color: #fff; font-size: 1rem; }
.shop-item span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.shop-item b { color: var(--yellow); }
.shop-item button {
  min-height: 38px;
  border: 2px solid var(--yellow);
  border-radius: 6px;
  color: #071124;
  background: var(--yellow);
  font-weight: 1000;
}
.shop-item button:disabled {
  border-color: #4e5c72;
  color: #72839c;
  background: #162238;
  cursor: not-allowed;
}
.shop-help { margin: 12px 0 0; color: var(--muted); font-size: .84rem; text-align: center; }

.item-menu {
  margin-top: 10px;
  border: 2px solid var(--yellow);
  border-radius: 8px;
  padding: 8px;
  background: rgba(7, 17, 36, .92);
}
.item-menu header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--yellow);
  font-weight: 1000;
  text-transform: uppercase;
}
.item-menu header button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: white;
  background: #162542;
  font-weight: 1000;
}
#item-menu-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
#item-menu-options button {
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: white;
  background: #102040;
  font-weight: 1000;
}
#item-menu-options button:not(:disabled):hover,
#item-menu-options button.is-selected {
  border-color: var(--yellow);
  color: #07101f;
  background: var(--yellow);
}
#item-menu-options button:disabled { opacity: .45; cursor: not-allowed; }

.care-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.care-controls button {
  min-width: 0;
  height: 58px;
  border: 2px solid #ffd84a;
  border-radius: 6px;
  padding: 4px 2px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: white;
  background: #224d88;
  font-size: 10px;
  font-weight: 1000;
  text-transform: uppercase;
}
.care-controls button span { color: var(--yellow); font-size: 18px; line-height: 1; }
.care-controls button:disabled { border-color: #53657b; color: #72859b; background: #18243a; cursor: not-allowed; }
.care-controls button.is-active { background: var(--red); }

.pet-toasts {
  position: fixed;
  z-index: 90;
  top: 14px;
  left: 50%;
  width: min(520px, calc(100vw - 24px));
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.pet-toast {
  border: 3px solid #f7ffff;
  border-radius: 10px;
  padding: 10px 14px;
  color: #172033;
  background: #fff9d6;
  box-shadow: 0 0 0 3px #2a74c9, 0 12px 28px rgba(0,0,0,.35);
  font-weight: 1000;
}
.pet-toast.is-critical {
  color: #fff;
  background: #df343e;
  box-shadow: 0 0 0 3px #ffcf24, 0 12px 28px rgba(0,0,0,.45);
}

.device-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.device-tabs button { min-height: 34px; border: 1px solid var(--line); border-radius: 4px; color: white; background: #15223b; font-size: 11px; font-weight: 900; }
.device-tabs button.is-active { border-color: var(--yellow); color: var(--yellow); }
.pet-list { max-height: 150px; overflow: auto; margin-top: 7px; }
.pet-item { display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: center; min-height: 48px; border-bottom: 1px solid #314a6b; padding: 5px; }
.pet-item img { width: 36px; height: 36px; object-fit: contain; image-rendering: pixelated; }
.pet-item div { min-width: 0; display: grid; }
.pet-item strong, .pet-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-item span, .list-empty { color: var(--muted); font-size: 11px; }
.list-empty { padding: 16px 4px; text-align: center; }

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .pet-device { position: static; width: min(100%, 640px); max-height: none; justify-self: center; }
}

@media (max-width: 640px) {
  body { padding-bottom: 72px; }
  .app-shell { width: 100%; padding: 8px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .brand-lockup h1 { font-size: 26px; }
  .wallet-strip { width: 100%; justify-content: flex-start; }
  .ca-pill { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
  .world-help { display: none; }
  .interaction-prompt { bottom: 6px; font-size: 11px; }
  .dialogue-box {
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-height: 88px;
    padding: 16px 15px 11px;
  }
  .dialogue-speaker { top: -13px; left: 10px; min-width: 68px; padding: 2px 7px; font-size: 9px; }
  .dialogue-text { min-height: 46px; font-size: 13px; line-height: 1.3; }
  .dialogue-next { right: 10px; bottom: 5px; font-size: 11px; }
  .dialogue-choices { right: 16px; bottom: 112px; min-width: 112px; padding: 5px; }
  .dialogue-choice { min-height: 31px; padding: 4px 8px 4px 26px; font-size: 14px; }
  .battle-hud { top: 6px; right: 8px; left: 8px; }
  .battle-hud > div { padding: 4px 6px; font-size: 9px; }
  .battle-box {
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-height: 86px;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px;
  }
  .battle-box p { font-size: 12px; }
  .battle-move { min-height: 28px; font-size: 10px; }
  .modal-panel { padding: 14px; }
  .modal-layer { padding: 8px; }
  .machine-modal { width: min(100%, 96vw); max-height: calc(100vh - 16px); padding: 12px; overflow-y: auto; }
  .machine-header { margin-bottom: 8px; }
  .machine-header h2 { font-size: 1.25rem; }
  .machine-layer.is-roulette .machine-body,
  .machine-layer.is-blackjack .machine-body,
  .machine-layer.is-slots .machine-actions { grid-template-columns: 1fr; }
  .machine-layer.is-slots .machine-help { grid-column: auto; }
  .prototype-reel { height: 210px; min-height: 190px; }
  .prototype-reel-strip img { height: 100px; min-height: 96px; }
  .prototype-roulette-wrap { --roulette-size: min(430px, 54vh, 82vw); }
  .blackjack-table { min-height: 320px; gap: 10px; }
  .machine-result { min-height: 54px; }
  .machine-spin { min-height: 54px; }
  .shop-modal { width: min(100%, 96vw); max-height: calc(100vh - 16px); padding: 12px; }
  .shop-header { grid-template-columns: 1fr auto; }
  .shop-balance { grid-column: 1 / -1; min-width: 0; text-align: left; }
  .shop-item { grid-template-columns: 1fr 68px; gap: 8px; }
  .shop-item button { grid-column: 1 / -1; }
  .care-controls {
    position: fixed;
    z-index: 20;
    left: 8px;
    right: 8px;
    bottom: 7px;
    gap: 4px;
    margin: 0;
    border: 2px solid var(--yellow);
    border-radius: 7px;
    padding: 5px;
    background: rgba(8, 14, 31, .97);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .45);
  }
  .care-controls button { height: 50px; font-size: 9px; }
}
