:root {
  --ink: #101820;
  --paper: #f3e9d2;
  --grime: #243746;
  --cyan: #5ce1e6;
  --yellow: #ffd447;
  --orange: #ff7b2c;
  --green: #8dc63f;
  --red: #e34f4f;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, #2a4350 0, transparent 36%),
    #0b1117;
  color: var(--paper);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

#game-shell {
  display: grid;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  place-items: center;
}

#game-frame {
  position: relative;
  width: min(calc(100vw - 16px), calc((100dvh - 16px) * 16 / 9));
  max-height: calc(100dvh - 16px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: clamp(3px, 0.45vw, 7px) solid #0c1115;
  border-radius: clamp(12px, 1.4vw, 22px);
  background: #243746;
  box-shadow:
    0 24px 70px #000a,
    inset 0 0 0 2px #ffffff12;
  isolation: isolate;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: clamp(18px, 3.4vw, 52px);
  place-items: center;
  text-align: center;
  background:
    linear-gradient(90deg, #0d1824ee 0%, #122431dc 48%, #0a2230e8 100%),
    url("assets/art/environments/office/office-battlefield-v1.webp?av=2") center / cover;
  transition: opacity 180ms ease;
}

.screen.hidden,
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.splash-screen {
  place-items: end center;
  background:
    linear-gradient(180deg, #0000 55%, #071018c7 82%, #071018f4 100%),
    url("assets/art/branding/smooth-brains-vs-smartasses-splash.webp?av=3") center / cover no-repeat;
}

.loading-card {
  display: grid;
  width: min(540px, 78vw);
  gap: 0.4rem;
  justify-items: center;
  padding: 0.8rem 1rem;
  border: 1px solid #ffffff25;
  border-radius: 16px;
  background: #081017dc;
  box-shadow: 0 12px 35px #000b;
}

.splash-menu-panel {
  display: grid;
  width: min(780px, 94%);
  grid-template-columns: minmax(230px, 1fr) auto;
  align-items: center;
  gap: 0.35rem 1rem;
  padding: clamp(10px, 1.5vw, 18px);
  border-radius: 17px;
  background: #071018e8;
}

.splash-menu-panel .briefing {
  grid-row: span 2;
  margin: 0;
}

.splash-menu-panel .text-btn {
  margin: 0;
}

.splash-menu-panel .primary-btn {
  min-width: min(250px, 38vw);
}

.splash-menu-panel .secondary-btn {
  padding-inline: 0.8em;
}

.btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.menu-panel {
  width: min(720px, 87%);
  padding: clamp(18px, 3vw, 40px);
  border: 2px solid #ffffff23;
  border-radius: 24px;
  background: #101820e8;
  box-shadow: 0 20px 70px #000a;
}

.eyebrow {
  margin-bottom: 0.6rem;
  color: var(--yellow);
  font-size: clamp(9px, 1.1vw, 15px);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 0.35em;
  margin: 0;
  filter: drop-shadow(0 5px 0 #081015);
  font-size: clamp(35px, 6vw, 82px);
  font-weight: 1000;
  letter-spacing: -0.07em;
  line-height: 0.85;
  text-transform: uppercase;
  transform: rotate(-1deg);
}

h1 span {
  color: var(--yellow);
  -webkit-text-stroke: 2px #563916;
}

h1 strong {
  color: var(--cyan);
  -webkit-text-stroke: 2px #123d52;
}

h1 small {
  color: var(--orange);
  font-size: 0.38em;
  letter-spacing: 0;
  -webkit-text-stroke: 1px #622b13;
}

.tagline {
  margin: 1.2rem 0;
  color: #fff7df;
  font-size: clamp(13px, 1.5vw, 20px);
  font-style: italic;
}

.briefing {
  display: grid;
  gap: 0.35rem;
  margin: 1rem auto 1.35rem;
  padding: 0.85rem 1rem;
  border-left: 5px solid var(--yellow);
  border-radius: 7px;
  background: #ffffff0c;
  text-align: left;
}

.briefing b {
  color: var(--yellow);
}

.briefing span {
  color: #d8e0df;
  font-size: clamp(11px, 1.15vw, 15px);
  line-height: 1.4;
}

.primary-btn,
.secondary-btn,
.text-btn {
  border: 0;
  cursor: pointer;
}

.primary-btn {
  min-width: min(330px, 78vw);
  padding: 0.82em 1.4em;
  border: 2px solid #fff6;
  border-radius: 12px;
  background: linear-gradient(#ffdd59, #f5a623);
  box-shadow:
    0 6px 0 #9b5319,
    0 11px 25px #0007;
  color: #251706;
  font-size: clamp(14px, 1.5vw, 21px);
  font-weight: 1000;
  text-transform: uppercase;
}

.primary-btn:hover,
.primary-btn:focus-visible {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.primary-btn:active {
  box-shadow: 0 2px 0 #9b5319;
  transform: translateY(4px);
}

.secondary-btn {
  padding: 0.78em 1.1em;
  border: 2px solid #ffffff42;
  border-radius: 12px;
  background: #263b4bef;
  box-shadow: 0 5px 0 #0a161f;
  color: #f2f0e6;
  font-size: clamp(12px, 1.2vw, 17px);
  font-weight: 900;
  white-space: nowrap;
}

.secondary-btn:hover,
.secondary-btn:focus-visible {
  border-color: var(--cyan);
  background: #315166;
}

.text-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: #d8e0df;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.dialog-card {
  width: min(590px, 89%);
  padding: clamp(20px, 3.5vw, 42px);
  border: 2px solid #ffffff24;
  border-radius: 22px;
  background: #101820ef;
  box-shadow: 0 22px 70px #000b;
}

.dialog-card h2 {
  margin: 0.1rem 0 1rem;
  color: var(--yellow);
  font-size: clamp(28px, 4vw, 54px);
  line-height: 0.95;
  text-transform: uppercase;
}

.dialog-card ol {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0;
  padding-left: 1.5rem;
  color: #e9eceb;
  text-align: left;
}

.dialog-card p {
  color: #cbd3d2;
  line-height: 1.5;
}

#loading-screen {
  z-index: 30;
}

#loading-label {
  margin: 0;
  color: #d8e0df;
}

.loading-track {
  width: min(480px, 72vw);
  height: 18px;
  overflow: hidden;
  border: 2px solid #fff7;
  border-radius: 999px;
  background: #0008;
}

#loading-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: repeating-linear-gradient(90deg, #ff5151 0 14%, #ffd447 14% 28%, #71d059 28% 42%, #4ac7e6 42% 56%, #7d6be8 56% 70%, #e963b2 70% 84%);
  transition: width 160ms ease;
}

.settings-card {
  width: min(520px, 90%);
}

.squad-panel {
  width: min(1040px, 95%);
  max-height: 96%;
  padding: clamp(16px, 2.4vw, 30px);
  overflow: auto;
  border: 2px solid #ffffff24;
  border-radius: 22px;
  background: #101820f2;
  box-shadow: 0 22px 70px #000b;
}

.campaign-panel {
  width: min(1160px, 97%);
  max-height: 96%;
  padding: clamp(12px, 1.8vw, 24px);
  overflow: auto;
  border: 2px solid #ffffff24;
  border-radius: 22px;
  background: #101820f4;
  box-shadow: 0 22px 70px #000b;
}

.campaign-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
}

