/* Descriptions stay readable; named groups and reward details use horizontal tabs. */
#troop-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
}
#troop-tabs button {
  flex: 0 0 auto;
  padding-inline: 14px;
}
#troops-view .troop-body p {
  display: block;
  font-size: 14px;
  line-height: 1.25;
  margin: 5px 0;
}
.route-about {
  min-height: 32px;
  padding: 3px 12px;
  margin: 3px 0;
  font-size: 13px;
  background: #14354ed9;
  color: #fff2bd;
  border: 1px solid #d2bb7e;
}
.route-intel {
  display: none;
}
.level-recruits {
  display: flex;
  justify-content: center;
  gap: 18px;
}
.level-recruits > span {
  display: grid;
  justify-items: center;
  flex: 1;
  text-align: center;
}
.level-recruits svg {
  width: 85px;
  height: 85px;
  border-radius: 18px;
}
.result-recruits h3 {
  font-size: 23px;
  margin: 0 0 8px;
  color: #ffdf7c;
}
.new-card-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.new-card-row article {
  display: flex;
  align-items: center;
  gap: 12px;
}
.new-card-row svg {
  flex: 0 0 80px;
  width: 80px;
  height: 90px;
  border-radius: 16px;
}
.new-card-row h4 {
  margin: 0 0 3px;
  font-size: 19px;
  color: #fff1c3;
}
.new-card-row p {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.3;
}
.new-card-row button {
  min-height: 40px;
  padding: 5px 14px;
  font-size: 15px;
}
.result-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
}
.result-tabs button {
  flex: 0 0 auto;
}
#modal .upgrade-heading p {
  display: block;
  font-size: 14px;
  line-height: 1.3;
  margin: 8px 0 0;
}
.victory-journey > p {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}
@media (max-width: 600px) and (max-height: 720px) {
  #troops-view .troop-art {
    height: 80px;
    min-height: 60px;
  }
  #troops-view .troop-body p {
    font-size: 13px;
  }
  .new-card-row {
    gap: 6px;
  }
  .new-card-row svg {
    flex-basis: 64px;
    width: 64px;
    height: 72px;
  }
  .new-card-row h4 {
    font-size: 17px;
  }
  .result-recruits h3 {
    font-size: 19px;
    margin-bottom: 5px;
  }
  .new-card-row p {
    font-size: 13px;
  }
  .journey-scroll {
    padding-bottom: 0;
  }
  #modal[data-variant='upgrade'] .upgrade-hero {
    grid-template-columns: 72px 1fr;
    gap: 12px;
  }
  #modal[data-variant='upgrade'] .upgrade-showcase {
    width: 72px;
    height: 100px;
  }
  #modal .upgrade-heading p {
    font-size: 13px;
  }
}
@media (max-height: 560px) and (min-width: 600px) {
  .new-card-row {
    flex-direction: row;
  }
  .new-card-row article {
    flex: 1;
    gap: 6px;
  }
  .new-card-row svg {
    flex-basis: 55px;
    width: 55px;
    height: 65px;
  }
  #troops-view .troop-body p {
    font-size: 13px;
  }
  #modal .upgrade-heading p {
    font-size: 13px;
  }
  .victory-journey > p {
    font-size: 13px;
    margin-block: 4px;
  }
}
#modal[data-variant='upgrade'] .upgrade-hero {
  margin: 0;
  padding: 0;
  min-height: 0;
}
#modal[data-variant='upgrade'] .upgrade-heading .eyebrow {
  margin: 0 0 4px;
}
#modal[data-variant='upgrade'] .upgrade-timing {
  font-size: 13px;
  line-height: 1.25;
  margin: 6px 0;
}
@media (max-width: 600px) and (max-height: 720px) {
  #modal[data-variant='upgrade'] .upgrade-heading .eyebrow {
    display: none;
  }
  #modal[data-variant='upgrade'] .upgrade-comparison {
    margin-top: 6px;
  }
  #modal[data-variant='upgrade'] .upgrade-stat {
    padding: 4px 0;
  }
}
@media (max-height: 560px) and (min-width: 600px) {
  #modal[data-variant='upgrade'] .upgrade-showcase {
    width: 82px;
    height: 82px;
    min-height: 0;
  }
  #modal[data-variant='upgrade'] .upgrade-heading p {
    margin-top: 4px;
  }
  #modal[data-variant='upgrade'] .upgrade-timing {
    margin: 2px 0;
  }
}
.route-about {
  min-height: 30px;
  padding: 2px 4px;
  margin: 0;
  background: transparent;
  color: #284e56;
  border: 0;
  box-shadow: none;
  font-size: 18px;
  line-height: 1.1;
}
.route-about span {
  font-size: 15px;
  color: #4d6971;
}
@media (max-height: 560px) and (min-width: 600px) {
  #troop-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(44px, 1fr);
    overflow: hidden;
    align-content: center;
  }
  #troop-tabs button {
    min-width: 0;
    padding: 3px;
    font-size: 13px;
  }
  .route-about {
    font-size: 16px;
    min-height: 26px;
  }
}
.result-recruits h3 {
  color: #285a65;
  font-family: 'Lilita One', sans-serif;
  font-weight: 400;
  font-size: 27px;
}
.new-card-row h4 {
  color: #244b59;
  font-size: 22px;
}
.new-card-row svg {
  flex-basis: 110px;
  width: 110px;
  height: 110px;
}
.new-card-row p {
  font-size: 16px;
}
.new-card-row button {
  min-height: 44px;
  padding: 7px 16px;
  border-radius: 12px;
  border: 2px solid #fff0a9;
  background: linear-gradient(#ffeb9a, #edbf54);
  color: #44361f;
  box-shadow: 0 3px #b28a3a;
  font-size: 17px;
}
@media (max-width: 600px) and (max-height: 720px) {
  .result-recruits h3 {
    font-size: 21px;
  }
  .new-card-row h4 {
    font-size: 18px;
  }
  .new-card-row svg {
    flex-basis: 64px;
    width: 64px;
    height: 76px;
  }
  .new-card-row p {
    font-size: 13px;
  }
  .new-card-row button {
    font-size: 15px;
    min-height: 40px;
    padding: 4px 12px;
  }
}
@media (max-height: 560px) and (min-width: 600px) {
  .new-card-row h4 {
    font-size: 18px;
  }
  .new-card-row p {
    font-size: 13px;
  }
  .new-card-row svg {
    flex-basis: 55px;
    width: 55px;
    height: 65px;
  }
  .new-card-row button {
    font-size: 14px;
    padding: 4px 10px;
  }
}
#modal[data-variant='level-plan'] .modal-body {
  padding: 16px;
}
#modal[data-variant='level-plan'] h2 {
  font-size: 28px;
  margin: 6px 0 12px;
  line-height: 1.05;
}
#modal[data-variant='level-plan'] p {
  font-size: 15px;
  line-height: 1.35;
  margin: 12px 0;
}
#modal[data-variant='level-plan'] .manual-tactic {
  padding: 10px;
}
#modal[data-variant='level-plan'] #brief-play {
  width: 100%;
  margin-top: 8px;
}
#brief-tabs {
  margin-bottom: 8px;
}
#brief-rewards .level-recruits svg {
  width: 90px;
  height: 90px;
}
@media (max-height: 560px) and (min-width: 600px) {
  #modal[data-variant='level-plan'] {
    width: min(760px, calc(100% - 30px));
  }
  #modal[data-variant='level-plan'] .modal-body {
    display: grid;
    grid-template-columns: 32% 1fr;
    gap: 6px 18px;
    padding: 12px 16px;
  }
  .level-plan-heading {
    grid-column: 1;
    grid-row: 1;
  }
  #modal[data-variant='level-plan'] h2 {
    font-size: 26px;
  }
  #modal[data-variant='level-plan'] p {
    font-size: 14px;
    line-height: 1.25;
    margin: 7px 0;
  }
  #brief-tabs {
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    margin: 0;
  }
  #brief-plan,
  #brief-tactics,
  #brief-rewards {
    grid-column: 2;
    grid-row: 1/3;
  }
  #modal[data-variant='level-plan'] #brief-play {
    grid-column: 2;
    grid-row: 3;
    min-height: 46px;
    margin: 0;
  }
  #brief-rewards .level-recruits svg {
    width: 65px;
    height: 65px;
  }
}

