:root {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #e9f0e6;
  background: #0e211c;
  font-synthesis: none;
  --ink: #17352d;
  --green: #bfe68a;
  --cream: #f2f0d8;
  --muted: #98afa4;
  --line: #385247;
  --yellow: #f8d66d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #213e34;
  color: #edf4e7;
  padding: 10px 14px;
  border-radius: 5px;
  font-weight: 650;
  font-size: 14px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #365641;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #183526;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
button.primary:hover {
  background: #d3f5a8;
}
button.outline {
  background: transparent;
  color: var(--ink);
  border-color: #a5b698;
}
.quiet,
.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 5px 0;
  font-size: 13px;
}
.text-button:hover,
.quiet:hover {
  background: none;
  color: var(--green);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.7px;
}
h3 {
  font-size: 17px;
}
p {
  font-size: 15px;
  line-height: 1.6;
}
small {
  font-size: 12px;
  line-height: 1.5;
}
.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.7px;
  color: var(--muted);
  margin-bottom: 7px;
}
.topbar {
  height: 76px;
  max-width: 1456px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 40px;
  border-bottom: 1px solid #ffffff0f;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--cream);
  font-size: 20px;
  letter-spacing: 2px;
  font-weight: 900;
}
.brand b {
  color: var(--green);
  font-size: 10px;
  letter-spacing: 3px;
  display: block;
  margin-top: 1px;
}
.brand-ball {
  color: var(--green);
  font-size: 42px;
  line-height: 1;
}
.server-label {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 7px;
  align-items: center;
}
#connection-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b5985f;
}
#connection-light.connected {
  background: #abe279;
  box-shadow: 0 0 10px #abec7933;
}
.game-layout {
  max-width: 1456px;
  margin: 0 auto;
  padding: 30px 40px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px;
}
.world-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
h1 {
  font-size: 30px;
  letter-spacing: -1px;
  margin: 0;
  color: var(--cream);
}
.world-heading .eyebrow {
  font-size: 9px;
}
.world-badges {
  display: flex;
  flex-direction: column;
  text-align: right;
  gap: 5px;
  font-size: 12px;
  color: #cfdfc6;
}
.weather {
  color: var(--muted);
  font-size: 11px;
}
.game-frame {
  position: relative;
  background: #345548;
  border: 6px solid #405e4d;
  border-radius: 8px;
  box-shadow:
    0 5px 0 #081a12,
    0 18px 40px #06120e66;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3/2;
  image-rendering: pixelated;
  outline: none;
  touch-action: none;
}
.location-hint {
  position: absolute;
  top: 16px;
  left: 16px;
  max-width: calc(100% - 32px);
  background: #11251ceb;
  color: #f1eed6;
  padding: 8px 12px;
  border-left: 3px solid var(--green);
  border-radius: 2px;
  font-size: 12px;
  pointer-events: none;
}
.interaction {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}
.interaction button {
  color: #152a1c;
  background: var(--cream);
  border: 2px solid #233e2f;
  box-shadow: 0 3px #0006;
  display: flex;
  gap: 18px;
  align-items: center;
}
.connection-cover {
  position: absolute;
  inset: 0;
  background: #10291fd9;
  display: grid;
  place-content: center;
  padding: 20px;
  text-align: center;
}
.world-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin: 17px 0 22px;
}
.controls-help {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.controls-help > span {
  display: flex;
  align-items: center;
  gap: 3px;
}
kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 2px 4px;
  color: #d6dfcf;
  border: 1px solid #466050;
  border-bottom: 2px solid #466050;
  border-radius: 3px;
}
.interaction kbd {
  color: var(--ink);
  border-color: #abb29e;
}
.trainer-strip {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.trainer-strip strong {
  font-size: 15px;
}
.trainer-strip .eyebrow {
  font-size: 8px;
  letter-spacing: 1.3px;
}
.mode-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #dfe5d8;
}
.mode-control small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.mode-control input {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gym-card {
  color: var(--ink);
  background: var(--cream);
  border-radius: 7px;
  padding: 24px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
}
.gym-card .eyebrow {
  font-size: 8px;
  letter-spacing: 1px;
  color: #658068;
  margin: 0;
}
.status-tag {
  font-size: 8px;
  border: 1px solid #a6b59c;
  padding: 4px 5px;
  font-weight: 800;
  letter-spacing: 1px;
}
.gym-card h2 {
  font-size: 24px;
  line-height: 1.16;
  margin-bottom: 20px;
}
.leader-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid #213c2722;
  border-bottom: 1px solid #213c2722;
  margin-bottom: 14px;
}
.leader-display span:not(.crown) {
  font-size: 10px;
  display: block;
  color: #647863;
}
.leader-display strong {
  font-size: 16px;
  display: block;
  margin-top: 3px;
}
.crown {
  font-size: 33px;
  color: #657f43;
  line-height: 1;
}
.gym-card p {
  font-size: 12px;
  line-height: 1.65;
  color: #5b715c;
  margin-bottom: 17px;
}
.gym-card .primary {
  width: 100%;
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.gym-card .primary:hover {
  background: #34533d;
}
.gym-progress {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
  font-size: 10px;
  color: #637b5c;
}
.gym-progress .achieved {
  color: #1c6b34;
  font-weight: 700;
}
.gym-actions {
  display: grid;
  gap: 8px;
}
.pending-info {
  font-size: 12px;
  padding: 12px 0;
  margin-bottom: 12px;
  border-top: 1px solid #213c2722;
  line-height: 1.6;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 17px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel h2 {
  font-size: 14px;
  letter-spacing: 0;
  margin: 0;
}
.panel .text-button {
  font-size: 11px;
  color: #bcdaaa;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.team-slot {
  background: #1e352b;
  border-radius: 5px;
  text-align: center;
  padding: 3px 0 7px;
}
.team-slot img {
  width: 57px;
  height: 57px;
  image-rendering: pixelated;
  display: block;
  margin: auto;
}
.team-slot strong {
  display: block;
  font-size: 10px;
  font-weight: 600;
}
.team-slot small {
  font-size: 9px;
  color: var(--muted);
}
.team-note {
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  margin-top: 12px;
  gap: 6px;
}
.count {
  font-size: 11px;
  color: var(--green);
}
.empty {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.player-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid #ffffff0a;
}
.player-row strong {
  font-size: 12px;
  display: block;
}
.player-row small {
  font-size: 10px;
  color: var(--muted);
  display: block;
}
.player-row button {
  margin-left: auto;
  font-size: 11px;
  padding: 7px 8px;
}
.player-icon {
  width: 22px;
  height: 28px;
  object-fit: none;
  object-position: 0 0;
  image-rendering: pixelated;
}
.invite-box {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 10px;
}
.invite-box p {
  font-size: 12px;
}
.invite-box button {
  font-size: 12px;
  margin-right: 7px;
}
#challenge-dialog {
  width: min(520px, calc(100vw - 24px));
}
#challenge-dialog .invite-box p,
#challenge-dialog .invite-box button {
  font-size: 16px;
}
.invite-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
#challenge-dialog .invite-actions button {
  min-height: 44px;
  margin: 0;
}
.invite-protection {
  background: #eef2d1;
  padding: 10px;
  border-left: 3px solid #658456;
}
#challenge-feedback {
  color: #904829;
}
.page-footer {
  max-width: 1456px;
  margin: 0 auto;
  padding: 18px 40px 25px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #789184;
  font-size: 9px;
  letter-spacing: 0.6px;
}
.touch-controls {
  display: none;
}
dialog {
  color: var(--ink);
  background: var(--cream);
  border: 1px solid #adc29f;
  border-radius: 10px;
  padding: 34px;
  max-width: min(470px, calc(100vw - 26px));
  max-height: 92dvh;
  box-shadow: 0 20px 90px #0008;
}
dialog::backdrop {
  background: #071911ba;
  backdrop-filter: blur(3px);
}
dialog .eyebrow {
  color: #667c5e;
  font-size: 10px;
}
dialog h2 {
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: -1px;
}
dialog p {
  color: #5d715d;
  font-size: 14px;
}
dialog label {
  font-size: 13px;
  font-weight: 600;
}
input:not([type='checkbox']):not([type='radio']),
select {
  display: block;
  border: 1px solid #a5b89d;
  border-radius: 5px;
  background: #fcfbed;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
  margin-top: 7px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 19px 0;
}
legend {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}
.avatar-choice {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-right: 20px;
}
.avatar-crop {
  display: inline-block;
  width: 16px;
  height: 32px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
.avatar-crop.red {
  background-image: url('/assets/red.png');
}
.avatar-crop.green {
  background-image: url('/assets/green.png');
}
.starter-choices {
  display: flex;
  gap: 8px;
}
.starter-choices label {
  position: relative;
  background: #e2e7cb;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  padding: 8px 5px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}
.starter-choices label:has(input:checked) {
  border-color: #48793d;
  background: #d5e6b9;
}
.starter-choices img {
  width: 70px;
  height: 70px;
  image-rendering: pixelated;
}
.starter-choices input {
  position: absolute;
  top: 5px;
  left: 5px;
  accent-color: #537e40;
}
#welcome-form > .primary {
  width: 100%;
  margin-bottom: 15px;
}
#welcome-form > small {
  display: block;
  color: #7b8a70;
  font-size: 11px;
}
.error {
  color: #ab392f;
  font-size: 12px;
  margin: 6px 0;
}
.wide-dialog {
  max-width: min(850px, calc(100vw - 26px));
  width: 850px;
}
.close {
  position: absolute;
  right: 12px;
  top: 9px;
  border: 0;
  background: none;
  color: #6a7a60;
  font-size: 25px;
  padding: 4px 8px;
}
.close:hover {
  background: #dde4ce;
}
.gym-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 22px 0;
}
.gym-modes article {
  border-top: 2px solid #a9ba90;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
}
.mode-number {
  font-size: 12px;
  color: #80956b;
  margin-bottom: 10px;
}
.gym-modes h3 {
  font-size: 16px;
}
.gym-modes p {
  font-size: 12px;
  flex: 1;
}
.gym-modes small {
  font-size: 10px;
  display: block;
  color: #6f815e;
  margin-bottom: 13px;
}
.gym-modes button {
  font-size: 12px;
}
.defense-team {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid #b8c4a3;
  padding-top: 14px;
}
.defense-team figure {
  margin: 0;
  text-align: center;
  font-size: 10px;
  flex: 1;
  min-width: 70px;
}
.defense-team img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}
#gym-history {
  font-size: 12px;
  margin-top: 20px;
  color: #647557;
}
#team-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.edit-mon {
  border: 1px solid #bdcba6;
  border-radius: 6px;
  padding: 12px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
}
.edit-mon > img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}
.edit-mon select {
  font-size: 12px;
  padding: 7px;
}
.edit-moves {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.edit-moves label {
  font-size: 10px;
  font-weight: 500;
}
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 15px;
}
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 28px;
}
.rules-grid p {
  font-size: 13px;
}
.pilot-note {
  font-size: 11px !important;
  border-top: 1px solid #bdcba6;
  padding-top: 15px;
}
#toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(500px, 90vw);
}
.toast {
  background: #eef1db;
  border-left: 4px solid #80ae5b;
  color: var(--ink);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 5px 18px #0004;
  border-radius: 4px;
  animation: toast-in 0.18s ease-out;
}
@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.battle-dialog {
  padding: 0;
  max-width: min(740px, calc(100vw - 20px));
  width: 740px;
  background: #eaf0d2;
  border: 5px solid #58754e;
  border-radius: 9px;
}
.battle-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #18372c;
  color: #d7e8c5;
  font-size: 11px;
  letter-spacing: 1px;
}
.battle-top button {
  font-size: 11px;
  color: #c8d8be;
}
.battle-scene {
  height: 280px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    #e8edc5 0%,
    #f8f5df 40%,
    #e3ebba 41%,
    #e3ebba 42%,
    #f1f0d7 43%,
    #e9edca 100%
  );
}
.battle-scene::before,
.battle-scene::after {
  content: '';
  position: absolute;
  width: 230px;
  height: 32px;
  border-radius: 50%;
  background: #b2c586;
  box-shadow: 0 7px #718f5544;
  right: 40px;
  top: 118px;
}
.battle-scene::after {
  left: 35px;
  top: 250px;
  width: 240px;
}
.monster-info {
  position: absolute;
  z-index: 2;
  background: #fbfbe4;
  border: 2px solid #6b8356;
  border-radius: 7px 2px 7px 2px;
  padding: 10px 12px;
  min-width: 205px;
  box-shadow: 3px 4px #34592925;
}
.monster-info > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.monster-info strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.monster-info span {
  font-size: 11px;
}
.monster-info small {
  font-size: 10px;
  display: block;
  text-align: right;
  margin-top: 3px;
}
.enemy-info {
  left: 28px;
  top: 25px;
}
.own-info {
  right: 30px;
  bottom: 30px;
}
.hp-track {
  height: 7px;
  border-radius: 6px;
  background: #c9ceb2;
  margin-top: 8px;
  overflow: hidden;
}
.hp-track i {
  display: block;
  height: 100%;
  width: 100%;
  background: #5daa62;
  transition: width 0.4s;
}
.hp-track i.low {
  background: #d2684f;
}
.own-sprite,
.enemy-sprite {
  position: absolute;
  width: 180px;
  height: 180px;
  object-fit: contain;
  image-rendering: pixelated;
  z-index: 1;
}
.enemy-sprite {
  right: 60px;
  top: 0;
}
.own-sprite {
  left: 62px;
  bottom: -10px;
}
.battle-console {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  min-height: 210px;
  background: #16372e;
  color: #eff3dc;
  border-top: 4px solid #77916a;
}

