/* Solamon title screen */
@supports (padding: max(0px)) {
  #app {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  #app .title-screen { min-height: 100%; }
}

.hatch-ready {
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 8px;
  width: min(210px, 85%);
  padding: 18px 8px;
  color: #315861;
  background: rgba(224, 255, 230, .42);
  border: 3px dashed #628d8a;
  font-family: 'Press Start 2P', monospace;
  text-align: center;
}
.hatch-ready span { font-size: 14px; }
.hatch-ready small { font-size: 7px; line-height: 1.6; }

.title-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  overflow: hidden;
  text-align: center;
  background: #06152b;
}

.title-bg {
  position: absolute;
  z-index: -3;
  inset: -3%;
  background: url('assets/solamon-home-bg.webp') center / cover no-repeat;
  animation: title-breathe 14s ease-in-out infinite alternate;
}

.title-screen::before {
  content: '';
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 9, 27, .18), rgba(2, 9, 27, .04) 48%, rgba(2, 9, 27, .74)),
    radial-gradient(circle at 50% 45%, transparent 15%, rgba(1, 7, 19, .35) 72%, rgba(1, 7, 19, .74) 100%);
}

.title-screen::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(74, 255, 210, .018) 8px);
}

.title-content {
  width: min(92vw, 850px);
  padding: clamp(28px, 6vh, 70px) 20px 32px;
  transform: translateY(-2vh);
  animation: title-rise .8s steps(8, end) both;
}

.chain-label {
  margin: 0 0 18px;
  color: #d9ff83;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(8px, 1vw, 12px);
  letter-spacing: .18em;
  text-shadow: 2px 2px #112d29, 0 0 14px #54ffd5;
}

.game-logo {
  position: relative;
  margin: 0;
  color: #f5ffd7;
  font-size: clamp(56px, 11vw, 128px);
  line-height: .95;
  letter-spacing: -.08em;
  text-indent: -.08em;
  -webkit-text-stroke: clamp(2px, .35vw, 5px) #0a2937;
  text-shadow: 0 7px 0 #1c7a6c, 0 12px 0 #082434, 0 18px 28px rgba(0, 0, 0, .7), 0 0 28px rgba(107, 255, 205, .55);
}

.game-logo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .55);
  transform: translateY(-2px);
  pointer-events: none;
}

.title-tagline {
  margin: 22px auto 30px;
  color: #e6f8ff;
  font-family: VT323, monospace;
  font-size: clamp(19px, 2vw, 27px);
  letter-spacing: .12em;
  text-shadow: 2px 2px #06152b;
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pixel-menu-button {
  width: min(88vw, 330px);
  padding: 16px 20px;
  border: 3px solid #cffff2;
  background: #103c46;
  color: #effff8;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  letter-spacing: .06em;
  box-shadow: 0 5px 0 #041820, 0 0 0 3px rgba(5, 18, 31, .75);
  transition: transform .12s steps(2), filter .12s;
}

.pixel-menu-button span {
  display: inline-block;
  width: 30px;
  color: #a8ef74;
  text-align: left;
}

.pixel-menu-button:hover,
.pixel-menu-button:focus-visible {
  filter: brightness(1.25);
  transform: translateY(-2px);
  outline: 3px solid #ffd866;
  outline-offset: 4px;
}

.pixel-menu-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #041820, 0 0 0 3px rgba(5, 18, 31, .75);
}

.start-button {
  background: #d9ff83;
  color: #082434;
  border-color: #f6ffdc;
  box-shadow: 0 5px 0 #3d6d3c, 0 0 0 3px rgba(5, 18, 31, .75);
}

.start-button span { color: #0d5e55; }

.title-hint {
  margin: 24px 0 0;
  color: rgba(226, 248, 255, .72);
  font-size: 15px;
  letter-spacing: .1em;
}

.title-monster {
  position: absolute;
  z-index: 1;
  width: clamp(96px, 12vw, 160px);
  height: clamp(96px, 12vw, 160px);
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 0 rgba(2, 11, 22, .55));
  animation: monster-bob 2.2s steps(4, end) infinite;
}

.title-monster .monster-art { width: 100%; height: 100%; border: 0; background: transparent; box-shadow: none; }

.title-monster-left { left: clamp(2%, 8vw, 12%); bottom: 8%; }
.title-monster-right { right: clamp(2%, 8vw, 12%); bottom: 9%; animation-delay: -1.1s; }

.settings-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 8, 20, .78);
  backdrop-filter: blur(5px);
}

.settings-panel {
  width: min(92vw, 460px);
  padding: 28px;
  background: #111b32;
  border: 4px solid #8ef6dc;
  box-shadow: 9px 9px 0 #020916;
  text-align: left;
  animation: panel-pop .22s steps(4, end);
}