/* One continuous world: native horizontal panning, no region pages. */
.route-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  isolation: isolate;
  overflow: hidden;
  border-radius: 22px;
}
#campaign-grid {
  max-width: none;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c5dba6 #234d4a;
  border-radius: 0;
  background: #cadca8;
}
.route-world {
  position: relative;
  height: 100%;
  min-width: 100%;
  isolation: isolate;
}
.route-world .route-island {
  inset: 0;
  clip-path: none;
  box-shadow:
    inset 0 15px 30px #fbf5ca44,
    inset 0 -30px 50px #254c5633;
  background:
    radial-gradient(ellipse at 12% 0%, #f5ebae99, transparent 28%),
    linear-gradient(90deg, #94c88a, #c7d894 25%, #d5c794 43%, #bbb899 59%, #a7bcc1 77%, #c9dbe0);
}
.route-world .route-landscape::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('art/training-camp.webp') left center / 800px 500px repeat-x;
  opacity: 0.09;
  mix-blend-mode: multiply;
}
.route-world .route-river {
  left: 0;
  top: 68%;
  width: 100%;
  height: 15%;
  transform: rotate(-1deg);
  border-radius: 45% 55% 35% 65%;
  background: linear-gradient(#a5ddd5, #74bcb8 50%, #80c9d6);
  opacity: 0.72;
  border-block: 5px solid #eef1c588;
}
.route-peak {
  position: absolute;
  width: 66px;
  height: 45px;
  background: linear-gradient(120deg, #dfdfc1 45%, #8ea596 46%);
  clip-path: polygon(0 100%, 42% 0, 61% 40%, 72% 19%, 100% 100%);
  filter: hue-rotate(var(--peak-hue));
}
.route-place {
  position: absolute;
  bottom: 10%;
  font:
    24px 'Lilita One',
    sans-serif;
  color: #305d5766;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.route-world .route-stop {
  width: 182px;
  max-width: 182px;
  gap: 3px;
  transform: translate(-50%, -30px);
}
.route-world .route-medallion {
  width: 76px;
  height: 64px;
  min-height: 64px;
}
.route-world .route-level {
  font-size: 34px;
}
.route-world .route-about {
  min-height: 44px;
  font:
    20px/1.08 'Lilita One',
    sans-serif;
}
.route-world .route-status {
  font-size: 12px;
  letter-spacing: 0.5px;
  margin-top: 7px;
}
.route-world .route-stop .mastery-stars {
  font-size: 24px;
}
.route-pan {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  min-height: 52px;
  padding: 8px;
  z-index: 3;
  background: linear-gradient(#fff2c8, #dbb879);
  border: 2px solid #fff2cf;
  border-radius: 15px;
  box-shadow:
    0 4px 0 #896e49,
    0 6px 12px #264a4944;
}
.route-pan-back {
  left: 3px;
}
.route-pan-forward {
  right: 3px;
}
.route-pan svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #38535a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.route-pan:disabled {
  opacity: 0;
  pointer-events: none;
}
.route-heading {
  justify-content: center;
  min-height: 24px;
}
#route-region {
  font-size: 14px;
  color: #547866;
}

/* Battle and training own the dock; secondary tools share its right edge. */
.game-nav {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(135px, 1.3fr) 64px;
  align-items: center;
  gap: 10px;
  min-height: calc(100px + env(safe-area-inset-bottom));
  height: calc(100px + env(safe-area-inset-bottom));
  flex: 0 0 calc(100px + env(safe-area-inset-bottom));
  padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  background: linear-gradient(#204653, #102c3b);
  border-top: 2px solid #b69f62;
  overflow: visible;
}
.game-nav .nav {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 65px;
  padding: 8px 6px;
  border-radius: 17px;
  background: linear-gradient(#569daa, #286474);
  border: 2px solid #a2d8d5;
  box-shadow:
    inset 0 3px 0 #c4ebe644,
    0 5px 0 #0b2936;
  color: #fff3d5;
}
.game-nav .nav > span {
  font:
    22px/1 'Lilita One',
    sans-serif;
  text-shadow: 0 2px #143b4c;
}
.game-nav .nav > img {
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
}
.game-nav .nav-battle,
.game-nav .nav-battle.active {
  height: 79px;
  background: linear-gradient(#ffe6a0, #f0b952 65%, #dfa13b);
  border: 3px solid #fff1b6;
  box-shadow:
    inset 0 3px 0 #fff9d6,
    0 6px 0 #8d5c26,
    0 9px 16px #051f3044;
  color: #60411e;
}
.game-nav .nav-battle > span {
  font-size: 30px;
  text-shadow: 0 2px #ffe8aa;
}
.game-nav .nav-battle > img {
  width: 49px;
  height: 49px;
  transform: none;
}
.game-nav .nav.active:not(.nav-battle) {
  border-color: #fff0b4;
  background: linear-gradient(#65b6ba, #347b8b);
}
.nav-utilities {
  display: grid;
  gap: 0;
  justify-items: stretch;
}
.game-nav .nav-tool,
.game-nav .feedback-fab {
  position: static;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  background: transparent;
  color: #e1e8d6;
  filter: none;
}
.game-nav .nav-tool img,
.game-nav .nav-tool svg {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
}
.game-nav .nav-tool span {
  font:
    700 10px 'Nunito',
    sans-serif;
}
.game-nav .nav-tool {
  flex-direction: column;
}
.topbar .top-context {
  display: none;
}
.topbar .wallet {
  margin-left: auto;
  gap: 14px;
}
.gem-balance {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #d9fcff;
}
.gem-balance svg {
  width: 31px;
  height: 36px;
}
.gem-balance > span,
.player-level {
  display: grid;
  justify-items: center;
  line-height: 1.05;
}
.gem-balance small,
.player-level small {
  font-size: 13px;
  font-weight: 800;
  color: #c4dedb;
}
.gem-balance b,
.player-level b {
  font:
    23px 'Lilita One',
    sans-serif;
  color: #f6ebc9;
}
.player-level {
  min-width: 36px;
}
.settings-tools {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.settings-tools button {
  min-height: 44px;
  flex: 1;
  font-size: 15px;
}
@media (min-width: 850px) {
  .game-nav {
    grid-template-columns: 230px 290px 120px;
    justify-content: center;
  }
  .nav-utilities {
    grid-template-columns: 1fr 1fr;
  }
  .game-nav .nav-tool span {
    font-size: 13px;
  }
  .game-nav .nav-tool {
    height: 60px;
  }
  .game-nav .nav-tool img,
  .game-nav .nav-tool svg {
    width: 31px;
    height: 31px;
  }
}
@media (max-width: 400px) {
  .game-nav {
    gap: 7px;
    grid-template-columns: minmax(100px, 1fr) minmax(125px, 1.2fr) 56px;
  }
  .game-nav .nav {
    flex-direction: column;
    gap: 1px;
  }
  .game-nav .nav > img {
    width: 32px;
    height: 32px;
  }
  .game-nav .nav > span {
    font-size: 20px;
  }
  .game-nav .nav-battle > span {
    font-size: 27px;
  }
  .game-nav .nav-battle > img {
    width: 38px;
    height: 38px;
  }
  .topbar .wallet {
    gap: 8px;
  }
}
@media (max-height: 560px) and (min-width: 600px) {
  #campaign-view {
    grid-template-rows: 24px minmax(0, 1fr);
  }
  #campaign-view .campaign-banner {
    grid-row: 1;
  }
  .route-heading {
    grid-column: 1;
    grid-row: 1;
  }
  .route-viewport {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
  }
  .lobby-actions {
    grid-column: 2;
    grid-row: 2;
  }
  .route-world .route-medallion {
    width: 56px;
    height: 48px;
    min-height: 48px;
  }
  .route-world .route-level {
    font-size: 28px;
  }
  .route-world .route-about {
    font-size: 17px;
    min-height: 36px;
  }
  .route-world .route-stop .mastery-stars {
    font-size: 18px;
  }
  .route-world .route-stop {
    gap: 1px;
  }
  .route-place {
    bottom: 5%;
    font-size: 18px;
  }
  .game-nav {
    height: calc(58px + env(safe-area-inset-bottom));
    min-height: calc(58px + env(safe-area-inset-bottom));
    flex-basis: calc(58px + env(safe-area-inset-bottom));
    padding-block: 3px;
    grid-template-columns: 180px 240px 110px;
    justify-content: center;
  }
  .game-nav .nav {
    height: 45px;
  }
  .game-nav .nav-battle,
  .game-nav .nav-battle.active {
    height: 49px;
  }
  .game-nav .nav > img,
  .game-nav .nav-battle > img {
    width: 34px;
    height: 34px;
  }
  .game-nav .nav > span {
    font-size: 23px;
  }
  .game-nav .nav-battle > span {
    font-size: 29px;
  }
  .nav-utilities {
    grid-template-columns: 1fr 1fr;
  }
  .game-nav .nav-tool {
    height: 48px;
  }
}

.result-feedback {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
  width: 48px;
  height: 48px;
  padding: 8px;
  border-radius: 14px;
  background: #173b4dda;
  border: 2px solid #edd897;
  color: #fff0c0;
}
.result-feedback svg {
  width: 28px;
  height: 28px;
}

/* The battlefield gets a conclusion before the reward screen appears. */
.battle-ending {
  position: absolute;
  z-index: 12;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100% - 24px));
  display: grid;
  gap: 5px;
  padding: 12px 15px;
  text-align: center;
  border: 2px solid #efdaa0;
  border-radius: 18px;
  background: linear-gradient(#244951f2, #102b40f5);
  box-shadow:
    0 5px 0 #081f32aa,
    0 10px 25px #10293866;
  color: #fff2c8;
}
.battle-ending strong {
  font:
    26px/1.1 'Lilita One',
    sans-serif;
}
.battle-ending span {
  font-size: 14px;
  line-height: 1.3;
}
.battle-ending button {
  min-height: 44px;
  font-size: 16px;
  background: #f5d27f;
  color: #44341e;
}
.battle-ending button:disabled {
  opacity: 0.5;
}
@media (max-height: 700px) {
  .battle-ending {
    padding: 8px 12px;
    gap: 3px;
    bottom: 6px;
  }
  .battle-ending strong {
    font-size: 22px;
  }
  .battle-ending span {
    display: none;
  }
}

.rival-preview {
  display: flex;
  gap: 12px;
  align-items: center;
}
.rival-preview > svg {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}
.rival-preview strong {
  display: block;
  font:
    21px 'Lilita One',
    sans-serif;
  color: #285560;
}
.rival-preview span {
  font-size: 14px;
  line-height: 1.25;
  display: block;
}
.campaign-celebration .next-lesson {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
}
.next-lesson > svg {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 2px solid #e9c674;
  border-radius: 12px;
}
.next-lesson > span {
  font-size: 14px;
  line-height: 1.15;
}
@media (max-height: 560px) and (min-width: 600px) {
  #modal[data-variant='level-plan'] .modal-body {
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 8px 16px;
    gap: 4px 18px;
  }
  #modal[data-variant='level-plan'] #brief-tabs {
    grid-column: 1 / -1;
    grid-row: 1;
    flex-direction: row;
  }
  #modal[data-variant='level-plan'] .level-plan-heading {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
  }
  #modal[data-variant='level-plan'] #brief-plan,
  #modal[data-variant='level-plan'] #brief-tactics,
  #modal[data-variant='level-plan'] #brief-rewards {
    grid-column: 2;
    grid-row: 2;
  }
  #modal[data-variant='level-plan'] p {
    margin: 8px 0;
  }
  #modal[data-variant='level-plan'] .rival-preview > svg {
    width: 52px;
    height: 52px;
  }
  #modal[data-variant='level-plan'] .manual-tactic {
    padding: 6px 8px;
  }
}