#battle-controls {
  padding: 15px;
}
#battle-question {
  font-size: 12px;
  color: #d8e5c8;
  margin-bottom: 10px;
}
.move-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.move-buttons button {
  background: #edf1d5;
  color: var(--ink);
  border-color: #b4c494;
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
}
.move-buttons small {
  display: block;
  font-size: 9px;
  color: #7d8c67;
  margin-top: 2px;
}
.battle-secondary {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.battle-secondary button {
  font-size: 10px;
  padding: 7px;
}
.battle-secondary button:first-child {
  flex: 1;
}
#switch-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 8px;
}
#switch-options button {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 10px;
  padding: 4px;
}
#switch-options img {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}
#battle-finish {
  width: 100%;
  border-radius: 0;
  padding: 17px;
}
dialog .text-button {
  color: #3b6b37;
}
@media (min-width: 1600px) {
  .game-layout {
    padding-top: 42px;
  }
  .world-heading {
    margin-bottom: 23px;
  }
}
@media (max-width: 1100px) {
  .topbar {
    padding: 0 24px;
  }
  .game-layout {
    padding: 25px 24px;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
  }
  .gym-card {
    padding: 19px;
  }
  .gym-card h2 {
    font-size: 21px;
  }
  .trainer-strip {
    flex-wrap: wrap;
  }
  .controls-help {
    gap: 8px;
  }
  .controls-help > span:last-child {
    display: none;
  }
  .page-footer {
    padding: 12px 24px;
  }
  .world-heading .weather {
    display: none;
  }
}
@media (max-width: 820px) {
  .topbar {
    height: 64px;
    padding: 0 16px;
    gap: 15px;
  }
  .brand {
    font-size: 17px;
  }
  .server-label {
    font-size: 10px;
  }
  .quiet {
    font-size: 11px;
  }
  .game-layout {
    grid-template-columns: 1fr;
    padding: 20px 16px;
    gap: 22px;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .sidebar .gym-card {
    grid-row: span 2;
  }
  .trainer-strip {
    padding: 15px 0;
  }
  .world-footer {
    margin-bottom: 12px;
  }
  .page-footer {
    padding: 10px 16px;
    flex-direction: column;
    gap: 6px;
  }
  .touch-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0;
  }
  .dpad {
    display: flex;
    gap: 6px;
  }
  .dpad button {
    width: 43px;
    height: 40px;
    padding: 4px;
  }
  h1 {
    font-size: 26px;
  }
  .touch-controls > button {
    font-size: 12px;
  }
  .game-frame {
    border-width: 4px;
  }
  .gym-modes {
    gap: 12px;
  }
  .world-footer .text-button {
    font-size: 12px;
  }
}
@media (max-width: 540px) {
  .sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar .gym-card {
    grid-row: auto;
  }
  .gym-card h2 br {
    display: none;
  }
  .gym-card h2 {
    font-size: 23px;
  }
  .gym-card .section-title {
    margin-bottom: 13px;
  }
  .team-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }
  .team-slot img {
    width: 45px;
    height: 45px;
  }
  .team-slot strong {
    font-size: 8px;
  }
  .world-heading {
    margin-bottom: 12px;
  }
  .world-badges {
    font-size: 11px;
  }
  .location-hint {
    font-size: 10px;
    left: 8px;
    top: 8px;
    padding: 6px 8px;
  }
  .server-label #connection {
    max-width: 88px;
    line-height: 1.3;
  }
  .trainer-strip .eyebrow {
    font-size: 8px;
  }
  .trainer-strip strong {
    font-size: 13px;
  }
  .mode-control {
    width: 100%;
  }
  .mode-control small {
    display: inline;
    margin-left: 9px;
  }
  .world-footer .controls-help {
    font-size: 9px;
  }
  .world-footer .controls-help > span:nth-child(2) {
    display: none;
  }
  dialog {
    padding: 25px 20px;
  }
  dialog h2 {
    font-size: 28px;
  }
  .gym-modes {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .gym-modes article {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding-top: 12px;
  }
  .gym-modes .mode-number {
    display: none;
  }
  .gym-modes h3,
  .gym-modes p {
    grid-column: 1/-1;
    margin-bottom: 4px;
  }
  .gym-modes p {
    font-size: 12px;
  }
  .gym-modes small {
    margin: 0;
    align-self: center;
  }
  .rules-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .edit-mon {
    padding: 9px;
  }
  .edit-moves {
    grid-template-columns: 1fr;
  }
  .edit-mon > img {
    width: 30px;
    height: 30px;
  }
  .edit-mon {
    grid-template-columns: 30px 1fr;
    gap: 5px;
  }
  .edit-mon select {
    font-size: 11px;
  }
  .battle-scene {
    height: 225px;
  }
  .monster-info {
    min-width: 152px;
    padding: 8px;
  }
  .monster-info strong {
    font-size: 11px;
  }
  .enemy-info {
    left: 10px;
    top: 18px;
  }
  .own-info {
    right: 10px;
    bottom: 18px;
  }
  .own-sprite,
  .enemy-sprite {
    width: 135px;
    height: 135px;
  }
  .enemy-sprite {
    right: 10px;
    top: 15px;
  }
  .own-sprite {
    left: 12px;
    bottom: 0;
  }
  .battle-scene::before {
    right: 0;
    top: 115px;
    width: 150px;
  }
  .battle-scene::after {
    left: 0;
    top: 212px;
    width: 170px;
  }
  .battle-console {
    grid-template-columns: 1fr;
  }

  #battle-controls {
    padding: 12px;
  }
  .battle-top {
    padding: 10px 12px;
  }
  .battle-dialog {
    padding: 0;
  }
  .battle-secondary button {
    font-size: 11px;
  }
  .move-buttons button {
    font-size: 13px;
  }
  .touch-controls button {
    touch-action: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
.battle-top .text-button {
  color: #edf0d0;
}

/* Expedition cards stay usable with touch and the shared D-pad / A / B. */
#expedition-list {
  display: grid;
  gap: 18px;
  margin: 18px 0;
}
.expedition-card {
  padding: 16px;
  border: 3px double #708379;
  border-left: 7px solid #478364;
  background: #f4f3d9;
}
.expedition-card[data-theme='desert'] {
  border-left-color: #b78040;
}
.expedition-card[data-theme='snow'] {
  border-left-color: #5b91ad;
}
.expedition-card[data-theme='island'] {
  border-left-color: #398e9e;
}
.expedition-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 1.2em;
}
.expedition-heading span {
  white-space: nowrap;
  font-size: 0.8em;
}
.expedition-card p {
  margin: 10px 0;
}
.expedition-card > button {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
}
.expedition-pokemon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}
.expedition-pokemon span {
  display: grid;
  justify-items: center;
  min-width: 64px;
}
.expedition-pokemon img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}
.expedition-deep {
  padding-top: 12px;
  border-top: 1px dashed #8b987b;
}
@media (max-width: 600px) {
  .expedition-card {
    padding: 10px;
  }
  .expedition-heading {
    flex-wrap: wrap;
  }
}

/* A compact portfolio, separate from permanent adventure badges. */
#gyms-owned {
  display: grid;
  gap: 10px;
  max-height: 42dvh;
  overflow-y: auto;
}
.gym-title-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 2px solid #82937a;
  background: #edf1da;
}
.gym-title-card strong {
  font-size: 26px;
}
.gym-title-card span {
  color: #426543;
}
.gym-title-card.disputed {
  border-color: #b47842;
  background: #fff1ce;
}
.gym-title-card.disputed span {
  color: #98522f;
}
#gyms-dialog > button:not(.close) {
  margin-top: 10px;
}