.campaign-heading h2 {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(25px, 3.5vw, 46px);
  line-height: 0.9;
  text-transform: uppercase;
}

.campaign-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.campaign-actions .text-btn {
  margin: 0;
  font-size: 11px;
}

.campaign-worlds {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 0.8vw, 11px);
  margin-top: 0.85rem;
}

.world-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #ffffff24;
  border-radius: 13px;
  background: #ffffff08;
}

.world-column h3 {
  min-height: 48px;
  margin: 0;
  padding: 0.55rem 0.45rem;
  background: linear-gradient(135deg, var(--world-accent, #ffd447) 0 5px, #182733 5px);
  color: #fff;
  font-size: clamp(10px, 1vw, 14px);
  line-height: 1.15;
}

.world-column h3 small {
  display: block;
  margin-bottom: 2px;
  color: var(--world-accent, #ffd447);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.level-list {
  display: grid;
  gap: 4px;
  padding: 5px;
}

.level-select-card {
  position: relative;
  display: grid;
  min-height: 49px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid #ffffff1f;
  border-radius: 7px;
  background: #15232dee;
  color: #e9eceb;
  cursor: pointer;
  text-align: left;
}

.level-select-card:hover,
.level-select-card:focus-visible,
.level-select-card.current {
  border-color: var(--world-accent, #ffd447);
  background: #263b4b;
}

.level-select-card.locked {
  filter: saturate(0.55);
  opacity: 0.68;
}

.level-select-card.completed {
  box-shadow: inset 3px 0 var(--world-accent, #8dc63f);
}

.level-number {
  color: var(--world-accent, #ffd447);
  font-size: 16px;
  font-weight: 1000;
  text-align: center;
}

.level-card-copy {
  min-width: 0;
}

.level-card-copy b,
.level-card-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-card-copy b {
  font-size: clamp(8px, 0.78vw, 11px);
}

.level-card-copy small {
  color: #9facab;
  font-size: 8px;
}

.campaign-note {
  margin: 0.55rem 0 0;
  color: #9facab;
  font-size: 9px;
}

.debug-overlay {
  z-index: 25;
  background: #071018d9;
}

.debug-card {
  width: min(720px, 93%);
}

.debug-level-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
  text-align: left;
}

.debug-level-row select {
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid #ffffff42;
  border-radius: 8px;
  background: #182733;
  color: #fff;
  font: inherit;
}

.debug-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.debug-actions button {
  padding: 0.65rem 0.35rem;
  border: 1px solid #ffffff32;
  border-radius: 8px;
  background: #263b4b;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.debug-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.85rem 0;
  text-align: left;
}

.debug-toggles label {
  padding: 0.55rem;
  border-radius: 7px;
  background: #ffffff0a;
  color: #dce3e2;
  font-size: 12px;
}

.debug-card p {
  margin: 0.55rem 0 0.8rem;
  font-size: 11px;
}

.debug-card code {
  color: var(--cyan);
}

.debug-btn {
  width: auto !important;
  padding-inline: 0.65rem !important;
  color: var(--yellow) !important;
  font-size: clamp(8px, 0.8vw, 11px) !important;
}

.level-chip {
  flex: 1 1 auto;
}

.squad-panel h2 {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(27px, 4vw, 52px);
  line-height: 1;
  text-transform: uppercase;
}

.squad-panel > p {
  margin: 0.6rem auto 1rem;
  color: #cbd3d2;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(7px, 1vw, 12px);
}

.enemy-intel {
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ffffff20;
  border-radius: 12px;
  background: #081017a6;
  text-align: left;
}

.enemy-intel > b {
  color: var(--cyan);
  font-size: 11px;
  text-transform: uppercase;
}

.enemy-intel > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.enemy-intel span {
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--intel-color) 65%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--intel-color) 12%, #101820);
  color: #f5f6f2;
  font-size: 10px;
  font-weight: 900;
}

.enemy-intel small {
  margin-left: 5px;
  color: var(--intel-color);
  font-size: 8px;
  text-transform: uppercase;
}

.roster-card {
  position: relative;
  display: grid;
  min-height: clamp(130px, 16vw, 190px);
  align-content: center;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 2px solid #ffffff24;
  border-radius: 14px;
  background: #182733ee;
  color: #f1eee3;
  cursor: pointer;
  text-align: center;
}

.roster-card:hover,
.roster-card:focus-visible {
  border-color: #ffffff70;
  transform: translateY(-2px);
}

.roster-card.selected {
  border-color: var(--yellow);
  background: #2b3b43f4;
  box-shadow: inset 0 0 0 2px #ffd4472b;
}

.roster-card.selected::after {
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--yellow);
  content: "✓";
  font-weight: 1000;
}

.roster-card.unavailable {
  filter: grayscale(0.9);
  opacity: 0.3;
  cursor: not-allowed;
}

.roster-card.subclass::before {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 5px;
  border-radius: 5px;
  background: #824ca7;
  color: #fff;
  content: "ADV";
  font-size: 8px;
  font-weight: 1000;
}

.roster-tier {
  position: absolute;
  top: 8px;
  right: 9px;
  color: #ffffff99;
  font-size: 9px;
  font-weight: 1000;
}

.roster-element {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: var(--element-color);
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.roster-glyph {
  font-size: clamp(28px, 4vw, 52px);
}

.roster-card b {
  font-size: clamp(11px, 1.2vw, 16px);
}

.roster-card small {
  min-height: 2.4em;
  color: #aeb9b8;
  font-size: clamp(8px, 0.8vw, 11px);
}

.roster-card em {
  color: var(--yellow);
  font-size: clamp(9px, 0.9vw, 12px);
  font-style: normal;
  font-weight: 900;
}

.squad-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.squad-actions .primary-btn {
  min-width: min(250px, 35vw);
}

#squad-count {
  min-width: 110px;
  color: #cbd3d2;
  font-size: 12px;
  font-weight: 900;
}

.settings-body {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 1.4rem;
}

.setting-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #ffffff1f;
  border-radius: 10px;
  background: #ffffff0a;
  text-align: left;
}

.setting-row span {
  display: grid;
}

.setting-row b {
  color: #f2f0e6;
}

.setting-row small {
  color: #9eaaa9;
}

.setting-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--yellow);
}

