@import url("/assets/fonts/fonts.css");
:root {
  --sheet-height: min(var(--visual-height, 100dvh), calc(100dvh - env(keyboard-inset-height, 0px)));
  --ink: #203830;
  --paper: #f5f3e9;
  --line: #dce1cf;
  --body: Warden, Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  margin: 0;
  background: #8fa86c;
  color: var(--ink);
  font: 14px/1.5 var(--body);
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  color: inherit;
  background: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:active {
  filter: brightness(1.12);
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #fff0a5;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
a {
  color: inherit;
}
img {
  object-fit: contain;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-weight: 400;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
[hidden] {
  display: none !important;
}
/* One continuous world. UI floats in it; no board frame or reserved control strip. */
.game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: clip;
  isolation: isolate;
  background: #8fa86c;
}
.field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}
.world {
  position: absolute;
  transform: translate(-50%, -50%);
  overflow: visible;
}
.world.portrait-world {
  transform: translate(-50%, -50%) rotate(90deg);
}
.world canvas {
  position: absolute;
  right: auto;
  bottom: auto;
  pointer-events: none;
}
#terrain {
  z-index: 0;
}
#battle {
  z-index: 1;
}
.tower-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
.tower {
  position: absolute;
  width: 10%;
  height: 15.4%;
  min-width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%);
  padding: 0;
  pointer-events: auto;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.tower-art {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
  pointer-events: none;
  filter: drop-shadow(0 4px 2px #193b2733);
}
.portrait-world .tower-art {
  transform: rotate(-90deg);
}
.tower-art:before {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: 16%;
  height: 13%;
  border-radius: 50%;
  background: #203f3347;
  filter: blur(3px);
  z-index: -1;
}
.tower img {
  width: 85%;
  height: 85%;
  image-rendering: pixelated;
  transform: translateY(-17%);
}
.tower.selected .tower-art:after {
  content: "";
  position: absolute;
  bottom: 8%;
  width: 75%;
  height: 28%;
  border: 2px solid #f7edab;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #496f4c80;
  z-index: -1;
}
.tower .level {
  position: absolute;
  bottom: 4%;
  font-size: 10px;
  letter-spacing: 1px;
  color: #fff1a6;
  text-shadow: 0 1px 3px #123a26;
}
.infusion-dot {
  position: absolute;
  right: 8%;
  top: 12%;
  width: 16px;
  height: 16px;
  background: #e5d295;
  color: #35472f;
  border: 1px solid #f5e3b4;
  border-radius: 50%;
  font-size: 11px;
  display: grid;
  place-items: center;
}
.clearing {
  min-width: 44px;
  min-height: 44px;
  position: absolute;
  transform: translate(-50%, -50%);
  width: 7%;
  height: 10.8%;
  pointer-events: auto;
  border-radius: 50%;
  padding: 0;
}
.clearing:hover,
.clearing:focus-visible {
  background: #f5f4c74d;
  outline: 2px solid #f5efb7;
  outline-offset: 0;
}
.game-hud {
  position: absolute;
  z-index: 3;
  top: calc(12px + env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  pointer-events: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px 10px;
  align-items: center;
}
.hud-title-row {
  display: contents;
}
.hud-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid #e1ecc560;
  border-radius: 14px;
  display: grid;
  place-items: center;
  position: relative;
  background: #203f30dc;
  box-shadow: 0 3px 9px #17382640;
  color: #f4f1d6;
  pointer-events: auto;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.hud-button svg {
  width: 21px;
  height: 21px;
}
.reserve-title {
  grid-column: 2;
  grid-row: 1;
  text-align: center;
  color: #fff8d8;
  text-shadow: 0 2px 5px #143d29;
  min-width: 0;
}
.reserve-title h1 {
  font: 22px/1.2 var(--display);
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reserve-title span {
  display: block;
  font-size: 8px;
  letter-spacing: 1.5px;
  margin-top: 2px;
}
.research-toggle {
  grid-column: 3;
  grid-row: 1;
}
.research-toggle b {
  position: absolute;
  right: -3px;
  top: -4px;
  background: #f1d886;
  border: 2px solid #375740;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  display: grid;
  place-items: center;
  color: #30432a;
}
.resources {
  grid-column: 1/-1;
  grid-row: 2;
  justify-self: center;
  display: flex;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 30px;
  background: #203f30cb;
  color: #f5f1cf;
  backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px #17382626;
}
.resource {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  font-size: 12px;
}
.resource + .resource {
  border-left: 1px solid #f2e9bf26;
}
.resource b {
  font-weight: 600;
}
.resource small {
  font-size: 10px;
  color: #e0e7c9;
}
.resource svg {
  width: 14px;
  height: 14px;
}
.hp svg {
  color: #f2b3a1;
}
.gold svg {
  color: #f2d58a;
}
.wave svg {
  color: #c3d89a;
}
.build-toggle {
  position: absolute;
  z-index: 3;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  width: 62px;
  height: 60px;
  border-radius: 19px;
  gap: 0;
  padding: 6px 0;
}
.build-toggle svg {
  width: 25px;
  height: 25px;
}
.build-toggle span {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}
.battle-actions {
  position: absolute;
  z-index: 3;
  bottom: calc(16px + env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.wave-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff9dc;
  text-shadow: 0 1px 4px #123b28;
  pointer-events: none;
}
.wave-preview img {
  width: 29px;
  height: 29px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 2px #153b2f80);
}
.wave-preview .tiny {
  display: none;
}
.wave-preview p {
  font-size: 12px;
  font-weight: 600;
}
.wave-preview p small {
  font-size: 10px;
  font-weight: 400;
}
.wave-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}
.speed {
  width: 44px;
  height: 48px;
  min-width: 44px;
  border: 1px solid #dce8b56e;
  border-radius: 15px;
  background: #203f30dc;
  box-shadow: 0 3px 9px #17382640;
  color: #f1f1d4;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}
.primary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: #244834;
  color: #f2f1d6;
  border: 1px solid #244834;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 3px 0 #18342a30;
  white-space: nowrap;
  min-height: 44px;
  text-decoration: none;
}
.primary svg {
  width: 16px;
  height: 16px;
}
.secondary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  background: #faf9f1;
  min-height: 44px;
  text-decoration: none;
}
.secondary svg {
  width: 17px;
  height: 17px;
}
#start-wave {
  min-width: 126px;
  min-height: 48px;
  background: linear-gradient(#e2ecad, #bfda83);
  border-color: #eef2bb;
  color: #243d28;
  box-shadow:
    0 3px 0 #748f4c,
    0 5px 14px #193c2b4d;
  border-radius: 15px;
}
#start-wave.is-paused {
  background: linear-gradient(#f3dfa0, #d9be77);
  border-color: #f8e7b1;
}
.placement-prompt {
  position: absolute;
  bottom: calc(101px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 28px);
  width: max-content;
  color: #fff6d7;
  background: #203f30d9;
  border-radius: 25px;
  padding: 7px 13px;
  font-size: 11px;
  text-align: center;
  backdrop-filter: blur(8px);
  pointer-events: none;
  box-shadow: 0 2px 12px #16372a26;
}
.placement-prompt.placing {
  padding: 2px 4px 2px 13px;
}
.placement-prompt button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #ffffff13;
  border-radius: 50%;
  color: #f9efc3;
  pointer-events: auto;
  flex-shrink: 0;
}
.placement-prompt button svg {
  width: 17px;
  height: 17px;
}
.icon-button {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf3;
  flex-shrink: 0;
}
.icon-button svg {
  width: 18px;
  height: 18px;
}
.tiny,
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #8c956e;
  font-weight: 600;
}
#toast {
  position: fixed;
  left: 50%;
  top: calc(104px + env(safe-area-inset-top));
  transform: translate(-50%, -8px);
  color: #fff4d0;
  background: #213f31f5;
  border: 1px solid #d6ddab8a;
  border-radius: 14px;
  padding: 11px 18px;
  box-shadow: 0 8px 30px #102d2544;
  opacity: 0;
  z-index: 100;
  pointer-events: none;
  transition: 0.2s;
  font-size: 12px;
  max-width: min(90%, 480px);
  width: max-content;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.float-wave {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 6;
  pointer-events: none;
  animation: wavePop 2.4s forwards;
}
.float-wave div {
  background: #183c2de8;
  border: 1px solid #b3c78688;
  border-radius: 18px;
  padding: 20px 32px;
  text-align: center;
  color: #f1efce;
  box-shadow: 0 10px 40px #142b2440;
}
.float-wave strong {
  font: 30px var(--display);
  display: block;
}
.float-wave small {
  font-size: 10px;
  letter-spacing: 2px;
  color: #b6c6a0;
}
@keyframes wavePop {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  15%,
  70% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}