@media (max-height: 560px) and (min-width: 600px) {
  #brief-rewards .level-recruits svg {
    width: 72px;
    height: 72px;
  }
}
@media (max-height: 560px) and (min-width: 600px) {
  #modal[data-variant='level-plan'] #brief-tabs {
    padding-block: 0;
  }
}
@media (max-height: 560px) and (min-width: 600px) {
  .campaign-celebration .result-actions {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 0 10px;
    align-items: center;
  }
  .campaign-celebration .next-lesson {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }
  .campaign-celebration .next-lesson > span {
    display: none;
  }
  .campaign-celebration .next-lesson:not(:has(svg)) {
    display: none;
  }
  .campaign-celebration #result-play {
    grid-column: 2;
    grid-row: 1;
  }
  .result-actions:not(:has(.next-lesson > svg)) #result-play {
    grid-column: 1 / -1;
  }
  .result-secondary {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Leave the battlefield room to breathe: health is drawn on the towers themselves. */
#battle-view .arena-wrap {
  gap: 3px;
}
#battle-view .battle-hud {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  min-height: 50px;
  flex: 0 0 50px;
  padding: 0 2px;
  gap: 8px;
}
#battle-view .battle-clock {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 8px;
  min-width: 70px;
  font-size: 27px;
  line-height: 1;
}
#battle-view .battle-clock.urgent {
  color: #ffad8d;
}
#battle-view #pause {
  min-width: 104px;
  width: auto;
  height: 48px;
  min-height: 48px;
  padding: 5px 12px;
  font-size: 18px;
}