.volume-row input[type="range"] {
  width: min(230px, 45vw);
  accent-color: var(--yellow);
}

#hud {
  position: absolute;
  z-index: 8;
  top: calc(clamp(7px, 1.2vw, 16px) + env(safe-area-inset-top, 0px));
  right: calc(clamp(7px, 1.2vw, 16px) + env(safe-area-inset-right, 0px));
  left: calc(clamp(7px, 1.2vw, 16px) + env(safe-area-inset-left, 0px));
  display: flex;
  align-items: stretch;
  gap: clamp(5px, 0.8vw, 12px);
  pointer-events: none;
}

.hud-chip {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.6em;
  padding: clamp(5px, 0.8vw, 10px) clamp(8px, 1.2vw, 15px);
  border: 1px solid #fff3;
  border-radius: 10px;
  background: #101820e5;
  box-shadow: 0 5px 14px #0006;
  color: #f2f0e6;
}

.hud-chip span {
  display: grid;
}

.hud-chip b {
  overflow: hidden;
  font-size: clamp(10px, 1.15vw, 16px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-chip small {
  overflow: hidden;
  color: #9eaaa9;
  font-size: clamp(7px, 0.7vw, 10px);
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.resource-chip {
  border-color: #ffda5770;
}

.crayon-icon,
.mini-crayon {
  display: inline-block;
  border: 2px solid #451b2d;
  background: linear-gradient(90deg, #ef476f 0 45%, #ffd166 45% 56%, #ef476f 56% 100%);
  transform: rotate(-12deg);
}

.crayon-icon {
  width: clamp(8px, 1.2vw, 15px);
  height: clamp(25px, 3vw, 39px);
  clip-path: polygon(50% 0, 100% 13%, 100% 88%, 50% 100%, 0 88%, 0 13%);
}

.icon-btn {
  width: clamp(32px, 3.7vw, 48px);
  border: 1px solid #fff3;
  border-radius: 10px;
  background: #101820e5;
  box-shadow: 0 5px 14px #0006;
  color: var(--yellow);
  cursor: pointer;
  font-weight: 1000;
  pointer-events: auto;
}

#pause-btn {
  margin-left: auto;
}

#unit-tray {
  position: absolute;
  z-index: 9;
  bottom: calc(clamp(7px, 1.2vw, 16px) + env(safe-area-inset-bottom, 0px));
  left: calc(clamp(7px, 1.2vw, 16px) + env(safe-area-inset-left, 0px));
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#unit-cards {
  display: flex;
  gap: clamp(5px, 0.65vw, 9px);
}

.play-dough-btn {
  display: grid;
  min-width: clamp(76px, 8vw, 104px);
  min-height: clamp(60px, 7vw, 88px);
  place-items: center;
  padding: 0.3rem 0.5rem;
  border: 2px solid #c989ff88;
  border-radius: 13px;
  background: #271638ed;
  box-shadow: 0 7px 18px #0008;
  color: #f7eaff;
  cursor: pointer;
  pointer-events: auto;
}

.play-dough-btn span {
  font-size: clamp(20px, 2.2vw, 31px);
  line-height: 1;
}

.play-dough-btn b {
  color: #e8b7ff;
  font-size: clamp(13px, 1.5vw, 20px);
}

.play-dough-btn small {
  font-size: clamp(7px, 0.72vw, 10px);
  font-weight: 900;
}

.play-dough-btn[aria-pressed="true"] {
  border-color: #f0c8ff;
  background: #583074f2;
  box-shadow: 0 0 0 3px #c989ff35, 0 7px 18px #0008;
}

.play-dough-btn:disabled {
  filter: grayscale(0.8);
  opacity: 0.45;
  cursor: not-allowed;
}

.unit-card {
  position: relative;
  display: grid;
  width: clamp(142px, 17vw, 218px);
  min-height: clamp(60px, 7vw, 88px);
  grid-template-columns: clamp(52px, 6vw, 78px) 1fr auto;
  align-items: center;
  gap: clamp(5px, 0.8vw, 10px);
  overflow: hidden;
  padding: 0.25rem 0.55rem 0.25rem 0.1rem;
  border: 2px solid #fff4;
  border-radius: 13px;
  background: #111b23ed;
  box-shadow: 0 7px 18px #0008;
  color: #f7f1df;
  cursor: pointer;
  text-align: left;
}

.unit-card .unit-glyph {
  display: grid;
  width: 100%;
  height: clamp(42px, 5vw, 65px);
  place-items: center;
  font-size: clamp(25px, 3vw, 39px);
}

.unit-card:hover,
.unit-card[aria-pressed="true"] {
  border-color: var(--yellow);
  background: #263642f4;
  transform: translateY(-2px);
}

.unit-card.disabled {
  filter: grayscale(0.85) brightness(0.66);
}

.unit-card img {
  width: 100%;
  height: clamp(52px, 6.4vw, 80px);
  object-fit: contain;
  filter: drop-shadow(0 4px 3px #0009);
}

.unit-card-copy {
  display: grid;
  min-width: 0;
}

.unit-card-copy b {
  overflow: hidden;
  font-size: clamp(10px, 1.1vw, 15px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-card-copy small {
  color: #aab6b5;
  font-size: clamp(7px, 0.75vw, 10px);
}

.unit-cost {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--yellow);
  font-size: clamp(12px, 1.35vw, 18px);
  font-weight: 1000;
}

.mini-crayon {
  width: 7px;
  height: 20px;
}

.card-cooldown {
  position: absolute;
  inset: auto 0 0;
  height: 0;
  background: #091118aa;
  pointer-events: none;
}

#tray-hint {
  max-width: 190px;
  margin-bottom: 0.4rem;
  color: #fff;
  font-size: clamp(8px, 0.8vw, 11px);
  font-weight: 800;
  filter: drop-shadow(0 2px 2px #000);
}

.toast {
  position: absolute;
  z-index: 15;
  top: 16%;
  left: 50%;
  padding: 0.55em 1em;
  border: 1px solid #fff4;
  border-radius: 999px;
  background: #101820e8;
  box-shadow: 0 7px 20px #0008;
  color: var(--yellow);
  font-size: clamp(11px, 1.3vw, 17px);
  font-weight: 1000;
  pointer-events: none;
  transform: translateX(-50%);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 1rem 0 1.4rem;
}

.result-stats span {
  padding: 0.65rem 0.35rem;
  border-radius: 8px;
  background: #ffffff0d;
  color: #9facab;
  font-size: clamp(8px, 0.85vw, 11px);
  text-transform: uppercase;
}

.result-stats b {
  display: block;
  color: #fff;
  font-size: clamp(18px, 2vw, 29px);
}

.promotion-card {
  width: min(760px, 94vw);
}

.promotion-media {
  display: grid;
  min-height: min(44vh, 330px);
  place-items: center;
  overflow: hidden;
  margin: 1rem 0 0.7rem;
  border: 1px solid #ffffff24;
  border-radius: 16px;
  background: #050b10;
}

.promotion-media img,
.promotion-media video {
  display: block;
  width: 100%;
  max-height: min(48vh, 380px);
  object-fit: contain;
}

.promotion-disclosure {
  color: #aeb9b8;
  font-size: 11px;
}

.promotion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

#build-version {
  position: absolute;
  z-index: 40;
  right: 6px;
  bottom: 4px;
  color: #ffffff66;
  font: 8px/1 monospace;
  pointer-events: none;
}

#rotate-hint {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  padding: 2rem;
  place-items: center;
  background: #081017f7;
  text-align: center;
}

.rotate-card {
  display: grid;
  gap: 0.5rem;
  color: var(--paper);
}

.rotate-card span {
  color: var(--yellow);
  font-size: 64px;
}

.rotate-card b {
  font-size: 22px;
}

.rotate-card small {
  color: #9facab;
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-hint {
    display: grid;
  }
}

/* Match Candy Dash on a phone held sideways: the browser viewport is the
   frame. Remove the decorative desktop inset, border and rounded corners so
   fullscreen has no artificial gutter around the game. */
@media (orientation: landscape) and (pointer: coarse) {
  #game-shell {
    padding: 0;
  }

  #game-frame {
    width: min(100vw, calc(100dvh * 16 / 9));
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-height: 520px) {
  .splash-menu-panel {
    width: min(720px, 96%);
    grid-template-columns: minmax(0, 1.2fr) minmax(210px, 0.8fr);
    gap: 6px 10px;
    padding: 10px;
  }

  .splash-menu-panel .btn-row {
    width: 100%;
    flex-direction: column;
    gap: 6px;
  }

  .splash-menu-panel .primary-btn,
  .splash-menu-panel .secondary-btn {
    width: 100%;
    min-width: 0;
    padding: 0.62em 0.75em;
  }

  .splash-menu-panel .text-btn {
    justify-self: center;
    padding: 0.2rem 0.6rem;
  }

  .menu-panel,
  .dialog-card {
    padding: 14px 24px;
  }

  .tagline,
  .briefing {
    margin-top: 0.65rem;
    margin-bottom: 0.65rem;
  }

  .dialog-card ol {
    gap: 0.25rem;
    margin: 0.5rem 0;
  }

  .squad-panel {
    padding: 10px 16px;
  }

  .squad-panel > p {
    margin: 0.3rem auto 0.55rem;
  }

  .roster-card {
    min-height: 112px;
    padding: 0.45rem;
  }

  .squad-actions {
    margin-top: 0.55rem;
  }

  .campaign-panel {
    max-height: 98%;
    padding: 8px 12px;
  }

  .campaign-worlds {
    margin-top: 0.45rem;
  }

  .world-column h3 {
    min-height: 39px;
    padding-block: 0.35rem;
  }

  .level-select-card {
    min-height: 39px;
  }

  .campaign-note {
    margin-top: 0.25rem;
  }

  .debug-card {
    width: min(760px, 96%);
    padding: 10px 18px;
  }

  .debug-card h2 {
    margin-bottom: 0.5rem;
    font-size: 31px;
  }

  .debug-level-row,
  .debug-toggles {
    margin-bottom: 0.5rem;
  }
}