.settings-panel h2 { margin: 12px 0 24px; font-size: 24px; }
.setting-row { display: flex; justify-content: space-between; width: 100%; padding: 15px 12px; background: #1b2946; border: 2px solid #516a83; border-bottom: 0; text-align: left; }
.setting-row:hover,
.setting-row:focus-visible { background: #263a5b; outline: 2px solid #8ef6dc; outline-offset: -2px; }
.setting-row b { color: #d9ff83; }
.settings-done { display: block; margin: 24px 0 0 auto; }
.scanlines-off::before { opacity: 0; }
.motion-off * { animation: none !important; transition: none !important; }
.motion-off .cell.active-unit { animation: none !important; }
.game-header .battle-nav-locked { opacity: .48; cursor: not-allowed; }
.game-header:has(+ #game-main .arena-wrap) { display: none; }

@keyframes title-breathe { to { transform: scale(1.035); } }
@keyframes title-rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(-2vh); } }
@keyframes monster-bob { 50% { transform: translateY(-10px); } }
@keyframes panel-pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 680px) {
  .title-content { transform: translateY(-5vh); }
  .title-monster { width: 88px; bottom: 3%; }
  .game-logo { font-size: clamp(48px, 18vw, 78px); }
  .title-tagline { max-width: 320px; line-height: 1.25; }
  .title-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* PokeRogue-inspired game flow, using original Solamon assets */
.monster-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  transform: scale(1.18);
}

.monster-art .idle-frame { opacity: 0; animation: idle-cycle 1s steps(1) infinite; }
.monster-art .idle-frame:first-child { opacity: 1; }
.monster-art .idle-frame:nth-child(2) { animation-delay: -.75s; }
.monster-art .idle-frame:nth-child(3) { animation-delay: -.5s; }
.monster-art .idle-frame:nth-child(4) { animation-delay: -.25s; }
.monster-art .attack-frame { opacity: 0; }
.monster-art .attack-frame:nth-child(1) { animation: attack-frame-1 .375s steps(1) 3 both; }
.monster-art .attack-frame:nth-child(2) { animation: attack-frame-2 .375s steps(1) 3 both; }
.monster-art .attack-frame:nth-child(3) { animation: attack-frame-3 .375s steps(1) 3 both; }

@keyframes idle-cycle { 0%, 24.99% { opacity: 1; } 25%, 100% { opacity: 0; } }
@keyframes attack-frame-1 { 0%, 32.9% { opacity: 1; } 33%, 100% { opacity: 0; } }
@keyframes attack-frame-2 { 0%, 32.9% { opacity: 0; } 33%, 65.9% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes attack-frame-3 { 0%, 65.9% { opacity: 0; } 66%, 100% { opacity: 1; } }

.monster-art:has(img) {
  background: color-mix(in srgb, var(--c) 22%, #10192b);
}
.monster-art.has-sprite.sprite-loading::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  background: var(--sprite) center / contain no-repeat;
  image-rendering: pixelated;
}
.monster-art.has-sprite img { z-index: 1; }
.monster-art.has-sprite img.sprite-error { display: none; }

.header-rank { color: #d9ff83; }
.window-kicker { margin: 0; color: #76f4dc; font-family: 'Press Start 2P', monospace; font-size: 10px; letter-spacing: .12em; }

.game-menu-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: calc(100svh - 68px);
  padding: 32px;
  overflow: hidden;
}

.menu-scene {
  position: absolute;
  z-index: -2;
  inset: 0;
  background: url('assets/solamon-home-bg.webp') center 58% / cover no-repeat;
  filter: saturate(.75) brightness(.54);
}

.game-menu-screen::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(15, 38, 51, .12), #060b19 86%);
}

.mode-window {
  width: min(94vw, 780px);
  padding: 30px;
  background: rgba(15, 24, 43, .96);
  border: 4px solid #7785ac;
  box-shadow: 10px 10px 0 #030611, inset 0 0 0 2px #253453;
  animation: panel-pop .28s steps(5, end);
}

.mode-window h1 { margin: 12px 0 28px; font-size: clamp(22px, 4vw, 38px); line-height: 1.3; }
.mode-options { display: grid; gap: 12px; }

.mode-choice {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  grid-template-areas: 'cursor title meta' 'cursor copy meta';
  align-items: center;
  width: 100%;
  min-height: 104px;
  padding: 18px;
  color: #eaf5ff;
  background: #17233d;
  border: 3px solid #53658c;
  text-align: left;
  box-shadow: inset 0 -4px rgba(4, 10, 22, .4);
}

.mode-choice:hover,
.mode-choice:focus-visible { border-color: #d9ff83; background: #203655; outline: 3px solid #07101d; outline-offset: -7px; }
.mode-choice .menu-cursor { grid-area: cursor; color: #d9ff83; opacity: 0; }
.mode-choice:hover .menu-cursor,
.mode-choice:focus-visible .menu-cursor { opacity: 1; animation: cursor-pulse .6s steps(2) infinite; }
.mode-choice b { grid-area: title; font-family: 'Press Start 2P', monospace; font-size: 18px; }
.mode-choice small { grid-area: copy; margin-top: 8px; color: #aebbd6; font-size: 18px; }
.mode-choice em { grid-area: meta; padding: 10px; color: #ffd866; font-style: normal; text-align: right; white-space: nowrap; }
.ranked-choice b { color: #ff83c4; }
.menu-help { display: flex; justify-content: space-between; margin-top: 22px; color: #8d9ab8; font-size: 15px; }

.dex-screen {
  min-height: calc(100svh - 68px);
  padding: 24px;
  background: linear-gradient(rgba(5, 10, 22, .9), rgba(5, 10, 22, .96)), url('assets/solamon-home-bg.webp') center / cover fixed;
}

.dex-title,
.box-label,
.leaderboard-head { display: flex; align-items: end; justify-content: space-between; }
.dex-title { max-width: 1400px; margin: 0 auto 16px; }
.dex-title h1 { margin: 8px 0 0; font-size: clamp(24px, 4vw, 40px); }
.dex-title > span { color: #ffd866; }

.dex-layout {
  display: grid;
  grid-template-columns: 270px minmax(420px, 1fr) 260px;
  gap: 12px;
  max-width: 1400px;
  margin: auto;
}

.solamon-detail,
.solamon-box,
.squad-pane {
  min-width: 0;
  background: rgba(17, 27, 50, .96);
  border: 3px solid #63709a;
  box-shadow: 6px 6px 0 #030611;
}

.solamon-detail { padding: 18px; text-align: center; }
.detail-type { text-align: left; }
.detail-art { display: grid; place-items: center; height: 180px; }
.detail-art .monster-art { width: 150px; height: 150px; border: 0; background: transparent; box-shadow: none; }
.solamon-detail h2 { margin: 7px 0; font-size: 17px; }
.solamon-detail > p { margin: 6px 0; color: #b6c4de; }
.dex-number { color: #76f4dc !important; }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 15px 0; text-align: left; }
.detail-stats span { padding: 7px; background: #202f4c; }
.detail-stats b { float: right; color: #ffd866; }
.trait-box { min-height: 82px; padding: 10px; background: #0c1427; border: 2px solid #435372; text-align: left; }
.trait-box b { display: block; color: #ff83c4; }
.trait-box span { color: #b6c4de; font-size: 16px; }
.squad-toggle { width: 100%; margin-top: 14px; font-size: 9px; }

.solamon-box { padding: 12px; }
.box-label { padding: 4px 5px 12px; color: #76f4dc; }
.solamon-grid { display: grid; grid-template-columns: repeat(5, minmax(70px, 1fr)); gap: 7px; }
.solamon-slot { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: #1c2a45; border: 2px solid #4f6082; }
.solamon-slot:hover,
.solamon-slot:focus-visible,
.solamon-slot.selected { background: #304e67; outline: 3px solid #d9ff83; outline-offset: -5px; }
.solamon-slot .monster-art { width: 58px; height: 58px; border: 0; background: transparent; box-shadow: none; }
.solamon-slot small { position: absolute; right: 3px; bottom: 2px; color: #fff; font-size: 13px; text-shadow: 1px 1px #000; }
.locked-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 8px; }
.locked-row span { display: grid; place-items: center; aspect-ratio: 1; color: #52617d; background: #0c1426; border: 2px solid #263450; }

.squad-pane { padding: 14px; }
.squad-pane h3 { margin: 5px 0; font-family: 'Press Start 2P', monospace; font-size: 12px; }
.squad-pane > p { margin: 0 0 12px; color: #76f4dc; font-size: 16px; }
.squad-pane > button { display: grid; grid-template-columns: 20px 48px 1fr; align-items: center; width: 100%; padding: 7px 3px; color: #eaf5ff; background: transparent; border: 0; border-bottom: 1px solid #3d4968; text-align: left; }
.squad-pane > button:hover { background: #253957; }
.squad-pane > button > b { color: #ffd866; }
.squad-pane .monster-art { width: 42px; height: 42px; }
.squad-pane > button > span { font-weight: bold; }
.squad-pane small { display: block; color: #9eabc5; font-weight: normal; }
.squad-points { display: flex; justify-content: space-between; margin-top: 14px; padding: 12px; background: #0c1427; color: #aebbd6; }
.squad-points b { color: #d9ff83; }
.command-bar { display: flex; gap: 22px; align-items: center; max-width: 1400px; margin: 14px auto 0; padding: 10px 14px; color: #8f9dbb; background: #0b1223; border: 2px solid #3c4a6c; font-size: 15px; }
.command-bar button { margin-left: auto; color: #d9ff83; background: transparent; border: 0; }

.ranked-screen {
  position: relative;
  min-height: calc(100svh - 68px);
  padding: 34px max(5vw, 24px) 60px;
  background: radial-gradient(circle at 25% 16%, rgba(102, 30, 101, .38), transparent 30%), linear-gradient(135deg, #090d1c, #111a35 55%, #080c19);
}

.ranked-screen::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .12; background: linear-gradient(45deg, transparent 48%, #ff83c4 49% 51%, transparent 52%); background-size: 34px 34px; }
.ranked-back { position: relative; z-index: 1; color: #aebbd6; background: transparent; border: 0; }
.ranked-hero { position: relative; display: grid; grid-template-columns: 1fr 320px; align-items: center; gap: 50px; max-width: 1100px; margin: 18px auto 30px; }
.season-copy h1 { margin: 15px 0; font-size: clamp(50px, 8vw, 92px); line-height: 1; }
.season-copy h1 i { color: #ff6bb6; font-style: normal; }
.season-copy > p { max-width: 460px; color: #b5c0da; }
.ranked-start { display: block; margin: 28px 0 12px; }
.season-copy > small { color: #76f4dc; }
.rank-emblem { display: grid; place-items: center; aspect-ratio: 1; padding: 30px; background: linear-gradient(145deg, #29345a, #11172f); border: 5px solid #d6dde9; box-shadow: 12px 12px 0 #030611, inset 0 0 0 6px #58647f; clip-path: polygon(50% 0, 92% 24%, 92% 74%, 50% 100%, 8% 74%, 8% 24%); text-align: center; }
.rank-emblem > span { color: #d9ff83; font-size: 62px; line-height: .8; }
.rank-emblem > b { margin-top: 10px; font-family: 'Press Start 2P', monospace; font-size: 17px; }
.rank-emblem > strong { margin-top: 7px; color: #ffd866; }
.rank-emblem > small { color: #b5c0da; }
.rank-emblem > em { margin-top: 10px; padding: 4px 8px; background: #08101f; font-style: normal; }
.rank-emblem .gain { color: #a8ef74; }
.rank-emblem .loss { color: #ff7f96; }
.ranked-data { position: relative; display: grid; grid-template-columns: 220px minmax(500px, 1fr); gap: 16px; max-width: 1100px; margin: auto; }
.season-stats { display: grid; align-content: start; background: #111a31; border: 3px solid #4c5879; }
.season-stats span { padding: 18px; color: #9eabc5; border-bottom: 2px solid #303d5e; }
.season-stats b { display: block; color: #edf5ff; font-family: 'Press Start 2P', monospace; font-size: 20px; }
.leaderboard { background: #111a31; border: 3px solid #4c5879; }
.leaderboard-head { padding: 16px; border-bottom: 3px solid #4c5879; }
.leaderboard-head h2 { margin: 0; font-size: 15px; }
.leaderboard-head span { color: #76f4dc; font-size: 15px; }
.rank-row { display: grid; grid-template-columns: 52px 1fr 130px 100px; align-items: center; min-height: 50px; padding: 7px 14px; border-bottom: 1px solid #34405f; }
.rank-row > b { color: #ffd866; }
.rank-row > span { font-weight: bold; }
.rank-row small { display: block; color: #76f4dc; font-weight: normal; }
.rank-row em { color: #b1bdd5; font-style: normal; }
.rank-row strong { text-align: right; }
.rank-row.you { background: #30485b; outline: 2px solid #d9ff83; outline-offset: -3px; }
.ranked-arena .battle-top { border-color: #ff83c4; }

@keyframes cursor-pulse { 50% { transform: translateX(4px); } }

@media (max-width: 980px) {
  .dex-layout { grid-template-columns: 230px 1fr; }
  .squad-pane { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .squad-pane h3,
  .squad-pane > p,
  .squad-points { grid-column: 1 / -1; }
  .ranked-data { grid-template-columns: 1fr; }
  .season-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .game-menu-screen { padding: 14px; }
  .mode-window { padding: 20px 14px; }
  .mode-choice { grid-template-columns: 24px 1fr; grid-template-areas: 'cursor title' 'cursor copy' 'meta meta'; }
  .mode-choice em { text-align: left; }
  .menu-help { display: none; }
  .dex-screen { padding: 14px; }
  .dex-layout { grid-template-columns: 1fr; }
  .solamon-box { grid-row: 1; }
  .solamon-detail { grid-row: 2; }
  .solamon-grid { grid-template-columns: repeat(4, 1fr); }
  .squad-pane { grid-template-columns: 1fr 1fr; }
  .command-bar span { display: none; }
  .ranked-screen { padding-inline: 18px; }
  .ranked-hero { grid-template-columns: 1fr; text-align: center; }
  .season-copy > p { margin-inline: auto; }
  .ranked-start { margin-inline: auto; }
  .rank-emblem { width: min(80vw, 300px); margin: auto; }
  .season-stats { grid-template-columns: 1fr 1fr 1fr; }
  .rank-row { grid-template-columns: 42px 1fr 86px; }
  .rank-row em { display: none; }
}

/* V3 game shell */
body::before { opacity: .06; mix-blend-mode: normal; }

:where(button, a, [tabindex]):focus-visible {
  outline: 3px solid #d9ff83;
  outline-offset: 3px;
}

button:disabled { cursor: not-allowed; }

.context-tip {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100vw - 36px));
  padding: 10px 12px;
  color: #eef7ff;
  background: rgba(8, 16, 35, .97);
  border: 3px solid #67ead7;
  box-shadow: 7px 7px 0 #020611, 0 0 20px rgba(103, 234, 215, .25);
}
.context-tip > span { color: #d9ff83; font-size: 30px; text-align: center; }
.context-tip b { color: #78f1dd; font-family: 'Press Start 2P', monospace; font-size: 9px; }
.context-tip p { margin: 4px 0 0; color: #c3d0e4; font-size: 16px; line-height: 1.05; }
.context-tip button { min-height: 38px; padding: 7px 9px; color: #0b1d25; background: #d9ff83; border: 2px solid #f4ffd9; font-family: 'Press Start 2P', monospace; font-size: 7px; }

.game-header {
  height: 88px;
  display: grid;
  grid-template-columns: 210px minmax(520px, 760px) auto;
  gap: 24px;
  padding: 0 28px;
  background: #090f20;
  border-bottom: 4px solid #43516f;
}

.header-brand { display: flex; flex-direction: column; gap: 4px; }
.header-brand small { color: #6cebd3; font-size: 11px; letter-spacing: .12em; }
.game-header .brand { font-size: 20px; }
.game-header button.brand { min-height: 36px; padding: 0; color: inherit; background: none; border: 0; text-align: left; }
.game-header .main-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; height: 62px; }
.game-header .main-nav button { position: relative; display: grid; grid-template-columns: 24px 1fr; grid-template-rows: 1fr 1fr; align-items: center; min-width: 0; padding: 8px 12px; color: #b8c5dc; background: #121b31; border: 2px solid #3d4a68; text-align: left; }
.game-header .main-nav button > span { grid-row: 1 / 3; color: #71809f; font-size: 20px; }
.game-header .main-nav button > b { align-self: end; font-family: 'Press Start 2P', monospace; font-size: 10px; }
.game-header .main-nav button > small { align-self: start; color: #7786a3; font-size: 14px; }
.game-header .main-nav button:hover,
.game-header .main-nav button.active { color: #f1fff8; background: #20344b; border-color: #83f4dc; }
.game-header .main-nav button.active::after { content: ''; position: absolute; right: 8px; bottom: -6px; left: 8px; height: 4px; background: #d9ff83; }
.game-header .main-nav button.active > span { color: #d9ff83; }
.game-header .wallet { justify-self: end; align-items: center; white-space: nowrap; }
.audio-toggle { padding: 5px 7px; color: #8ef6dc; background: #111b32; border: 2px solid #43516f; font-size: 13px; }
.audio-toggle:hover { color: #d9ff83; border-color: #8ef6dc; }

/* Mode selection */
.mode-hub {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  height: calc(100svh - 88px);
  padding: 24px max(4vw, 24px) 18px;
  overflow: hidden;
  background: linear-gradient(rgba(4, 11, 23, .76), rgba(4, 11, 23, .94)), url('assets/solamon-home-bg.webp') center / cover;
}

.mode-hub-head { position: relative; display: flex; align-items: center; justify-content: center; max-width: 1320px; width: 100%; margin: auto; }
.mode-hub-head .mode-help { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
.mode-hub-head h1 { margin: 0; font-size: clamp(26px, 4vw, 44px); }
.mode-hub-head > p { max-width: 360px; margin: 0; color: #a9b8d0; text-align: right; }
.mode-showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: min(1320px, 100%); min-height: 0; margin: auto; }
.mode-poster { position: relative; display: grid; grid-template-columns: 45% 1fr; min-height: 0; padding: 0; overflow: hidden; color: #f2f7ff; background: #132037; border: 4px solid #52617e; box-shadow: 8px 8px 0 #020611; text-align: left; }
.mode-poster:hover,
.mode-poster:focus-visible { border-color: #d9ff83; outline: 4px solid #07101e; outline-offset: -9px; transform: translateY(-3px); }
.poster-world { position: relative; display: flex; align-items: end; justify-content: center; min-height: 100%; overflow: hidden; background: linear-gradient(180deg, #17625e, #0c2938); }
.poster-world::before { content: ''; position: absolute; inset: 0; opacity: .32; background: url('assets/solamon-home-bg.webp') center / cover; }
.poster-world img { position: relative; width: clamp(90px, 12vw, 165px); image-rendering: pixelated; filter: drop-shadow(0 12px 0 rgba(0, 0, 0, .3)); }
.poster-world img + img { width: clamp(70px, 9vw, 125px); margin-left: -30px; }
.pvp-poster .poster-world { background: radial-gradient(circle, #8f315e, #24172f 68%); }
.pvp-poster .poster-world img { position: absolute; right: 7%; bottom: 5%; width: clamp(90px, 10vw, 140px); }
.poster-rank { position: relative; align-self: center; color: #ff70bb; font-size: clamp(90px, 13vw, 170px); text-shadow: 0 0 28px #ff4caa; }
.poster-index { position: absolute; top: 16px; left: 16px; z-index: 2; padding: 7px; color: #06121e; background: #d9ff83; font-family: 'Press Start 2P', monospace; }
.mode-poster > div:last-child { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 26px; }
.mode-poster p { margin: 0 0 12px; color: #72ecd5; font-size: 16px; }
.mode-poster h2 { margin: 0 0 10px; font-size: clamp(17px, 2vw, 28px); line-height: 1.25; }
.mode-poster small { color: #aebbd1; font-size: 17px; line-height: 1.2; }
.mode-poster > div:last-child > b { margin-top: auto; padding-top: 24px; color: #ffd866; font-family: 'Press Start 2P', monospace; font-size: 10px; }
.hub-status { display: flex; justify-content: center; gap: 34px; color: #72809d; font-size: 15px; }
.hub-status span:first-child { color: #d9ff83; }

/* Run team selector */
.run-select-screen {
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr) 42px;
  height: calc(100svh - 88px);
  padding: 10px 14px;
  overflow: hidden;
  background: #242435;
}
.run-tabs { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 5px; max-width: 980px; margin: 0 auto; width: 100%; }
.run-tabs button { color: #f1eaf6; background: #3a3042; border: 3px solid #792e39; font-family: 'Press Start 2P', monospace; font-size: 9px; }
.run-tabs button.active { color: #ffd56b; background: #56313a; border-color: #e3483b; }
.run-select-layout { display: grid; grid-template-columns: 270px minmax(460px, 1fr) 250px; gap: 9px; min-height: 0; padding-top: 8px; }
.run-mon-info,
.run-box,
.run-party { min-height: 0; background: #eef0e6; border: 5px solid #aeb1b1; box-shadow: inset 0 0 0 3px #5b6064; }
.run-mon-info { display: grid; grid-template-rows: auto 122px auto auto auto auto 1fr auto; padding: 10px; color: #35343c; overflow: hidden; text-align: center; }
.run-number { justify-self: start; color: #5b6064; font-family: 'Press Start 2P', monospace; font-size: 16px; }
.run-detail-art { display: grid; place-items: center; background: repeating-linear-gradient(0deg, #eef2dd 0 5px, #d9e1cf 6px 9px); }
.run-detail-art .monster-art { width: 120px; height: 120px; border: 0; background: transparent; box-shadow: none; }
.run-type { justify-self: start; margin-top: 8px; font-weight: bold; font-size: 22px; }
.run-mon-info h2 { margin: 4px 0; color: #34323b; font-size: 21px; }
.run-mon-info > p { margin: 0 0 9px; color: #66636b; font-size: 19px; }
.run-stat-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; text-align: left; }
.run-stat-lines span { padding: 8px 9px; background: #d4d8d1; font-size: 19px; }
.run-stat-lines b { float: right; }
.run-stat-lines .stat-wide { grid-column: 1 / -1; }
.run-trait { align-self: stretch; margin-top: 9px; padding: 10px; background: #fff; border: 2px solid #a8acad; text-align: left; }
.run-trait b { display: block; color: #a92e68; font-size: 19px; }
.run-trait span { font-size: 17px; }
.run-add { align-self: end; padding: 10px; color: #0a2027; background: #a9ef76; border: 3px solid #fff; box-shadow: 3px 3px 0 #456334; font-family: 'Press Start 2P', monospace; font-size: 8px; }
.run-add.remove { color: #fff; background: #d14c68; box-shadow-color: #632537; }
.run-box { display: grid; grid-template-rows: 38px minmax(0, 1fr); padding: 9px; overflow: hidden; color: #33343c; background: #babfbe; }
.run-box-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; color: #f5f2f6; background: #48444f; }
.run-grid { display: grid; grid-template-columns: repeat(5, minmax(64px, 1fr)); grid-auto-rows: minmax(88px, 1fr); gap: 4px; min-height: 0; padding: 7px; overflow: hidden; background: repeating-linear-gradient(0deg, #aeb3b2 0 7px, #a3a8a7 8px 10px); }
.run-slot { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; row-gap: 2px; min-height: 88px; padding: 4px 4px 6px; color: #31323a; background: rgba(218, 221, 214, .38); border: 2px solid transparent; }
.run-slot:hover,
.run-slot.focused { background: #e2e7dc; border-color: #e33c38; outline: 3px solid #421f27; outline-offset: -6px; }
.run-slot.picked::after { content: '✓'; position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 20px; height: 20px; color: #172719; background: #a9ef76; border: 2px solid #fff; font-weight: bold; }
.run-slot .monster-art { width: 62px; height: 62px; border: 0; background: transparent; box-shadow: none; }
.run-slot small { align-self: end; max-width: 100%; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.run-slot em { position: absolute; left: 4px; top: 4px; padding: 0 4px; color: #fff; background: rgba(30, 24, 36, .78); font-size: 11px; font-style: normal; }
.run-locked { display: grid; place-items: center; min-height: 88px; color: #727878; background: rgba(82, 89, 90, .2); border: 2px solid rgba(73, 79, 81, .3); }
.run-party { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; padding: 10px; color: #f5eef7; background: #3a3042; border-color: #cf3e38; box-shadow: inset 0 0 0 3px #792e39; }
.run-mode-label { padding: 9px; background: #251e2e; border: 2px solid #6a4059; }
.run-mode-label small { display: block; color: #b9a9bd; }
.run-mode-label b { color: #ffd56b; }
.run-party h3 { margin: 12px 0 8px; font-family: 'Press Start 2P', monospace; font-size: 10px; }
.run-party-slots { display: grid; gap: 6px; align-content: stretch; grid-auto-rows: minmax(58px, 1fr); min-height: 0; }
.run-party-slots > button,
.empty-party { display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; min-height: 58px; height: 100%; width: 100%; padding: 4px; color: #f5eef7; background: #4a3b4d; border: 2px solid #7a596d; text-align: center; font-size: 18px; }
.run-party-slots > button { grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
.run-party-slots .monster-art { height: 100%; max-height: 62px; width: auto; aspect-ratio: 1; min-height: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.run-party-slots small { display: block; color: #d9ff83; font-size: 15px; line-height: 1.1; }
.empty-party { grid-template-rows: 1fr; }
.empty-party { color: #8d7e91; border-style: dashed; }
.run-counter { display: flex; align-items: center; justify-content: space-between; padding: 7px; background: #251e2e; }
.run-counter strong { color: #d9ff83; font-size: 24px; }
.run-counter span { font-size: 14px; }
.run-start { padding: 12px; color: #241d2a; background: #ffd56b; border: 3px solid #fff0bd; box-shadow: 4px 4px 0 #794a22; font-family: 'Press Start 2P', monospace; font-size: 9px; }
.run-start:disabled { filter: grayscale(1); opacity: .45; }
.run-back { margin-top: 7px; color: #cdbed0; background: transparent; border: 0; }
.run-command { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; color: #f2eef4; background: #3a3042; border: 3px solid #a73634; font-size: 15px; }

/* Collection workspace */
.dex-screen { display: grid; grid-template-rows: 54px 40px minmax(0, 1fr) 38px; gap: 7px; height: calc(100svh - 88px); min-height: 0; padding: 10px 14px; overflow: hidden; }
.dex-title { width: 100%; max-width: none; margin: 0; }
.dex-title h1 { font-size: 25px; }
.dex-tabs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.dex-tabs button { color: #b9c4d8; background: #1b253e; border: 2px solid #4d5b79; }
.dex-tabs button.active { color: #091c25; background: #d9ff83; border-color: #f3ffd7; }
.dex-layout { grid-template-columns: 250px minmax(440px, 1fr) 240px; width: 100%; max-width: none; min-height: 0; height: 100%; overflow: hidden; }
.solamon-detail,
.solamon-box,
.squad-pane { min-height: 0; overflow: auto; }
.solamon-detail { display: grid; grid-template-rows: auto 130px auto auto auto 1fr auto; padding: 10px; }
.detail-head { display: flex; justify-content: space-between; }
.detail-art { height: 130px; }
.detail-art .monster-art { width: 120px; height: 120px; }
.solamon-detail h2 { margin: 4px 0; }
.detail-stats { margin: 8px 0; }
.trait-box { min-height: 112px; }
.solamon-grid { grid-template-columns: repeat(7, minmax(62px, 1fr)); align-content: start; gap: 4px; }
.solamon-slot { min-height: 0; aspect-ratio: 1; border-top-color: var(--type); }
.solamon-slot .monster-art { width: 64px; height: 64px; }
.solamon-slot small { right: auto; bottom: 3px; left: 4px; max-width: 66%; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.solamon-slot em { position: absolute; top: 3px; right: 3px; color: #ffd866; font-size: 9px; font-style: normal; }
.locked-slot { display: grid; place-items: center; min-height: 0; aspect-ratio: 1; color: #465570; background: #0d1628; border: 2px solid #293651; }
.empty-squad { display: grid; grid-template-columns: 24px 1fr; align-items: center; min-height: 48px; color: #53617d; border-bottom: 1px dashed #394665; }
.command-bar { width: 100%; max-width: none; margin: 0; }

/* Egg dispenser */
.egg-lab { display: grid; grid-template-rows: 62px minmax(0, 1fr) 54px; gap: 9px; height: calc(100svh - 88px); padding: 10px 18px; overflow: hidden; color: #303038; background: repeating-linear-gradient(0deg, #efffdc 0 8px, #dff3cf 9px 13px); }
.egg-lab-head { display: flex; align-items: center; justify-content: space-between; padding: 0 15px; color: #f4f2f5; background: #3a3042; border: 4px solid #a93732; }
.egg-lab-head h1 { margin: 6px 0 0; font-size: 22px; }
.egg-stock { display: flex; gap: 8px; }
.egg-stock span { min-width: 115px; padding: 8px 12px; background: #251f2d; border: 2px solid #754655; text-align: center; }
.egg-stock b { color: #ffd866; }
.egg-lab-layout { display: grid; grid-template-columns: minmax(520px, 1fr) 330px; gap: 16px; min-height: 0; }
.machine-bay { position: relative; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(180px, .55fr); place-items: end center; min-height: 0; overflow: hidden; }
.egg-machine { align-self: stretch; display: grid; place-items: center; width: min(440px, 88%); filter: drop-shadow(8px 8px 0 rgba(49, 54, 53, .35)); }
.egg-machine img { width: 100%; max-height: 100%; object-fit: contain; image-rendering: pixelated; }
.egg-machine.dispensing img { animation: machine-pump .7s steps(5); }
.hatch-platform { position: relative; align-self: end; display: grid; place-items: center; width: 100%; height: 70%; min-height: 220px; border-bottom: 8px solid #9ca3a0; }
.hatch-platform::before { content: ''; position: absolute; bottom: 0; width: 80%; height: 34px; background: #707d7b; border: 6px solid #b9c0bd; }
.hatch-egg { position: relative; z-index: 1; display: none; width: 135px; height: 135px; filter: drop-shadow(8px 8px 0 rgba(54, 67, 66, .25)); }
.hatch-egg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; opacity: 0; animation: egg-idle .8s steps(1) infinite; }
.hatch-egg img:first-child { opacity: 1; }
.hatch-egg img:nth-child(2) { animation-delay: -.6s; }
.hatch-egg img:nth-child(3) { animation-delay: -.4s; }
.hatch-egg img:nth-child(4) { animation-delay: -.2s; }
.dispensing .hatch-egg { display: block; animation: egg-drop .8s steps(8) both; }
.hatching .hatch-egg { display: block; animation: egg-crack .32s steps(4) infinite; }
.hatch-reveal { position: relative; z-index: 1; text-align: center; animation: reveal-mon .65s steps(7) both; }
.hatch-reveal .monster-art { width: 150px; height: 150px; margin: auto; border: 0; background: transparent; box-shadow: none; }
.hatch-reveal h2 { margin: 18px 0 4px; color: #31333a; font-size: 20px; }
.hatch-reveal p { margin: 0; color: #655f6b; }
.dispenser-menu { align-self: center; padding: 18px; color: #f5eef6; background: #3a3042; border: 5px solid #b23a33; box-shadow: 7px 7px 0 #55201f, inset 0 0 0 3px #702b30; }
.dispenser-option { display: grid; grid-template-columns: 38px 1fr auto; grid-template-rows: 1fr 1fr; width: 100%; margin: 14px 0; padding: 12px; color: #fff; background: #4a3a4d; border: 3px solid #f14a3d; text-align: left; }
.dispenser-option > span { grid-row: 1/3; color: #d9ff83; font-size: 27px; }
.dispenser-option small { color: #beaabd; }
.dispenser-option em { grid-row: 1/3; align-self: center; color: #ffd866; font-style: normal; }
.egg-odds { display: grid; gap: 4px; margin: 15px 0; }
.egg-odds span { display: flex; justify-content: space-between; padding: 5px 8px; background: #292231; color: #c7b9ca; }
.egg-odds b { color: #7cebd6; }
.dispense-button { width: 100%; padding: 13px; color: #20252a; background: #d9ff83; border: 4px solid #fff9ca; box-shadow: 5px 5px 0 #586b37; font-family: 'Press Start 2P', monospace; font-size: 9px; }
.dispense-button:disabled { filter: grayscale(1); }
.dispenser-menu > small { display: block; margin-top: 12px; color: #bdaebe; text-align: center; }
.egg-dialog { display: flex; align-items: center; gap: 12px; padding: 0 18px; color: #fff; background: #3a3042; border: 4px solid #b23a33; }
.egg-dialog > span { color: #d9ff83; }
.egg-dialog p { margin: 0; font-size: 20px; }

/* Ranked console */
.ranked-v2 { display: grid; grid-template-rows: 64px minmax(0, 1fr); gap: 10px; height: calc(100svh - 88px); min-height: 0; padding: 12px 18px; overflow: hidden; }
.ranked-titlebar { position: relative; display: flex; align-items: center; justify-content: space-between; max-width: 1400px; width: 100%; margin: auto; }
.ranked-titlebar h1 { margin: 7px 0 0; font-size: 26px; }
.season-clock { padding: 8px 16px; background: #131d35; border: 2px solid #4d5978; }
.season-clock small { display: block; color: #9aa8c1; }
.season-clock b { color: #ffd866; }
.ranked-console { position: relative; display: grid; grid-template-columns: 260px minmax(500px, 1fr) 240px; gap: 10px; min-height: 0; max-width: 1400px; width: 100%; margin: auto; }
.player-rank-card,
.rank-rules { min-height: 0; padding: 16px; background: #111a31; border: 3px solid #4c5879; }
.player-rank-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.compact-emblem { position: relative; width: 190px; height: 190px; }
.compact-emblem img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.compact-emblem b { position: absolute; top: 76%; left: 50%; width: 62%; color: #d9ff83; font-family: 'Press Start 2P', monospace; font-size: 8px; text-align: center; text-shadow: 2px 2px #06101f; transform: translate(-50%, -50%); }
.player-rank-card > strong { margin-top: 12px; color: #ffd866; font-size: 24px; }
.player-rank-card > small { color: #98a7c0; }
.player-rank-card > em { margin-top: 8px; padding: 4px 8px; background: #070e1d; font-style: normal; }
.rank-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin: 14px 0; }
.rank-mini-stats span { padding: 7px 2px; color: #91a0ba; border: 1px solid #34425f; }
.rank-mini-stats b { display: block; color: #fff; }
.ranked-queue { width: 100%; padding: 13px; color: #251022; background: #ff6bb6; border: 3px solid #ffd6ea; box-shadow: 4px 4px 0 #64254d; font-family: 'Press Start 2P', monospace; font-size: 9px; }
.player-rank-card > p { color: #76f4dc; font-size: 14px; }
.ranked-console .leaderboard { min-height: 0; overflow: hidden; }
.ranked-console .leaderboard-head { position: sticky; top: 0; z-index: 2; background: #111a31; }
.ranked-console .rank-row { min-height: 48px; }
.rank-rules h3 { margin: 5px 0 12px; font-family: 'Press Start 2P', monospace; font-size: 10px; }
.rank-rules > div:not(.reward-track):not(.season-rewards) { display: flex; justify-content: space-between; padding: 9px; background: #1b2742; border-bottom: 1px solid #43506d; }
.rank-rules .gain { color: #a8ef74; }
.rank-rules .loss { color: #ff7f96; }
.rank-rules hr { margin: 18px 0; border: 0; border-top: 2px solid #465270; }
.rank-rules p { color: #aab6cd; font-size: 16px; }
.reward-track { height: 12px; background: #080f1f; border: 2px solid #43506d; }
.reward-track span { display: block; height: 100%; background: #d9ff83; }
.rank-rules > small { color: #ffd866; }
.rank-rules > button { width: 100%; margin-top: 22px; padding: 9px; color: #b7c3d9; background: transparent; border: 2px solid #465270; }

/* One generated frame, reused across the whole game UI. */
.mode-poster,
.run-mon-info, .run-box, .run-party,
.solamon-detail, .solamon-box, .squad-pane,
.egg-lab-head, .dispenser-menu, .egg-dialog,
.player-rank-card, .leaderboard, .rank-rules,
.settings-panel, .battle-top, .team-panel, .battle-controls {
  border: 12px solid transparent;
  border-image: url('assets/solamon-ui-frame.webp') 185 / 12px stretch;
  background-clip: padding-box;
}
.mode-poster:hover,
.mode-poster:focus-visible { filter: brightness(1.12); }

/* Combat arena */
.arena-wrap {
  max-width: none;
  min-height: calc(100svh - 88px);
  background: linear-gradient(rgba(3, 9, 22, .2), rgba(3, 9, 22, .5)), url('assets/solamon-battle-arena.webp') center / cover no-repeat;
}
.arena-wrap .battle-top,
.arena-wrap .team-panel,
.arena-wrap .battle-controls { background: rgba(7, 14, 29, .92); }
.arena-wrap:has(.cell.active-unit .side0) .battle-top,
.arena-wrap:has(.cell.active-unit .side0) .battle-controls { box-shadow: inset 5px 0 #62ecff, inset -5px 0 rgba(98,236,255,.28); }
.arena-wrap:has(.cell.active-unit .side1) .battle-top,
.arena-wrap:has(.cell.active-unit .side1) .battle-controls { box-shadow: inset 5px 0 rgba(255,102,184,.28), inset -5px 0 #ff66b8; }
.player-team .unit-row.turn-unit { background: linear-gradient(90deg, rgba(76,224,240,.42), rgba(12,24,45,.92) 62%); box-shadow: inset 5px 0 #62ecff; }
.enemy .unit-row.turn-unit { background: linear-gradient(270deg, rgba(255,102,184,.42), rgba(12,24,45,.92) 62%); box-shadow: inset -5px 0 #ff66b8; }
.battle-controls > div:not(.action-buttons):not(.attack-preview) { display: flex; align-items: center; gap: 12px; }
.battle-top-actions { display: flex; gap: 7px; }
.tutorial-trigger { color: #d9ff83; }
.board {
  isolation: isolate;
  border: 10px solid transparent;
  border-image: url('assets/solamon-ui-frame.webp') 185 / 10px stretch;
  background: rgba(4, 12, 25, .78);
  box-shadow: 0 0 0 3px rgba(89, 231, 220, .3), 8px 8px 0 #020611;
}
.cell { background: rgba(34, 58, 82, .86); border-color: rgba(102, 143, 171, .7); }
.cell.dark { background: rgba(22, 43, 67, .9); }
.cell.active-unit { animation: none; }
.arena-wrap.animating .action-buttons { pointer-events: none; }
.unit-row.deployed { background: rgba(88, 231, 213, .14); outline: 1px solid rgba(88, 231, 213, .48); opacity: 1; }
.unit-row.deployed small:last-of-type { color: #7cf4de; }
.unit-row.benched { opacity: .42; }
.cell.motion-origin { z-index: 30; overflow: visible; }
.board-unit.moving { z-index: 12; animation: battle-move .75s steps(6) both; }
.board-unit.attacking { z-index: 13; }
.board-unit.side0 .monster-art img { transform: scale(-1.18, 1.18); }
.board-unit .monster-art,
.board-unit .monster-art:has(img) {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.board-unit .monster-art > span { color: var(--c); filter: drop-shadow(1px 1px 0 #06101b); }
@keyframes battle-move {
  0% { transform: translate(0, 0) scale(1); }
  45% { transform: translate(calc(var(--move-x) * .48), calc(var(--move-y) * .48 - 8px)) scale(1.08); }
  100% { transform: translate(var(--move-x), var(--move-y)) scale(1); }
}

/* Tutorial */
.mode-help { text-align: right; }
.mode-help p { margin: 0 0 10px; color: #aebbd1; }
.mode-help button {
  padding: 9px 12px;
  color: #d9ff83;
  background: #101a30;
  border: 2px solid #6f809f;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}
.tutorial-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(1, 5, 15, .9);
}
.tutorial-panel {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: center;
  width: min(920px, 96vw);
  min-height: 480px;
  padding: 28px;
  color: #eef8ff;
  background: #0c1629;
  border: 16px solid transparent;
  border-image: url('assets/solamon-ui-frame.webp') 185 / 16px stretch;
  animation: panel-pop .22s steps(4) both;
}
.tutorial-panel > img { width: 100%; max-height: 390px; object-fit: contain; image-rendering: pixelated; }
.tutorial-close { position: absolute; z-index: 2; top: 13px; right: 15px; color: #ff83c4; background: transparent; border: 0; font-size: 30px; }
.tutorial-copy { padding: 30px; }
.tutorial-copy h2 { margin: 18px 0; color: #fff; font-size: 22px; line-height: 1.45; }
.tutorial-copy > p:not(.window-kicker) { min-height: 78px; color: #b9c7dd; font-size: 23px; line-height: 1.15; }
.tutorial-copy > strong { display: block; min-height: 48px; color: #ffd866; font-size: 18px; }
.tutorial-progress { display: flex; gap: 8px; margin: 22px 0; }
.tutorial-progress span { width: 34px; height: 7px; background: #34435f; }
.tutorial-progress span.active { background: #76f4dc; box-shadow: 0 0 8px #76f4dc; }
.tutorial-actions { display: flex; justify-content: space-between; gap: 12px; }
.tutorial-actions button { padding: 12px; background: #1a2944; border: 2px solid #647494; font-family: 'Press Start 2P', monospace; font-size: 8px; }
.tutorial-actions button:disabled { opacity: .3; }
.tutorial-actions .primary { margin-left: auto; color: #071622; background: #d9ff83; border-color: #f5ffda; }

@keyframes machine-pump { 40% { transform: translateY(5px) rotate(-1deg); } 70% { transform: translateY(-2px) rotate(1deg); } }
@keyframes egg-idle { 0%, 24.99% { opacity: 1; } 25%, 100% { opacity: 0; } }
@keyframes egg-drop { from { transform: translate(-230px, -180px) rotate(-180deg); opacity: 0; } to { transform: translate(0, 0) rotate(0); opacity: 1; } }
@keyframes egg-crack { 25% { transform: translateX(-7px) rotate(-4deg); } 75% { transform: translateX(7px) rotate(4deg); } }
@keyframes reveal-mon { from { opacity: 0; transform: scale(.25); filter: brightness(4); } to { opacity: 1; transform: scale(1); filter: brightness(1); } }

@media (min-width: 821px) and (max-height: 800px) {
  .arena-wrap { padding: 8px 16px; }
  .battle-top { padding: 5px 10px; }
  .battle-top .eyebrow { margin: 0; }
  .arena-layout { grid-template-columns: 230px 380px 230px; gap: 10px; }
  .board { width: 380px; }
  .team-panel h3 { padding-block: 3px; }
  .unit-row { padding-block: 2px; }
  .unit-row .monster-art { width: 30px; height: 30px; }
  .unit-row b { font-size: 16px; }
  .unit-row small { font-size: 11px; }
  .battle-controls { margin-top: 8px; padding: 8px; }
  .battle-controls > div:not(.attack-preview) { display: flex; align-items: center; gap: 12px; }
}

@media (max-width: 1050px) {
  .game-header { grid-template-columns: 150px 1fr auto; gap: 10px; padding-inline: 14px; }
  .header-brand small { display: none; }
  .run-select-layout { grid-template-columns: 230px minmax(380px, 1fr) 220px; }
  .run-grid { grid-template-columns: repeat(4, 1fr); }
  .dex-layout { grid-template-columns: 220px minmax(380px, 1fr) 210px; }
  .ranked-console { grid-template-columns: 230px minmax(420px, 1fr); }
  .rank-rules { display: none; }
}

@media (max-width: 760px) {
  body { padding-bottom: 68px; }
  .game-header { height: 66px; grid-template-columns: 1fr auto; padding-inline: 12px; }
  .game-header .main-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; height: 66px; padding: 5px; background: #080e1d; border-top: 3px solid #43516f; }
  .game-header .main-nav button { display: flex; flex-direction: column; justify-content: center; padding: 4px; text-align: center; }
  .game-header .main-nav button > span { font-size: 16px; }
  .game-header .main-nav button > b { font-size: 7px; }
  .game-header .main-nav button > small { display: none; }
  .game-header .wallet { font-size: 15px; }
  .audio-toggle { padding: 4px; font-size: 11px; }
  .mode-hub,
  .run-select-screen,
  .dex-screen,
  .egg-lab,
  .ranked-v2 { height: calc(100svh - 66px - 68px); overflow: hidden; }
  .mode-hub { display: block; }
  .mode-hub-head > p,
  .hub-status { display: none; }
  .mode-help p { display: none; }
  .mode-showcase { grid-template-columns: 1fr; margin-top: 14px; }
  .mode-poster { min-height: 260px; }
  .run-select-screen { display: block; }
  .run-tabs { height: 42px; overflow-x: auto; }
  .run-select-layout { display: flex; flex-direction: column; }
  .run-box { order: -1; min-height: 360px; }
  .run-mon-info,
  .run-party { min-height: 480px; }
  .run-command { display: none; }
  .dex-screen { display: block; }
  .dex-tabs { margin: 9px 0; overflow-x: auto; }
  .dex-layout { display: flex; flex-direction: column; }
  .solamon-box { order: -1; min-height: 360px; }
  .solamon-grid { grid-template-columns: repeat(4, 1fr); }
  .solamon-slot .monster-art { width: 58px; height: 58px; }
  .squad-pane { min-height: 460px; }
  .solamon-detail { display: flex; flex-direction: column; height: clamp(540px, 84vh, 760px); min-height: 0; overflow: hidden; }
  .solamon-detail .detail-profile { display: contents; }
  .solamon-detail .detail-art { flex: 1 1 auto; height: auto; min-height: 120px; }
  .solamon-detail .trait-box { min-height: 112px; }
  .egg-lab { display: block; }
  .egg-lab-head { margin-bottom: 10px; padding-inline: 7px; }
  .egg-lab-head h1 { font-size: 17px; }
  .egg-stock span { min-width: 92px; padding: 6px; }
  .egg-stock span:last-child { display: none; }
  .egg-lab-layout { grid-template-columns: 1fr; }
  .machine-bay { min-height: 520px; }
  .dispenser-menu { margin-top: 12px; }
  .egg-dialog { min-height: 54px; margin-top: 10px; }
  .ranked-v2 { display: block; }
  .ranked-console { grid-template-columns: 1fr; }
  .player-rank-card { min-height: 430px; }
  .ranked-console .leaderboard { min-height: 480px; }
  .tutorial-panel { grid-template-columns: 1fr; max-height: 92svh; min-height: 0; padding: 16px; overflow: hidden; }
  .tutorial-panel > img { width: 150px; max-height: 170px; margin: auto; }
  .tutorial-copy { padding: 8px; }
  .tutorial-copy h2 { font-size: 14px; }
  .tutorial-copy > p:not(.window-kicker) { min-height: 0; font-size: 19px; }
}

/* Economy, rarity, and unified battle-choice pass. */
.level-pips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin: 3px 0 6px; }
.level-pips i { height: 6px; background: #28334b; border: 1px solid #53617a; }
.level-pips i.filled { background: #d9ff83; border-color: #f4ffd5; box-shadow: 0 0 7px rgba(217,255,131,.55); }
.upgrade-button { width: 100%; padding: 8px; color: #1b2430; background: #ffd866; border: 3px solid #fff0ad; box-shadow: 3px 3px 0 #765224; font-family: 'Press Start 2P', monospace; font-size: 7px; }
.upgrade-button:disabled { color: #768198; background: #283248; border-color: #46536c; box-shadow: none; }
.rarity-label { color: #d9ff83; }
.rarity-rare .rarity-label, .solamon-slot.rarity-rare em { color: #74d9ff; }
.rarity-epic .rarity-label, .solamon-slot.rarity-epic em { color: #df8dff; }
.rarity-legendary .rarity-label, .solamon-slot.rarity-legendary em { color: #ffd866; text-shadow: 0 0 7px rgba(255,216,102,.75); }
.solamon-detail { grid-template-rows: auto 118px auto auto auto auto 1fr auto auto; }
.detail-art { height: 118px; }
.detail-art .monster-art { width: 110px; height: 110px; }

.egg-shop-layout { grid-template-columns: minmax(460px, 1fr) minmax(410px, 500px); }
.egg-catalog { align-self: stretch; display: grid; grid-template-rows: auto minmax(0,1fr) auto auto auto; gap: 6px; padding: 12px; overflow: hidden; }
.egg-options { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; min-height: 0; overflow: auto; }
.egg-option { display: grid; grid-template-columns: 50px 1fr; grid-template-rows: 1fr auto; gap: 1px 5px; min-height: 70px; padding: 4px; color: #eeeaf1; background: #2b2433; border: 2px solid #685169; text-align: left; }
.egg-option:hover, .egg-option.active { color: #fff; background: #4a3551; border-color: #d9ff83; box-shadow: inset 0 0 0 1px #d9ff83; }
.egg-option-art { position: relative; grid-row: 1/3; width: 48px; height: 48px; align-self: center; }
.egg-option-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; opacity: 0; animation: egg-idle .8s steps(1) infinite; }
.egg-option-art img:first-child { opacity: 1; }
.egg-option-art img:nth-child(2) { animation-delay: -.6s; }
.egg-option-art img:nth-child(3) { animation-delay: -.4s; }
.egg-option-art img:nth-child(4) { animation-delay: -.2s; }
.egg-option b { display: block; font-family: 'Press Start 2P', monospace; font-size: 7px; line-height: 1.4; }
.egg-option small { display: block; color: #bbaebe; font-size: 12px; line-height: 1; }
.egg-option em { grid-column: 2; color: #ffd866; font-size: 13px; font-style: normal; }
.selected-egg { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #251e2e; }
.selected-egg b { color: #d9ff83; }
.selected-egg span { flex: 1; color: #bdaebe; }
.selected-egg em { color: #ffd866; font-style: normal; }
.duplicate-reward, .hatch-reveal .duplicate-reward { display: block; margin-top: 5px; color: #9c6b10; }

.cell.choice-move { cursor: crosshair; box-shadow: inset 0 0 0 3px rgba(89,231,220,.95); }
.cell.choice-attack { cursor: crosshair; box-shadow: inset 0 0 0 4px rgba(255,107,182,.98), 0 0 12px rgba(255,107,182,.55); }
.move-key, .attack-key { padding: 2px 5px; font-style: normal; }
.move-key { color: #7cf4de; background: rgba(89,231,220,.12); }
.attack-key { color: #ff8bc6; background: rgba(255,107,182,.12); }
.pass-button { min-width: 118px; color: #d8e1ee; }

@media (min-width: 761px) {
  .arena-wrap .arena-layout { grid-template-columns: clamp(230px, 20vw, 340px) minmax(320px, 1fr) clamp(230px, 20vw, 340px); max-width: 1180px; width: 100%; margin: auto; gap: clamp(6px, 1vw, 14px); }
  .arena-wrap .team-panel { grid-template-rows: auto repeat(3, minmax(0, 1fr)); }
  .arena-wrap .unit-row { padding-inline: 4px; }
  .arena-wrap .unit-row .monster-art { width: clamp(34px, 5vh, 50px); height: clamp(34px, 5vh, 50px); }
  .arena-wrap .board { max-width: min(100%, 680px); }
}

@media (max-width: 1050px) {
  .egg-shop-layout { grid-template-columns: minmax(380px, 1fr) 390px; }
  .egg-option { grid-template-columns: 42px 1fr; min-height: 60px; }
  .egg-option-art { width: 40px; height: 40px; }
}

@media (max-width: 760px) {
  .egg-shop-layout { grid-template-rows: minmax(0, 42%) minmax(0, 58%); }
  .egg-options { grid-template-columns: repeat(4, 1fr); }
  .egg-option { display: block; min-height: 54px; text-align: center; }
  .egg-option-art { display: block; width: 32px; height: 32px; margin: auto; }
  .egg-option small { display: none; }
  .egg-option em { display: block; font-size: 9px; }
  .selected-egg { font-size: 10px; }
  .arena-wrap .team-panel { grid-template-rows: auto repeat(3, minmax(0,1fr)); }
  .move-key, .attack-key { display: inline-block; }
}

/* Fixed-screen game shell: every view stays inside the viewport. */
html,
body { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
body { padding: 0; }
#app { display: flex; flex-direction: column; width: 100%; height: 100dvh; overflow: hidden; }
#app > main { flex: 1; min-height: 0; overflow: hidden; }
.title-screen { width: 100%; height: 100%; min-height: 0; }
.game-header { flex: 0 0 88px; }
.run-grid,
.solamon-detail,
.solamon-box,
.squad-pane,
.ranked-console .leaderboard { overflow: hidden; }

@media (min-width: 761px) and (max-height: 800px) {
  .arena-wrap { display: grid; height: calc(100dvh - 88px); min-height: 0; gap: 6px; overflow: hidden; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: auto minmax(0, 1fr) auto; }
  .arena-wrap:has(.timeline) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .arena-wrap .timeline { height: 48px; margin: 0; padding: 5px; overflow: hidden; }
  .arena-wrap .arena-layout { height: 100%; min-height: 0; align-items: stretch; }
  .arena-wrap .board { width: auto; height: 100%; max-height: 100%; justify-self: center; }
  .arena-wrap .team-panel { min-height: 0; overflow: hidden; }
  .arena-wrap .battle-controls { margin: 0; }
  .run-party { padding: 6px; }
  .run-mode-label { padding: 5px 7px; }
  .run-party h3 { margin: 5px 0; }
  .run-party-slots { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(45px, 1fr); gap: 3px; }
  .run-party-slots > button,
  .empty-party { min-height: 45px; padding: 2px; font-size: 16px; }
  .run-party-slots small { font-size: 13px; }
  .run-counter { padding: 4px 7px; }
  .run-counter strong { font-size: 20px; }
  .run-start { padding: 8px; }
  .run-back { margin-top: 2px; font-size: 16px; }
}

@media (min-width: 761px) and (max-height: 650px) {
  .dex-screen { grid-template-rows: 42px 32px minmax(0, 1fr) 30px; gap: 4px; padding: 6px 10px; }
  .dex-title h1 { margin-top: 2px; font-size: 18px; }
  .dex-tabs button { padding: 0; }
  .solamon-detail { grid-template-rows: auto 80px auto auto auto 1fr auto; padding: 6px; }
  .detail-art { height: 80px; }
  .detail-art .monster-art { width: 78px; height: 78px; }
  .solamon-detail h2 { margin: 1px 0; font-size: 12px; }
  .solamon-detail > p { margin: 1px 0; font-size: 13px; }
  .detail-stats { gap: 2px; margin: 3px 0; font-size: 12px; }
  .detail-stats span { padding: 2px 4px; }
  .trait-box { min-height: 0; padding: 4px; }
  .trait-box span { font-size: 12px; }
  .squad-toggle { margin-top: 3px; padding: 7px 3px; font-size: 6px; box-shadow: none; }
  .squad-pane { padding: 6px; }
  .squad-pane h3 { margin: 1px 0; font-size: 9px; }
  .squad-pane > p { margin-bottom: 2px; font-size: 12px; }
  .squad-pane > button { grid-template-columns: 16px 32px 1fr; padding: 1px; font-size: 12px; }
  .squad-pane .monster-art { width: 29px; height: 29px; }
  .squad-pane small { font-size: 10px; }
  .squad-points { margin-top: 3px; padding: 5px; font-size: 12px; }
  .command-bar { padding-block: 3px; }
  .arena-wrap .team-panel h3 { padding: 1px 3px; font-size: 8px; }
  .arena-wrap .unit-row { min-height: 0; padding: 0 2px; }
  .arena-wrap .unit-row .monster-art { width: 22px; height: 22px; }
  .arena-wrap .unit-row b { font-size: 13px; line-height: 1; }
  .arena-wrap .unit-row small { font-size: 9px; line-height: 1; }
  .arena-wrap .unit-row small:nth-of-type(2) { display: none; }
}

@media (max-width: 760px) {
  :root { --mobile-header: 58px; --mobile-nav: 58px; }
  .game-header { flex-basis: var(--mobile-header); height: var(--mobile-header); padding-inline: 9px; }
  .game-header { grid-template-columns: minmax(120px, 1fr) auto; }
  .header-brand { width: 120px; min-width: 120px; overflow: visible; }
  .game-header .brand { font-size: 15px; }
  .game-header .main-nav { height: var(--mobile-nav); }
  .game-header .wallet { gap: 6px; font-size: 13px; }
  .audio-toggle { font-size: 9px; }
  #app > main { padding-bottom: var(--mobile-nav); }
  .mode-hub,
  .run-select-screen,
  .dex-screen,
  .egg-lab,
  .ranked-v2,
  .arena-wrap { width: 100%; height: 100%; min-height: 0; overflow: hidden; }

  .mode-hub { display: grid; grid-template-rows: 58px minmax(0, 1fr); gap: 6px; padding: 7px; }
  .mode-hub-head { align-items: center; }
  .mode-hub-head h1 { margin-top: 3px; font-size: 20px; }
  .mode-showcase { grid-template-columns: 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; min-height: 0; margin: 0; }
  .mode-poster { grid-template-columns: 34% 1fr; min-height: 0; border-width: 8px; }
  .mode-poster > div:last-child { padding: 8px; }
  .mode-poster p { margin-bottom: 3px; font-size: 12px; }
  .mode-poster h2 { margin-bottom: 5px; font-size: 15px; }
  .mode-poster small { font-size: 13px; }
  .mode-poster > div:last-child > b { padding-top: 5px; font-size: 7px; }
  .poster-world img { width: 72px; }
  .poster-world img + img { width: 58px; margin-left: -22px; }
  .pvp-poster .poster-world img { width: 72px; }
  .poster-rank { font-size: 74px; }
  .poster-index { top: 5px; left: 5px; padding: 3px; font-size: 13px; }

  .run-select-screen { display: grid; grid-template-rows: 32px minmax(0, 1fr); padding: 4px; }
  .run-tabs { grid-template-columns: repeat(5, 1fr); height: 32px; overflow: hidden; }
  .run-tabs button { padding: 0; font-size: 6px; }
  .run-select-layout { display: grid; grid-template: minmax(0, 44%) minmax(0, 56%) / 1fr 1fr; gap: 4px; min-height: 0; padding-top: 4px; }
  .run-box { grid-area: 1 / 1 / 2 / 3; min-height: 0; padding: 4px; }
  .run-box-head { padding-inline: 4px; font-size: 14px; }
  .run-grid { grid-template-columns: repeat(5, 1fr); grid-auto-rows: minmax(0, 1fr); gap: 2px; padding: 3px; overflow: hidden; }
  .run-slot,
  .run-locked { min-height: 0; }
  .run-slot .monster-art { width: 38px; height: 38px; }
  .run-slot small { font-size: 9px; }
  .run-slot em { font-size: 7px; }
  .run-mon-info { grid-area: 2 / 1; min-height: 0; grid-template-rows: auto 66px auto auto auto auto 1fr auto; padding: 4px; border-width: 8px; }
  .run-number { font-size: 14px; }
  .run-detail-art .monster-art { width: 65px; height: 65px; }
  .run-mon-info h2 { margin: 2px 0; font-size: 10px; }
  .run-mon-info > p,
  .run-type { margin: 1px; font-size: 12px; }
  .run-stat-lines { gap: 2px; margin: 3px 0; font-size: 11px; }
  .run-stat-lines span { padding: 2px; }
  .run-trait { min-height: 0; padding: 3px; font-size: 11px; }
  .run-trait span { font-size: 10px; }
  .run-add { padding: 6px 2px; font-size: 6px; }
  .run-party { grid-area: 2 / 2; min-height: 0; padding: 4px; border-width: 8px; }
  .run-mode-label { padding: 4px; font-size: 11px; }
  .run-party h3 { margin: 4px 0; font-size: 7px; }
  .run-party-slots { grid-template-columns: 1fr 1fr; gap: 2px; }
  .run-party-slots > button,
  .empty-party { min-height: 39px; padding: 1px; font-size: 11px; }
  .run-party-slots .monster-art { max-width: 27px; }
  .run-party-slots small { font-size: 9px; }
  .run-counter { padding: 3px; }
  .run-counter strong { font-size: 16px; }
  .run-counter span { font-size: 9px; }
  .run-start { padding: 6px 2px; font-size: 6px; box-shadow: none; }
  .run-back { margin-top: 1px; font-size: 11px; }

  .dex-screen { display: grid; grid-template-rows: 34px 28px minmax(0, 1fr) 28px; gap: 3px; padding: 4px; }
  .dex-title h1 { margin-top: 2px; font-size: 15px; }
  .dex-title > span { font-size: 12px; }
  .dex-title .window-kicker { font-size: 7px; }
  .dex-tabs { grid-template-columns: repeat(6, 1fr); gap: 2px; margin: 0; overflow: hidden; }
  .dex-tabs button { padding: 0; font-size: 8px; }
  .dex-layout { display: grid; grid-template: minmax(0, 43%) minmax(0, 57%) / 44% 56%; gap: 3px; min-height: 0; height: 100%; margin: 0; }
  .solamon-box { grid-area: 1 / 1 / 2 / 3; min-height: 0; padding: 4px; border-width: 8px; }
  .box-label { padding: 1px 2px 3px; font-size: 12px; }
  .solamon-grid { grid-template-columns: repeat(4, 1fr); gap: 2px; }
  .solamon-slot .monster-art { width: 43px; height: 43px; }
  .solamon-slot small { font-size: 8px; }
  .locked-slot { display: none; }
  .solamon-detail { grid-area: 2 / 1; min-height: 0; grid-template-rows: auto 70px auto auto auto 1fr auto; padding: 4px; border-width: 8px; }
  .detail-art { height: 70px; }
  .detail-art .monster-art { width: 68px; height: 68px; }
  .solamon-detail h2 { font-size: 10px; }
  .solamon-detail > p { margin: 1px; font-size: 11px; }
  .detail-stats { gap: 2px; margin: 3px 0; font-size: 11px; }
  .detail-stats span { padding: 2px; }
  .trait-box { min-height: 0; padding: 3px; font-size: 10px; }
  .trait-box span { font-size: 10px; }
  .squad-toggle { margin-top: 3px; padding: 5px 1px; font-size: 5px; box-shadow: none; }
  .squad-pane { grid-area: 2 / 2; display: block; min-height: 0; padding: 4px; border-width: 8px; }
  .squad-pane h3 { font-size: 8px; }
  .squad-pane > p { margin-bottom: 2px; font-size: 11px; }
  .squad-pane > button { grid-template-columns: 12px 29px 1fr; min-height: 0; padding: 1px; font-size: 11px; }
  .squad-pane .monster-art { width: 27px; height: 27px; }
  .squad-pane small { font-size: 8px; }
  .squad-points { margin-top: 2px; padding: 4px; font-size: 11px; }
  .command-bar { min-height: 0; padding: 2px 6px; font-size: 10px; }

  .egg-lab { display: grid; grid-template-rows: 42px minmax(0, 1fr) 36px; gap: 4px; padding: 4px; }
  .egg-lab-head { margin: 0; padding-inline: 4px; border-width: 8px; }
  .egg-lab-head h1 { margin-top: 2px; font-size: 11px; }
  .egg-lab-head .window-kicker { font-size: 6px; }
  .egg-stock span { min-width: 76px; padding: 3px; font-size: 11px; }
  .egg-lab-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 52%) minmax(0, 48%); gap: 4px; min-height: 0; }
  .machine-bay { grid-template-columns: 58% 42%; min-height: 0; }
  .egg-machine { width: 94%; }
  .hatch-platform { height: 65%; min-height: 0; }
  .hatch-platform::before { height: 18px; border-width: 3px; }
  .hatch-egg { width: 58px; height: 75px; border-width: 3px; }
  .hatch-reveal .monster-art { width: 80px; height: 80px; }
  .hatch-reveal h2 { font-size: 12px; }
  .hatch-reveal p { font-size: 11px; }
  .dispenser-menu { align-self: stretch; margin: 0; padding: 5px; border-width: 8px; }
  .dispenser-menu .window-kicker { font-size: 7px; }
  .dispenser-option { grid-template-columns: 25px 1fr auto; margin: 3px 0; padding: 4px; font-size: 11px; }
  .dispenser-option > span { font-size: 18px; }
  .egg-odds { gap: 1px; margin: 3px 0; font-size: 11px; }
  .egg-odds span { padding: 1px 4px; }
  .dispense-button { padding: 6px; font-size: 6px; box-shadow: none; }
  .dispenser-menu > small { margin-top: 3px; font-size: 10px; }
  .egg-dialog { min-height: 0; margin: 0; padding: 0 7px; border-width: 8px; }
  .egg-dialog p { font-size: 13px; }

  .ranked-v2 { display: grid; grid-template-rows: 44px minmax(0, 1fr); gap: 4px; padding: 4px; }
  .ranked-titlebar h1 { margin-top: 2px; font-size: 15px; }
  .ranked-titlebar .window-kicker { font-size: 7px; }
  .season-clock { padding: 3px 6px; font-size: 11px; }
  .ranked-console { display: grid; grid-template-columns: 1fr; grid-template-rows: 43% 57%; gap: 3px; min-height: 0; height: 100%; margin: 0; }
  .player-rank-card { min-height: 0; padding: 4px; border-width: 8px; }
  .compact-emblem { flex: 0 0 78px; width: 78px; height: 78px; }
  .player-rank-card > strong { margin-top: 1px; font-size: 15px; }
  .player-rank-card > small,
  .player-rank-card > em,
  .player-rank-card > p { font-size: 10px; }
  .rank-mini-stats { margin: 3px 0; font-size: 10px; }
  .rank-mini-stats span { padding: 2px; }
  .ranked-queue { padding: 6px; font-size: 6px; box-shadow: none; }
  .ranked-console .leaderboard { min-height: 0; border-width: 8px; overflow: hidden; }
  .leaderboard-head { padding: 5px; }
  .leaderboard-head h2 { font-size: 9px; }
  .ranked-console .rank-row { grid-template-columns: 28px 1fr 60px; min-height: 0; height: calc((100% - 34px) / 8); padding: 1px 5px; font-size: 11px; }
  .rank-row strong { font-size: 10px; }

  .arena-wrap { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 3px; padding: 4px; }
  .battle-top { min-height: 0; padding: 3px; border-width: 8px; }
  .battle-top .eyebrow { margin: 0; font-size: 10px; }
  .battle-top h2 { margin: 1px 0; font-size: 10px; }
  .battle-top span { display: none; }
  .battle-top-actions button { padding: 4px; font-size: 9px; }
  .timeline { display: none; }
  .arena-layout { display: grid; grid-template-columns: 66px minmax(0, 1fr) 66px; gap: 3px; min-height: 0; align-items: center; }
  .team-panel { display: block; min-height: 0; height: min-content; padding: 2px; border-width: 7px; }
  .team-panel h3 { padding: 2px; font-size: 6px; text-align: center; }
  .unit-row { justify-content: center; min-height: 0; padding: 1px; border: 0; }
  .unit-row .monster-art { width: 28px; height: 28px; }
  .unit-row > span, .unit-row .unit-name { display: none; }
  .board { width: 100%; max-width: calc(100dvh - 260px); margin: auto; border-width: 7px; box-shadow: none; }
  .battle-controls { min-height: 0; margin: 0; padding: 4px; border-width: 8px; font-size: 11px; }
  .battle-controls > div:not(.action-buttons):not(.attack-preview) { gap: 4px; }
  .battle-controls b { font-size: 7px; }
  .battle-controls span { font-size: 10px; }
  .action-buttons { gap: 3px; }
  .action-buttons button,
  .battle-controls > .primary { padding: 5px; font-size: 6px; }

  .tutorial-backdrop { padding: 5px; }
  .tutorial-panel { grid-template-columns: 1fr; grid-template-rows: 120px minmax(0, 1fr); width: 96vw; height: min(94dvh, 700px); max-height: 94dvh; padding: 8px; overflow: hidden; }
  .tutorial-panel > img { width: 115px; max-height: 115px; }
  .tutorial-copy { padding: 4px; }
  .tutorial-copy h2 { margin: 7px 0; font-size: 11px; }
  .tutorial-copy > p:not(.window-kicker) { margin: 5px 0; font-size: 15px; }
  .tutorial-copy > strong { min-height: 0; font-size: 13px; }
  .tutorial-progress { margin: 8px 0; }
  .tutorial-actions button { padding: 7px; font-size: 6px; }
}

/* Functional fit: resize complete workspaces instead of clipping their controls. */
@media (min-width: 761px) {
  .arena-wrap { display: grid; width: 100%; height: 100%; min-height: 0; gap: clamp(5px, 1vh, 12px); padding: clamp(8px, 1.5vh, 18px) clamp(14px, 2vw, 28px); overflow: hidden; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: auto minmax(0, 1fr) auto; }
  .arena-wrap:has(.timeline) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .arena-wrap .timeline { height: clamp(42px, 5.5vh, 58px); margin: 0; padding: 5px 8px; overflow: hidden; }
  .arena-wrap .arena-layout { height: 100%; min-height: 0; align-items: stretch; }
  .arena-wrap .board { width: auto; height: 100%; max-width: 100%; max-height: min(100%, 630px); justify-self: center; box-shadow: none; }
  .arena-wrap .team-panel { display: grid; grid-template-rows: auto repeat(6, minmax(0, 1fr)); min-height: 0; height: 100%; overflow: hidden; }
  .arena-wrap .unit-row { min-height: 0; height: 100%; padding-block: clamp(0px, .5vh, 5px); overflow: hidden; }
  .arena-wrap .unit-row .monster-art { width: clamp(22px, 4vh, 38px); height: clamp(22px, 4vh, 38px); flex: 0 0 auto; }
  .arena-wrap .unit-row b { font-size: clamp(13px, 1.8vh, 19px); line-height: 1; }
  .arena-wrap .unit-row small { display: block; font-size: clamp(9px, 1.35vh, 14px); line-height: 1; }
  .arena-wrap .battle-controls { min-height: 0; margin: 0; padding-block: clamp(7px, 1.3vh, 14px); }
}

@media (min-width: 1600px) {
  .solamon-grid { grid-template-columns: repeat(10, minmax(70px, 1fr)); }
  .solamon-slot .monster-art { width: 78px; height: 78px; }
}

@media (max-width: 760px) {
  .solamon-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .locked-slot { display: grid; }
  .solamon-slot .monster-art { width: 34px; height: 34px; }
  .solamon-slot small { max-width: 74%; font-size: 6px; }
  .solamon-slot em { font-size: 6px; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: auto minmax(0, 1fr) auto; }
  .arena-wrap:has(.timeline) { grid-template-rows: auto 32px minmax(0, 1fr) auto; }
  .arena-wrap .battle-top span { display: block; font-size: 8px; }
  .arena-wrap .timeline { display: flex; height: 32px; gap: 0; margin: 0; padding: 2px; overflow: hidden; }
  .arena-wrap .timeline > b { width: 28px; font-size: 5px; white-space: normal; }
  .arena-wrap .timeline span { flex: 1; min-width: 0; gap: 0; padding: 0; font-size: 6px; }
  .arena-wrap .timeline span i { display: none; }
  .arena-wrap .timeline .monster-art { width: 17px; height: 17px; }
  .arena-wrap .timeline small { padding: 0 1px; font-size: 6px; }
}

/* Final battle density overrides: combat has three fighters per side. */
@media (min-width: 761px) {
  .arena-wrap .arena-layout { grid-template-columns: clamp(230px, 20vw, 340px) minmax(320px, 1fr) clamp(230px, 20vw, 340px); max-width: 1180px; width: 100%; margin: auto; gap: clamp(6px, 1vw, 14px); }
  .arena-wrap .team-panel { grid-template-rows: auto repeat(3, minmax(0, 1fr)); }
  .arena-wrap .unit-row .monster-art { width: clamp(34px, 5vh, 50px); height: clamp(34px, 5vh, 50px); }
  .arena-wrap .board { max-width: min(100%, 680px); }
}
@media (max-width: 760px) {
  .arena-wrap .team-panel { grid-template-rows: auto repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 761px) {
  .solamon-detail { grid-template-rows: auto 88px auto auto auto auto minmax(44px, 1fr) auto auto; gap: 2px; overflow: hidden; }
  .detail-art { height: 88px; }
  .detail-art .monster-art { width: 86px; height: 86px; }
  .solamon-detail h2, .solamon-detail > p { margin: 1px 0; }
  .detail-stats { grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 2px 0; font-size: 12px; }
  .detail-stats span { padding: 3px; }
  .trait-box { min-height: 0; padding: 5px; overflow: hidden; }
  .trait-box span { font-size: 12px; line-height: 1; }
  .squad-toggle { margin-top: 2px; padding: 6px 2px; font-size: 6px; box-shadow: none; }
}
.hatch-reveal { min-width: 190px; padding: 8px 18px; }
.hatch-reveal strong { color: #2f6d4a; }

/* Empty squad builder remains explorable before onboarding. */
.run-empty-info { grid-template-rows: auto 1fr auto auto auto; align-content: center; }
.run-empty-emblem { align-self: center; display: grid; place-items: center; width: 120px; aspect-ratio: 1; margin: auto; color: #8b9290; background: repeating-linear-gradient(0deg, #e6eadf 0 6px, #d7ded5 7px 10px); border: 4px dashed #a7aeaa; font-family: 'Press Start 2P', monospace; font-size: 36px; }
.run-empty-info h2 { margin-top: 12px; }
.run-empty-info .run-add { width: 100%; }
.empty-run-grid .run-locked { position: relative; color: #687171; }
.empty-run-grid .run-locked small { position: absolute; top: 4px; left: 5px; color: #7b8382; font-size: 9px; }

/* Starter pack */
.starter-claim {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
  width: min(360px, 88vw);
  margin: 18px auto 10px;
  padding: 11px 16px;
  color: #f3fbff;
  background: linear-gradient(135deg, #202f55, #522857);
  border: 3px solid #ffe67b;
  box-shadow: 6px 6px 0 #080713, inset 0 0 0 2px #ff79ba;
  text-align: left;
  animation: starter-pulse 1.4s steps(2) infinite;
}
.starter-claim > span { grid-row: 1 / 3; padding: 8px 7px; color: #171020; background: #ffe67b; font-family: 'Press Start 2P', monospace; font-size: 8px; }
.starter-claim b { font-family: 'Press Start 2P', monospace; font-size: 10px; }
.starter-claim small { color: #8ef6dc; font-size: 14px; }
.start-button:disabled { opacity: .42; filter: grayscale(.6); cursor: not-allowed; transform: none; }

.starter-pack-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 40%, rgba(126, 79, 190, .42), rgba(3, 6, 16, .94) 58%);
}
.starter-pack {
  position: relative;
  width: min(620px, 94vw);
  padding: 18px;
  background: linear-gradient(180deg, #172442, #0a1022);
  border: 4px solid #7788b2;
  box-shadow: 10px 10px 0 #02040c, inset 0 0 0 3px #2e4069;
  text-align: center;
  animation: panel-pop .28s steps(4) both;
}
.starter-pack.rarity-rare { border-color: #72d9ff; box-shadow: 10px 10px 0 #02040c, inset 0 0 32px rgba(114,217,255,.2); }
.starter-pack-head { display: flex; justify-content: space-between; align-items: end; border-bottom: 2px solid #3f5075; text-align: left; }
.starter-pack-head h2 { margin: 4px 0 12px; font-size: clamp(18px, 4vw, 30px); }
.starter-pack-head > span { margin-bottom: 12px; color: #ffd866; }
.starter-card { display: grid; justify-items: center; align-content: center; row-gap: 6px; min-height: 355px; padding: 26px 12px 12px; animation: starter-card-in .48s steps(6) both; }
.starter-card .monster-art { width: 150px; height: 150px; margin-bottom: 22px; border: 0; background: transparent; box-shadow: none; filter: drop-shadow(0 12px 0 rgba(2,5,14,.45)); }
.starter-card .monster-art img { transform: scale(1.12); }
.starter-card > p { margin: 0; font-weight: 900; text-transform: uppercase; }
.starter-card h3 { margin: 10px 0 10px; font-family: 'Press Start 2P', monospace; font-size: 19px; }
.starter-card > div { display: flex; gap: 6px; }
.starter-card > div span { padding: 4px 9px; background: #202f4e; color: #aebbd1; }
.starter-card > div b { color: #ffd866; }
.starter-card > small { max-width: 450px; margin-top: 9px; color: #d9ff83; font-size: 18px; letter-spacing: .5px; text-transform: uppercase; }
.starter-rarity { padding: 4px 12px; color: #101427; background: #d9ff83; font-family: 'Press Start 2P', monospace; font-size: 8px; }
.rarity-rare .starter-rarity { background: #72d9ff; }
.starter-pack-track { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 2px 0 14px; }
.starter-pack-track > span { display: grid; place-items: center; height: 50px; color: #60708e; background: #0b1326; border: 2px solid #2f3e5e; }
.starter-pack-track > span.seen { border-color: #5ed9c7; }
.starter-pack-track > span.now { color: #101427; background: #ffd866; border-color: #fff2ad; }
.starter-pack-track .monster-art { width: 42px; height: 42px; border: 0; background: transparent; box-shadow: none; }
.starter-next { min-width: min(330px, 100%); }

/* Canonical Soladex: exactly seven creatures per type row. */
@media (min-width: 1600px) { .solamon-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.solamon-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.solamon-box { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.solamon-grid.full-dex { grid-template-rows: repeat(5, minmax(0, 1fr)); height: auto; min-height: 0; }
.solamon-grid.full-dex .solamon-slot .monster-art { width: min(56px, 72%); height: auto; aspect-ratio: 1; }
.locked-slot { position: relative; display: grid !important; grid-template-rows: auto 1fr auto; place-items: center; min-width: 0; color: #4d5c79; border-color: color-mix(in srgb, var(--type) 34%, #293651); }
.locked-slot b { position: absolute; top: 3px; left: 4px; font-size: 8px; }
.locked-slot i { color: color-mix(in srgb, var(--type) 48%, #34425c); font-size: clamp(15px, 2vw, 26px); font-style: normal; }
.locked-slot small { font-family: 'Press Start 2P', monospace; font-size: 8px; }
.empty-detail { display: grid; place-items: center; align-content: center; color: #77849e; }
.detail-empty-mark { display: grid; place-items: center; width: 92px; aspect-ratio: 1; color: #36445f; background: #0b1325; border: 3px dashed #35425f; font-family: 'Press Start 2P', monospace; font-size: 30px; }

/* Combat feedback */
.cell.active-unit { z-index: 4; box-shadow: inset 0 0 0 4px #ffe26e, inset 0 0 18px rgba(255,226,110,.7), 0 0 16px rgba(255,226,110,.75); animation: current-unit-pulse .75s steps(2) infinite !important; }
.cell.active-unit::after { content: 'TURN'; position: absolute; z-index: 9; top: -8px; left: 50%; transform: translateX(-50%); padding: 2px 4px; color: #15101e; background: #ffe26e; font-family: 'Press Start 2P', monospace; font-size: clamp(4px,.65vw,7px); pointer-events: none; }
.board-unit.attacking { animation: attack-lunge 1.125s steps(9) both; filter: drop-shadow(0 0 8px #fff); }
.board-unit.side1.attacking { animation-name: attack-lunge-left; }
.board-unit.target-hit { z-index: 15; animation: target-impact .375s steps(3) both; }
.board-unit.target-hit::after { content: ''; position: absolute; inset: -20%; border: 5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 5px #ff5e9f, 0 0 28px 10px #ffcd62; animation: impact-ring .375s steps(3) both; pointer-events: none; }
.damage-pop { position: absolute; z-index: 30; top: -30%; left: 50%; padding: 3px 5px; color: #fff; background: #d91f62; border: 2px solid #fff; box-shadow: 3px 3px 0 #190716; font-family: 'Press Start 2P', monospace; font-size: clamp(8px, 1vw, 13px); animation: damage-rise .75s steps(6) both; pointer-events: none; }
@keyframes damage-rise { from { transform: translate(-50%, 5px); opacity: 1; } 65% { opacity: 1; } to { transform: translate(-50%, -30px); opacity: 0; } }
.timeline span.ko { filter: grayscale(1); opacity: .18; text-decoration: line-through; }

@keyframes starter-pulse { 50% { filter: brightness(1.2); transform: translateY(-2px); } }
@keyframes starter-card-in { from { opacity: 0; transform: scale(.5) translateY(20px); filter: brightness(3); } to { opacity: 1; transform: scale(1); filter: brightness(1); } }
@keyframes current-unit-pulse { to { filter: brightness(1.25); } }
@keyframes attack-lunge { 0%, 20% { transform: translateX(0) scale(1); } 55% { transform: translateX(12%) scale(1.18); } 72% { transform: translateX(18%) scale(1.22); } 100% { transform: translateX(0) scale(1); } }
@keyframes attack-lunge-left { 0%, 20% { transform: translateX(0) scale(1); } 55% { transform: translateX(-12%) scale(1.18); } 72% { transform: translateX(-18%) scale(1.22); } 100% { transform: translateX(0) scale(1); } }
@keyframes target-impact { 0% { transform: translate(0); filter: brightness(3); } 25% { transform: translate(-8px, 2px); } 50% { transform: translate(7px, -2px); } 75% { transform: translate(-4px, 1px); } 100% { transform: translate(0); filter: brightness(1); } }
@keyframes impact-ring { from { opacity: 1; transform: scale(.35); } to { opacity: 0; transform: scale(1.35); } }

@media (max-width: 760px) {
  .starter-pack { padding: 9px; }
  .starter-card { min-height: 245px; padding: 6px; }
  .starter-card .monster-art { width: 120px; height: 120px; }
  .starter-card h3 { font-size: 12px; }
  .starter-card > small { font-size: 12px; }
  .starter-pack-track > span { height: 34px; }
  .starter-pack-track .monster-art { width: 30px; height: 30px; }
  .locked-slot b { display: none; }
}

/* Collection workspace: readable cards, direct squad controls, persistent inner scroll. */
.solamon-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  text-align: left;
}
.detail-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
  min-height: 230px;
  padding: 6px;
  background: linear-gradient(135deg, rgba(42, 67, 94, .72), rgba(8, 18, 36, .3));
  border: 1px solid #3c4f70;
}
.detail-profile .detail-art { width: 100%; height: 100%; min-height: 150px; }
.detail-profile .detail-art .monster-art { width: min(220px, 84%); height: auto; aspect-ratio: 1; }
.detail-identity { min-width: 0; }
.detail-identity h2 { margin: 0 0 8px; overflow-wrap: anywhere; font-size: clamp(12px, 1vw, 17px); line-height: 1.45; text-align: center; }
.detail-identity p { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: 0; color: #aebbd2; font-size: 15px; }
.detail-identity p small { color: #dce6f6; }
.detail-identity .level-pips { margin-top: 10px; }
.solamon-detail .detail-stats { flex: 0 0 auto; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0; font-size: 13px; }
.solamon-detail .trait-box { flex: 0 0 auto; min-height: 72px; padding: 9px; overflow: hidden; }
.solamon-detail .trait-box span { display: block; margin-top: 5px; line-height: 1.2; }
.detail-actions { display: grid; gap: 7px; margin-top: auto; }
.detail-actions .squad-toggle { margin: 0; }

.solamon-box { grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.solamon-grid,
.solamon-grid.full-dex {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: none;
  grid-auto-rows: clamp(128px, 18vh, 172px);
  align-content: start;
  height: 100%;
  min-height: 0;
  padding: 2px 9px 8px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #67e8d4 #0a1325;
  scrollbar-width: thin;
}
.solamon-grid::-webkit-scrollbar { width: 10px; }
.solamon-grid::-webkit-scrollbar-track { background: #0a1325; border-left: 2px solid #283958; }
.solamon-grid::-webkit-scrollbar-thumb { background: #67e8d4; border: 2px solid #0a1325; }
.solamon-slot {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  aspect-ratio: auto;
}
.solamon-slot-main {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 10px 5px 20px;
  color: inherit;
  background: transparent;
  border: 0;
}
.solamon-slot-main:focus-visible { outline: 3px solid #d9ff83; outline-offset: -6px; }
.solamon-grid.full-dex .solamon-slot .monster-art,
.solamon-slot .monster-art { width: min(104px, 76%); height: auto; aspect-ratio: 1; }
.solamon-slot small { max-width: calc(100% - 12px); font-size: clamp(9px, .75vw, 12px); }
.slot-team-toggle {
  position: absolute;
  z-index: 4;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #07141b;
  background: #d9ff83;
  border: 2px solid #f4ffd4;
  box-shadow: 2px 2px 0 #273b22;
  font-weight: 900;
  line-height: 1;
}
.solamon-slot.in-squad { box-shadow: inset 0 0 0 3px #64ead5; }
.solamon-slot.in-squad .slot-team-toggle { color: #061a1d; background: #64ead5; border-color: #d8fffa; }
.slot-team-toggle:hover,
.slot-team-toggle:focus-visible { transform: translate(-1px, -1px); filter: brightness(1.15); }

.squad-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.squad-heading { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.squad-heading h3 { margin: 0 0 4px; }
.squad-heading p { margin: 0; color: #76f4dc; }
.squad-heading > small { color: #8493ae; font-size: 11px; text-align: right; }
.squad-list { display: grid; grid-template-rows: repeat(6, minmax(0, 1fr)); flex: 1; min-height: 0; }
.squad-member { display: grid; grid-template-columns: minmax(0, 1fr) 28px; min-height: 0; border-bottom: 1px solid #3d4968; }
.squad-member.selected { background: rgba(100, 234, 213, .12); box-shadow: inset 3px 0 #64ead5; }
.squad-member-main {
  display: grid;
  grid-template-columns: 20px 46px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  padding: 4px 2px;
  color: #eaf5ff;
  background: transparent;
  border: 0;
  text-align: left;
}
.squad-member-main:hover { background: #253957; }
.squad-member-main > b { color: #ffd866; }
.squad-member-main > span { min-width: 0; overflow: hidden; font-weight: bold; text-overflow: ellipsis; white-space: nowrap; }
.squad-member-main small { display: block; color: #9eabc5; font-weight: normal; }
.squad-remove { align-self: stretch; padding: 0; color: #ff9acb; background: rgba(120, 35, 75, .16); border: 0; border-left: 1px solid #52364d; font-size: 22px; }
.squad-remove:hover,
.squad-remove:focus-visible { color: #fff; background: #b6346e; }
.squad-list .empty-squad { height: 100%; min-height: 0; padding-inline: 5px; }
.squad-points { flex: 0 0 auto; }

/* Combat workspace: phase-specific rails leave the square board as the visual anchor. */
.team-panel h3 { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.team-panel h3 span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-panel h3 small { color: #ffd866; font-family: 'DM Mono', monospace; font-size: 10px; white-space: nowrap; }
.unit-row[data-recall] { cursor: pointer; }
.unit-row[data-recall]:hover { background: rgba(255, 107, 182, .18); outline-color: #ff77bd; }

@media (min-width: 761px) {
  .dex-layout { grid-template-columns: clamp(280px, 17vw, 330px) minmax(0, 1fr) clamp(245px, 15vw, 285px); gap: clamp(8px, 1vw, 16px); }
  .arena-wrap .arena-layout { width: 100%; max-width: 1540px; gap: clamp(8px, 1vw, 16px); }
  .arena-wrap.deploy-phase .arena-layout { grid-template-columns: clamp(245px, 18vw, 335px) minmax(440px, 760px) clamp(245px, 18vw, 335px); justify-content: center; }
  .arena-wrap.deploy-phase .team-panel { grid-template-rows: auto repeat(6, minmax(0, 1fr)); }
  .arena-wrap.fight-phase .arena-layout,
  .arena-wrap.ended-phase .arena-layout { grid-template-columns: clamp(215px, 15vw, 285px) minmax(460px, 760px) clamp(215px, 15vw, 285px); justify-content: center; }
  .arena-wrap.fight-phase .team-panel,
  .arena-wrap.ended-phase .team-panel { grid-template-rows: auto repeat(3, minmax(0, 1fr)); }
  .arena-wrap .board { max-width: min(100%, 760px); max-height: 100%; }
  .arena-wrap.deploy-phase .unit-row { height: 100%; padding: 3px 5px; }
  .arena-wrap.deploy-phase .unit-row .monster-art { width: clamp(32px, 4.2vh, 46px); height: clamp(32px, 4.2vh, 46px); }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .dex-layout { grid-template-columns: 235px minmax(0, 1fr) 220px; gap: 6px; }
  .detail-profile { grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: 1fr; flex: 0 0 auto; min-height: 88px; gap: 5px; }
  .detail-profile .detail-art { min-height: 88px; }
  .solamon-detail { gap: 4px; padding: 7px; }
  .solamon-detail .trait-box { min-height: 58px; padding: 5px; }
  .solamon-grid,
  .solamon-grid.full-dex { grid-auto-rows: clamp(118px, 18vh, 142px); }
  .solamon-grid.full-dex .solamon-slot .monster-art,
  .solamon-slot .monster-art { width: min(76px, 72%); }
  .squad-heading > small { display: none; }
  .squad-member { grid-template-columns: minmax(0, 1fr) 24px; }
  .squad-member-main { grid-template-columns: 15px 34px minmax(0, 1fr); font-size: 13px; }
  .squad-member-main .monster-art { width: 32px; height: 32px; }
  .arena-wrap.deploy-phase .arena-layout { grid-template-columns: 205px minmax(360px, 1fr) 205px; }
  .arena-wrap.fight-phase .arena-layout,
  .arena-wrap.ended-phase .arena-layout { grid-template-columns: 190px minmax(380px, 1fr) 190px; }
}

@media (min-width: 761px) and (max-height: 800px) {
  .solamon-detail { gap: 3px; padding: 6px; }
  .detail-profile { flex-basis: 130px; min-height: 120px; padding: 3px; }
  .detail-profile .detail-art { min-height: 96px; }
  .detail-profile .detail-art .monster-art { width: min(150px, 72%); }
  .detail-identity h2 { margin-bottom: 2px; font-size: 11px; }
  .detail-identity p { font-size: 11px; }
  .detail-identity .level-pips { margin-top: 3px; }
  .solamon-detail .detail-stats { gap: 2px; font-size: 10px; }
  .solamon-detail .detail-stats span { padding: 2px 3px; }
  .solamon-detail .trait-box { min-height: 48px; padding: 4px; }
  .solamon-detail .trait-box span { margin-top: 2px; font-size: 10px; }
  .detail-actions { gap: 3px; }
  .detail-actions .upgrade-button,
  .detail-actions .squad-toggle { padding: 5px 2px; }
  .arena-wrap .battle-top { max-height: 82px; padding: 2px 7px; overflow: hidden; }
  .arena-wrap .battle-top .eyebrow { margin: 0; font-size: 11px; }
  .arena-wrap .battle-top h2 { margin: 2px 0; font-size: 13px; }
  .arena-wrap .battle-top span { display: block; overflow: hidden; font-size: 12px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
  .arena-wrap .battle-top-actions button { padding: 5px 7px; font-size: 9px; }
  .arena-wrap .battle-controls { height: 66px; max-height: 66px; padding: 3px 7px; overflow: hidden; }
  .arena-wrap .battle-controls b { font-size: 9px; }
  .arena-wrap .battle-controls span { font-size: 12px; }
}

@media (max-width: 760px) {
  .solamon-detail { gap: 3px; padding: 4px; overflow-y: auto; }
  .detail-profile { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: 1fr; flex: 0 0 auto; gap: 3px; min-height: 66px; padding: 2px; }
  .detail-profile .detail-art { min-height: 62px; height: 62px; }
  .detail-profile .detail-art .monster-art { width: 62px; height: 62px; }
  .detail-identity h2 { margin-bottom: 2px; font-size: 8px; }
  .detail-identity p { gap: 1px; font-size: 9px; }
  .detail-identity .level-pips { margin-top: 3px; }
  .solamon-detail .detail-stats { font-size: 9px; }
  .solamon-detail .trait-box { min-height: 0; padding: 3px; }
  .detail-actions { gap: 3px; margin-top: 0; }
  .solamon-grid,
  .solamon-grid.full-dex { grid-auto-rows: 76px; padding: 1px 4px 4px 1px; overflow-y: auto; }
  .solamon-grid.full-dex .solamon-slot .monster-art,
  .solamon-slot .monster-art { width: 42px; }
  .slot-team-toggle { top: 2px; right: 2px; width: 17px; height: 17px; border-width: 1px; box-shadow: none; font-size: 11px; }
  .squad-heading { margin-bottom: 2px; }
  .squad-heading h3 { font-size: 8px; }
  .squad-heading p { font-size: 10px; }
  .squad-heading > small { display: none; }
  .squad-member { grid-template-columns: minmax(0, 1fr) 19px; }
  .squad-member-main { grid-template-columns: 12px 28px minmax(0, 1fr); padding: 1px; font-size: 10px; }
  .squad-member-main .monster-art { width: 27px; height: 27px; }
  .squad-member-main small { font-size: 7px; }
  .squad-remove { font-size: 15px; }
  .squad-points { margin-top: 2px; }
  .arena-wrap.deploy-phase .team-panel { grid-template-rows: auto repeat(6, minmax(0, 1fr)); }
  .team-panel h3 small { display: none; }
}

/* 2026-07 design audit: stronger scale, denser workspaces and true mobile reflow. */
.starter-pack-head { align-items: center; }
.starter-pack-head > div:first-child { text-align: left; }
.starter-pack-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.starter-count { color: #ffd866; font-family: 'Press Start 2P', monospace; font-size: 10px; white-space: nowrap; }
.starter-rarity { position: static; min-width: 82px; text-align: center; }
.mobile-unit-hp { display: none; }

.mode-hub { gap: 12px; padding-block: 18px 14px; }
.mode-showcase { align-self: stretch; height: 100%; margin-block: 0; }
.mode-poster { height: 100%; }
.mode-poster small { max-width: 34ch; font-size: clamp(16px, 1.35vw, 20px); line-height: 1.3; }
.mode-help p { margin: 0 0 8px; color: #c2cee2; font-size: 17px; }

.ranked-console { align-self: stretch; height: 100%; margin: 0 auto; }
.ranked-console .leaderboard { align-self: stretch; }
.ranked-console .rank-row { min-height: 54px; font-size: 17px; }
.ranked-titlebar h1 { font-size: 30px; }

.run-select-layout { grid-template-columns: clamp(260px, 20vw, 320px) minmax(460px, 1fr) clamp(250px, 18vw, 290px); gap: 12px; }
.run-tabs { max-width: 1100px; gap: 8px; }
.run-tabs button { min-height: 42px; font-size: 9px; transition: color .14s, background .14s, transform .14s; }
.run-tabs button:hover,
.run-tabs button:focus-visible { color: #d9ff83; transform: translateY(-2px); }
.run-mon-info { grid-template-rows: auto minmax(150px, 30%) auto auto auto auto minmax(72px, 1fr) auto; padding: 12px; }
.run-detail-art .monster-art { width: min(180px, 78%); height: auto; aspect-ratio: 1; }
.run-mon-info h2 { font-size: clamp(17px, 1.4vw, 22px); }
.run-trait { align-self: start; min-height: 72px; font-size: 17px; }
.run-trait span { display: block; margin-top: 5px; font-size: 15px; line-height: 1.25; }
.run-box { padding: 10px; }
.run-grid { grid-template-columns: repeat(4, minmax(105px, 1fr)); grid-auto-rows: minmax(135px, 1fr); align-content: stretch; overflow-x: hidden; overflow-y: auto; }
.run-grid:not(:has(.run-slot:nth-child(7))) { grid-template-columns: repeat(3, minmax(120px, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.run-slot .monster-art { width: min(88px, 60%); height: auto; aspect-ratio: 1; }
.run-slot small { font-size: clamp(15px, 1.15vw, 18px); }
.run-slot em { font-size: 12px; }
.run-locked { min-height: 130px; }
.run-party-slots > button,
.empty-party { min-height: 62px; }
.run-command { font-size: 16px; }

.solamon-slot.in-squad { box-shadow: inset 0 0 0 3px #64ead5; }
.squad-mark { position: absolute; z-index: 3; top: 6px; right: 6px; padding: 3px 5px; color: #061a1d; background: #64ead5; border: 2px solid #d8fffa; font-family: 'Press Start 2P', monospace; font-size: 6px; pointer-events: none; }
.squad-member { grid-template-columns: minmax(0, 1fr); }
.squad-member-main { min-height: 100%; }
.solamon-detail .detail-stats { font-size: 14px; }
.solamon-detail .trait-box span { font-size: 14px; line-height: 1.25; }
.detail-actions .upgrade-button,
.detail-actions .squad-toggle { min-height: 40px; font-size: 7px; }

.egg-lab { background: radial-gradient(circle at 32% 48%, rgba(232,255,224,.98) 0 18%, rgba(178,218,196,.96) 48%, rgba(52,81,91,.98) 100%); }
.egg-shop-layout { grid-template-columns: minmax(560px, 1.2fr) minmax(440px, .8fr); max-width: 1500px; width: 100%; margin: auto; }
.machine-bay { grid-template-columns: minmax(340px, 1fr) minmax(270px, .72fr); border: 1px solid rgba(91,133,132,.35); background: radial-gradient(circle at 31% 55%, rgba(255,255,220,.66), transparent 37%), linear-gradient(180deg, rgba(255,255,255,.08), rgba(13,52,62,.16)); }
.machine-bay::after { content: 'DISPENSE BAY'; position: absolute; right: 7%; top: 9%; color: #315861; font-family: 'Press Start 2P', monospace; font-size: 9px; letter-spacing: 1px; }
.egg-machine { width: min(500px, 96%); }
.hatch-platform { height: 82%; }
.hatch-platform.idle .hatch-egg { display: block; animation: selected-egg-float 1.2s steps(4) infinite; }
.egg-catalog { padding: 16px; }
.egg-option { min-height: 82px; padding: 7px; }
.egg-option b { font-size: 8px; }
.egg-option small { font-size: 14px; line-height: 1.15; }
.egg-option em { font-size: 14px; }
.selected-egg { min-height: 42px; font-size: 16px; }
.dispense-button { min-height: 48px; font-size: 10px; }
.egg-dialog p { font-size: 20px; }

.cell.choice-move { background: #276c82; box-shadow: inset 0 0 0 4px #67f2dc, inset 0 0 24px rgba(103,242,220,.38); }
.cell.choice-move:hover,
.cell.choice-move:focus-visible { background: #49a9b3; filter: brightness(1.22); }
.cell.choice-attack { background: #8d3769; box-shadow: inset 0 0 0 4px #ff78bc, inset 0 0 26px rgba(255,100,176,.52), 0 0 14px rgba(255,107,182,.6); }
.battle-controls { font-size: 18px; }
.battle-controls b { font-size: 12px; }
.battle-controls span { color: #c4cee0; }
.move-key,
.attack-key { padding: 4px 7px; }

@keyframes selected-egg-float { 50% { transform: translateY(-8px); filter: drop-shadow(0 14px 0 rgba(54,67,66,.2)) brightness(1.12); } }

@media (min-width: 761px) and (max-height: 800px) {
  .run-mon-info { grid-template-rows: auto 112px auto auto auto auto minmax(54px, 1fr) auto; }
  .run-detail-art .monster-art { width: 112px; }
  .run-trait { min-height: 54px; font-size: 14px; }
  .run-trait span { font-size: 12px; }
  .run-grid { grid-auto-rows: minmax(105px, 1fr); }
  .run-grid:not(:has(.run-slot:nth-child(7))) { grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .run-slot .monster-art { width: min(82px, 68%); }
  .ranked-console .rank-row { min-height: 46px; }
  .egg-option { min-height: 62px; }
  .egg-option small { font-size: 12px; }
}

@media (max-width: 760px) {
  .starter-pack-head h2 { margin-bottom: 7px; }
  .starter-pack-meta { flex-direction: column; align-items: end; gap: 5px; margin-bottom: 5px; }
  .starter-rarity { min-width: 66px; padding: 3px 7px; font-size: 7px; }
  .starter-count { font-size: 8px; }

  .mode-hub { grid-template-rows: 64px minmax(0, 1fr); }
  .mode-help p { font-size: 12px; }

  .run-select-screen { grid-template-rows: 40px minmax(0, 1fr); }
  .run-tabs { height: 40px; }
  .run-tabs button { min-height: 38px; font-size: 7px; }
  .run-select-layout { grid-template: minmax(0, 56%) minmax(0, 44%) / 46% 54%; }
  .run-grid,
  .run-grid:not(:has(.run-slot:nth-child(7))) { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); overflow-y: auto; }
  .run-slot .monster-art { width: min(60px, 68%); }
  .run-slot small { font-size: 10px; }
  .run-mon-info { grid-template-rows: auto 62px auto auto auto minmax(38px, 1fr) auto; }
  .run-mon-info > p { display: none; }
  .run-trait span { font-size: 10px; }
  .run-party-slots > button,
  .empty-party { min-height: 42px; font-size: 12px; }

  .squad-mark { top: 2px; right: 2px; padding: 2px; border-width: 1px; font-size: 4px; }
  .solamon-detail .detail-stats { font-size: 10px; }
  .detail-actions .upgrade-button,
  .detail-actions .squad-toggle { min-height: 30px; font-size: 6px; }

  .egg-lab-layout { grid-template-rows: minmax(0, 48%) minmax(0, 52%); }
  .machine-bay { grid-template-columns: 55% 45%; }
  .machine-bay::after { right: 4%; top: 5%; font-size: 6px; }
  .hatch-platform { height: 82%; }
  .hatch-platform.idle .hatch-egg { width: 72px; height: 72px; }
  .egg-options { grid-template-columns: repeat(4, 1fr); }
  .egg-option { min-height: 62px; }
  .egg-option b { font-size: 6px; }

  .arena-wrap:has(.timeline) { grid-template-rows: auto 38px minmax(0, 1fr) auto; }
  .arena-wrap .timeline { height: 38px; }
  .arena-wrap .timeline > b { width: 34px; font-size: 6px; }
  .arena-wrap .timeline .monster-art { width: 21px; height: 21px; }
  .arena-wrap .timeline small { font-size: 7px; }
  .arena-wrap .battle-top h2 { font-size: 13px; }
  .arena-wrap .battle-top span { font-size: 9px; }
  .arena-layout { grid-template: minmax(0, 1fr) 72px / 1fr 1fr; gap: 4px; align-items: stretch; }
  .arena-layout > .board { grid-area: 1 / 1 / 2 / 3; align-self: center; width: min(100%, calc(100dvh - 370px)); max-width: 336px; }
  .arena-layout > .team-panel:first-child { grid-area: 2 / 1; }
  .arena-layout > .team-panel.enemy { grid-area: 2 / 2; }
  .arena-wrap .team-panel { display: grid; grid-template: 18px minmax(0, 1fr) / repeat(3, 1fr); width: 100%; height: 72px; padding: 2px; }
  .arena-wrap .team-panel h3 { grid-column: 1 / -1; font-size: 7px; }
  .arena-wrap .unit-row { position: relative; display: grid; place-items: center; width: 100%; height: 100%; padding: 0; }
  .arena-wrap .unit-row .monster-art { width: 40px; height: 40px; }
  .arena-wrap .unit-row > span, .arena-wrap .unit-row .unit-name { display: none; }
  .mobile-unit-hp { position: absolute; right: 1px; bottom: 1px; display: block; min-width: 18px; padding: 1px 2px; color: #fff; background: #091124; border: 1px solid #fff; font-family: 'DM Mono', monospace; font-size: 9px; line-height: 1; }
  .battle-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-height: 82px; padding: 6px; }
  .battle-controls > div:not(.action-buttons):not(.attack-preview) { display: block; }
  .battle-controls b { font-size: 8px; }
  .battle-controls b small { display: block; font-size: 12px; }
  .battle-controls span { display: block; font-size: 11px; line-height: 1.15; }
  .action-buttons { align-self: stretch; }
  .action-buttons button,
  .battle-controls > .primary { min-width: 96px; height: 100%; padding: 6px; font-size: 7px; }
  .ranked-console { grid-template-rows: 41% 59%; }
}

/* Bespoke mode art, guided onboarding, uploaded audio pass and readable battle rails. */
.chain-label { margin-bottom: clamp(28px, 4vh, 48px); }
.title-tagline { margin-top: clamp(30px, 4vh, 46px); }
.title-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(88vw, 430px);
}
.title-secondary-actions .pixel-menu-button { width: 100%; padding-inline: 10px; font-size: 9px; }
.title-secondary-actions .daily-open-btn { grid-column: 1 / -1; justify-self: center; width: calc(50% - 5px); }
.tutorial-button { color: #d9ff83; background: #172a42; }

.poster-world.mode-art-adventure,
.poster-world.mode-art-ranked {
  background-position: center;
  background-size: cover;
  image-rendering: pixelated;
}
.poster-world.mode-art-adventure { background-image: url('assets/mode-adventure.webp'); }
.poster-world.mode-art-ranked { background-image: url('assets/mode-ranked.webp'); }
.poster-world.mode-art-adventure::before,
.poster-world.mode-art-ranked::before { display: none; }
.poster-world.mode-art-adventure::after,
.poster-world.mode-art-ranked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 12, 28, .04), rgba(4, 12, 28, .08) 55%, rgba(4, 12, 28, .36));
}
.mode-poster:hover .poster-world,
.mode-poster:focus-visible .poster-world { background-size: 104%; }

.tutorial-visual {
  width: 100%;
  aspect-ratio: 1;
  background: url('assets/tutorial-steps.webp') 0 0 / 200% 200% no-repeat;
  border: 3px solid #416083;
  box-shadow: 8px 8px 0 #030815;
  image-rendering: pixelated;
}
.tutorial-step-1 { background-position: 100% 0; }
.tutorial-step-2 { background-position: 0 100%; }
.tutorial-step-3 { background-position: 100% 100%; }

.battle-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(150px, 22vw, 360px) auto;
  gap: 14px;
}
.battle-status { min-width: 0; }
.battle-clash {
  align-self: stretch;
  min-height: 60px;
  background: url('assets/battle-versus.webp') center / cover no-repeat;
  border-inline: 2px solid rgba(107, 226, 239, .34);
  image-rendering: pixelated;
}
.battle-top-actions { justify-self: end; }
.unit-copy { min-width: 0; }
.unit-stats { display: flex !important; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.unit-stats i {
  display: inline-block;
  height: auto;
  margin: 0;
  padding: 3px 5px;
  color: #ecf7ff;
  background: #22334e;
  border: 1px solid #405477;
  font-style: normal;
  line-height: 1;
}
.unit-role { margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-health { display: block; height: 5px; margin-top: 7px; background: #293853; }
.unit-health em { display: block; height: 100%; background: linear-gradient(90deg, #62e8d4, #d9ff83); }
.enemy .unit-health em { background: linear-gradient(90deg, #ff65b1, #ff9bca); }

@media (min-width: 1181px) {
  .arena-wrap .arena-layout { max-width: 1900px; }
  .arena-wrap.deploy-phase .arena-layout { grid-template-columns: clamp(330px, 24vw, 470px) minmax(460px, 720px) clamp(330px, 24vw, 470px); }
  .arena-wrap.fight-phase .arena-layout,
  .arena-wrap.ended-phase .arena-layout { grid-template-columns: clamp(330px, 24vw, 470px) minmax(460px, 700px) clamp(330px, 24vw, 470px); }
  .arena-wrap .unit-row { gap: 3px 14px; padding: 10px 14px 13px; }
  .arena-wrap .unit-row .monster-art { width: clamp(62px, 7.5vh, 94px); height: clamp(62px, 7.5vh, 94px); }
  .arena-wrap .unit-row .unit-name { font-size: clamp(17px, 2vh, 24px); padding-top: 2px; }
  .arena-wrap .unit-row small { font-size: clamp(12px, 1.55vh, 16px); }
  .arena-wrap .unit-stats { gap: 5px; margin-top: 5px; }
  .arena-wrap .unit-stats i { padding: 5px 8px; font-size: clamp(13px, 1.6vh, 16px); }
  .arena-wrap .unit-role { margin-top: 6px; white-space: normal; line-height: 1.3; overflow: visible; }
  .arena-wrap .unit-health { height: 7px; margin-top: 0; }
  .arena-wrap .unit-row .unit-hp-num { font-size: clamp(13px, 1.55vh, 17px); line-height: 1; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .arena-wrap.deploy-phase .arena-layout,
  .arena-wrap.fight-phase .arena-layout,
  .arena-wrap.ended-phase .arena-layout { grid-template-columns: 210px minmax(380px, 1fr) 210px; }
  .battle-top { grid-template-columns: minmax(0, 1fr) 190px auto; }
}

@media (max-width: 760px) {
  .title-content { padding-top: 18px; }
  .chain-label { margin-bottom: clamp(18px, 3vh, 28px); }
  .title-tagline { margin-top: clamp(20px, 3vh, 30px); }
  .title-secondary-actions { width: min(88vw, 360px); }
  .title-secondary-actions .pixel-menu-button { font-size: 7px; }
  .mode-poster { grid-template-columns: 39% 1fr; }
  .battle-top { grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
  .battle-clash { display: none; }
  .tutorial-visual { width: 115px; margin: auto; }
}

/* Pointer drag system and cyan LED route preview. */
.unit-row[data-pick],
.board-unit[data-uid],
.run-slot[data-run-focus],
.solamon-slot-main[data-select-mon] { cursor: grab; touch-action: none; }
.drag-source { opacity: .38 !important; filter: grayscale(.45); }
.drag-ghost {
  position: fixed !important;
  z-index: 200;
  width: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  pointer-events: none;
  transform: translate(-50%, -72%) scale(1.08);
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.45)) drop-shadow(0 0 10px #67f2dc);
}
.drag-drop-ready { outline: 4px dashed #67f2dc !important; outline-offset: -8px; background-color: rgba(57, 217, 208, .16) !important; }
.cell.drag-hover { box-shadow: inset 0 0 0 5px #d9ff83, 0 0 18px #67f2dc !important; }
.cell.drag-attack { box-shadow: inset 0 0 0 5px #fff, 0 0 22px #ff6bb6 !important; }
/* Each path cell draws up to two half-cell LED arms (entry via ::before, exit via ::after),
   so corners render as an L instead of a full crossing. */
.cell[class*="path-a-"]::before,
.cell[class*="path-b-"]::after {
  content: '';
  position: absolute;
  z-index: 8;
  pointer-events: none;
  filter: drop-shadow(0 0 4px #6fffee);
  background-image: radial-gradient(circle, #dffff9 0 2px, #62f4df 3px, transparent 4px);
  background-size: 13px 13px;
}
.cell.path-a-left::before, .cell.path-b-left::after { left: 0; top: calc(50% - 7px); width: calc(50% + 7px); height: 14px; background-repeat: repeat-x; background-position: right center; }
.cell.path-a-right::before, .cell.path-b-right::after { right: 0; top: calc(50% - 7px); width: calc(50% + 7px); height: 14px; background-repeat: repeat-x; background-position: left center; }
.cell.path-a-up::before, .cell.path-b-up::after { top: 0; left: calc(50% - 7px); width: 14px; height: calc(50% + 7px); background-repeat: repeat-y; background-position: center bottom; }
.cell.path-a-down::before, .cell.path-b-down::after { bottom: 0; left: calc(50% - 7px); width: 14px; height: calc(50% + 7px); background-repeat: repeat-y; background-position: center top; }
.cell.path-end::before {
  content: '';
  position: absolute;
  z-index: 7;
  inset: 13%;
  border: 3px dashed #d9ff83;
  box-shadow: 0 0 12px #67f2dc, inset 0 0 10px rgba(103,242,220,.35);
  pointer-events: none;
}
.board-unit.moving { animation: none !important; will-change: transform; }
.board-unit.moving .monster-art { animation: walkBob .24s ease-in-out infinite; transform-origin: 50% 92%; }
@keyframes walkBob {
  0% { transform: translateY(0) scaleY(1) scaleX(1) rotate(0deg); }
  25% { transform: translateY(-16%) scaleY(1.05) scaleX(.97) rotate(-2.5deg); }
  50% { transform: translateY(0) scaleY(.94) scaleX(1.05) rotate(0deg); }
  75% { transform: translateY(-16%) scaleY(1.05) scaleX(.97) rotate(2.5deg); }
  100% { transform: translateY(0) scaleY(1) scaleX(1) rotate(0deg); }
}
.motion-off .board-unit.moving .monster-art { animation: none; }

@media (max-width: 760px) {
  .drag-ghost { width: 38px !important; height: 38px !important; }
  .cell[class*="path-a-"]::before,
  .cell[class*="path-b-"]::after { background-size: 9px 9px; }
  .cell.path-a-left::before, .cell.path-b-left::after,
  .cell.path-a-right::before, .cell.path-b-right::after { top: calc(50% - 5px); width: calc(50% + 5px); height: 10px; }
  .cell.path-a-up::before, .cell.path-b-up::after,
  .cell.path-a-down::before, .cell.path-b-down::after { left: calc(50% - 5px); width: 10px; height: calc(50% + 5px); }
}

/* Phone UX: portrait is an orientation gate; the game itself fits one landscape view. */
.orientation-gate { display: none; }
@media (orientation: portrait) and (max-width: 760px) {
  .orientation-gate {
    position: fixed;
    z-index: 400;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    padding: 28px;
    color: #eefaff;
    background: radial-gradient(circle at 50% 38%, #183858, #050b19 66%);
    text-align: center;
  }
  .orientation-gate::before {
    content: '';
    position: absolute;
    inset: 12px;
    border: 10px solid transparent;
    border-image: url('assets/solamon-ui-frame.webp') 185 / 10px stretch;
    pointer-events: none;
  }
  .orientation-gate h2 { margin: 8px 0 0; color: #d9ff83; font-size: 17px; line-height: 1.55; }
  .orientation-gate > p:not(.window-kicker) { margin: 0 0 8px; color: #b8cae0; font-size: 19px; }
  .orientation-gate button { padding: 12px 16px; color: #071725; background: #65ead9; border: 3px solid #dffff8; box-shadow: 4px 4px 0 #164c55; font-family: 'Press Start 2P', monospace; font-size: 8px; }
  .rotate-phone {
    display: grid;
    place-items: center;
    width: 122px;
    height: 70px;
    color: #72f0df;
    background: #0b1830;
    border: 5px solid #72f0df;
    box-shadow: 0 0 0 4px #1e3452, 0 0 20px rgba(103,242,220,.45);
    animation: phone-rotate 1.6s steps(4) infinite;
  }
  .rotate-phone::after { content: ''; position: absolute; right: calc(50% - 67px); width: 4px; height: 17px; background: #d9ff83; }
  .rotate-phone span { font-family: 'Press Start 2P', monospace; font-size: 8px; }
}
@keyframes phone-rotate { 0%, 18% { transform: rotate(90deg) scale(.8); } 48%, 100% { transform: rotate(0) scale(1); } }

@media (orientation: landscape) and (max-width: 1100px) and (max-height: 650px) {
  .settings-backdrop { padding: 4px; }
  .settings-panel {
    width: min(460px, calc(100vw - 8px));
    max-height: calc(100dvh - 8px);
    padding: 9px;
    overflow: hidden;
    border-width: 7px;
    box-shadow: 4px 4px 0 #020916;
  }
  .settings-panel .eyebrow { font-size: 7px; }
  .settings-panel h2 { margin: 2px 0 6px; font-size: 14px; }
  .setting-row { min-height: 38px; padding: 5px 8px; font-size: 12px; }
  .settings-done { width: 100%; min-height: 34px; margin: 6px 0 0; padding: 5px; font-family: 'VT323', monospace; font-size: 13px; font-weight: 700; }

  .starter-pack-backdrop { padding: 4px; }
  .starter-pack {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 27px 32px;
    width: min(700px, calc(100vw - 8px));
    height: min(390px, calc(100dvh - 8px));
    padding: 5px 8px;
    overflow: hidden;
    border-width: 3px;
    box-shadow: 4px 4px 0 #02040c, inset 0 0 0 2px #2e4069;
  }
  .starter-pack-head h2 { margin: 1px 0 4px; font-size: 14px; }
  .starter-pack-head .window-kicker { font-size: 7px; }
  .starter-pack-meta { flex-direction: row; gap: 5px; margin: 0 0 3px; }
  .starter-rarity { min-width: 58px; padding: 2px 5px; font-size: 6px; }
  .starter-count { font-size: 7px; }
  .starter-card {
    grid-template: auto auto auto minmax(0, 1fr) / minmax(88px, 30%) minmax(0, 1fr);
    align-items: center;
    min-height: 0;
    padding: 2px 5px;
  }
  .starter-card > .monster-art { grid-area: 1 / 1 / 5 / 2; width: min(168px, 38vh); height: min(168px, 38vh); }
  .starter-card > p { grid-area: 1 / 2; font-size: 10px; }
  .starter-card h3 { grid-area: 2 / 2; margin: 1px 0 3px; font-size: 11px; }
  .starter-card > div:not(.monster-art) { grid-area: 3 / 2; justify-content: center; }
  .starter-card > div:not(.monster-art) span { padding: 2px 5px; font-size: 10px; }
  .starter-card > small { grid-area: 4 / 2; align-self: start; margin-top: 3px; font-size: 11px; line-height: 1.1; }
  .starter-pack-track { gap: 3px; margin: 1px 0 3px; }
  .starter-pack-track > span { height: 24px; font-size: 9px; }
  .starter-pack-track .monster-art { width: 21px; height: 21px; }
  .starter-next { min-height: 30px; padding: 4px 8px; font-family: 'VT323', monospace; font-size: 13px; font-weight: 700; }

  :root { --phone-header: 52px; }
  body { font-size: 14px; }
  .game-header {
    flex: 0 0 var(--phone-header);
    height: var(--phone-header);
    grid-template-columns: 112px minmax(390px, 1fr) auto;
    gap: 7px;
    padding: 0 8px;
    border-bottom-width: 3px;
  }
  .header-brand { gap: 0; }
  .game-header .brand { font-size: 12px; }
  .header-brand small { font-size: 6px; }
  .game-header .main-nav { height: 42px; gap: 3px; }
  .game-header .main-nav button { grid-template-columns: 16px 1fr; padding: 3px 5px; border-width: 1px; }
  .game-header .main-nav button > span { font-size: 13px; }
  .game-header .main-nav button > b { font-size: 7px; }
  .game-header .main-nav button > small { font-size: 9px; }
  .game-header .wallet { gap: 5px; font-size: 11px; }
  .audio-toggle { min-height: 36px; padding: 3px 6px; border-width: 1px; font-size: 8px; }
  #app > main { padding: 0; }
  .mode-hub, .run-select-screen, .dex-screen, .egg-lab, .ranked-v2, .arena-wrap { height: 100%; min-height: 0; }

  .title-content { width: min(650px, 88vw); padding: 8px 12px; transform: none; }
  .chain-label { margin-bottom: 9px; font-size: 7px; }
  .game-logo { font-size: clamp(48px, 15vh, 68px); }
  .title-tagline { margin: 10px auto 9px; font-size: 16px; }
  .starter-claim { width: 300px; margin: 6px auto; padding: 6px 9px; }
  .starter-claim > span, .starter-claim b { font-size: 6px; }
  .starter-claim small { font-size: 10px; }
  .title-actions { gap: 6px; }
  .pixel-menu-button { width: 260px; padding: 9px 12px; font-size: 7px; box-shadow: 0 3px 0 #041820; }
  .title-secondary-actions { width: 300px; gap: 6px; }
  .title-secondary-actions .pixel-menu-button { padding: 8px 5px; font-size: 6px; }
  .title-hint { margin-top: 7px; font-size: 9px; }
  .title-monster { width: 78px; height: 78px; }

  .mode-hub { grid-template-rows: 34px minmax(0, 1fr); gap: 5px; padding: 5px 8px; }
  .mode-hub-head { align-items: center; }
  .mode-hub-head h1 { margin: 2px 0 0; font-size: 15px; }
  .mode-help { display: flex; align-items: center; gap: 8px; }
  .mode-help p, .hub-status { display: none; }
  .mode-help button { min-height: 34px; padding: 5px 9px; font-size: 7px; }
  .mode-showcase { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; gap: 7px; }
  .mode-poster { grid-template-columns: 38% 1fr; border-width: 7px; box-shadow: 3px 3px 0 #020611; }
  .mode-poster > div:last-child { padding: 9px; }
  .mode-poster p { margin-bottom: 4px; font-size: 10px; }
  .mode-poster h2 { margin-bottom: 7px; font-size: 13px; }
  .mode-poster small { font-size: 12px; }
  .mode-poster > div:last-child > b { padding-top: 5px; font-size: 6px; }
  .poster-index { top: 4px; left: 4px; padding: 3px; font-size: 8px; }

  .run-select-screen { grid-template-rows: 26px minmax(0, 1fr) 24px; padding: 3px 5px; }
  .run-tabs { height: 26px; gap: 2px; }
  .run-tabs button { border-width: 1px; font-size: 7px; }
  .run-select-layout { grid-template-columns: 160px minmax(330px, 1fr) 190px; gap: 4px; padding-top: 3px; }
  .run-mon-info, .run-box, .run-party { border-width: 7px; }
  .run-mon-info { grid-template-rows: auto 58px auto auto auto 1fr auto; padding: 4px; }
  .run-number, .run-mon-info h2 { font-size: 8px; }
  .run-detail-art .monster-art { width: 56px; height: 56px; }
  .run-type, .run-mon-info > p, .run-stat-lines span, .run-trait span { font-size: 9px; }
  .run-stat-lines { gap: 1px; }
  .run-stat-lines span, .run-trait { padding: 2px; }
  .run-add { padding: 5px 2px; border-width: 1px; font-size: 5px; }
  .run-box { grid-template-rows: 24px minmax(0, 1fr); padding: 4px; }
  .run-box-head { padding-inline: 4px; font-size: 9px; }
  .run-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: minmax(56px, 1fr); gap: 2px; padding: 3px; }
  .run-slot { min-height: 54px; }
  .run-slot .monster-art { width: 42px; height: 42px; }
  .run-slot small { font-size: 8px; }
  .run-slot em { display: none; }
  .run-party { padding: 4px; }
  .run-mode-label { padding: 3px; font-size: 9px; }
  .run-party h3 { margin: 3px 0; font-size: 6px; }
  .run-party-slots { gap: 1px; }
  .run-party-slots > button, .empty-party { min-height: 34px; padding: 1px; font-size: 10px; }
  .run-party-slots .monster-art { max-width: 26px; }
  .run-party-slots small { font-size: 9px; }
  .run-counter { padding: 2px 4px; }
  .run-counter strong { font-size: 13px; }
  .run-counter span { font-size: 9px; }
  .run-start { padding: 5px; border-width: 1px; font-size: 6px; }
  .run-back { margin-top: 1px; font-size: 10px; }
  .run-command { padding-inline: 7px; border-width: 1px; font-size: 9px; }

  .dex-screen { grid-template-rows: 30px 25px minmax(0, 1fr) 24px; gap: 3px; padding: 4px 6px; }
  .dex-title h1 { font-size: 12px; }
  .dex-title, .dex-title span { font-size: 9px; }
  .dex-tabs { gap: 2px; }
  .dex-tabs button { border-width: 1px; padding: 1px; font-size: 8px; }
  .dex-layout { grid-template-columns: 150px minmax(360px, 1fr) 180px; gap: 4px; }
  .solamon-detail, .solamon-box, .squad-pane { border-width: 7px; }
  .solamon-detail { grid-template-rows: auto 54px auto auto auto minmax(28px, 1fr) auto auto; padding: 4px; }
  .detail-art { height: 54px; }
  .detail-art .monster-art { width: 52px; height: 52px; }
  .solamon-detail h2 { font-size: 9px; }
  .solamon-detail > p, .detail-stats, .trait-box span { font-size: 9px; }
  .detail-stats { gap: 1px; margin: 1px 0; }
  .detail-stats span, .trait-box { padding: 2px; }
  .squad-toggle { padding: 4px 1px; font-size: 5px; }
  .solamon-grid { grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .solamon-slot .monster-art { width: 36px; height: 36px; }
  .solamon-slot small { font-size: 7px; }
  .squad-pane { grid-column: auto; grid-row: auto; display: flex; padding: 4px; }
  .squad-pane h3 { font-size: 7px; }
  .squad-pane > p, .squad-pane small { font-size: 9px; }
  .squad-pane > button { grid-template-columns: 13px 29px 1fr; min-height: 34px; padding: 1px; font-size: 9px; }
  .squad-pane .monster-art { width: 27px; height: 27px; }
  .squad-points { margin-top: 2px; padding: 3px; font-size: 9px; }
  .command-bar { padding: 1px 6px; font-size: 9px; }

  .egg-lab { grid-template-rows: 36px minmax(0, 1fr) 30px; gap: 4px; padding: 4px 7px; }
  .egg-lab-head { padding-inline: 7px; border-width: 6px; }
  .egg-lab-head h1 { margin: 1px 0 0; font-size: 10px; }
  .egg-stock { gap: 3px; }
  .egg-stock span { min-width: 75px; padding: 3px 5px; font-size: 9px; }
  .egg-lab-layout { grid-template-columns: minmax(400px, 1fr) 270px; gap: 5px; }
  .machine-bay { grid-template-columns: 1fr .6fr; }
  .egg-machine { width: min(240px, 90%); }
  .hatch-platform { min-height: 0; height: 80%; }
  .hatch-egg { width: 70px; height: 70px; }
  .hatch-reveal .monster-art { width: 78px; height: 78px; }
  .egg-catalog { align-self: stretch; gap: 2px; padding: 4px; border-width: 7px; overflow: hidden; }
  .egg-options { grid-template-columns: 1fr 1fr; gap: 1px; }
  .egg-option { grid-template-columns: 28px 1fr; min-height: 32px; padding: 0; font-size: 8px; }
  .egg-option-art { width: 28px; height: 28px; }
  .egg-option small, .egg-catalog > small { display: none; }
  .selected-egg { min-height: 16px; padding: 1px 2px; font-size: 8px; }
  .selected-egg span { display: none; }
  .dispense-button { padding: 3px; border-width: 2px; font-size: 6px; }
  .egg-dialog { padding-inline: 8px; border-width: 6px; }
  .egg-dialog p { font-size: 12px; }

  .ranked-v2 { grid-template-rows: 34px minmax(0, 1fr); gap: 4px; padding: 4px 7px; }
  .ranked-titlebar h1 { margin: 1px 0 0; font-size: 12px; }
  .season-clock { padding: 2px 7px; font-size: 9px; }
  .ranked-console { grid-template-columns: 180px minmax(340px, 1fr) 165px; gap: 4px; }
  .player-rank-card, .rank-rules, .leaderboard { padding: 5px; border-width: 7px; }
  .rank-rules { display: block; }
  .compact-emblem { width: 78px; height: 78px; }
  .player-rank-card > strong { margin-top: 2px; font-size: 14px; }
  .player-rank-card > small, .player-rank-card > p { font-size: 9px; }
  .rank-mini-stats { margin: 4px 0; }
  .rank-mini-stats span { padding: 2px; font-size: 8px; }
  .ranked-queue { padding: 5px; border-width: 1px; font-size: 6px; }
  .ranked-console .rank-row { min-height: 29px; padding: 2px 4px; font-size: 10px; }
  .rank-rules h3 { margin: 2px 0 4px; font-size: 6px; }
  .rank-rules > div:not(.reward-track) { padding: 3px; }
  .rank-rules hr { margin: 5px 0; }
  .rank-rules p { margin: 4px 0; font-size: 9px; }
  .rank-rules > button { margin-top: 5px; padding: 3px; font-size: 9px; }

  .arena-wrap { display: grid; grid-template-rows: 40px auto minmax(0, 1fr) 42px; gap: 3px; padding: 3px 6px; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: 40px minmax(0, 1fr) 42px; }
  .arena-wrap .battle-top { min-height: 0; max-height: none; padding: 2px 5px; border-width: 7px; }
  .battle-top { grid-template-columns: minmax(0, 1fr) 110px auto; gap: 5px; }
  .battle-top .eyebrow { margin: 0; font-size: 8px; }
  .battle-top h2 { margin: 1px 0; font-size: 9px; }
  .battle-top span { display: none; }
  .battle-clash { min-height: 26px; }
  .battle-top-actions button { padding: 3px 4px; font-size: 8px; }
  .arena-wrap .timeline { height: 27px; margin: 0; padding: 1px 4px; gap: 2px; }
  .timeline > b { font-size: 7px; }
  .timeline span { padding: 1px; font-size: 8px; }
  .timeline .monster-art { width: 17px; height: 17px; }
  .arena-wrap .arena-layout { grid-template-columns: 188px minmax(240px, 1fr) 188px; gap: 4px; width: 100%; max-width: 864px; height: 100%; min-height: 0; }
  .arena-wrap .board { width: auto; height: 100%; max-width: 100%; max-height: 100%; justify-self: center; border-width: 6px; box-shadow: none; }
  .arena-wrap .team-panel { display: grid; grid-template-rows: auto repeat(3, minmax(0, 1fr)); height: 100%; padding: 2px; border-width: 7px; }
  .arena-wrap.deploy-phase .team-panel { grid-template-rows: auto repeat(6, minmax(0, 1fr)); }
  .arena-wrap .team-panel h3 { padding: 1px; font-size: 6px; }
  .arena-wrap .unit-row { min-height: 0; height: 100%; gap: 3px; padding: 0 1px; overflow: hidden; }
  .arena-wrap .unit-row .monster-art { width: 25px; height: 25px; }
  .arena-wrap .unit-row b { font-size: 10px; line-height: 1; }
  .arena-wrap .unit-row small { font-size: 7px; line-height: 1; }
  .arena-wrap .unit-stats { gap: 1px; margin-top: 1px; }
  .arena-wrap .unit-stats i { padding: 1px 2px; }
  .arena-wrap .unit-role, .arena-wrap .unit-health { display: none; }
  .arena-wrap .battle-controls { min-height: 0; margin: 0; padding: 3px 6px; border-width: 7px; }
  .battle-controls b { font-size: 6px; }
  .battle-controls b small { font-size: 10px; }
  .battle-controls span { font-size: 9px; }
  .action-buttons button, .battle-controls > .primary { min-width: 74px; padding: 4px; font-size: 6px; }

  .tutorial-backdrop { padding: 5px; }
  .tutorial-panel { grid-template-columns: 170px minmax(0, 1fr); width: min(700px, 96vw); min-height: 0; height: min(330px, 92vh); padding: 12px; border-width: 9px; }
  .tutorial-visual { width: 145px; }
  .tutorial-copy { padding: 8px 12px; }
  .tutorial-copy h2 { margin: 6px 0; font-size: 11px; }
  .tutorial-copy > p:not(.window-kicker) { min-height: 42px; margin: 4px 0; font-size: 14px; }
  .tutorial-copy > strong { min-height: 28px; font-size: 11px; }
  .tutorial-progress { margin: 7px 0; }
  .tutorial-actions button { padding: 6px; font-size: 6px; }
  .tutorial-close { top: 4px; right: 6px; font-size: 20px; }
}

/* Living mode cards: fixed artwork scale plus rotating animated Solamon. */
.mode-poster:hover .poster-world,
.mode-poster:focus-visible .poster-world {
  background-position: center;
  background-size: cover;
  transform: none;
}
.mode-copy { position: relative; overflow: hidden; }
.mode-solamon-stage {
  position: absolute;
  right: 18px;
  bottom: 76px;
  left: 18px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 16px;
  height: 132px;
  pointer-events: none;
}
.mode-fighter { position: relative; width: 100px; height: 100px; filter: drop-shadow(0 8px 0 rgba(1,5,14,.42)); }
.mode-fighter .monster-art { width: 100px; height: 100px; border: 0; background: transparent; box-shadow: none; }
.mode-fighter-2 { transform: translateY(-5px); }
.mode-fighter-2 .monster-art img { transform: scaleX(-1); }
.mode-fighter-idle,
.mode-fighter-attack { position: absolute; inset: 0; }
.mode-fighter-attack { opacity: 0; animation: mode-attack-show 20s steps(1) infinite; }
.mode-fighter-2 .mode-fighter-attack { animation-delay: -10s; }
.mode-fighter-attack .attack-frame { animation-iteration-count: infinite; }
.mode-fighter-idle { animation: mode-idle-show 20s steps(1) infinite; }
.mode-fighter-2 .mode-fighter-idle { animation-delay: -10s; }
@keyframes mode-attack-show { 0%, 31%, 43%, 100% { opacity: 0; } 32%, 42% { opacity: 1; } }
@keyframes mode-idle-show { 0%, 31%, 43%, 100% { opacity: 1; } 32%, 42% { opacity: 0; } }

/* Custom enchanted field underneath the tactical grid. */
.arena-wrap .board {
  background-color: #113d31;
  background-image: linear-gradient(rgba(3,25,22,.08), rgba(3,25,22,.18)), url('assets/solamon-battle-board.webp');
  background-position: center;
  background-size: cover;
}
.arena-wrap .cell:not(.legal):not(.move):not(.target) { background: rgba(8,38,33,.22); border-color: rgba(137,204,188,.58); }
.arena-wrap .cell.dark:not(.legal):not(.move):not(.target) { background: rgba(3,25,29,.34); }

/* Minimal and readable battle header. */
.battle-clash { display: none; }
.arena-wrap .battle-top {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  min-height: clamp(52px, 6.5vh, 78px);
  max-height: none;
  padding: 7px 16px;
  background: linear-gradient(90deg, rgba(8,22,39,.98), rgba(12,31,45,.94));
}
.arena-wrap .battle-status { display: grid; align-content: center; min-width: 0; }
.arena-wrap .battle-top .eyebrow { margin: 0 0 4px; color: #70ecd9; font-size: clamp(11px, 1.3vh, 15px); }
.arena-wrap .battle-top h2 { margin: 0 0 4px; font-size: clamp(15px, 2.1vh, 22px); }
.arena-wrap .battle-top span { display: block; color: #c1d2e4; font-size: clamp(13px, 1.7vh, 18px); line-height: 1; }
.battle-top-actions { align-self: center; gap: 9px; }
.battle-top-actions button {
  min-width: 110px;
  min-height: 48px;
  padding: 10px 13px;
  border: 3px solid #5f7596;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  box-shadow: 3px 3px 0 #030711;
}
.battle-help-button { color: #08202a; background: #d9ff83; border-color: #f5ffda !important; }
.battle-help-button span { display: inline !important; color: #08202a !important; font-family: inherit; font-size: inherit !important; }
.battle-ready-button { color: #04201a; background: #58e7d5; border-color: #b8fff4 !important; }
.battle-pass-button { color: #201803; background: #ffcf5a; border-color: #ffe9ad !important; }
.battle-ready-button:disabled { color: #6b7f96; background: #1c2c44; border-color: #3d4a68 !important; cursor: not-allowed; filter: none; opacity: .8; }
.battle-ready-button:not(:disabled) { animation: readyPulse 1.1s ease-in-out infinite; }
@keyframes readyPulse { 50% { box-shadow: 0 0 0 3px rgba(88,231,213,.45); } }
.motion-off .battle-ready-button { animation: none; }
.battle-leave-button { color: #ffeaf5; background: #8b315b; border-color: #ff83c4 !important; }
.battle-leave-button.confirming { color: #1b0710; background: #ffd866; border-color: #fff4bf !important; box-shadow: 4px 4px 0 #7c421d; }
.battle-top-actions button:hover { filter: brightness(1.18); transform: translateY(-2px); }

@media (max-width: 760px) {
  .mode-solamon-stage { right: 6px; bottom: 31px; left: 6px; gap: 3px; height: 58px; }
  .mode-fighter,
  .mode-fighter .monster-art { width: 52px; height: 52px; }
}

@media (orientation: landscape) and (max-width: 1100px) and (max-height: 650px) {
  .mode-solamon-stage { right: 8px; bottom: 25px; left: 8px; gap: 5px; height: 66px; }
  .mode-fighter,
  .mode-fighter .monster-art { width: 58px; height: 58px; }
  .arena-wrap { grid-template-rows: 56px auto minmax(0, 1fr) 42px; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: 56px minmax(0, 1fr) 42px; }
  .arena-wrap .battle-top { min-height: 56px; padding: 4px 7px; border-width: 7px; }
  .arena-wrap .battle-top .eyebrow { margin-bottom: 1px; font-size: 7px; }
  .arena-wrap .battle-top h2 { margin-bottom: 1px; font-size: 10px; }
  .arena-wrap .battle-top span { display: block; max-width: 58vw; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .battle-top-actions { gap: 4px; }
  .battle-top-actions button { min-height: 36px; padding: 5px 7px; border-width: 2px; font-family: 'VT323', monospace; font-size: 13px; font-weight: 700; box-shadow: 2px 2px 0 #030711; }
  .detail-profile { grid-template-columns: 1fr; grid-template-rows: 54px auto; flex: 0 0 auto; min-height: 78px; gap: 1px; padding: 1px; }
  .detail-profile .detail-art { min-height: 52px; height: 52px; }
  .detail-profile .detail-art .monster-art { width: 52px; height: 52px; }
  .detail-identity h2 { margin: 0; overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
  .detail-identity p,
  .detail-identity .level-pips { display: none; }
  .solamon-detail { gap: 2px; overflow: hidden; }
  .solamon-detail .trait-box { min-height: 22px; height: 22px; padding: 2px 3px; }
  .solamon-detail .trait-box span { display: none; }
  .detail-actions { gap: 2px; margin-top: auto; }
  .detail-actions .upgrade-button,
  .detail-actions .squad-toggle { min-height: 27px; padding: 2px 1px; font-size: 5px; line-height: 1.2; }
  .context-tip { right: 8px; bottom: 8px; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 6px; width: min(520px, calc(100vw - 16px)); padding: 6px 7px; border-width: 2px; box-shadow: 3px 3px 0 #020611; }
  .context-tip > span { font-size: 22px; }
  .context-tip b { font-size: 7px; }
  .context-tip p { margin-top: 2px; font-size: 11px; }
  .context-tip button { min-height: 34px; padding: 5px 7px; font-size: 6px; }
  .game-header .main-nav button > b,
  .mode-help button,
  .run-tabs button { font-size: 8px; }
  .mode-poster > div:last-child > b { font-family: VT323, monospace; font-size: 12px; line-height: 1; letter-spacing: .04em; }
  .run-add { min-height: 30px; font-family: VT323, monospace; font-size: 11px; font-weight: 700; }
  .run-start { min-height: 30px; font-family: VT323, monospace; font-size: 12px; font-weight: 700; }
  .arena-wrap .team-panel h3 { font-family: VT323, monospace; font-size: 11px; font-weight: 700; }
  .arena-wrap .unit-row small { font-size: 8px; }
  .arena-wrap.fight-phase .unit-row .monster-art,
  .arena-wrap.ended-phase .unit-row .monster-art { width: 40px; height: 40px; }
  .arena-wrap.fight-phase .unit-row small.unit-role,
  .arena-wrap.ended-phase .unit-row small.unit-role { display: block; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
  .action-buttons button,
  .battle-controls > .primary { min-height: 36px; font-size: 8px; }
  .arena-wrap .battle-controls { height: auto; max-height: none; }
  .detail-actions .upgrade-button,
  .detail-actions .squad-toggle { font-family: VT323, monospace; font-size: 10px; font-weight: 700; }
  .dispense-button,
  .ranked-queue,
  .tutorial-actions button { font-size: 8px; }
  .ranked-queue,
  .rank-rules > button { min-height: 30px; }
}

@media (orientation: landscape) and (max-width: 760px) and (max-height: 650px) {
  .game-header + #game-main:not(:has(.arena-wrap)) { padding-bottom: 42px; }
  .run-select-layout { grid-template: minmax(0, 56%) minmax(0, 44%) / 46% 54%; width: 100%; }
  .dex-screen { grid-template-rows: 24px 20px minmax(0, 1fr) 24px; gap: 2px; padding: 2px 6px; }
  .dex-title h1 { margin: 0; font-size: 10px; }
  .dex-title .window-kicker { font-size: 5px; }
  .dex-title, .dex-title span { font-size: 8px; }
  .dex-tabs button { font-size: 7px; }
  .dex-layout { grid-template: minmax(0, 38%) minmax(0, 62%) / 44% 56%; width: 100%; }
  .solamon-box { padding: 2px; border-width: 3px; }
  .box-label { min-height: 12px; height: 12px; padding: 0 2px; font-size: 7px; }
  .solamon-grid,
  .solamon-grid.full-dex { grid-auto-rows: 32px; gap: 2px; padding: 0 2px; }
  .solamon-slot { min-height: 32px; aspect-ratio: auto; }
  .solamon-slot small,
  .solamon-slot em,
  .solamon-slot .squad-mark { display: none; }
  .solamon-grid.full-dex .solamon-slot .monster-art,
  .solamon-slot .monster-art { width: 28px; height: 28px; }
  .solamon-detail { grid-template-rows: 32px 10px 26px; gap: 1px; padding: 1px; border-width: 3px; }
  .solamon-detail .detail-head,
  .solamon-detail .trait-box { display: none; }
  .detail-profile { grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: 32px; min-height: 32px; height: 32px; padding: 0; }
  .detail-profile .detail-art { min-height: 32px; height: 32px; }
  .detail-profile .detail-art .monster-art { width: 32px; height: 32px; }
  .detail-identity h2 { font-size: 8px; }
  .detail-stats { display: flex; height: 10px; gap: 1px; margin: 0; font-size: 7px; }
  .detail-stats span { padding: 1px; }
  .solamon-detail .trait-box { min-height: 12px; height: 12px; padding: 0 2px; font-size: 8px; }
  .solamon-detail .trait-box span { display: none; }
  .detail-actions { grid-template-columns: 1fr 1fr; gap: 2px; }
  .detail-actions .upgrade-button,
  .detail-actions .squad-toggle { min-height: 26px; height: 26px; font-size: 8px; }
  .squad-pane { padding: 1px; border-width: 5px; }
  .squad-heading { min-height: 12px; height: 12px; }
  .squad-heading h3 { font-size: 7px; }
  .squad-heading p,
  .squad-heading small,
  .squad-points { display: none; }
  .squad-list { grid-template: repeat(2, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr)); gap: 1px; }
  .squad-member-main { grid-template-columns: 9px 22px minmax(0, 1fr); padding: 0 1px; font-size: 9px; }
  .squad-member-main .monster-art { width: 20px; height: 20px; }
  .squad-member-main small { display: none; }
  .squad-points { min-height: 13px; margin: 0; padding: 1px 3px; font-size: 8px; }
  .egg-lab-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 52%) minmax(0, 48%); width: 100%; height: 100%; }
  .machine-bay { grid-template-columns: 58% 42%; }
  .egg-machine { width: 90px; }
  .hatch-platform { align-self: center; min-height: 0; height: 90%; }
  .hatch-egg { width: 65px; height: 65px; }
  .egg-catalog { grid-template-rows: auto minmax(0, 1fr) auto; gap: 1px; padding: 3px; border-width: 5px; }
  .egg-options { grid-template-columns: repeat(4, 1fr); }
  .egg-option { display: block; min-height: 0; height: 100%; padding: 0; }
  .egg-option-art { width: 18px; height: 18px; margin: auto; }
  .selected-egg { display: none; }
  .dispense-button { min-height: 28px; height: 28px; padding: 1px; }
  .ranked-console { grid-template-columns: 1fr; grid-template-rows: 43% 57%; width: 100%; height: 100%; }
  .rank-rules { display: none; }
  .player-rank-card { display: grid; grid-template: auto auto / 76px minmax(0, 1fr) 130px; align-items: center; gap: 1px 6px; padding: 3px; }
  .compact-emblem { grid-area: 1 / 1 / 3 / 2; width: 68px; height: 68px; }
  .player-rank-card > strong { grid-area: 1 / 2; margin: 0; font-size: 15px; }
  .player-rank-card > small { grid-area: 2 / 2; }
  .player-rank-card > em,
  .player-rank-card > p { display: none; }
  .rank-mini-stats { grid-area: 2 / 2; align-self: end; margin: 0; transform: translateY(13px); }
  .rank-mini-stats span { padding: 1px 3px; }
  .ranked-queue { grid-area: 1 / 3 / 3 / 4; min-height: 38px; }
  .leaderboard-head { min-height: 24px; padding: 2px 4px; }
  .ranked-console .rank-row { min-height: 0; height: calc((100% - 24px) / 8); padding: 0 3px; font-size: 8px; }
  .arena-wrap { grid-template-rows: 44px 24px minmax(0, 1fr) 40px; }
  .arena-wrap > * { min-width: 0; max-width: 100%; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: 44px minmax(0, 1fr) 40px; }
  .arena-wrap .battle-top { min-height: 44px; padding: 1px 4px; border-width: 5px; }
  .arena-wrap .battle-top span { display: none; }
  .battle-top-actions button { min-width: 104px; min-height: 30px; font-size: 12px; }
  .arena-wrap .timeline { height: 24px; }
  .arena-wrap .timeline > b { width: 38px; font-size: 6px; }
  .arena-wrap .timeline .monster-art { width: 17px; height: 17px; }
  .arena-layout { grid-template: minmax(0, 1fr) 58px / 1fr 1fr; }
  .arena-layout > .board { width: auto; height: 100%; max-width: 100%; }
  .arena-wrap .team-panel { grid-template: 16px minmax(0, 1fr) / repeat(3, 1fr); height: 58px; }
  .arena-wrap .team-panel h3 { font-size: 8px; }
  .arena-wrap .battle-controls { height: 40px; padding-block: 2px; }
  .action-buttons button,
  .battle-controls > .primary { min-height: 32px; height: 32px; }
}

/* Final cycle 8 overrides must win over the compact legacy queries above. */
.solamon-grid > .solamon-slot,
.solamon-grid > .locked-slot { align-self: stretch; box-sizing: border-box; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; }
.locked-slot small { font-size: clamp(20px, 2.2vw, 34px); line-height: 1; }
.egg-option-art .static-egg-frame { opacity: 1; animation: none; }
.hatch-platform.idle .hatch-egg { display: none; }

@media (max-width: 760px), (pointer: coarse) and (max-height: 650px) {
  html,
  body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  #app { height: auto; min-height: 100dvh; overflow: visible; }
  #app > main { flex: none; width: 100%; height: auto; min-height: 620px; overflow: visible; padding-bottom: var(--mobile-nav, 58px); }
  .game-header { position: sticky; z-index: 100; top: 0; }
  .title-screen,
  .mode-hub,
  .run-select-screen,
  .dex-screen,
  .egg-lab,
  .ranked-v2,
  .arena-wrap { height: 620px; min-height: 620px; overflow: visible; }
  .orientation-gate { height: 100dvh; min-height: 0; overflow: hidden; }
  .locked-slot small { display: block; font-size: 15px; }
  .hatch-ready { width: min(150px, 82%); padding: 8px 5px; }
  .hatch-ready span { font-size: 9px; }
  .hatch-ready small { font-size: 5px; }
}

/* Cycle 14: settings sliders, attack preview, mode facts, ranked console v3, denser grids. */
.setting-slider { display: grid; grid-template-columns: 1fr 110px 44px; align-items: center; gap: 8px; width: 100%; margin: 6px 0; padding: 9px 12px; color: inherit; background: #1c2438; border: 2px solid #46536c; font-size: 15px; text-align: left; }
.setting-slider b { text-align: right; color: #7cebd6; }
.setting-slider input[type="range"] { width: 100%; accent-color: #67f2dc; }

.arena-wrap .battle-controls { position: relative; }
.mode-facts { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 10px 0 0; }
.mode-facts span { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; background: rgba(4,10,20,.62); border: 2px solid rgba(103,242,220,.28); }
.mode-facts small { color: #8fd8cc; font-size: 12px; letter-spacing: .6px; white-space: nowrap; }
.mode-facts b { font-size: 21px; text-align: right; white-space: nowrap; }
.mode-suggested { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 7px; background: rgba(4,10,20,.5); border: 2px dashed rgba(217,255,131,.35); }
.mode-suggested small { color: #d9ff83; font-size: 10px; letter-spacing: .6px; }
.mode-suggested > span { display: flex; gap: 2px; }
.mode-suggested .monster-art { width: 30px; height: 30px; border: 0; background: transparent; box-shadow: none; }

.ranked-console { grid-template-columns: 250px minmax(320px, 1fr) minmax(240px, .75fr) 230px; }
.match-history { min-height: 0; overflow: hidden auto; background: #111a31; border: 3px solid #4c5879; }
.history-row { display: grid; grid-template-columns: 30px 1fr auto auto; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #232f4d; font-size: 15px; }
.history-row b { display: grid; place-items: center; width: 24px; height: 24px; font-family: 'Press Start 2P', monospace; font-size: 10px; }
.history-row.win b { color: #10240f; background: #a9ef76; }
.history-row.loss b { color: #2c0f18; background: #ff8fb8; }
.history-row em { font-style: normal; }
.history-row.win em { color: #a9ef76; }
.history-row.loss em { color: #ff8fb8; }
.history-row strong { color: #ffd866; }
.history-empty { padding: 14px; color: #98a7c0; font-size: 15px; }
.tier-progress { width: 100%; margin-top: 10px; text-align: left; }
.tier-progress small { display: block; margin-bottom: 4px; color: #98a7c0; font-size: 11px; letter-spacing: .4px; }
.queue-status { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: #a9ef76; font-size: 12px; letter-spacing: .5px; }
.queue-status i { width: 9px; height: 9px; background: #a9ef76; border-radius: 50%; box-shadow: 0 0 8px #a9ef76; animation: queue-pulse 1.6s ease-in-out infinite; }
@keyframes queue-pulse { 50% { opacity: .35; } }
.season-rewards { display: grid; gap: 4px; margin: 8px 0; }
.tier-reward { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 5px 8px; background: #0d1527; border-left: 4px solid #46536c; opacity: .62; }
.tier-reward.unlocked { border-left-color: #a9ef76; opacity: 1; }
.tier-reward.current { background: #182342; border-left-color: #ffd866; opacity: 1; box-shadow: inset 0 0 0 2px rgba(255,216,102,.35); }
.tier-reward b { font-family: 'Press Start 2P', monospace; font-size: 8px; align-self: center; }
.tier-reward span { grid-column: 2; font-size: 13px; color: #cfdaf0; }
.tier-reward small { grid-column: 2; color: #8fa0bd; font-size: 11px; }

.solamon-grid.full-dex .solamon-slot .monster-art,
.solamon-slot .monster-art { width: min(88px, 68%); }
.solamon-slot-main { padding: 6px 4px 15px; }
.run-locked { min-height: 110px; }
.run-slot .monster-art { width: min(80px, 56%); }

@media (max-width: 1180px) {
  .ranked-console { grid-template-columns: 240px minmax(300px, 1fr) 220px; }
  .match-history { display: none; }
}
@media (max-width: 900px) {
  .mode-facts b { font-size: 12px; }
  .mode-suggested { display: none; }
}


/* Cycle 15: starter type beside name, top-left battle names, clean sprites. */
.starter-card h3 .starter-type { font-family: 'VT323', monospace; font-size: 23px; font-style: normal; margin-left: 10px; vertical-align: middle; }
.unit-row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'name name' 'art copy'; align-items: center; gap: 2px 10px; }
.unit-row .unit-name { grid-area: name; display: block; justify-self: start; text-align: left; font-size: 18px; line-height: 1.1; }
.unit-row .monster-art { grid-area: art; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.unit-row .unit-copy { grid-area: copy; }
.unit-row .mobile-unit-hp { grid-area: art; }
.unit-stats i { font-size: 15px; }
.unit-role { font-size: 15px; }
@media (max-width: 760px) {
  .unit-row .unit-name { font-size: 14px; }
  .unit-stats i { font-size: 12px; }
  .unit-role { font-size: 12px; }
}

/* Deploy onboarding: pulse the squad first, then the legal cells while placing/dragging. */
@keyframes squad-attention {
  0%, 100% { box-shadow: 0 0 0 3px rgba(217, 255, 131, .95), 0 0 22px rgba(217, 255, 131, .55); }
  50% { box-shadow: 0 0 0 3px rgba(217, 255, 131, .25), 0 0 6px rgba(217, 255, 131, .15); }
}
@keyframes cell-attention {
  0%, 100% { box-shadow: inset 0 0 0 3px #5ee5f2, inset 0 0 14px rgba(94, 229, 242, .65); filter: brightness(1.22); }
  50% { box-shadow: inset 0 0 0 3px rgba(94, 229, 242, .35); filter: brightness(1); }
}
.arena-wrap.awaiting-pick .player-team { animation: squad-attention 1.15s ease-in-out infinite; }
.arena-wrap.placing .cell.legal:not(:has(.board-unit)),
.arena-wrap.drag-deploying .cell.legal:not(:has(.board-unit)) { animation: cell-attention .85s ease-in-out infinite; }
.arena-wrap.placing.drag-deploying .player-team,
.arena-wrap.drag-deploying.awaiting-pick .player-team { animation: none; }


/* Rival deployment: units drop in one at a time. */
@keyframes unit-spawn { from { opacity: 0; transform: translateY(-16px) scale(.4); filter: brightness(3); } to { opacity: 1; transform: none; filter: brightness(1); } }
.board-unit.spawning { animation: unit-spawn .42s steps(5) both; }

/* Cycle 16: airier Collection grid without tile names. */
.solamon-grid { gap: 12px; padding: 4px; }
.solamon-grid.full-dex .solamon-slot .monster-art,
.solamon-slot .monster-art { width: min(74px, 56%); }
@media (max-width: 900px) {
  .solamon-grid { gap: 6px; }
}

/* Deploy bar: readable copy and a properly sized READY button. */
.arena-wrap.deploy-phase .battle-controls { min-height: 64px; padding: 10px 18px; }
.arena-wrap.deploy-phase .battle-controls b { font-size: 14px; }
.arena-wrap.deploy-phase .battle-controls > div > span { font-size: 20px; color: #c8d4ea; }
.arena-wrap.deploy-phase .battle-controls .primary { margin-right: 6px; padding: 15px 30px; font-size: 13px; }
@media (max-height: 430px) {
  .arena-wrap.deploy-phase .battle-controls { min-height: 0; padding: 4px 8px; }
  .arena-wrap.deploy-phase .battle-controls b { font-size: 10px; }
  .arena-wrap.deploy-phase .battle-controls > div > span { font-size: 13px; }
  .arena-wrap.deploy-phase .battle-controls .primary { margin-right: 2px; padding: 8px 14px; font-size: 9px; }
}

/* Battle log, trait tooltips, egg odds. */
.battle-log { height: 74px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: #4c5879 transparent; }
.battle-log p { margin: 0 0 2px; color: #aab8d2; font-size: 15px; line-height: 1.2; }
.battle-log p:last-child { color: #eef5ff; font-size: 17px; }
.trait-tip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; cursor: pointer; }
.trait-info { display: inline-flex; align-items: center; padding: 2px 6px; color: #08131f; background: #8fd9ff; border-radius: 2px; font-family: 'Press Start 2P', monospace; font-size: .58em; letter-spacing: .5px; white-space: nowrap; }
.trait-tip:hover .trait-info, .trait-tip:focus-visible .trait-info { background: #c7edff; }
.trait-tip:hover { text-decoration: underline; text-underline-offset: 3px; }
.unit-row[data-inert] { opacity: .7; cursor: default; }
.unit-row.turn-unit[data-inert], .unit-row.deployed[data-inert] { opacity: 1; }
.selected-egg { flex-wrap: wrap; row-gap: 2px; }
.egg-odds-line { display: flex; gap: 6px; width: 100%; order: 3; }
.egg-odds-line i { padding: 1px 6px; background: #292231; font-style: normal; font-size: 13px; letter-spacing: .4px; }
.egg-odds-line .od-c { color: #cfd6e4; }
.egg-odds-line .od-r { color: #72d9ff; }
.egg-odds-line .od-e { color: #a379df; }
.egg-odds-line .od-l { color: #ffd866; }
@media (max-height: 500px) {
  .battle-log { height: 40px; }
  .battle-log p { font-size: 11px; }
  .battle-log p:last-child { font-size: 13px; }
}

/* Online arena: three FIFO pools, wallet-gated identity and live earnings. */
.online-lobby .player-rank-card { overflow: auto; scrollbar-width: thin; }
.online-tier-list { display: grid; gap: 7px; width: 100%; margin: 10px 0; }
.online-tier-list button { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; width: 100%; padding: 9px; color: #edf5ff; text-align: left; background: #17233d; border: 2px solid #53688d; box-shadow: 2px 2px 0 #070b15; }
.online-tier-list button:hover, .online-tier-list button:focus-visible { border-color: #5ee5f2; background: #203354; }
.online-tier-list button span { font-family: 'Press Start 2P', monospace; font-size: 8px; color: #5ee5f2; }
.online-tier-list button small { grid-column: 1; color: #96a7c8; font-size: 13px; }
.online-tier-list button b { grid-column: 2; grid-row: 1 / 3; color: #ffd866; font-size: 13px; }
.online-lobby .wallet-connect { background: #5ee5f2; border-color: #d9fbff; color: #08131f; box-shadow: 4px 4px 0 #1d5263; }
.online-lobby .queue-cancel { background: #ff6b87; border-color: #ffd3dc; color: #260b14; }
.online-protocol { padding-bottom: 8px; overflow: auto; }
.protocol-step { display: grid; grid-template-columns: 30px 1fr; gap: 9px; align-items: center; padding: 11px 9px; border-bottom: 1px solid #3d4968; }
.protocol-step b { display: grid; place-items: center; width: 27px; aspect-ratio: 1; color: #07101a; background: #5ee5f2; font-family: 'Press Start 2P', monospace; font-size: 8px; }
.protocol-step span { color: #bdc9df; font-size: 16px; line-height: 1.1; }
.online-lobby .rank-row { grid-template-columns: 42px minmax(100px, 1fr) 110px 130px; }
.online-lobby .rank-row strong { color: #a8ef74; }
.online-lobby .rank-rules > button { width: 100%; margin-top: 6px; }
.online-lobby .queue-status { color: #5ee5f2; }
.arena-wrap.online-arena .battle-controls { border-color: #5ee5f2; }
@media (max-width: 1100px) {
  .online-lobby .rank-row { grid-template-columns: 34px minmax(90px, 1fr) 90px 100px; }
}
@media (max-height: 500px) {
  .online-tier-list { grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 3px 0; }
  .online-tier-list button { display: block; padding: 4px; text-align: center; box-shadow: none; }
  .online-tier-list button span { font-size: 6px; }
  .online-tier-list button small { display: none; }
  .online-tier-list button b { display: block; margin-top: 2px; font-size: 9px; }
  .protocol-step { padding: 4px; }
  .protocol-step b { width: 19px; font-size: 6px; }
  .protocol-step span { font-size: 11px; }
}

/* Battle turn timer */
.arena-wrap { position: relative; }
.battle-timer { display: inline-flex; align-items: baseline; gap: 6px; align-self: flex-start; margin-top: 6px; padding: 3px 10px; font-family: 'Press Start 2P', monospace; color: #bfe3ff; background: rgba(7, 14, 29, .85); border: 2px solid #2f6d86; }
.battle-timer[hidden] { display: none; }
.battle-timer span { font-size: 9px; letter-spacing: 1px; color: #7fb9d6; }
.battle-timer b { min-width: 26px; font-size: 20px; color: #eaf7ff; text-align: right; }
.battle-timer small { font-size: 10px; color: #7fb9d6; }
.battle-timer.urgent { color: #ffd7db; border-color: #ff5d6c; animation: timerPulse .6s steps(2, end) infinite; }
.battle-timer.urgent b { color: #ff8189; }
@keyframes timerPulse { 50% { background: rgba(92, 12, 22, .9); } }

/* Start / victory / defeat banner */
.result-banner { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.result-banner span { padding: 14px 26px; font-family: 'Press Start 2P', monospace; font-size: clamp(34px, 8vw, 88px); letter-spacing: 2px; color: #fff; text-shadow: 5px 5px 0 rgba(0, 0, 0, .55); animation: bannerSlam .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.result-banner.victory span { color: #ffe37a; text-shadow: 5px 5px 0 #7a4a00, 0 0 26px rgba(255, 214, 90, .6); }
.result-banner.defeat span { color: #ff8189; text-shadow: 5px 5px 0 #5a0a12, 0 0 26px rgba(255, 90, 110, .5); }
.result-banner.draw span { color: #bcd2ea; text-shadow: 5px 5px 0 #1a2c44; }
.result-banner.intro span { color: #8ef0ff; text-shadow: 5px 5px 0 #06485a, 0 0 26px rgba(94, 229, 242, .6); animation: bannerZoom .5s cubic-bezier(.2, 1.4, .4, 1) both, bannerFade .35s ease-in 1.1s both; }
@keyframes bannerSlam { 0% { transform: scale(2.4); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes bannerZoom { 0% { transform: scale(.2) rotate(-8deg); opacity: 0; } 70% { transform: scale(1.1) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes bannerFade { to { opacity: 0; transform: scale(1.3); } }
.motion-off .result-banner span { animation: none; }
.motion-off .battle-timer.urgent { animation: none; }

/* Online PvP stakes selection */
.stakes-screen { display: flex; flex-direction: column; gap: 16px; width: min(1180px, 100%); margin: auto; padding: 18px clamp(12px, 2vw, 28px) 28px; }
.stakes-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.stakes-head h1 { margin: 4px 0 0; font-family: 'Press Start 2P', monospace; font-size: clamp(20px, 3vw, 34px); color: #eaf7ff; }
.stakes-head .window-kicker { color: #6fe0ff; }
.stakes-back { align-self: center; padding: 10px 16px; color: #cfe0f5; background: #16233c; border: 2px solid #3d4a68; font-family: 'VT323', monospace; font-size: 17px; cursor: pointer; }
.stakes-back:hover { border-color: #62ecff; color: #fff; }
.stakes-intro { max-width: 880px; color: #b9c7de; font-size: clamp(14px, 1.5vw, 17px); line-height: 1.5; }
.stakes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(10px, 1.4vw, 18px); }
.stakes-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; color: #e9f3ff; text-align: left; background: linear-gradient(180deg, rgba(14,26,46,.96), rgba(8,16,30,.96)); border: 3px solid #33507a; box-shadow: 6px 6px 0 rgba(3,8,16,.5); cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; }
.stakes-card:hover { transform: translateY(-3px); border-color: #62ecff; box-shadow: 8px 10px 0 rgba(3,8,16,.55); }
.stakes-card.low { border-top: 6px solid #62e8d4; }
.stakes-card.medium { border-top: 6px solid #ffd96a; }
.stakes-card.high { border-top: 6px solid #ff7aa8; }
.stakes-card.chosen { border-color: #ffd96a; box-shadow: 0 0 0 3px rgba(255,217,106,.5), 8px 10px 0 rgba(3,8,16,.55); }
.stakes-card-head { display: flex; flex-direction: column; gap: 4px; }
.stakes-tag { align-self: flex-start; padding: 3px 8px; font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 1px; color: #04121f; background: #62e8d4; }
.stakes-card.medium .stakes-tag { background: #ffd96a; }
.stakes-card.high .stakes-tag { background: #ff7aa8; }
.stakes-card-head b { font-family: 'Press Start 2P', monospace; font-size: 15px; color: #fff; }
.stakes-card-head small { color: #8aa0bf; font-size: 12px; letter-spacing: .3px; }
.stakes-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0; border-block: 1px solid #2c3d5c; }
.stakes-figures small { display: block; color: #8aa0bf; font-size: 11px; letter-spacing: .4px; }
.stakes-figures strong { font-family: 'Press Start 2P', monospace; font-size: 15px; color: #eaf7ff; }
.stakes-pot strong { color: #ffd96a; }
.stakes-blurb { color: #b9c7de; font-size: 13.5px; line-height: 1.45; }
.stakes-facts { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.stakes-facts li { color: #9fb2d0; font-size: 12.5px; line-height: 1.35; }
.stakes-choose { margin-top: auto; padding-top: 8px; color: #62ecff; font-family: 'VT323', monospace; font-size: 18px; letter-spacing: .5px; }
.stakes-card.chosen .stakes-choose { color: #ffd96a; }
.stakes-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: #8aa0bf; font-family: 'VT323', monospace; font-size: 16px; }
@media (max-width: 860px) {
  .stakes-grid { grid-template-columns: 1fr; }
  .stakes-head { flex-direction: column; align-items: flex-start; }
}

/* Tall desktop: keep the battle top compact so the squad panels get the height.
   Flex column avoids relying on grid auto-row stretch, which was ballooning the
   top bar and squeezing the Solamon rows into an unreadable strip. */
@media (min-width: 761px) and (min-height: 801px) {
  .arena-wrap { display: flex; flex-direction: column; height: calc(100svh - 88px); min-height: 0; overflow: hidden; }
  .arena-wrap .battle-top { flex: 0 0 auto; min-height: 0; max-height: none; align-content: center; }
  .arena-wrap .timeline { flex: 0 0 auto; }
  .arena-wrap .arena-layout { flex: 1 1 auto; height: auto; min-height: 0; }
  .arena-wrap .battle-controls { flex: 0 0 auto; }
  .arena-wrap .team-panel { height: 100%; }
  .battle-top-actions { align-items: center; }
}
.battle-subline { margin: 3px 0 0; color: #8aa0bf; font-size: clamp(12px, 1.5vh, 15px); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Squad panels: match the row count to the fighters actually shown so 3-unit
   combat cards fill the panel instead of sitting in a 6-slot grid half empty. */
@media (min-width: 761px) {
  .arena-wrap.fight-phase .team-panel,
  .arena-wrap.ended-phase .team-panel { grid-template-rows: auto repeat(3, minmax(0, 1fr)); }
  .arena-wrap.deploy-phase .team-panel { grid-template-rows: auto repeat(6, minmax(0, 1fr)); }
  .arena-wrap.deploy-phase .unit-row .monster-art { width: clamp(46px, 6vh, 72px); height: clamp(46px, 6vh, 72px); }
  .arena-wrap.deploy-phase .unit-row b { font-size: clamp(17px, 2vh, 23px); }
  .arena-wrap.deploy-phase .unit-stats i { padding: 4px 7px; font-size: clamp(12px, 1.5vh, 16px); }
  .arena-wrap.fight-phase .unit-row,
  .arena-wrap.ended-phase .unit-row { align-content: center; }
}

/* Bigger, readable combat status line now that the buttons live up top. */
@media (min-width: 761px) {
  .arena-wrap .battle-controls b { font-size: clamp(17px, 2.1vh, 24px); }
  .arena-wrap .battle-controls b small { font-size: clamp(15px, 1.95vh, 22px); }
  .arena-wrap .battle-controls span { font-size: clamp(15px, 1.9vh, 21px); }
  .arena-wrap .battle-controls .move-key,
  .arena-wrap .battle-controls .attack-key { font-size: clamp(14px, 1.85vh, 20px); padding: 4px 9px; }
}

/* Cycle 19: clearer tactical flow, resilient sprites, Collection tools and access. */
html, body { background-color: #050a14; }
.skip-link {
  position: fixed;
  z-index: 9999;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #06131e;
  background: #d9ff83;
  border: 3px solid #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
:where(button, input, [role="button"], [tabindex="0"]):focus-visible { outline: 3px solid #fff08a; outline-offset: 2px; }

.monster-art.has-sprite.sprite-loading { overflow: hidden; }
.monster-art.has-sprite.sprite-loading::after {
  content: '';
  position: absolute;
  z-index: 3;
  inset: 14%;
  border: 2px solid color-mix(in srgb, var(--c) 70%, #fff);
  opacity: .62;
  animation: sprite-scan .7s steps(4) infinite;
  pointer-events: none;
}
.sprite-fallback { display: none !important; }
.monster-art.sprite-failed .sprite-fallback {
  position: absolute;
  z-index: 6;
  inset: 6%;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--c);
  background: rgba(5,13,27,.94);
  border: 2px dashed currentColor;
  cursor: pointer;
  pointer-events: auto;
}
.sprite-fallback b { font-size: clamp(16px, 2.4vw, 34px); }
.sprite-fallback small { color: #eef8ff; font-family: 'VT323', monospace; font-size: clamp(10px, 1vw, 15px); }
@keyframes sprite-scan { 50% { opacity: .18; transform: scale(.9); } }

.dex-toolbar { display: grid; grid-template-columns: minmax(390px, 1fr) minmax(180px, 260px) auto; gap: 6px; min-width: 0; }
.dex-search { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; min-width: 0; color: #76f4dc; background: #0c1628; border: 2px solid #4d5b79; }
.dex-search > b { text-align: center; font-size: 21px; }
.dex-search input { width: 100%; height: 100%; min-width: 0; padding: 4px 7px; color: #eef8ff; background: transparent; border: 0; outline: 0; font-family: 'VT323', monospace; font-size: 18px; text-transform: uppercase; }
.dex-search input::placeholder { color: #8090aa; opacity: 1; }
.dex-search:focus-within { border-color: #76f4dc; box-shadow: inset 0 0 0 1px #76f4dc; }
.dex-ownership { display: grid; grid-template-columns: repeat(3, minmax(62px, 1fr)); gap: 3px; }
.dex-ownership button { padding: 3px 7px; color: #b9c4d8; background: #1b253e; border: 2px solid #4d5b79; font-family: 'VT323', monospace; font-size: 16px; }
.dex-ownership button.active { color: #081920; background: #76f4dc; border-color: #d9fff8; }
.dex-empty-grid { grid-column: 1 / -1; display: grid; place-items: center; align-content: center; gap: 10px; min-height: 180px; color: #8392ac; border: 2px dashed #3b4966; text-align: center; }
.dex-empty-grid b { color: #e7effc; font-family: 'Press Start 2P', monospace; font-size: 13px; }
.dex-empty-grid span { font-size: 18px; }

.battle-flow { display: flex; align-items: center; gap: 5px; margin: 5px 0 0; padding: 0; list-style: none; }
.battle-flow li { display: flex; align-items: center; gap: 5px; padding: 4px 7px; color: #71809a; background: rgba(5,13,27,.78); border: 2px solid #34425d; font-family: 'Press Start 2P', monospace; font-size: clamp(6px, .65vw, 9px); white-space: nowrap; }
.battle-flow li + li::before { content: '›'; margin-left: -12px; margin-right: 4px; color: #73829c; }
.battle-flow i { display: grid; place-items: center; width: 17px; height: 17px; color: #06131e; background: #71809a; font-style: normal; }
.battle-flow li.done { color: #82a09b; border-color: #42645e; }
.battle-flow li.done i { background: #5b8179; }
.battle-flow li.available { color: #d8e7fb; border-color: #4f6b8f; }
.battle-flow li:nth-child(2).available { color: #8cf8ff; border-color: #51dce8; }
.battle-flow li:nth-child(3).available { color: #ff9dce; border-color: #ff66b8; }
.battle-flow li:nth-child(4).available { color: #ffe184; border-color: #d5a83d; }
.battle-flow li.active { color: #06131e; background: #ffe26e; border-color: #fff6ba; box-shadow: 0 0 14px rgba(255,226,110,.4); }
.battle-flow li.active i { background: #071522; color: #ffe26e; }

.arena-wrap .cell.choice-move { border-color: #77f4ff; box-shadow: inset 0 0 0 2px rgba(119,244,255,.72), inset 0 0 22px rgba(45,212,224,.26); }
.move-marker { position: absolute; z-index: 3; inset: 50% auto auto 50%; color: #aafaff; font-size: clamp(8px, 1.1vw, 15px); text-shadow: 0 0 8px #23d6e2; transform: translate(-50%,-50%); pointer-events: none; }
.arena-wrap .cell.choice-attack { border-color: #ff86c5; box-shadow: inset 0 0 0 3px rgba(255,102,184,.78), inset 0 0 24px rgba(255,60,154,.25); }
.board-unit.ko-unit { z-index: 16; animation: unit-ko .62s steps(6) both; filter: grayscale(1) brightness(2); }
.board-unit.ko-unit .monster-art { animation: unit-ko-fall .62s steps(6) both; }
.result-banner.turn span { color: #a8f8ff; font-size: clamp(24px, 6vw, 64px); text-shadow: 4px 4px 0 #06485a, 0 0 24px rgba(94,229,242,.55); animation: bannerSlam .32s steps(4) both, bannerFade .25s ease-in .55s both; }
.unit-row.turn-unit { animation: turn-row-in .45s steps(4) both; }
@keyframes unit-ko { 35% { transform: translateY(-8px) scale(1.15); } 100% { transform: translateY(18px) scale(.35); opacity: 0; } }
@keyframes unit-ko-fall { to { transform: rotate(18deg); } }
@keyframes turn-row-in { 50% { filter: brightness(1.45); } }

@media (pointer: coarse) {
  :where(.main-nav button, .pixel-menu-button, .dex-toolbar button, .command-bar button, .battle-top-actions button, .battle-controls button, .detail-actions button) { min-height: 44px; }
}

@media (pointer: coarse) and (orientation: landscape) and (min-width: 761px) and (max-width: 1100px) {
  .arena-wrap.deploy-phase .arena-layout,
  .arena-wrap.fight-phase .arena-layout,
  .arena-wrap.ended-phase .arena-layout { grid-template-columns: 132px minmax(0, 1fr) 132px; max-width: 900px; gap: 5px; }
  .arena-wrap .team-panel { padding: 2px; border-width: 7px; }
  .arena-wrap .team-panel h3 { font-family: 'VT323', monospace; font-size: 12px; }
  .arena-wrap .unit-row { grid-template-columns: 38px minmax(0,1fr); grid-template-areas: 'art name' 'art copy'; gap: 1px 3px; padding: 2px; }
  .arena-wrap .unit-row .monster-art { width: 38px; height: 38px; }
  .arena-wrap .unit-row .unit-name { font-family: 'VT323', monospace; font-size: 13px; }
  .arena-wrap .unit-stats i:nth-child(n+2),
  .arena-wrap .unit-role { display: none; }
  .unit-hp-line { margin-top: 2px; }
}

@media (orientation: landscape) and (max-width: 760px) and (max-height: 650px) {
  .dex-screen { grid-template-rows: 30px 90px minmax(0, 1fr) 24px; }
  .dex-title h1 { font-size: 12px; }
  .dex-title .window-kicker { font-size: 6px; }
  .dex-toolbar { grid-template: 44px 44px / minmax(0, 1fr) auto; gap: 2px 4px; }
  .dex-tabs { grid-area: 1 / 1 / 2 / 3; }
  .dex-tabs button { color: #dbe6f7; font-size: 9px; }
  .dex-search { grid-template-columns: 20px minmax(0, 1fr); }
  .dex-search > b { font-size: 15px; }
  .dex-search input { padding: 1px 4px; font-size: 15px; }
  .dex-ownership { min-width: 174px; }
  .dex-ownership button { min-height: 44px; padding: 1px 3px; border-width: 1px; font-size: 12px; }
  .battle-flow { gap: 2px; margin-top: 2px; }
  .battle-flow li { gap: 2px; padding: 2px 4px; border-width: 1px; font-family: 'VT323', monospace; font-size: 10px; font-weight: 700; }
  .battle-flow li + li::before { margin-left: -7px; margin-right: 1px; }
  .battle-flow i { width: 13px; height: 13px; }
  .arena-wrap .battle-top { min-height: 58px; }
  .arena-wrap { grid-template-rows: 58px 24px minmax(0, 1fr) 44px; }
  .arena-wrap:not(:has(.timeline)) { grid-template-rows: 58px minmax(0, 1fr) 44px; }
  .arena-wrap .battle-top-actions button { min-height: 40px; }
  .arena-wrap .team-panel { height: 52px; grid-template: 14px minmax(0, 1fr) / repeat(3, 1fr); }
  .arena-layout { grid-template-rows: minmax(0, 1fr) 52px; }
  .arena-layout > .board { justify-self: center; }
  .arena-wrap .unit-row .monster-art { width: 34px; height: 34px; }
  .arena-wrap .battle-controls { min-height: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
.motion-off *, .motion-off *::before, .motion-off *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }

/* Live HP shown beside the health bar in the squad cards (board badges removed) */
.unit-hp-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.unit-hp-line .unit-health { flex: 1 1 auto; margin-top: 0; }
.unit-hp-num { flex: 0 0 auto; color: #eaf7ff; font-family: 'Press Start 2P', monospace; font-size: clamp(12px, 1.6vh, 17px); line-height: 1; white-space: nowrap; }
.unit-hp-num small { color: #8aa0bf; font-size: .72em; }
.enemy .unit-hp-num { color: #ffd3e6; }

.result-banner.fx-float { position: fixed; z-index: 200; }

/* Economy v2: $SOLAMON eggs stay visible but locked until the token launches. */
.egg-option.locked { opacity: .55; }
.egg-option.locked em { color: #c9a3ff; }