dialog {
  max-width: min(760px, calc(100vw - 32px));
  width: 100%;
  max-height: 88dvh;
  padding: 0;
  border: 1px solid #d5ddc5;
  border-radius: 16px;
  background: #f7f5e9;
  color: var(--ink);
  box-shadow: 0 25px 120px #0b20175c;
}
dialog::backdrop {
  background: #10241cc2;
  backdrop-filter: blur(6px);
}
.modal-head {
  padding: 27px 30px 20px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font: 30px var(--display);
  letter-spacing: -0.7px;
  margin-top: 5px;
}
.modal-head p {
  font-size: 11px;
  color: #8d957e;
  margin-top: 9px;
}
.modal-body {
  padding: 24px 30px 28px;
}
.modal-body p {
  font-size: 12px;
  line-height: 1.8;
  color: #7a8772;
}
.modal-body .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 16px;
}
.modal-body .row:first-child {
  margin-top: 0;
}
.modal-body .row strong {
  font-weight: 500;
  font-size: 12px;
}
.modal-body .row small {
  display: block;
  font-size: 10px;
  color: #89967e;
}
.modal-body .primary {
  padding: 12px 18px;
}
.modal-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}
.modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.region-card {
  border: 1px solid #dce3ce;
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  background: #fffdf4;
}
.region-card .region-art {
  height: 112px;
  position: relative;
  overflow: hidden;
  background: #788e56;
}
.region-art canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.region-card .region-content {
  padding: 15px;
}
.region-card h3 {
  font: 20px var(--display);
  line-height: 1.2;
  margin: 6px 0;
}
.region-card p {
  font-size: 10px;
  line-height: 1.6;
}
.region-card small {
  font-size: 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8d9c75;
}
.region-card.locked {
  opacity: 0.5;
}
.modal-card {
  padding: 15px;
  background: #fffdf5;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.modal-card h3 {
  font: 20px var(--display);
  margin: 5px 0 8px;
}
.modal-card p {
  font-size: 10px;
}
.modal-card img {
  width: 65px;
  height: 65px;
  image-rendering: pixelated;
}
.mode-choice {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.mode-choice button {
  flex: 1;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
  background: #fdfcf4;
  font-size: 11px;
}
.mode-choice button.active {
  background: #e5edd6;
  border-color: #9cb580;
}
.mode-choice small {
  display: block;
  font-size: 9px;
  color: #89987b;
  margin-top: 3px;
}
.result {
  text-align: center;
}
.result .result-image {
  width: 150px;
  height: 130px;
  image-rendering: pixelated;
  margin-top: -5px;
  filter: drop-shadow(0 10px 10px #395c2d20);
}
.result h3 {
  font: 38px var(--display);
  margin: 8px 0;
}
.result .result-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 20px 0;
}
.result-stats strong {
  display: block;
  font: 28px var(--display);
}
.result-stats small {
  font-size: 9px;
  color: #879477;
}
.result .row {
  justify-content: center;
}
.offline-progress {
  width: 100%;
  height: 10px;
  accent-color: #6b8f50;
  margin: 18px 0;
}
.status-box {
  padding: 14px 17px;
  border: 1px solid #d4dec4;
  background: #e9efdd;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.7;
  margin: 14px 0;
  color: #60754f;
}
.form-input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 11px;
  border-radius: 6px;
  background: #fffdf7;
  color: var(--ink);
  margin-top: 10px;
}
.infusion-detail {
  padding: 12px;
  border: 1px solid #d7dfc5;
  border-radius: 7px;
  background: #edf2e0;
  margin-top: 12px;
}
.infusion-detail strong {
  font: 17px var(--display);
}
.infusion-detail p {
  font-size: 10px;
  color: #7f8f6d;
  margin-top: 5px;
}
.target-select {
  width: 100%;
  margin-top: 12px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fafaf1;
  color: #7e8d73;
  font-size: 9px;
}
.combo-items {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 10px 0;
}
.combo-items img {
  height: 18px;
  width: 18px;
}
.combo-items span {
  font-size: 10px;
  color: #a7af98;
} /* Field journal and defender sheets only take space while open. */
dialog {
  overscroll-behavior: contain;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  border-radius: 24px;
  scrollbar-width: thin;
}
dialog::backdrop {
  background: #0e2b2380;
  backdrop-filter: blur(5px);
}
.modal-head {
  position: sticky;
  top: 0;
  background: #f7f5e9f5;
  z-index: 2;
  backdrop-filter: blur(12px);
}
.modal-head p {
  font-size: 12px;
}
.modal-body p {
  font-size: 13px;
}
.modal-card p {
  font-size: 12px;
}
.modal-card h3 {
  font-size: 23px;
}
.modal-body .row strong {
  font-size: 14px;
}
.modal-body .row small {
  font-size: 12px;
}
.form-input {
  font-size: 16px;
}
.type-chip {
  font-size: 10px;
  border-radius: 6px;
  padding: 4px 7px;
  color: #46643e;
  background: #e4ecd7;
  border: 1px solid #d5dfc7;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.type-chip img {
  width: 13px;
  height: 13px;
}
.status-box {
  font-size: 12px;
}
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.element-btn {
  border: 1px solid #d3ddc2;
  border-radius: 14px;
  background: #eaf0da;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 16px 4px;
  gap: 6px;
  min-height: 100px;
}
.element-btn img {
  width: 29px;
  height: 29px;
}
.element-btn span {
  font-size: 13px;
}
.element-btn small {
  font-size: 9px;
  color: #688550;
}
.element-btn.unresearched {
  background: #fffdf5;
  border-style: dashed;
}
.element-btn.unresearched img {
  opacity: 0.55;
}
.research-balance {
  font-size: 14px;
  color: #5c7b47;
  background: #e6edd4;
  border-radius: 12px;
  padding: 12px 16px;
}
.research-done {
  width: 100%;
  margin-top: 22px;
}
.resume-button {
  width: 100%;
  margin-bottom: 20px;
  font-size: 14px;
}
.game-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.menu-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 12px;
  text-align: left;
  background: #fffdf6;
  min-height: 76px;
}
.menu-tile > svg:first-child {
  color: #6c8856;
  width: 24px;
  height: 24px;
}
.menu-tile > svg:last-child {
  margin-left: auto;
  width: 14px;
  color: #96a27d;
}
.menu-tile strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.menu-tile small {
  display: block;
  font-size: 10px;
  color: #849075;
  margin-top: 3px;
}
.menu-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  font-size: 11px;
  color: #7d8c70;
}
.save-note {
  text-align: center;
  font-size: 10px !important;
  margin-top: 15px;
}
.companion-dialog {
  width: 420px;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #f7f5e9f5;
  z-index: 2;
}
.panel-title strong {
  display: block;
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
  color: #8c987d;
}
.selection-body {
  padding: 16px 24px 24px;
}
.pokemon-hero {
  height: 95px;
  background: radial-gradient(ellipse, #e7edda, transparent 72%);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.pokemon-hero img {
  width: 110px;
  height: 95px;
  image-rendering: pixelated;
  filter: drop-shadow(0 9px 5px #34472a22);
}
.dex-num,
.rarity {
  position: absolute;
  top: 8px;
  font-size: 10px;
  letter-spacing: 1px;
  color: #a4b18c;
}
.dex-num {
  left: 0;
}
.rarity {
  right: 0;
  color: #b29e52;
}
.selected-name {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.selected-name h2 {
  font: 28px var(--display);
  letter-spacing: -0.6px;
}
.selected-role {
  text-align: center;
  color: #859271;
  font-size: 11px;
  margin-top: 4px;
}
.description {
  font-size: 12px;
  color: #7f8b73;
  line-height: 1.6;
  text-align: center;
  margin: 13px 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 12px 0;
  border-block: 1px solid var(--line);
}
.stats div {
  text-align: center;
  border-right: 1px solid var(--line);
}
.stats div:last-child {
  border: 0;
}
.stats strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
}
.stats small {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8e9a80;
}
.selection-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.selection-actions .primary {
  flex: 1;
}
.target-select {
  font-size: 12px;
  padding: 12px;
  margin-top: 14px;
  border-radius: 9px;
}
.infusion-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: #8d977b;
  text-transform: uppercase;
  margin: 18px 0 9px;
}
.recipe-mini {
  width: 100%;
  border: 1px solid #d5dfc3;
  background: #edf2df;
  border-radius: 12px;
  text-align: left;
  padding: 11px 12px;
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 57px;
}
.recipe-mini strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.recipe-mini small {
  font-size: 10px;
  color: #869772;
  display: block;
  margin-top: 3px;
}
.recipe-glyph {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #dce8c3;
  border-radius: 50%;
  color: #6a8a46;
  flex-shrink: 0;
}
.recipe-price {
  margin-left: auto;
  font-size: 11px;
  white-space: nowrap;
  color: #9b854a;
}
.recipe-mini.unavailable {
  opacity: 0.6;
}
.infusion-detail strong {
  font-size: 19px;
}
.infusion-detail p {
  font-size: 12px;
}
.empty-selection {
  display: none;
}
/* On-map recruitment opens at the clearing, rather than taking a permanent strip. */
.roster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 14px 0;
}
.pokemon-card {
  border: 1px solid #cdd8b7;
  border-radius: 12px;
  background: linear-gradient(#fffbed, #e7edce);
  position: relative;
  text-align: center;
  padding: 7px 2px;
  min-width: 0;
  min-height: 91px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
}
.pokemon-card img {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 2px #2d492124);
}
.pokemon-card strong {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pokemon-card .cost {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #766636;
  margin-top: 2px;
}
.pokemon-card .cost svg {
  width: 11px;
  height: 11px;
}
.pokemon-card.locked {
  background: #e4e8db;
}
.pokemon-card.locked img {
  filter: grayscale(1);
  opacity: 0.45;
}
.pokemon-card.locked .cost {
  color: #687857;
  font-size: 10px;
}
.pokemon-card.unaffordable .cost {
  color: #884d30;
}
.pokemon-card.picked {
  border-color: #91ad5f;
  background: #e1efbb;
}
.pokemon-card:hover {
  border-color: #89a966;
  background: #e7f0d0;
}
.recruit-dialog {
  width: 330px !important;
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 24px) !important;
  position: fixed;
  inset: auto;
  top: 0;
  left: 0;
  margin: 0 !important;
  transform: none !important;
  border-radius: 20px !important;
  box-shadow: 0 12px 40px #183b2a66 !important;
  scroll-padding-top: 66px;
}
.recruit-dialog::backdrop {
  background: #163b2515;
  backdrop-filter: none;
}
.recruit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f5e9f5;
}
.recruit-heading h2 {
  font: 22px var(--display);
  margin-top: 2px;
}
.recruit-heading .eyebrow {
  font-size: 8px;
}
.recruit-note {
  font-size: 11px;
  color: #5b6b50;
  padding: 12px 15px 15px;
  line-height: 1.5;
}
/* Scrollable sheets retain their existing progression and account functionality. */
.hud-button {
  flex-shrink: 0;
}
.mode-choice button {
  min-height: 48px;
}
.target-select {
  font-size: 16px;
  min-height: 44px;
}
.modal-body .row {
  flex-wrap: wrap;
}
.modal-body .row > * {
  min-width: 0;
}
.modal-card,
.region-content {
  min-width: 0;
}
.modal-card h3 {
  overflow-wrap: break-word;
}
.game-menu-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.menu-tile span {
  min-width: 0;
}
.menu-tile > svg {
  flex-shrink: 0;
}
.modal-body p,
.description,
.selected-role,
.modal-head p,
.menu-tile small {
  color: #5b6b50;
}
.element-btn small {
  color: #516b3d;
}
dialog {
  position: fixed;
  inset: auto env(safe-area-inset-right) auto env(safe-area-inset-left);
  top: calc(var(--visual-top, 0px) + var(--sheet-height)/2);
  transform: translateY(-50%);
  margin: 0 auto;
  max-width: min(
    760px,
    calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 24px)
  );
  max-height: calc(
    var(--sheet-height) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  scroll-padding-top: 140px;
}
.companion-dialog {
  max-width: min(
    420px,
    calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 20px)
  );
  scroll-padding-top: 90px;
}
.modal-head,
.panel-title {
  flex-shrink: 0;
}
@media (min-aspect-ratio: 1/1) {
  .game-hud {
    grid-template-columns: 44px minmax(0, 1fr) auto 44px;
    gap: 10px;
  }
  .reserve-title {
    text-align: left;
  }
  .reserve-title h1 {
    font-size: 22px;
  }
  .resources {
    grid-column: 3;
    grid-row: 1;
  }
  .research-toggle {
    grid-column: 4;
  }
  #toast {
    top: calc(70px + env(safe-area-inset-top));
  }
}
@media (max-width: 600px) {
  .game-hud {
    top: calc(10px + env(safe-area-inset-top));
  }
  .reserve-title h1 {
    font-size: 20px;
  }
  .resources {
    padding: 4px 8px;
  }
  .resource {
    font-size: 12px;
    padding: 0 7px;
  }
  .build-toggle {
    left: max(12px, env(safe-area-inset-left));
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
  }
  .battle-actions {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
  #start-wave {
    min-width: 116px;
    font-size: 11px;
    padding: 12px;
  }
  .placement-prompt {
    font-size: 10px;
  }
  .modal-head {
    padding: 18px 18px 15px;
  }
  .modal-head h2 {
    font-size: 26px;
  }
  .modal-head .eyebrow {
    font-size: 8px;
  }
  .modal-head p {
    font-size: 11px;
  }
  .modal-body {
    padding: 18px;
  }
  .modal-grid {
    grid-template-columns: 1fr;
  }
  .modal-grid.dex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-card {
    padding: 12px;
  }
  .modal-card h3 {
    font-size: 21px;
  }
  .modal-card p {
    font-size: 12px;
  }
  .modal-card img {
    width: 60px;
    height: 60px;
  }
  .modal-body .row {
    gap: 10px;
  }
  .modal-body .row .primary,
  .modal-body .row .secondary {
    flex: 1;
  }
  .region-card {
    display: flex;
  }
  .region-card .region-art {
    width: 100px;
    min-width: 100px;
    height: auto;
    min-height: 150px;
  }
  .region-card .region-content {
    padding: 13px;
  }
  .region-card h3 {
    font-size: 22px;
  }
  .region-card p {
    font-size: 12px;
  }
  .game-menu-grid {
    gap: 8px;
  }
  .menu-tile {
    padding: 12px 10px;
    gap: 8px;
    min-height: 72px;
  }
  .menu-tile strong {
    font-size: 12px;
  }
  .menu-tile small {
    font-size: 10px;
  }
  .menu-tile > svg:last-child {
    display: none;
  }
  .menu-settings {
    flex-wrap: wrap;
  }
  .companion-dialog {
    top: auto;
    bottom: calc(
      100dvh - var(--visual-top, 0px) - var(--sheet-height) + 10px + env(safe-area-inset-bottom)
    );
    transform: none;
    margin: 0 auto;
    width: calc(100% - 20px);
    max-width: 420px;
    max-height: min(77dvh, calc(var(--sheet-height) - 24px));
  }
  .companion-dialog .panel-title {
    padding: 14px 20px;
  }
  .selection-body {
    padding: 12px 20px 20px;
  }
  .pokemon-hero {
    height: 75px;
  }
  .pokemon-hero img {
    height: 80px;
  }
  .description {
    font-size: 12px;
    margin: 11px 0;
  }
  .selected-name h2 {
    font-size: 26px;
  }
  .result h3 {
    font-size: 30px;
  }
  .result .result-stats {
    gap: 25px;
  }
  .status-box {
    padding: 12px;
    font-size: 12px;
  }
  #toast {
    font-size: 11px;
  }
}
@media (max-width: 360px) {
  .reserve-title h1 {
    font-size: 18px;
  }
  .resource {
    padding: 0 6px;
  }
  .modal-grid.dex-grid {
    grid-template-columns: 1fr;
  }
  .menu-tile {
    gap: 6px;
    padding: 10px 8px;
  }
  .menu-tile > svg:first-child {
    width: 19px;
  }
  .menu-tile strong {
    font-size: 11px;
  }
  .menu-tile small {
    font-size: 9px;
  }
  .speed {
    width: 44px;
  }
  #start-wave {
    min-width: 106px;
    padding: 11px;
  }
  .placement-prompt {
    max-width: calc(100% - 20px);
  }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .game-hud {
    top: max(8px, env(safe-area-inset-top));
    gap: 8px;
  }
  .reserve-title h1 {
    font-size: 19px;
  }
  .resources {
    padding: 4px 6px;
    gap: 0;
  }
  .resource {
    padding: 0 5px;
    font-size: 11px;
  }
  .resource svg {
    width: 12px;
    height: 12px;
  }
  .resource small {
    font-size: 9px;
  }
  .placement-prompt {
    bottom: calc(84px + env(safe-area-inset-bottom));
    font-size: 10px;
  }
  .build-toggle {
    width: 56px;
    height: 54px;
  }
  .wave-preview img {
    width: 24px;
    height: 24px;
  }
  .wave-preview p {
    font-size: 11px;
  }
  .battle-actions {
    gap: 2px;
  }
  .recruit-dialog {
    max-height: calc(var(--sheet-height) - 24px);
  }
  .recruit-heading {
    padding: 8px 14px;
  }
  .pokemon-card {
    min-height: 74px;
    padding: 4px 2px;
  }
  .pokemon-card img {
    width: 34px;
    height: 34px;
  }
  .pokemon-card strong {
    font-size: 10px;
  }
  .pokemon-card .cost {
    font-size: 10px;
  }
  .recruit-note {
    padding: 8px 15px 10px;
  }
  .roster {
    gap: 6px;
  }
  .modal-head {
    padding: 12px 18px;
  }
  .modal-head h2 {
    font-size: 24px;
  }
  .modal-head p {
    margin-top: 5px;
  }
  .modal-body {
    padding: 16px 20px;
  }
  .research-grid {
    margin: 12px 0;
  }
  .element-btn {
    min-height: 86px;
    padding: 10px 4px;
  }
  .companion-dialog {
    width: 650px;
    max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 24px);
    top: calc(var(--visual-top, 0px) + var(--sheet-height)/2);
    bottom: auto;
    transform: translateY(-50%);
    max-height: calc(var(--sheet-height) - 24px);
    margin: 0 auto;
  }
  .companion-dialog .panel-title {
    padding: 10px 18px;
  }
  .selection-body {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 6px 16px;
    padding: 10px 18px 18px;
  }
  .pokemon-hero {
    grid-column: 1;
    grid-row: 1/4;
    height: 100px;
    align-self: center;
  }
  .selected-name,
  .selected-role,
  .stats {
    grid-column: 2;
    margin: 0;
  }
  .selected-name {
    justify-content: flex-start;
  }
  .selected-role {
    text-align: left;
  }
  .description {
    display: none;
  }
  .stats {
    padding: 8px 0;
  }
  .selection-actions,
  .target-select,
  .infusion-label,
  .recipe-mini,
  .infusion-detail {
    grid-column: 1/-1;
    margin-top: 6px;
  }
  .infusion-label {
    margin-top: 12px;
  }
  .selected-name h2 {
    font-size: 25px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition: none !important;
  }
}
/* Gem drafting shares the on-field picker; its journal stays tucked away. */
.gem-prospect {
  border-bottom: 3px solid var(--element);
}
.gem-prospect .cost {
  font-size: 9px;
  color: #526744;
}
.gem-redraw {
  background: #e1e8d8;
  border-style: dashed;
}
.gem-redraw > svg {
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  color: #7d8b57;
}
.shard-wallet {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0;
}
.shard-count {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 10px 3px;
  background: #e9eddf;
  border-radius: 11px;
}
.shard-count i {
  font-size: 23px;
  line-height: 1.2;
  color: var(--element);
  font-style: normal;
  text-shadow: 0 1px 1px #283a4440;
}
.shard-count b {
  font-size: 17px;
}
.shard-count small {
  font-size: 9px;
}
.gem-intro {
  display: flex;
  gap: 18px;
  align-items: center;
}
.gem-intro h3 {
  font: 27px var(--display);
  margin: 6px 0;
}
.gem-emblem {
  font-size: 60px;
  color: #8eaf8b;
  text-shadow: 0 3px 0 #547665;
}
.gem-recipes-title {
  font: 24px var(--display);
  margin: 25px 0 10px;
}
.gem-recipe-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.gem-recipe-list .recipe-mini {
  margin: 0;
}
.gem-recipe-list .recipe-price {
  font-size: 10px;
}
.reserve-title span {
  display: block;
  font-size: 8px;
  letter-spacing: 1.4px;
  color: #fbf4cb;
  text-shadow: 0 1px 3px #1d3b24;
}
@media (max-width: 600px) {
  .gem-recipe-list {
    grid-template-columns: 1fr;
  }
  .gem-emblem {
    display: none;
  }
  .gem-intro h3 {
    font-size: 24px;
  }
  .shard-wallet {
    gap: 4px;
  }
  .shard-count small {
    font-size: 8px;
  }
  .shard-count {
    padding: 8px 2px;
  }
  .recruit-heading h2 {
    font-size: 21px;
  }
  .gem-prospect strong {
    font-size: 10px;
  }
}
/* The app opens in the reserve lodge, rather than dropping into a live board. */
#hub {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: auto;
  overscroll-behavior: contain;
  background: #142b26;
  color: #f4f2db;
  scrollbar-color: #607c62 #142b26;
}
.game.is-away {
  visibility: hidden;
  pointer-events: none;
}
.app-lobby {
  min-height: 100%;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 80% 0, #344e3d80, transparent 65%), #142b26;
}
.lobby-header {
  height: calc(84px + env(safe-area-inset-top));
  padding: calc(18px + env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 18px
    max(28px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1320px;
  margin: auto;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ecedcf;
  font: 25px var(--display);
  min-height: 44px;
  padding: 0;
}
.wordmark svg {
  width: 27px;
  height: 27px;
  color: #cddc91;
}
.wordmark b {
  font-weight: 400;
}
.lobby-profile {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: #bacab6;
  font-size: 12px;
  padding: 0;
}
.lobby-profile svg {
  width: 18px;
}
.lobby-main {
  max-width: 1264px;
  margin: auto;
  padding: 0 24px;
}
.title-scene {
  position: relative;
  min-height: 540px;
  isolation: isolate;
  border-radius: 28px;
  overflow: hidden;
  background: #516e48;
  box-shadow: 0 20px 70px #071e2633;
}
.title-landscape,
.title-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.title-landscape canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% 50%;
  transform: scale(1.08);
}
.title-shade {
  z-index: -1;
  background:
    linear-gradient(90deg, #142b26ed 0%, #19392bbb 35%, #1a392732 68%),
    linear-gradient(0deg, #173729bb, transparent 45%);
}
.title-copy {
  padding: 70px 58px 86px;
  position: relative;
  z-index: 2;
  max-width: 650px;
}
.lobby-eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #baca9e;
  display: block;
  font-weight: 500;
}
.title-copy h1 {
  font: clamp(44px, 5.2vw, 76px)/1.02 var(--display);
  letter-spacing: -2.5px;
  margin: 22px 0;
}
.title-copy > p {
  color: #d0dec2;
  font-size: 15px;
  line-height: 1.8;
  margin: 0 0 30px;
}
.lobby-primary {
  min-height: 54px;
  border-radius: 14px;
  background: #d3e5a0;
  color: #263b2c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 25px;
  font-size: 14px;
  font-weight: 600;
  box-shadow:
    0 4px 0 #8eaa68,
    0 8px 30px #0a251e40;
}
.lobby-primary svg {
  width: 19px;
}
.lobby-text-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #d8e4be;
  font-size: 12px;
  min-height: 44px;
}
.title-copy > .lobby-text-button {
  display: flex;
  margin-top: 9px;
  padding: 4px 0;
}
.lobby-text-button svg {
  width: 16px;
}
.title-caption {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: #b1c4a0;
  margin-top: 24px;
}
.title-caption svg {
  width: 14px;
  height: 14px;
}
.title-companions {
  position: absolute;
  bottom: 84px;
  right: 35px;
  width: 44%;
  height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  filter: drop-shadow(0 18px 8px #1b362c66);
  pointer-events: none;
}
.title-companions img {
  width: 34%;
  height: 65%;
  image-rendering: pixelated;
  object-fit: contain;
  animation: companion-idle 4s ease-in-out infinite;
}
.title-companions img:nth-child(2) {
  height: 90%;
  width: 37%;
  animation-delay: -1.2s;
  margin-inline: -6%;
}
.title-companions img:nth-child(3) {
  animation-delay: -2.5s;
}
.scene-label {
  position: absolute;
  right: 30px;
  bottom: 25px;
  left: 58px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 2px;
  color: #e1e9c1b0;
}
.scene-label span {
  color: #d5e1b5;
}
.home-continue {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  width: 100%;
  border: 1px solid #7f9f6c50;
  background: linear-gradient(110deg, #304c39, #263e33);
  border-radius: 20px;
  padding: 22px;
  margin: 22px 0;
  color: #e6edd3;
}
.continue-icon {
  width: 50px;
  height: 50px;
  background: #c9dc9240;
  color: #daedaa;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.home-continue > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.home-continue small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #b7c99c;
}
.home-continue strong {
  display: block;
  font: 24px var(--display);
  margin: 3px 0;
}
.home-continue span span {
  font-size: 11px;
  color: #b9cbb0;
}
.home-continue > svg {
  color: #cbdc9c;
}
.lobby-section {
  padding: 36px 0 20px;
}
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.section-heading h2 {
  font: 34px var(--display);
  margin-top: 8px;
}
.lobby-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.lobby-mode-card {
  position: relative;
  min-width: 0;
  text-align: left;
  background: linear-gradient(140deg, #344d3d, #243e34);
  border: 1px solid #90aa7340;
  border-radius: 22px;
  padding: 28px;
  color: #f0f1d9;
  transition:
    transform 0.2s,
    border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.lobby-mode-card:hover {
  transform: translateY(-4px);
  border-color: var(--mode-color, #bccb9d);
}
.mode-glyph {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--mode-color, #cbd79d) 15%, transparent);
  color: var(--mode-color, #cbd79d);
  margin-bottom: 22px;
}
.mode-glyph svg {
  width: 24px;
  height: 24px;
}
.lobby-mode-card > small {
  color: var(--mode-color, #bac9a1);
  font-size: 9px;
  letter-spacing: 1px;
}
.lobby-mode-card h2 {
  font: 29px var(--display);
  margin: 9px 0 12px;
}
.lobby-mode-card p {
  font-size: 12px;
  color: #bdcdb8;
  line-height: 1.8;
  flex: 1;
}
.mode-detail {
  font-size: 10px;
  color: #baccac;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  width: 100%;
}
.mode-detail svg {
  margin-left: auto;
  width: 17px;
}
.lobby-bottom-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  color: #92ad93;
  font-size: 11px;
  gap: 16px;
}
.lobby-bottom-note button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}
.lobby-bottom-note svg {
  width: 15px;
}
.lobby-nav {
  position: fixed;
  z-index: 3;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  display: flex;
  padding: 7px;
  background: #203e32ed;
  border: 1px solid #79956460;
  border-radius: 22px;
  box-shadow: 0 8px 35px #071c2350;
  backdrop-filter: blur(15px);
}
.lobby-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border-radius: 15px;
  color: #95b09a;
  font-size: 9px;
}
.lobby-nav button[aria-current] {
  background: #bdd6961c;
  color: #dae9b2;
}
.lobby-nav svg {
  width: 20px;
  height: 20px;
}
.lobby-page-heading {
  padding: 25px 0 32px;
  max-width: 800px;
}
.lobby-back {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: #b6c6aa;
  font-size: 12px;
  padding: 0;
  margin-bottom: 22px;
}
.lobby-back svg {
  width: 17px;
}
.lobby-page-heading h1 {
  font: clamp(34px, 4.5vw, 58px)/1.1 var(--display);
  letter-spacing: -1.5px;
  margin: 14px 0 18px;
}
.lobby-page-heading > p {
  font-size: 14px;
  color: #bccdb2;
  line-height: 1.8;
}
.mode-picker .lobby-mode-card {
  min-height: 300px;
}
.coming-mode {
  opacity: 0.58;
  border-style: dashed;
  --mode-color: #aebbb4;
}
.mode-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lobby-footnote {
  font-size: 11px;
  color: #97ae94;
  margin: 28px 0;
  line-height: 1.8;
  max-width: 670px;
}
.reserve-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.reserve-option {
  position: relative;
  text-align: left;
  min-height: 400px;
  overflow: hidden;
  border-radius: 23px;
  border: 1px solid #97ad7b40;
  isolation: isolate;
  color: #f6f2d8;
  padding: 28px;
  display: flex;
  align-items: flex-end;
  background: #253a35;
}
.reserve-preview,
.reserve-preview-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.reserve-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reserve-preview-shade {
  z-index: -1;
  background: linear-gradient(0deg, #0c2628f5, #0e252828 90%);
}
.reserve-option:disabled {
  opacity: 0.42;
}
.reserve-number {
  position: absolute;
  top: 18px;
  left: 24px;
  font: 52px var(--display);
  color: #f5f1d99c;
}
.reserve-option-copy {
  width: 100%;
}
.reserve-option small {
  font-size: 8px;
  letter-spacing: 1.4px;
  color: #d5deb8;
}
.reserve-option h2 {
  font: 32px/1.07 var(--display);
  margin: 12px 0;
}
.reserve-option p {
  font-size: 12px;
  line-height: 1.6;
  color: #d2dfc6;
  margin-bottom: 22px;
}
.reserve-option-copy > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 10px;
  color: #d9e2c2;
}
.reserve-option svg {
  width: 23px;
}
.lobby-rule-note {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #8ca87b40;
  background: #2a4435;
  padding: 18px 22px;
  border-radius: 18px;
  margin-top: 22px;
  max-width: 850px;
}
.lobby-rule-note svg {
  color: #d0dda4;
}
.lobby-rule-note p {
  font-size: 12px;
  line-height: 1.7;
  color: #c4d3b7;
}
.lobby-header button:focus-visible,
.app-lobby button:focus-visible {
  outline-color: #dceca2;
}
@keyframes companion-idle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
@media (max-width: 700px) {
  .lobby-header {
    height: calc(72px + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  }
  .wordmark {
    font-size: 23px;
  }
  .lobby-profile span {
    font-size: 10px;
  }
  .lobby-main {
    padding: 0 16px;
  }
  .title-scene {
    min-height: 580px;
    border-radius: 24px;
  }
  .title-copy {
    padding: 32px 25px 185px;
    max-width: none;
  }
  .title-copy h1 {
    font-size: 49px;
    letter-spacing: -1.8px;
    margin: 17px 0;
  }
  .title-copy > p {
    font-size: 12px;
    line-height: 1.8;
    margin-bottom: 24px;
  }
  .title-copy .lobby-eyebrow {
    font-size: 8px;
    letter-spacing: 1.5px;
  }
  .title-shade {
    background: linear-gradient(180deg, #152e29e0, #16352eb0 45%, #17352f15 75%, #17352f80);
  }
  .title-landscape canvas {
    object-position: 56% 50%;
  }
  .title-companions {
    bottom: 38px;
    right: 18px;
    width: 80%;
    height: 180px;
  }
  .title-companions img {
    height: 62%;
  }
  .title-companions img:nth-child(2) {
    height: 87%;
  }
  .title-caption {
    margin-top: 20px;
    font-size: 9px;
  }
  .scene-label {
    left: 25px;
    right: 25px;
    bottom: 19px;
    font-size: 7px;
  }
  .lobby-primary {
    min-height: 50px;
    font-size: 12px;
    padding: 13px 20px;
  }
  .title-copy > .lobby-text-button {
    font-size: 11px;
    margin-top: 8px;
  }
  .lobby-mode-grid,
  .mode-picker {
    grid-template-columns: 1fr;
  }
  .lobby-mode-card {
    padding: 24px;
    min-height: 240px;
  }
  .mode-picker .lobby-mode-card {
    min-height: 250px;
  }
  .lobby-mode-card h2 {
    font-size: 29px;
  }
  .mode-glyph {
    width: 43px;
    height: 43px;
    margin-bottom: 17px;
  }
  .lobby-mode-card .mode-detail {
    margin-top: 20px;
  }
  .section-heading {
    display: block;
    margin-bottom: 20px;
  }
  .section-heading h2 {
    font-size: 31px;
  }
  .section-heading > .lobby-text-button {
    margin-top: 8px;
  }
  .lobby-section {
    padding-top: 25px;
  }
  .lobby-bottom-note {
    flex-wrap: wrap;
    padding-top: 8px;
  }
  .home-continue {
    padding: 18px;
    gap: 12px;
    border-radius: 18px;
    margin: 18px 0;
  }
  .home-continue strong {
    font-size: 22px;
  }
  .home-continue small {
    font-size: 8px;
  }
  .home-continue span span {
    font-size: 10px;
  }
  .continue-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  .lobby-page-heading {
    padding: 8px 6px 25px;
  }
  .lobby-page-heading h1 {
    font-size: 39px;
  }
  .lobby-page-heading > p {
    font-size: 12px;
  }
  .lobby-back {
    margin-bottom: 16px;
  }
  .reserve-picker {
    grid-template-columns: 1fr;
  }
  .reserve-option {
    min-height: 310px;
    padding: 25px;
  }
  .reserve-option h2 {
    font-size: 34px;
    max-width: 240px;
  }
  .reserve-preview canvas {
    object-position: 50% 45%;
  }
  .lobby-rule-note {
    align-items: flex-start;
    padding: 17px;
    gap: 12px;
  }
  .lobby-rule-note p {
    font-size: 11px;
  }
  .lobby-rule-note svg {
    margin-top: 3px;
  }
  .lobby-footnote {
    font-size: 10px;
    padding: 0 5px;
  }
  .lobby-nav {
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 6px;
  }
  .lobby-eyebrow {
    font-size: 9px;
  }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .lobby-header {
    height: 64px;
    padding: 10px 24px;
  }
  .title-scene {
    min-height: 370px;
  }
  .title-copy {
    padding: 35px 35px 58px;
    max-width: 65%;
  }
  .title-copy h1 {
    font-size: 44px;
  }
  .title-companions {
    width: 38%;
    height: 220px;
    bottom: 45px;
  }
  .title-caption {
    display: none;
  }
  .mode-picker,
  .lobby-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reserve-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .reserve-option {
    min-height: 330px;
    padding: 18px;
  }
  .reserve-option h2 {
    font-size: 28px;
  }
  .scene-label {
    left: 35px;
  }
  .lobby-page-heading h1 {
    font-size: 38px;
  }
}
/* Lightweight selection and optional continuous waves. */
.quick-companion {
  position: absolute;
  z-index: 5;
  left: max(12px, env(safe-area-inset-left));
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: 310px;
  max-width: calc(100vw - 24px);
  padding: 13px;
  background: #f5f4e9f5;
  border: 1px solid #d5dec3;
  border-radius: 19px;
  box-shadow: 0 10px 35px #19382d40;
  backdrop-filter: blur(12px);
}
.quick-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quick-top > img {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
}
.quick-top > div {
  flex: 1;
  min-width: 0;
}
.quick-top h2 {
  font: 22px var(--display);
}
.quick-top small {
  font-size: 10px;
  color: #6f805d;
}
.quick-top .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
}
.quick-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.quick-actions .primary {
  flex: 1;
  padding: 10px;
  font-size: 11px;
}
.quick-actions .secondary {
  font-size: 11px;
  min-height: 44px;
  padding: 9px 12px;
}
.quick-technique {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  background: #e5edd1;
  font-size: 11px;
  min-height: 44px;
}
.quick-technique span {
  font-size: 10px;
  color: #6c8051;
}
.auto-wave {
  align-self: flex-end;
  min-height: 34px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 10px;
  background: #203f32c9;
  color: #e5ebc9;
  font-size: 10px;
}
.auto-wave[aria-pressed="true"] {
  background: #d3e4a4;
  color: #294331;
}
.auto-wave svg {
  width: 13px;
  height: 13px;
}
.gem-salvage {
  width: calc(100% - 28px);
  margin: 10px 14px 0;
  min-height: 44px;
  border: 1px solid #b7c6a2;
  background: #e7eddc;
  border-radius: 12px;
  font-size: 11px;
}
.game {
  transition: opacity 0.2s;
}
.float-wave {
  pointer-events: none;
}
.tower-art {
  transition: filter 0.2s;
}
.tower.selected .tower-art {
  filter: drop-shadow(0 5px 6px #eff6b840);
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .quick-companion {
    width: 280px;
    bottom: 80px;
    padding: 10px;
  }
  .quick-top > img {
    width: 40px;
    height: 40px;
  }
  .quick-top h2 {
    font-size: 20px;
  }
  .quick-actions {
    margin-top: 7px;
  }
  .quick-technique {
    margin-top: 6px;
  }
  .auto-wave {
    min-height: 28px;
  }
  .gem-salvage {
    margin-top: 7px;
    min-height: 38px;
  }
}
/* Auto shares the wave preview row instead of shrinking the playable camera. */
.battle-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  align-items: center;
}
.battle-actions .auto-wave {
  grid-row: 1;
  grid-column: 1;
  align-self: center;
}
.battle-actions .wave-preview {
  grid-row: 1;
  grid-column: 2;
}
.battle-actions .wave-actions {
  grid-row: 2;
  grid-column: 1/-1;
  justify-content: flex-end;
}
@media (max-width: 360px) {
  .battle-actions {
    column-gap: 6px;
  }
  .auto-wave {
    font-size: 9px;
    padding-inline: 7px;
  }
}
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lobby-mode-grid:not(.mode-picker) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mode-detail > .icon-box:last-child {
  margin-left: auto;
}
.home-continue > .icon-box:last-child {
  margin-left: auto;
}
.lobby-nav .icon-box {
  height: 20px;
}
.lobby-nav {
  width: min(470px, calc(100% - 24px));
}
.lobby-rule-note > .icon-box {
  align-self: flex-start;
  margin-top: 2px;
}
.poker-dialog {
  width: 450px !important;
}
.poker-body {
  padding: 0 15px 16px;
}
.poker-body > p {
  font-size: 12px;
  color: #647657;
  margin-bottom: 13px;
}
.playing-hand {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.playing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 104px;
  padding: 9px 4px 6px;
  border-radius: 11px;
  background: #fffdf4;
  border: 1px solid #cad3be;
  color: #293b36;
  box-shadow: 0 3px 0 #b6c0a7;
}
.playing-card b {
  align-self: flex-start;
  margin-left: 5px;
  font: 22px Georgia;
}
.playing-card > span {
  font-size: 27px;
  line-height: 1;
}
.playing-card small {
  font-size: 8px;
  letter-spacing: 0.5px;
  min-height: 13px;
}
.playing-card.suit-red {
  color: #ad5652;
}
.playing-card.is-held {
  background: #e9efce;
  border: 2px solid #7c9b58;
  box-shadow: 0 3px 0 #668447;
}
.playing-card:disabled {
  opacity: 1;
  cursor: default;
}
.hand-result {
  font: 26px Georgia;
  text-align: center;
  margin: 18px 0;
  color: #304b38;
}
.hand-result small {
  display: block;
  font: 10px var(--body);
  color: #748769;
  margin-top: 4px;
}
.poker-buttons {
  display: flex;
  gap: 8px;
}
.poker-buttons .primary {
  flex: 1;
}
.poker-buttons .secondary {
  min-height: 44px;
}
.poker-rewards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.poker-reward {
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  padding: 10px 7px;
  background: #e8efd7;
  border: 1px solid #c9d4b2;
  border-radius: 13px;
  min-width: 0;
  min-height: 83px;
}
.poker-reward img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}
.poker-reward span {
  min-width: 0;
}
.poker-reward strong {
  font-size: 12px;
  display: block;
}
.poker-reward small {
  display: block;
  font-size: 9px;
  color: #6c7b5c;
}
.poker-bank {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
}
.poker-hint {
  font-size: 10px !important;
  margin-top: 12px;
}
.poker-guide {
  border-top: 1px solid #d8dfcd;
  margin-top: 14px;
  font-size: 11px;
  color: #64745a;
}
.poker-guide summary {
  min-height: 44px;
  padding: 12px 2px;
  cursor: pointer;
  color: #344e39;
}
.poker-guide p {
  margin-bottom: 12px;
}
.poker-guide table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.poker-guide th,
.poker-guide td {
  padding: 6px;
  text-align: left;
  border-bottom: 1px solid #d8dfcd;
}
.poker-guide caption {
  text-align: left;
  margin-bottom: 8px;
}
.balance-lab {
  padding-bottom: 24px;
}
.lab-form,
.lab-results {
  background: #f2f3e6;
  color: #294234;
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 24px;
}
.lab-form fieldset {
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
}
.lab-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.lab-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.lab-field > span {
  font-size: 11px;
  color: #57704c;
}
.lab-field input,
.lab-field select {
  width: 100%;
  min-height: 46px;
  font: 15px var(--body);
  color: #294234;
  background: #fffdf5;
  border: 1px solid #c9d4b9;
  border-radius: 10px;
  padding: 9px;
}
.lab-caveat {
  font-size: 11px;
  color: #617957;
  line-height: 1.7;
  margin: 18px 0;
}
.lab-empty {
  border: 1px dashed #6e896c;
  border-radius: 20px;
  text-align: center;
  padding: 38px 24px;
  color: #a7be9d;
}
.lab-empty > .icon-box svg {
  width: 30px;
  height: 30px;
}
.lab-empty h2 {
  font: 30px Georgia;
  color: #e2e9ce;
  margin: 15px 0;
}
.lab-empty p {
  font-size: 12px;
  line-height: 1.8;
  max-width: 500px;
  margin: auto;
}
.lab-error {
  font-size: 13px;
  color: #9d4137;
  margin-top: 18px;
}
.lab-progress {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.lab-progress progress {
  flex: 1;
  min-width: 120px;
  accent-color: #708f50;
}
.lab-result-heading {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}
.lab-result-heading h2 {
  font: 30px Georgia;
  margin: 8px 0;
}
.lab-result-heading .lobby-eyebrow {
  color: #677d55;
}
.lab-results > p {
  font-size: 12px;
  margin: 18px 0;
}
.lab-results table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 12px;
}
.lab-results caption {
  text-align: left;
  font-size: 11px;
  color: #7a8b68;
  margin-bottom: 10px;
}
.lab-results th,
.lab-results td {
  text-align: left;
  padding: 12px 7px;
  border-bottom: 1px solid #d5dec8;
}
.lab-results h3 {
  font: 24px Georgia;
  margin: 20px 0;
}
.damage-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.damage-bars > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: #e5ecd8;
  border-radius: 10px;
  font-size: 11px;
}
.lab-limitations {
  font-size: 11px;
  color: #617957;
  padding-left: 18px;
  line-height: 1.8;
}
@media (max-width: 1000px) {
  .lobby-mode-grid:not(.mode-picker) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lab-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .lobby-mode-grid:not(.mode-picker) {
    grid-template-columns: 1fr;
  }
  .lab-form,
  .lab-results {
    padding: 20px 16px;
  }
  .lab-fields {
    gap: 14px 12px;
  }
  .lab-field > span {
    font-size: 10px;
  }
  .lab-field input,
  .lab-field select {
    font-size: 16px;
  }
  .lab-result-heading {
    display: block;
  }
  .lab-result-heading h2 {
    font-size: 26px;
  }
  .lab-results table {
    font-size: 10px;
  }
  .lab-results th,
  .lab-results td {
    padding: 10px 4px;
  }
  .damage-bars {
    grid-template-columns: 1fr 1fr;
  }
  .damage-bars > div {
    font-size: 10px;
    padding: 10px;
  }
  .playing-card {
    min-height: 97px;
  }
  .playing-card b {
    font-size: 20px;
  }
  .poker-reward {
    flex-direction: column;
    text-align: center;
  }
  .lobby-nav button {
    font-size: 8px;
  }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .playing-card {
    min-height: 84px;
  }
  .poker-dialog .recruit-heading {
    padding-block: 8px;
  }
  .poker-body {
    padding-bottom: 12px;
  }
  .hand-result {
    margin: 12px 0;
    font-size: 23px;
  }
  .poker-reward {
    min-height: 65px;
  }
  .poker-body > p {
    margin-bottom: 10px;
  }
  .lab-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.poker-dialog .roster {
  display: block;
  padding: 0;
}
.poker-dialog #gem-salvage {
  display: none;
}
.auth-error {
  overflow: auto;
  padding: 10vh 10vw;
  background: #f5f3e9;
  color: #203830;
  font: 18px Georgia;
}
.auth-error p {
  margin: 20px 0;
}
.expedition-seed {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: 390px;
  margin-bottom: 25px;
}
.expedition-seed > span {
  font-size: 11px;
  color: #c5d6b3;
}
.expedition-seed input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  color: #ebefdc;
  background: #2b4538;
  border: 1px solid #739366;
  border-radius: 11px;
  font: 16px var(--body);
}
.expedition-seed small {
  color: #93ad8d;
  font-size: 10px;
}
