:root {
  --bg: #0f1722;
  --bg-panel: rgba(13, 25, 39, 0.86);
  --bg-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(220, 202, 164, 0.22);
  --gold: #d8b56a;
  --gold-soft: rgba(216, 181, 106, 0.15);
  --text: #f4efe3;
  --muted: #c5c9d3;
  --danger: #ff7a7a;
  --good: #8ee29b;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(216, 181, 106, 0.16), transparent 32%),
    linear-gradient(180deg, #162233 0%, #0b1118 100%);
}

button,
select,
input {
  font: inherit;
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.panel {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 20px;
  border-radius: 28px;
  padding: 28px;
  margin-bottom: 20px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.77rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cinzel", serif;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.3rem);
  line-height: 0.95;
}

.lede,
.help-text,
.rules-list,
.meta-text {
  color: var(--muted);
}

.hero-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
}

.hero-stat {
  padding: 14px;
  border-radius: 18px;
  background: var(--bg-soft);
}

.hero-stat span,
.player-card label,
.compact-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.hero-stat strong {
  font-size: 1.15rem;
}

.layout {
  display: grid;
  gap: 20px;
}

.panel {
  border-radius: 24px;
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.inline-actions-start {
  justify-content: flex-start;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.primary-button {
  color: #16120b;
  background: linear-gradient(135deg, #f3d084, #c79d49);
  font-weight: 700;
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.setup-grid,
.player-forms,
.scoreboard {
  display: grid;
  gap: 16px;
}

.setup-grid,
.scoreboard {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.player-forms {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.player-card,
.score-card,
.action-card {
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.player-card h3,
.score-card h3,
.action-card h3 {
  margin-bottom: 14px;
}

.tower-grid,
.action-grid,
.inline-grid,
.details-grid {
  display: grid;
  gap: 12px;
}

.tower-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.details-grid {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.stat-pill,
.tower-pill,
.intel-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 8px 0 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.9rem;
}

.tower-box,
.subtle-box {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.tower-box.dead {
  border: 1px solid rgba(255, 122, 122, 0.35);
  background: rgba(255, 122, 122, 0.08);
}

.action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-row {
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.submitted-card {
  outline: 1px solid rgba(142, 226, 155, 0.35);
  background: rgba(142, 226, 155, 0.07);
}

.distributed-grid {
  display: grid;
  gap: 10px;
}

.distributed-row {
  display: grid;
  gap: 8px;
}

.action-row.disabled {
  opacity: 0.5;
}

.action-row select,
.action-row input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(8, 13, 20, 0.7);
}

.status-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--gold-soft);
  color: var(--text);
  border: 1px solid rgba(216, 181, 106, 0.28);
  box-shadow: 0 0 0 1px rgba(216, 181, 106, 0.1) inset;
  font-weight: 600;
}

.status-banner.status-banner--tutorial-hint {
  border-color: rgba(240, 206, 136, 0.85);
  background: linear-gradient(180deg, rgba(72, 48, 18, 0.95), rgba(36, 24, 12, 0.96));
  box-shadow:
    0 0 0 1px rgba(240, 206, 136, 0.35) inset,
    0 0 24px rgba(216, 181, 106, 0.25);
  color: #f6e2b0;
}

.log {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.log-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.log-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.log-tab.active {
  background: var(--gold-soft);
  border-color: rgba(216, 181, 106, 0.4);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 16, 0.72);
}

.modal-card {
  position: relative;
  width: min(860px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 16px auto;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.move-guide-content {
  display: grid;
  gap: 12px;
}

.move-guide-section {
  display: grid;
  gap: 10px;
}

.move-guide-section-grid {
  display: grid;
  gap: 12px;
}

.settings-button {
  min-width: 52px;
  padding: 10px 14px;
  font-size: 1.2rem;
  line-height: 1;
}

.settings-card {
  width: min(460px, calc(100vw - 24px));
}

.settings-menu {
  display: grid;
  gap: 12px;
}

.settings-menu-button {
  width: 100%;
  justify-content: center;
}

.settings-menu-button-danger {
  color: #fff1f1;
  background: rgba(170, 39, 39, 0.92);
}

.practice-card {
  width: min(640px, calc(100vw - 24px));
}

.practice-mode-button {
  min-height: 72px;
  font-size: 1.05rem;
}

.log-entry {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.log-entry strong {
  color: var(--text);
}

.hidden {
  display: none;
}

body.tutorial-active {
  scroll-behavior: smooth;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.12);
  pointer-events: none;
}

.tutorial-card {
  position: fixed;
  top: 20px;
  right: 20px;
  left: auto;
  bottom: auto;
  width: min(520px, calc(100vw - 28px));
  padding: 24px 26px;
  border-radius: 20px;
  border: 1px solid rgba(216, 181, 106, 0.5);
  background: rgba(10, 18, 30, 0.98);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
  z-index: 201;
  pointer-events: auto;
  transform: none;
}

.tutorial-card.tutorial-card--left {
  right: auto;
  left: 20px;
}

.tutorial-card h2 {
  margin: 6px 0 12px;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
}

.tutorial-text {
  margin: 0 0 20px;
  font-size: 1.05rem;
  line-height: 1.65;
}

.tutorial-actions {
  gap: 10px;
}

.tutorial-focus {
  position: relative;
  z-index: 53;
  outline: 4px solid rgba(216, 181, 106, 0.9);
  outline-offset: 6px;
  border-radius: 18px;
  box-shadow:
    0 0 0 2px rgba(255, 236, 179, 0.35),
    0 0 24px rgba(216, 181, 106, 0.35);
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.03);
  scroll-margin-top: 140px;
  scroll-margin-bottom: 140px;
  scroll-margin-left: 24px;
  scroll-margin-right: 24px;
}

.tutorial-focus.arena-tower,
.tutorial-focus.dock-button,
.tutorial-focus.move-chip,
.tutorial-focus.secondary-button,
.tutorial-focus.primary-button {
  border-radius: 22px;
}

/* Keep all three character columns visible during First Mission setup. */
body.tutorial-active #setup-grid .tower-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.tutorial-active #ready-button.tutorial-focus {
  position: relative;
  z-index: 54;
}

.warning-text {
  color: var(--danger);
  font-size: 0.9rem;
}

.good-text {
  color: var(--good);
}

.rules-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
}

details summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 700;
}

.arena-shell {
  display: block;
}

.arena-board {
  position: relative;
  border-radius: 28px;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 14%, rgba(216, 181, 106, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.arena-hud {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.arena-stat,
.arena-title {
  border-radius: 20px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.arena-stat span,
.arena-title span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.arena-stat strong,
.arena-title strong {
  font-size: 1.45rem;
}

.arena-title {
  text-align: center;
}

.arena-field {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: clamp(360px, 42vh, 560px);
  border-radius: 30px;
  margin-bottom: 0;
  padding: 28px 12px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.05), transparent 50%),
    linear-gradient(180deg, rgba(7, 12, 19, 0.72), rgba(10, 17, 26, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.07);
  /* visible: nations use translate(-50%,-50%); top spawns sit partly above anchor — hidden clipped titles/towers */
  overflow: visible;
  isolation: isolate;
}

.arena-field.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px 14px;
  align-content: start;
  overflow: hidden;
}

.arena-field.is-grid::after {
  inset: 12px;
}

.arena-field::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.arena-nation {
  position: absolute;
  width: min(100%, 330px);
  max-width: calc(100% - 8px);
  transform: translate(-50%, -50%);
  z-index: 1;
}

.arena-field.playercount-4:not(.is-grid) .arena-nation {
  width: min(100%, 288px);
}

.arena-field.playercount-4:not(.is-grid) .arena-cluster {
  gap: 4px 6px;
}

.arena-field.playercount-4:not(.is-grid) .arena-tower {
  max-width: 96px;
  min-height: 112px;
}

.arena-field.playercount-4:not(.is-grid) .arena-tower-frame {
  min-height: 106px;
  padding: 8px 6px 10px;
}

.arena-field.playercount-4:not(.is-grid) .arena-tower-crest {
  font-size: 1.4rem;
}

.arena-field.playercount-4:not(.is-grid) .arena-tower-name {
  font-size: 0.56rem;
}

.arena-nation--grid {
  position: relative;
  width: 100%;
  max-width: none;
  transform: none;
  left: auto;
  top: auto;
  z-index: 1;
}

.arena-nation-name {
  margin-bottom: 10px;
  text-align: center;
  color: var(--text);
  font-family: "Cinzel", serif;
  letter-spacing: 0.05em;
}

.arena-field.is-grid .arena-nation-name {
  text-align: left;
  padding-left: 6px;
}

.arena-cluster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 8px;
  justify-items: stretch;
  align-items: start;
  width: 100%;
}

@keyframes arena-tower-idle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes arena-hp-shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes arena-select-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(255, 214, 120, 0.55),
      0 0 18px rgba(255, 200, 80, 0.35),
      inset 0 0 24px rgba(255, 220, 140, 0.08);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(255, 230, 160, 0.85),
      0 0 28px rgba(255, 210, 100, 0.55),
      inset 0 0 28px rgba(255, 235, 180, 0.12);
  }
}

.arena-tower {
  --hp-pct: 100;
  width: 100%;
  max-width: 112px;
  min-width: 0;
  justify-self: center;
  min-height: 128px;
  position: relative;
  border: none;
  border-radius: 0;
  padding: 0;
  color: var(--text);
  cursor: default;
  overflow: visible;
  background: transparent;
  animation: arena-tower-idle 4.5s ease-in-out infinite;
  transition: transform 160ms ease, filter 160ms ease;
}

.arena-tower-sheen {
  position: absolute;
  inset: 0;
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.14) 0%,
    transparent 38%,
    transparent 62%,
    rgba(255, 255, 255, 0.06) 100%
  );
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

.arena-tower-frame {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 124px;
  padding: 10px 8px 12px;
  border-radius: 12px 12px 16px 16px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  justify-items: center;
  gap: 6px;
  background:
    linear-gradient(180deg, rgba(12, 18, 28, 0.95) 0%, rgba(8, 12, 20, 0.98) 100%);
  border: 3px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 10px 0 rgba(0, 0, 0, 0.35),
    0 14px 24px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nation-azure .arena-tower .arena-tower-frame {
  border-color: rgba(79, 164, 255, 0.72);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 10px 0 rgba(0, 0, 0, 0.35),
    0 14px 24px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(79, 164, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nation-verdant .arena-tower .arena-tower-frame {
  border-color: rgba(129, 208, 110, 0.72);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 10px 0 rgba(0, 0, 0, 0.35),
    0 14px 24px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(129, 208, 110, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nation-amber .arena-tower .arena-tower-frame {
  border-color: rgba(236, 208, 75, 0.78);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 10px 0 rgba(0, 0, 0, 0.35),
    0 14px 24px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(236, 208, 75, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nation-crimson .arena-tower .arena-tower-frame {
  border-color: rgba(241, 96, 96, 0.75);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 10px 0 rgba(0, 0, 0, 0.35),
    0 14px 24px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(241, 96, 96, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.arena-tower-crest {
  font-size: 1.65rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
}

.arena-tower-hpbar {
  width: 100%;
  height: 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.arena-tower-hpfill {
  display: block;
  height: 100%;
  width: calc(var(--hp-pct) * 1%);
  border-radius: 3px;
  background: linear-gradient(180deg, #7dff9a 0%, #2db84a 45%, #0f6a2e 100%);
  box-shadow:
    0 0 10px rgba(80, 255, 140, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: width 280ms cubic-bezier(0.33, 1, 0.68, 1);
}

.arena-tower--obscured .arena-tower-hpfill {
  width: 100% !important;
  opacity: 0;
}

.arena-tower--obscured .arena-tower-hpbar {
  background: repeating-linear-gradient(
    -45deg,
    rgba(40, 48, 62, 0.95),
    rgba(40, 48, 62, 0.95) 6px,
    rgba(28, 34, 44, 0.95) 6px,
    rgba(28, 34, 44, 0.95) 12px
  );
  background-size: 200% 200%;
  animation: arena-hp-shimmer 2.8s linear infinite;
  border-color: rgba(255, 255, 255, 0.18);
}

.arena-tower.is-destroyed .arena-tower-hpfill {
  width: 0 !important;
  opacity: 0;
}

.arena-tower.is-destroyed .arena-tower-frame {
  filter: grayscale(0.85) brightness(0.75);
  border-color: rgba(80, 80, 90, 0.6);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 8px 0 rgba(0, 0, 0, 0.4),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.arena-tower.is-destroyed {
  animation: none;
  opacity: 0.88;
}

.arena-tower.is-destroyed .arena-tower-crest {
  filter: grayscale(1) brightness(0.7);
}

.arena-tower-name {
  font-family: "Orbitron", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: #f0ebe0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.arena-tower-meta {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
  color: #a8b4c8;
  text-align: center;
  letter-spacing: 0.03em;
}

.arena-nation.is-self .arena-tower-meta {
  color: #9ef0b0;
  text-shadow: 0 0 8px rgba(120, 255, 160, 0.35);
}

.arena-tower.is-selectable {
  cursor: pointer;
  animation: arena-select-pulse 1.2s ease-in-out infinite;
}

.arena-tower.is-selectable .arena-tower-frame {
  border-color: rgba(255, 220, 120, 0.95);
  box-shadow:
    0 0 0 2px rgba(255, 200, 80, 0.35),
    0 12px 0 rgba(0, 0, 0, 0.3),
    0 18px 32px rgba(255, 190, 60, 0.25),
    inset 0 0 20px rgba(255, 220, 140, 0.12);
}

.arena-tower.is-selectable:hover {
  transform: translateY(-5px) scale(1.04);
  filter: brightness(1.08);
}

.arena-tower.is-selectable:hover .arena-tower-frame {
  border-color: #ffe08a;
}

.arena-tower-threat {
  position: absolute;
  top: -10px;
  left: -8px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(177, 48, 48, 0.94);
  color: #fff4ef;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
}

.arena-tower-intel {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 92px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(53, 110, 175, 0.94);
  color: #eef7ff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
  z-index: 4;
}

.arena-tower-threat-icon {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, #fff4ef 0 28%, transparent 30%),
    radial-gradient(circle at center, transparent 0 48%, #fff4ef 50% 68%, transparent 70%);
}

.arena-damage-burst {
  position: absolute;
  top: -10px;
  right: -8px;
  z-index: 4;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.arena-damage-emoji {
  grid-area: 1 / 1;
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.arena-damage-value {
  grid-area: 1 / 1;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff8de;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transform: translateY(1px);
}

.arena-tower--parliament .arena-tower-hpfill {
  background: linear-gradient(180deg, #9ecbff 0%, #3d8eef 45%, #1a5caa 100%);
  box-shadow:
    0 0 10px rgba(100, 180, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.arena-tower--base .arena-tower-hpfill {
  background: linear-gradient(180deg, #c9ffa8 0%, #5cb83a 45%, #2a7018 100%);
  box-shadow:
    0 0 10px rgba(120, 220, 90, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.arena-tower--office .arena-tower-hpfill {
  background: linear-gradient(180deg, #ffe8a0 0%, #e8a82e 45%, #a86a0a 100%);
  box-shadow:
    0 0 10px rgba(255, 200, 80, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.arena-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
  min-width: 0;
}

.arena-side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
}

.arena-side-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.arena-side-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: start;
  gap: 4px;
  height: auto;
}

.arena-side-tab {
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: "Orbitron", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

.arena-side-tab.is-active {
  border-color: rgba(216, 181, 106, 0.55);
  background: rgba(216, 181, 106, 0.12);
  color: #f5e3b5;
}

.arena-side-tab-badge {
  margin-left: 4px;
  color: #ff9f7a;
}

.arena-side-body {
  min-height: 0;
  height: 100%;
}

.arena-side-panel {
  display: none;
}

.arena-side-panel.is-active {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.arena-reports-log.log {
  min-height: 0;
  max-height: none;
  height: 100%;
  overflow: auto;
}

.comms-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  height: 100%;
}

.comms-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comms-channel {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.comms-channel.is-active {
  border-color: rgba(216, 181, 106, 0.55);
  background: rgba(216, 181, 106, 0.14);
  color: #f5e3b5;
}

.arena-comms-log.chat-log {
  min-height: 0;
  max-height: none;
  height: 100%;
  overflow: auto;
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.arena-comms-compose.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-message-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.chat-message-time {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.chat-message.is-self {
  border-left: 2px solid rgba(216, 181, 106, 0.55);
  padding-left: 8px;
}

.bronze-war-table .arena-side-tabs {
  border-bottom: 1px solid rgba(179, 127, 64, 0.28);
  padding-bottom: 4px;
  gap: 3px;
}

.bronze-war-table .arena-side-tab {
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 0 6px;
  border-color: rgba(179, 127, 64, 0.35);
  border-radius: 4px;
  background: rgba(22, 15, 9, 0.55);
  font-family: "Cinzel", serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.bronze-war-table .arena-side-tab.is-active {
  border-color: rgba(240, 196, 108, 0.85);
  background: linear-gradient(180deg, rgba(105, 72, 38, 0.92), rgba(55, 36, 21, 0.96));
  color: #fff3d4;
}

.bronze-war-table .comms-channel {
  border-color: rgba(179, 127, 64, 0.35);
  background: rgba(22, 15, 9, 0.55);
  font-family: "Cinzel", serif;
}

.bronze-war-table .comms-channel.is-active {
  border-color: rgba(240, 196, 108, 0.85);
  background: linear-gradient(180deg, rgba(105, 72, 38, 0.92), rgba(55, 36, 21, 0.96));
  color: #fff3d4;
}

.bronze-war-table .arena-comms-log.chat-log,
.bronze-war-table .arena-reports-log.log {
  border-color: rgba(179, 127, 64, 0.35);
  background: rgba(22, 15, 9, 0.38);
}

@media (max-width: 920px) {
  .arena-side-tabs {
    grid-template-columns: 1fr;
  }

  .comms-channels {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .comms-channel {
    flex: 0 0 auto;
  }
}

.arena-command-deck {
  position: sticky;
  top: 10px;
  z-index: 12;
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 18px 18px;
  border-radius: 22px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(14, 22, 34, 0.98) 0%, rgba(8, 12, 20, 0.99) 100%);
  border: 3px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 12px 0 rgba(0, 0, 0, 0.28),
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 28px rgba(216, 181, 106, 0.08);
}

.chat-widget {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 10px;
}

.chat-widget-fab {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(10, 14, 22, 0.78);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
}

.chat-widget-fab-label {
  font-family: "Orbitron", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-widget-fab-count {
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  color: var(--gold);
}

.chat-widget-panel {
  pointer-events: auto;
  width: min(460px, calc(100vw - 44px));
  border-radius: 18px;
  padding: 14px;
  background: rgba(10, 14, 22, 0.62);
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 16px 40px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(216, 181, 106, 0.12);
  backdrop-filter: blur(16px);
}

.chat-widget-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.chat-widget-head > div {
  min-width: 0;
}

.chat-widget-head h3 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #eef2f8;
  line-height: 1.2;
}

.chat-widget-close.secondary-button {
  padding: 8px 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.chat-widget-log.chat-log {
  max-height: 320px;
  overflow: auto;
  border-radius: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

.chat-widget-compose.chat-compose {
  margin-top: 10px;
}

.chat-widget-compose input {
  background: rgba(8, 13, 20, 0.82);
}

.arena-command-deck-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.arena-command-deck-title {
  margin: 4px 0 0;
  font-family: "Orbitron", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f2ebe0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.arena-command-deck-hint {
  margin: 0;
  max-width: 420px;
  text-align: right;
  font-size: 0.82rem;
  line-height: 1.45;
}

.war-panel-kicker {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.war-panel-header h3 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #eef2f8;
}

.war-panel-badge {
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.arena-sidecard.war-panel {
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(12, 18, 28, 0.96) 0%, rgba(8, 12, 20, 0.98) 100%);
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 10px 0 rgba(0, 0, 0, 0.25),
    0 14px 28px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.arena-national-decision.decision-card-active {
  border-color: rgba(216, 181, 106, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 10px 0 rgba(0, 0, 0, 0.22),
    0 0 26px rgba(216, 181, 106, 0.2),
    inset 0 0 20px rgba(216, 181, 106, 0.06);
}

.arena-queue-card .orders-queue {
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.war-panel-inset {
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

.move-tray-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  text-align: center;
}

.move-tray-empty-text {
  margin: 0;
  font-size: 0.88rem;
  max-width: 36ch;
}

.arena-sidecard:not(.war-panel),
.move-tray:not(.move-tray-empty):not(.war-panel-inset),
.arena-dock {
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidecard-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.war-panel-header {
  align-items: flex-start;
}

.orders-queue {
  display: grid;
  gap: 10px;
}

.order-pill {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
}

.order-pill {
  align-items: start;
}

.order-pill div {
  display: grid;
  gap: 4px;
}

.order-pill strong {
  font-size: 0.92rem;
}

.order-pill span {
  color: var(--muted);
  font-size: 0.8rem;
}

.order-pill-decision {
  border: 1px solid rgba(216, 181, 106, 0.28);
}

.decision-card-active {
  border-color: rgba(216, 181, 106, 0.3);
  background: rgba(216, 181, 106, 0.09);
}

.order-remove {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
}

.arena-popup select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  color: var(--text);
  background: rgba(8, 13, 20, 0.7);
}

.arena-dock {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  background: transparent;
  border: none;
}

.dock-button,
.move-chip {
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 10px;
  display: grid;
  gap: 6px;
  text-align: left;
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.95) 0%, rgba(10, 14, 22, 0.98) 100%);
  color: var(--text);
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 8px 0 rgba(0, 0, 0, 0.28),
    0 12px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.dock-button span:first-child,
.move-chip span:first-child {
  font-family: "Orbitron", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #dce2ec;
  line-height: 1.25;
}

.dock-button strong,
.move-chip strong {
  font-family: "Orbitron", sans-serif;
  color: #f0d78c;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.dock-button:hover:not(:disabled),
.move-chip:hover:not(.is-disabled) {
  transform: translateY(-2px);
  border-color: rgba(216, 181, 106, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 10px 0 rgba(0, 0, 0, 0.22),
    0 16px 28px rgba(216, 181, 106, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.dock-button:disabled,
.move-chip:disabled,
.move-chip.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.move-chip.is-disabled {
  cursor: help;
}

.dock-button.is-active {
  border-color: rgba(255, 214, 120, 0.85);
  background: linear-gradient(180deg, rgba(40, 32, 18, 0.95) 0%, rgba(22, 18, 12, 0.98) 100%);
  box-shadow:
    0 0 0 2px rgba(216, 181, 106, 0.35),
    0 10px 0 rgba(0, 0, 0, 0.2),
    0 0 28px rgba(255, 200, 80, 0.2),
    inset 0 0 24px rgba(216, 181, 106, 0.1);
}

.move-chip.is-selected {
  border-color: rgba(255, 220, 140, 0.9);
  background: linear-gradient(180deg, rgba(45, 38, 22, 0.98) 0%, rgba(20, 16, 10, 0.99) 100%);
  box-shadow:
    0 0 0 2px rgba(216, 181, 106, 0.4),
    0 10px 0 rgba(0, 0, 0, 0.22),
    0 0 32px rgba(255, 190, 60, 0.22),
    inset 0 0 20px rgba(216, 181, 106, 0.12);
}

.move-tray:not(.move-tray-empty) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.command-actions,
.command-actions-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.command-actions-bar {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.command-bar-btn {
  min-height: 44px;
}

.command-bar-submit.primary-button {
  min-width: 160px;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow:
    0 8px 0 rgba(0, 0, 0, 0.25),
    0 12px 24px rgba(216, 181, 106, 0.15);
}

.move-tooltip {
  position: fixed;
  z-index: 4000;
  width: min(340px, calc(100vw - 32px));
  border-radius: 18px;
  padding: 12px 12px 10px;
  background: rgba(10, 14, 22, 0.62);
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 16px 40px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(216, 181, 106, 0.14);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.move-tooltip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.move-tooltip-title {
  font-family: "Orbitron", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #eef2f8;
}

.move-tooltip-cost {
  font-family: "Orbitron", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.move-tooltip-body {
  margin: 0 0 8px;
  line-height: 1.55;
  font-size: 0.92rem;
}

.move-tooltip-hint {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(197, 201, 211, 0.72);
}

.sidecard-subheader {
  margin-top: 14px;
}

.chat-shell {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.chat-log {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.chat-message {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-message.is-self {
  border-color: rgba(216, 181, 106, 0.28);
  background: rgba(216, 181, 106, 0.08);
}

.chat-message strong {
  color: var(--text);
}

.chat-message span {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.chat-compose input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(8, 13, 20, 0.7);
}

.arena-popup-backdrop {
  position: absolute;
  inset: 0;
  z-index: 29;
  background: rgba(7, 10, 16, 0.74);
  border-radius: 28px;
}

.arena-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: min(420px, calc(100% - 28px));
  transform: translate(-50%, -50%);
  border-radius: 22px;
  padding: 18px;
  background: rgba(12, 18, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.war-phase-popup {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: rgba(6, 10, 16, 0.72);
}

.war-phase-popup.hidden {
  display: none;
}

.war-phase-popup-card {
  width: min(520px, calc(100vw - 32px));
  padding: 24px 28px;
  border-radius: 24px;
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  color: var(--text);
  background: rgba(12, 18, 28, 0.94);
  border: 1px solid rgba(216, 181, 106, 0.4);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 18px;
  justify-items: center;
}

#war-phase-popup-title {
  margin: 0;
  color: #f1d49b;
  font-family: "Cinzel", serif;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
  letter-spacing: 0.04em;
}

#war-phase-popup-text {
  max-width: 34ch;
  margin: 0;
  color: var(--text);
  font-family: "Cinzel", serif;
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.war-phase-popup.outcome-defeat #war-phase-popup-title {
  color: #ef9f8e;
}

#war-phase-popup-button {
  width: min(220px, 50%);
  padding: 8px 12px;
  font-size: 0.88rem;
  min-width: 0;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .action-grid,
  .tower-grid,
  .inline-grid,
  .arena-dock,
  .arena-workspace,
  .arena-hud {
    grid-template-columns: 1fr;
  }

  .arena-command-deck {
    position: relative;
    top: auto;
    z-index: auto;
  }

  .chat-widget {
    left: 10px;
    bottom: 10px;
  }

  .arena-command-deck-head {
    flex-direction: column;
    align-items: stretch;
  }

  .arena-command-deck-hint {
    text-align: left;
    max-width: none;
  }

  .page-shell {
    width: min(100vw - 18px, 1400px);
  }

  .arena-field {
    min-height: max(360px, min(520px, 45dvh));
  }

  .arena-field.is-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px 12px;
  }

  .arena-nation {
    width: min(100%, 300px);
    max-width: min(300px, calc(100vw - 64px));
  }

  .arena-cluster {
    gap: 4px 6px;
  }

  .arena-tower {
    max-width: 96px;
    min-height: 112px;
  }

  .arena-tower-frame {
    min-height: 108px;
    padding: 8px 6px 10px;
  }

  .arena-tower-crest {
    font-size: 1.35rem;
  }

  .arena-tower-name {
    font-size: 0.55rem;
  }

  .command-actions,
  .command-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .command-bar-submit.primary-button {
    width: 100%;
  }

  .tutorial-card {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    padding: 20px;
  }

  .tutorial-card.tutorial-card--left {
    right: 12px;
    left: 12px;
  }
}

.profile-card {
  width: min(720px, calc(100vw - 32px));
  max-height: min(80vh, 900px);
  overflow: auto;
}

.match-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.match-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(216, 181, 106, 0.24);
  background: rgba(8, 16, 28, 0.72);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.match-list-item:hover {
  border-color: rgba(216, 181, 106, 0.5);
  background: rgba(12, 22, 36, 0.92);
}

.review-section {
  margin-bottom: 18px;
}

.review-section-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(216, 181, 106, 0.88);
}

.queue-status {
  margin-top: 0.75rem;
}

.auth-gate-panel,
.command-center-panel,
.home-menu-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: min(78vh, 760px);
}

.auth-gate-panel.hidden,
.command-center-panel.hidden,
.home-menu-panel.hidden {
  display: none;
}

.command-center-panel {
  border: none;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

.command-center-card {
  width: min(420px, 100%);
  text-align: center;
  padding: 12px 8px 4px;
}

.command-center-brand {
  margin-bottom: 28px;
}

.command-center-brand h2 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
}

.command-center-auth-button {
  width: 100%;
  margin-top: 18px;
}

.command-center-auth-redirect-button {
  width: 100%;
  margin-top: 12px;
}

.auth-mode-hint {
  margin-top: 16px;
  line-height: 1.5;
}

.command-center-panel.signed-out-view .command-center-card {
  width: min(1360px, 100%);
  min-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(32px, 6vw, 72px);
  border-radius: 28px;
  border: 1px solid rgba(115, 129, 151, 0.28);
  background: #0f1a28;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.command-center-panel.signed-out-view .command-center-brand {
  margin-bottom: 18px;
}

.command-center-panel.signed-out-view .command-center-brand h2 {
  font-size: clamp(2.25rem, 4vw, 3.1rem);
  line-height: 1.05;
}

.command-center-panel.signed-out-view .command-center-auth {
  width: min(420px, 100%);
}

.command-center-panel.signed-out-view .command-center-auth .lede {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
}

.command-center-panel.signed-out-view .command-center-auth .meta-text {
  min-height: 1.4em;
  margin-top: 14px;
}

.command-center-panel.signed-out-view .command-center-auth-button {
  width: 100%;
  min-height: 46px;
  margin-top: 28px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 30px rgba(199, 157, 73, 0.14);
}

.home-menu-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.home-menu-column.hidden {
  display: none;
}

.ranked-profile-card {
  display: grid;
  gap: 7px;
  padding: 16px 18px;
  text-align: left;
  border: 1px solid rgba(216, 181, 106, 0.4);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(216, 181, 106, 0.15), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ranked-profile-card .section-kicker {
  margin: 0;
}

.ranked-profile-card strong {
  font-family: "Cinzel", serif;
  font-size: 1.25rem;
  color: var(--text);
}

.ranked-profile-card .meta-text {
  display: block;
}

.ranked-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ranked-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c79d49, #f2d58d);
  transition: width 220ms ease;
}

.home-menu-button {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  color: var(--text);
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.home-menu-button:hover {
  border-color: rgba(216, 181, 106, 0.55);
  background: rgba(216, 181, 106, 0.12);
}

.home-menu-button-danger {
  color: var(--danger);
}

.home-modal-card {
  width: min(460px, calc(100vw - 32px));
}

.home-modal-actions {
  display: grid;
  gap: 12px;
}

.home-modal-action {
  width: 100%;
}

.commander-name-actions {
  width: 100%;
  justify-content: flex-end;
}

.commander-name-backdrop {
  pointer-events: none;
}

.commander-name-modal-open {
  overflow: hidden;
}

.account-confirm-actions {
  width: 100%;
  justify-content: flex-end;
}

.hero-compact {
  margin-bottom: 12px;
}

.hero.hero-compact {
  gap: 14px;
  padding: 18px 22px;
  margin-bottom: 12px;
  border: 1px solid rgba(206, 158, 87, 0.45);
  background:
    radial-gradient(circle at 12% 0%, rgba(216, 181, 106, 0.14), transparent 36%),
    linear-gradient(145deg, rgba(28, 22, 15, 0.96), rgba(12, 10, 8, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(255, 222, 157, 0.08),
    0 14px 36px rgba(0, 0, 0, 0.35);
}

.hero-compact h1 {
  font-size: clamp(1.9rem, 4.2vw, 3.2rem);
  color: #f0d39c;
  letter-spacing: 0.04em;
}

.hero-compact .eyebrow {
  color: #cbb083;
}

.hero-compact .hero-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(206, 158, 87, 0.5);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(46, 33, 20, 0.92), rgba(22, 15, 9, 0.94));
}

.hero-compact .hero-stat {
  position: relative;
  padding: 10px 12px 10px 36px;
  border: 1px solid rgba(206, 158, 87, 0.28);
  border-radius: 8px;
  background: rgba(14, 10, 6, 0.55);
}

.hero-compact .hero-stat::before {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.9;
}

.hero-compact .hero-stat-status::before { content: "♛"; color: #e8c57a; }
.hero-compact .hero-stat-lobby::before { content: "⛨"; color: #e8c57a; }
.hero-compact .hero-stat-account::before { content: "♟"; color: #e8c57a; }

.hero-compact .hero-stat span {
  margin-bottom: 4px;
  color: #cbb083;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-compact .hero-stat strong {
  color: #f6dfae;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .hero.hero-compact {
    grid-template-columns: 1fr;
  }

  .hero-compact .hero-card {
    grid-template-columns: 1fr;
  }
}

/* ===== Ornate Waiting Room ===== */

.waiting-room-panel,
#lobby-panel.waiting-room-panel {
  position: relative;
  padding: 22px 24px 24px;
  border: 2px solid rgba(206, 158, 87, 0.55);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 181, 106, 0.12), transparent 34%),
    linear-gradient(160deg, rgba(32, 24, 16, 0.97), rgba(14, 11, 8, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 222, 157, 0.1),
    inset 0 0 48px rgba(0, 0, 0, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.4);
}

.waiting-room-panel::before,
.waiting-room-panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(230, 188, 104, 0.7);
  pointer-events: none;
}

.waiting-room-panel::before {
  top: 10px;
  left: 10px;
  border-right: 0;
  border-bottom: 0;
}

.waiting-room-panel::after {
  right: 10px;
  bottom: 10px;
  border-left: 0;
  border-top: 0;
}

.waiting-room-heading {
  margin-bottom: 16px;
  align-items: center;
}

.waiting-room-panel .section-kicker {
  color: #d8b56a;
  letter-spacing: 0.18em;
}

.waiting-room-panel h2 {
  color: #f0d39c;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: 0.04em;
}

.waiting-room-actions {
  gap: 10px;
}

.waiting-room-action {
  border: 1px solid rgba(206, 158, 87, 0.55) !important;
  border-radius: 8px !important;
  color: #e9d3a0 !important;
  background: linear-gradient(180deg, rgba(46, 33, 20, 0.95), rgba(24, 17, 11, 0.95)) !important;
  box-shadow:
    inset 0 1px rgba(255, 231, 180, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.3);
  font-family: "Cinzel", serif;
  letter-spacing: 0.04em;
}

.waiting-room-action:hover {
  border-color: #e0bd78 !important;
  filter: brightness(1.1);
}

.waiting-room-meta {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.waiting-room-field {
  padding: 12px 14px;
  border: 1px solid rgba(206, 158, 87, 0.42);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(38, 28, 18, 0.92), rgba(18, 13, 8, 0.94));
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
}

.waiting-room-field .compact-label {
  margin-bottom: 6px;
  color: #cbb083;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lobby-code-value {
  color: #f6dfae;
  font-family: "Cinzel", serif;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
}

.invite-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invite-link-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #e7d3a5;
  font-size: 0.92rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.invite-copy-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(206, 158, 87, 0.55);
  border-radius: 8px;
  color: #e8c57a;
  background: rgba(20, 14, 9, 0.9);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.invite-copy-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.invite-copy-button:hover {
  border-color: #e0bd78;
  color: #f6dfae;
  background: rgba(46, 33, 20, 0.95);
}

.invite-copy-button.is-copied {
  border-color: #8ee29b;
  color: #8ee29b;
}

.waiting-room-roster.scoreboard,
#lobby-panel .waiting-room-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 4px 0 18px;
}

#lobby-panel .team-selection-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.team-selection-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(206, 158, 87, 0.42);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(56, 41, 25, 0.96), rgba(22, 16, 11, 0.98));
  box-shadow: inset 0 1px rgba(255, 230, 178, 0.08), 0 10px 22px rgba(0, 0, 0, 0.28);
}

.team-selection-card.is-current {
  border-color: rgba(232, 188, 105, 0.9);
  box-shadow: inset 0 0 22px rgba(216, 181, 106, 0.1), 0 10px 24px rgba(0, 0, 0, 0.34);
}

.team-selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.team-selection-head h3,
.team-selection-head p {
  margin: 0;
}

.team-selection-head h3 {
  color: #fff0ca;
  font-family: "Cinzel", serif;
  font-size: 1.2rem;
}

.team-selection-head p {
  margin-top: 4px;
  color: #d7c29a;
  font-size: 0.82rem;
}

.team-current-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(232, 188, 105, 0.58);
  border-radius: 999px;
  color: #f1d49b;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-player-slots {
  display: grid;
  gap: 8px;
}

.team-player-slot {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(203, 181, 140, 0.3);
  border-radius: 8px;
  color: rgba(215, 194, 154, 0.7);
  overflow-wrap: anywhere;
}

.team-player-slot.is-filled {
  border-style: solid;
  border-color: rgba(203, 181, 140, 0.36);
  color: #f3e4c5;
  background: rgba(13, 10, 7, 0.35);
}

.team-player-slot span {
  font-size: 0.8rem;
}

.team-select-button {
  width: 100%;
}

.team-selection-note {
  grid-column: 1 / -1;
  margin: 0;
  color: #d7c29a;
  text-align: center;
}

@media (max-width: 720px) {
  #lobby-panel .team-selection-grid {
    grid-template-columns: 1fr;
  }
}

.waiting-commander-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(206, 158, 87, 0.45);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(24, 17, 11, 0.55), rgba(10, 8, 6, 0.78)),
    var(--city-image, none);
  background-position: center;
  background-size: cover;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.35);
}

.waiting-commander-card.nation-pending {
  background:
    linear-gradient(180deg, rgba(42, 32, 22, 0.96), rgba(18, 13, 8, 0.98));
}

.waiting-commander-card[data-city="earth"] { border-color: rgba(179, 155, 98, 0.7); }
.waiting-commander-card[data-city="fire"] { border-color: rgba(220, 113, 59, 0.7); }
.waiting-commander-card[data-city="wind"] { border-color: rgba(146, 179, 122, 0.7); }
.waiting-commander-card[data-city="water"] { border-color: rgba(85, 191, 199, 0.7); }

.waiting-commander-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 6, 4, 0.18), rgba(8, 6, 4, 0.78));
  pointer-events: none;
}

.waiting-commander-emblem {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  border: 1px solid rgba(230, 188, 104, 0.55);
  border-radius: 50%;
  background: rgba(16, 11, 7, 0.82);
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.waiting-commander-copy {
  position: relative;
  z-index: 1;
}

.waiting-commander-card h3 {
  margin: 0 0 4px;
  color: #fff0ca;
  font-family: "Cinzel", serif;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.waiting-commander-card p {
  margin: 0;
  color: #d7c29a;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.waiting-room-setup {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(206, 158, 87, 0.28);
}

.waiting-setup-heading {
  align-items: center;
  margin-bottom: 14px;
}

body.tutorial-active #setup-panel {
  scroll-margin-top: 160px;
  padding-bottom: 24px;
}

body.tutorial-active #ready-button {
  scroll-margin-top: 160px;
  scroll-margin-bottom: 160px;
}

.waiting-lock-button,
#lobby-panel .waiting-lock-button {
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid #f0d091;
  border-radius: 8px;
  color: #241608;
  background: linear-gradient(180deg, #f3d795 0%, #dfae55 55%, #c98f37 100%);
  box-shadow:
    inset 0 1px rgba(255, 244, 214, 0.85),
    inset 0 -2px rgba(94, 58, 17, 0.4),
    0 0 18px rgba(224, 162, 67, 0.35),
    0 6px 16px rgba(0, 0, 0, 0.35);
  font-family: "Cinzel", serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.waiting-lock-button:hover:not(:disabled),
#lobby-panel .waiting-lock-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.waiting-lock-button:disabled,
#lobby-panel .waiting-lock-button:disabled {
  opacity: 0.7;
  filter: saturate(0.7);
  cursor: default;
}

.waiting-setup-card {
  border: 1px solid rgba(206, 158, 87, 0.4);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(38, 28, 18, 0.9), rgba(18, 13, 8, 0.94));
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.3);
}

.waiting-setup-card h3 {
  color: #f0d39c;
  font-family: "Cinzel", serif;
}

.waiting-tower-box {
  border: 1px solid rgba(206, 158, 87, 0.3);
  border-radius: 8px;
  background: rgba(14, 10, 6, 0.55);
}

.waiting-tower-box .compact-label {
  color: #cbb083;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.waiting-tower-box select {
  width: 100%;
  border: 1px solid rgba(206, 158, 87, 0.4);
  border-radius: 6px;
  color: #f0dcae;
  background: rgba(20, 14, 9, 0.95);
}

#lobby-panel .panel-heading {
  margin-bottom: 10px;
}

#lobby-panel .inline-actions {
  gap: 10px;
}

#lobby-panel .secondary-button,
#lobby-panel .primary-button {
  padding: 10px 16px;
}

#lobby-panel .scoreboard,
#lobby-panel .setup-grid {
  gap: 12px;
}

#lobby-panel .player-card {
  padding: 12px 14px;
  border-radius: 18px;
}

#lobby-panel .player-card h3 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

#lobby-panel #setup-panel .panel-heading {
  margin-bottom: 10px;
}

#lobby-panel #setup-grid .tower-grid {
  gap: 10px;
}

#lobby-panel #setup-grid .tower-box {
  padding: 10px;
}

#lobby-panel #setup-grid select {
  padding: 7px 8px;
}

@media (max-width: 820px) {
  .waiting-room-meta {
    grid-template-columns: 1fr;
  }

  .waiting-room-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .waiting-room-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.lobby-code-box {
  display: grid;
  gap: 4px;
}

#lobby-panel .nation-choice-header {
  margin-bottom: 14px;
  text-align: center;
}

#lobby-panel .nation-choice-header h3 {
  margin: 2px 0 4px;
  font-family: "Orbitron", sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#lobby-panel .nation-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#lobby-panel .nation-choice {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(229, 194, 126, 0.42);
  border-radius: 8px;
  color: #f7e7c1;
  background: #16110d;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

#lobby-panel .nation-choice:hover,
#lobby-panel .nation-choice.is-selected {
  border-color: #efb658;
  box-shadow: 0 0 0 2px rgba(239, 182, 88, 0.4), 0 12px 24px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

#lobby-panel .nation-choice:disabled {
  cursor: default;
  opacity: 0.72;
}

#lobby-panel .nation-choice-image,
#lobby-panel .nation-choice-shade {
  position: absolute;
  inset: 0;
}

#lobby-panel .nation-choice-image {
  background-image: var(--nation-image);
  background-position: center;
  background-size: cover;
  filter: saturate(0.9);
}

#lobby-panel .nation-choice-shade {
  background: linear-gradient(180deg, rgba(5, 7, 8, 0.12), rgba(5, 7, 8, 0.84));
}

#lobby-panel .nation-choice-content {
  position: absolute;
  inset: auto 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#lobby-panel .nation-choice-content strong {
  font-family: "Orbitron", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#lobby-panel .nation-choice-content small {
  color: rgba(255, 239, 203, 0.82);
}

#lobby-panel .nation-waiting {
  margin: 14px 0 0;
  text-align: center;
}

@media (max-width: 640px) {
  #lobby-panel .nation-choice-grid {
    grid-template-columns: 1fr;
  }
}

/* Elemental city war table */
.bronze-war-table {
  --bronze: #b6813f;
  --bronze-light: #e0bd78;
  --bronze-dark: #5c3b20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  height: 100%;
  padding: 10px;
  background:
    radial-gradient(circle at 50% 0%, rgba(211, 165, 88, 0.16), transparent 34%),
    linear-gradient(145deg, #2b2117 0%, #17120d 58%, #0d0b08 100%);
  border: 3px ridge rgba(185, 132, 67, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(255, 222, 157, 0.12),
    inset 0 0 70px rgba(0, 0, 0, 0.52),
    0 18px 46px rgba(0, 0, 0, 0.42);
}

.bronze-war-table .arena-hud {
  display: none;
}

.bronze-war-table .arena-command-deck {
  position: relative;
  top: auto;
  z-index: 12;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-width: 1px;
  border-color: rgba(179, 127, 64, 0.6);
  border-radius: 6px;
  background:
    linear-gradient(160deg, rgba(79, 57, 35, 0.98), rgba(37, 27, 18, 0.99));
}

.bronze-war-table .arena-command-deck-head {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(0, 1.8fr) auto;
  align-items: stretch;
  gap: 10px 14px;
  margin: 0 0 4px;
}

.bronze-war-table .arena-command-deck-identity {
  min-width: 0;
  align-self: center;
}

.bronze-war-table .arena-command-deck-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  color: #f1d49b;
}

.bronze-war-table .arena-command-deck-sep {
  opacity: 0.55;
}

.bronze-war-table .arena-command-deck-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  align-self: stretch;
}

.bronze-war-table .arena-stat-chip {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 10px 8px;
  border: 1px solid rgba(185, 132, 67, 0.5);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(80, 59, 37, 0.84), rgba(41, 30, 20, 0.9));
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.3),
    inset 0 1px rgba(255, 225, 172, 0.12);
  text-align: center;
}

.bronze-war-table .arena-stat-chip span {
  color: rgba(203, 181, 140, 0.88);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bronze-war-table .arena-stat-chip strong {
  color: #f0d39c;
  font-family: "Cinzel", serif;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.05;
}

.bronze-war-table .arena-turn-timer.is-critical {
  border-color: rgba(221, 160, 82, 0.9);
  background: linear-gradient(180deg, rgba(105, 65, 29, 0.9), rgba(54, 33, 19, 0.96));
}

.bronze-war-table .arena-turn-timer.is-critical strong {
  color: #ffd08a;
}

.bronze-war-table .arena-turn-timer.is-expired strong {
  color: #ef9f8e;
}

.bronze-war-table .command-actions-bar {
  align-self: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  padding: 0;
  border: 0;
  gap: 8px;
}

.bronze-war-table .command-bar-btn {
  min-height: 38px;
  padding: 8px 14px;
}

.bronze-war-table .arena-settings-button {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
}

.bronze-war-table .arena-workspace {
  flex: 1;
  min-height: 0;
  margin: 0;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  align-items: stretch;
}

.bronze-war-table .arena-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  height: 100%;
  padding: 10px;
  place-items: center;
  container-type: size;
  border: 1px solid rgba(181, 128, 64, 0.52);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(20, 15, 10, 0.86), rgba(20, 15, 10, 0.86)),
    repeating-linear-gradient(45deg, #372719 0 8px, #2d2117 8px 16px);
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.65),
    0 8px 22px rgba(0, 0, 0, 0.25);
}

.bronze-war-table .arena-field.playercount-2 {
  grid-template-rows: minmax(0, 1fr);
}

.bronze-war-table .arena-field.playercount-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.bronze-war-table .arena-field.playercount-3 .arena-nation.is-self {
  grid-column: 1 / -1;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.bronze-war-table .arena-field.playercount-3 .arena-nation:not(.is-self) {
  width: 100%;
}

.bronze-war-table .arena-field::after {
  display: none;
}

.bronze-war-table .arena-nation,
.bronze-war-table .arena-nation--grid {
  position: relative;
  left: auto;
  top: auto;
  width: min(100%, calc((100cqh - 10px) / 2));
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  transform: none;
  border: 1px solid color-mix(in srgb, var(--city-accent) 72%, #25170d);
  border-radius: 6px;
  overflow: hidden;
  background: #17120d;
  box-shadow:
    0 0 0 2px rgba(19, 12, 7, 0.75),
    0 9px 20px rgba(0, 0, 0, 0.4);
}

.bronze-war-table .arena-field.playercount-2 .arena-nation {
  width: min(100%, 100cqh);
}

.bronze-war-table .arena-field.playercount-4:not(.is-grid) .arena-nation {
  width: 100%;
  max-width: none;
}

.bronze-war-table .arena-field.playercount-4:not(.is-grid) .arena-tower {
  width: clamp(82px, 28%, 116px);
  max-width: 116px;
  min-height: 72px;
}

.bronze-war-table .arena-field.playercount-4:not(.is-grid) .arena-tower-frame {
  min-height: 0;
  padding: 5px 7px 6px;
}

.bronze-war-table .arena-field.playercount-4:not(.is-grid) .arena-tower-name {
  font-size: 0.58rem;
}

.arena-nation[data-city="earth"] {
  --city-accent: #b39b62;
}

.arena-nation[data-city="fire"] {
  --city-accent: #dc713b;
}

.arena-nation[data-city="water"] {
  --city-accent: #55bfc7;
}

.arena-nation[data-city="wind"] {
  --city-accent: #92b37a;
}

.bronze-war-table .arena-nation.is-self {
  outline: 3px solid color-mix(in srgb, var(--city-accent) 78%, #f4d995);
  outline-offset: -3px;
  box-shadow:
    0 0 0 2px rgba(19, 12, 7, 0.8),
    0 0 24px color-mix(in srgb, var(--city-accent) 42%, transparent);
}

.bronze-war-table .arena-nation.is-ally {
  outline: 2px solid rgba(126, 194, 156, 0.78);
  outline-offset: -2px;
  box-shadow:
    0 0 0 2px rgba(19, 12, 7, 0.76),
    0 0 20px rgba(92, 175, 130, 0.22);
}

.bronze-war-table .arena-nation.is-ally .arena-nation-name span,
.arena-nation.is-ally .arena-tower-meta {
  color: #a7e5bd;
}

.bronze-war-table .arena-nation-name,
.bronze-war-table .arena-field.is-grid .arena-nation-name {
  position: absolute;
  z-index: 8;
  right: 10px;
  bottom: 10px;
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 7px 10px;
  text-align: right;
  border: 1px solid color-mix(in srgb, var(--city-accent) 62%, #2d1c10);
  border-radius: 4px;
  color: #f2dfb7;
  background: rgba(28, 19, 12, 0.9);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.bronze-war-table .arena-nation-name span,
.bronze-war-table .arena-nation-name small {
  color: #cbb58c;
  font-size: 0.56rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bronze-war-table .arena-nation-name strong {
  color: #fff0ca;
  font-size: clamp(0.88rem, 1.6vw, 1.15rem);
  line-height: 1.15;
}

.bronze-war-table .arena-city {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  isolation: isolate;
  background-image: var(--city-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  image-rendering: pixelated;
}

.bronze-war-table .arena-city-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 6, 4, 0.1) 55%, rgba(8, 5, 3, 0.42) 100%),
    radial-gradient(circle at center, transparent 54%, rgba(9, 6, 4, 0.28) 100%);
}

.bronze-war-table .arena-tower--hotspot {
  --hp-pct: 100;
  position: absolute;
  z-index: 5;
  left: var(--tower-x);
  top: var(--tower-y);
  width: clamp(82px, 28%, 116px);
  min-width: 0;
  min-height: 72px;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  overflow: visible;
  border: 0;
  background: transparent;
  animation: none;
  opacity: 1;
}

.bronze-war-table .arena-tower--hotspot.is-locked {
  opacity: 1;
}

/* Only dim locked towers when First Mission is ready for Base targeting. */
body.tutorial-pick-base .bronze-war-table .arena-tower--hotspot.is-locked {
  opacity: 0.42;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

body.tutorial-pick-base .bronze-war-table .arena-tower.is-selectable {
  opacity: 1;
  filter: none;
}

.bronze-war-table .arena-tower-marker {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 2px solid #f0ce88;
  background: rgba(48, 31, 17, 0.76);
  box-shadow:
    0 0 0 3px rgba(24, 15, 8, 0.58),
    0 0 14px color-mix(in srgb, var(--city-accent) 70%, transparent);
}

.bronze-war-table .arena-tower-marker::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 231, 177, 0.88);
  background: color-mix(in srgb, var(--city-accent) 76%, #5d3a1e);
}

.bronze-war-table .arena-tower-frame {
  position: absolute;
  z-index: 3;
  top: calc(50% + 21px);
  left: 50%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 6px;
  width: max-content;
  min-width: 82px;
  max-width: 116px;
  min-height: 0;
  padding: 5px 7px 6px;
  transform: translateX(-50%);
  border: 1px solid rgba(222, 183, 111, 0.72);
  border-radius: 3px;
  color: #f5e7c5;
  background:
    linear-gradient(180deg, rgba(67, 45, 26, 0.96), rgba(29, 20, 13, 0.98));
  box-shadow:
    0 4px 0 rgba(13, 8, 4, 0.55),
    0 7px 14px rgba(0, 0, 0, 0.48);
}

.bronze-war-table .arena-tower-name {
  font-family: "Cinzel", serif;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: #f4dfb3;
}

.bronze-war-table .arena-tower-meta {
  font-family: "Manrope", sans-serif;
  font-size: 0.56rem;
  color: #d3c09c;
}

.bronze-war-table .arena-tower-hpbar {
  grid-column: 1 / -1;
  width: 100%;
  height: 5px;
  border-color: rgba(226, 188, 116, 0.35);
  border-radius: 1px;
  background: rgba(12, 8, 5, 0.7);
}

.bronze-war-table .arena-tower.is-selectable {
  cursor: pointer;
  animation: none;
}

.bronze-war-table .arena-tower.is-selectable .arena-tower-marker {
  animation: city-hotspot-pulse 1.15s ease-in-out infinite;
}

.bronze-war-table .arena-tower.is-selectable:hover {
  transform: translate(-50%, -50%) scale(1.08);
  filter: brightness(1.15);
}

.bronze-war-table .arena-tower.is-selectable:hover .arena-tower-frame {
  border-color: #ffe3a0;
}

.bronze-war-table .arena-tower.is-destroyed {
  filter: grayscale(1) brightness(0.58);
}

.bronze-war-table .arena-tower.is-destroyed .arena-tower-marker {
  border-color: #756859;
  background: rgba(30, 27, 24, 0.82);
  box-shadow: 0 0 0 3px rgba(20, 17, 14, 0.62);
}

.bronze-war-table .arena-tower.is-destroyed .arena-tower-frame {
  min-height: 0;
  filter: grayscale(1);
  border-color: rgba(126, 111, 91, 0.65);
  box-shadow: 0 4px 0 rgba(13, 8, 4, 0.55);
}

.bronze-war-table .arena-tower-intel {
  top: -4px;
  bottom: auto;
  z-index: 7;
  border-radius: 3px;
  background: rgba(34, 72, 75, 0.96);
}

.bronze-war-table .arena-tower-threat {
  top: -6px;
  left: -4px;
  z-index: 8;
  border-radius: 3px;
  background: rgba(124, 43, 27, 0.96);
}

.bronze-war-table .arena-damage-emoji {
  display: none;
}

.bronze-war-table .arena-damage-burst {
  top: 6px !important;
  right: -2px !important;
  width: 34px;
  height: 34px;
  border: 2px solid #f3b45b;
  border-radius: 50%;
  background: rgba(105, 31, 15, 0.94);
  box-shadow: 0 0 16px rgba(236, 95, 39, 0.72);
}

.bronze-war-table .arena-damage-value {
  font-family: "Cinzel", serif;
  color: #ffe0a1;
}

@keyframes city-hotspot-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(24, 15, 8, 0.58),
      0 0 12px color-mix(in srgb, var(--city-accent) 65%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 6px rgba(241, 202, 126, 0.28),
      0 0 28px #f0c46c;
  }
}

/* Bronze-age HUD: carved tablets rather than computer panels */
.bronze-war-table .arena-command-deck,
.bronze-war-table .arena-sidecard.war-panel,
.bronze-war-table .war-panel-inset {
  border-color: rgba(179, 127, 64, 0.6);
  border-radius: 6px;
  background:
    linear-gradient(160deg, rgba(79, 57, 35, 0.98), rgba(37, 27, 18, 0.99));
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.35),
    inset 0 1px rgba(255, 225, 169, 0.1),
    0 8px 18px rgba(0, 0, 0, 0.36);
}

.bronze-war-table .arena-command-deck {
  border-width: 1px;
}

.bronze-war-table .arena-command-deck-title,
.bronze-war-table .war-panel-header h3,
.bronze-war-table .chat-widget-head h3 {
  font-family: "Cinzel", serif;
  color: #f1d49b;
  letter-spacing: 0.06em;
}

.bronze-war-table .war-panel-kicker {
  color: #d4a85f;
  margin: 0;
}

.bronze-war-table .dock-button,
.bronze-war-table .move-chip {
  border: 1px solid rgba(190, 141, 76, 0.64);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(103, 76, 45, 0.96), rgba(52, 37, 23, 0.99));
  box-shadow:
    inset 0 1px rgba(255, 229, 177, 0.12),
    0 4px 0 rgba(18, 11, 6, 0.48);
}

.bronze-war-table .dock-button span:first-child,
.bronze-war-table .move-chip span:first-child,
.bronze-war-table .dock-button strong,
.bronze-war-table .move-chip strong,
.bronze-war-table .command-bar-submit.primary-button {
  font-family: "Cinzel", serif;
}

.bronze-war-table .dock-button.is-active,
.bronze-war-table .move-chip.is-selected {
  border-color: #e6bf73;
  background:
    linear-gradient(180deg, rgba(125, 83, 40, 0.98), rgba(66, 39, 20, 0.99));
  box-shadow:
    inset 0 0 18px rgba(231, 182, 91, 0.14),
    0 4px 0 rgba(18, 11, 6, 0.48),
    0 0 18px rgba(224, 162, 67, 0.22);
}

.bronze-war-table .order-pill {
  border: 1px solid rgba(179, 127, 64, 0.35);
  border-radius: 4px;
  background: rgba(22, 15, 9, 0.38);
}

.bronze-war-table .dock-button,
.bronze-war-table .move-chip {
  min-height: 40px;
  padding: 7px 8px;
}

.bronze-war-table .move-tray:not(.move-tray-empty) {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.bronze-war-table .arena-side {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.bronze-war-table .arena-side-body {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Immersive single-screen war room (reference layout) */
body.in-war-room {
  overflow: hidden;
}

body.in-war-room .page-shell {
  width: min(1720px, calc(100vw - 12px));
  max-width: none;
  padding: 6px 0;
  height: 100dvh;
  overflow: hidden;
}

body.in-war-room .layout {
  height: 100%;
  gap: 0;
}

#game-panel.game-panel--immersive {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 12px);
  max-height: calc(100dvh - 12px);
  margin: 0;
  padding: 6px;
  overflow: hidden;
  border-radius: 14px;
}

#game-panel.game-panel--immersive > .panel-heading,
#game-panel.game-panel--immersive > #status-banner,
#game-panel.game-panel--immersive > #scoreboard {
  display: none !important;
}

#game-panel.game-panel--immersive > #player-form,
#game-panel.game-panel--immersive .arena-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#game-panel.game-panel--immersive .arena-board {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  padding: 8px;
}

#game-panel.game-panel--immersive .arena-reports-log.log,
#game-panel.game-panel--immersive .arena-comms-log.chat-log,
#game-panel.game-panel--immersive .arena-queue-card .orders-queue {
  overflow: auto;
}

#game-panel.game-panel--immersive .arena-side-panel.is-active {
  height: 100%;
}

#game-panel.game-panel--immersive #arena-reports-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

#game-panel.game-panel--immersive .arena-reports-log.log,
#game-panel.game-panel--immersive .arena-comms-log.chat-log {
  min-height: 0;
  max-height: none;
  height: 100%;
}

#game-panel.game-panel--immersive .arena-queue-card .orders-queue {
  max-height: min(240px, 28vh);
}

#game-panel.game-panel--immersive .arena-sidecard.war-panel {
  padding: 10px 12px;
}

@media (max-width: 1100px) {
  body.in-war-room .page-shell {
    width: min(100vw - 8px, 1720px);
  }

  .bronze-war-table .arena-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  }
}

@media (max-width: 920px) {
  body.in-war-room {
    overflow: auto;
  }

  body.in-war-room .page-shell,
  #game-panel.game-panel--immersive {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .bronze-war-table {
    padding: 10px;
    height: auto;
  }

  .bronze-war-table .arena-command-deck-head {
    grid-template-columns: 1fr;
  }

  .bronze-war-table .arena-command-deck-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bronze-war-table .command-actions-bar {
    flex-wrap: wrap;
  }

  .bronze-war-table .arena-workspace {
    grid-template-columns: 1fr;
  }

  .bronze-war-table .arena-field,
  .bronze-war-table .arena-field.is-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .bronze-war-table .arena-field.playercount-3 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, auto);
  }

  .bronze-war-table .arena-field.playercount-3 .arena-nation.is-self {
    grid-column: auto;
    height: auto;
    aspect-ratio: 1;
  }

  .bronze-war-table .arena-nation,
  .bronze-war-table .arena-nation--grid {
    max-width: none;
    width: min(100%, 100cqw);
  }
}



/* Signed-in command center */
.command-center-panel:not(.signed-out-view) {
  position: relative;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(100vh - 48px);
}

.command-center-panel:not(.signed-out-view) .command-center-card {
  position: relative;
  width: min(1120px, 100%);
  max-width: 100%;
  min-width: 0;
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  padding: clamp(36px, 5vw, 62px) clamp(28px, 6vw, 76px) 34px;
  overflow: hidden;
  text-align: left;
  border: 1px solid rgba(216, 181, 106, 0.2);
  border-radius: 28px;
  background:
    radial-gradient(circle at 14% 24%, rgba(198, 139, 40, 0.08), transparent 23%),
    radial-gradient(circle at 88% 70%, rgba(16, 91, 139, 0.12), transparent 27%),
    repeating-radial-gradient(circle at 4% 42%, transparent 0 58px, rgba(201, 149, 55, 0.045) 59px 60px, transparent 61px 112px),
    linear-gradient(135deg, rgba(5, 20, 35, 0.99), rgba(3, 14, 27, 0.99));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 28px 80px rgba(0, 0, 0, 0.4);
}

.command-center-panel:not(.signed-out-view) .command-center-card::before,
.command-center-panel:not(.signed-out-view) .command-center-card::after {
  position: absolute;
  z-index: 0;
  content: "";
  pointer-events: none;
}

.command-center-panel:not(.signed-out-view) .command-center-card::before {
  inset: 0;
  opacity: 0.3;
  background:
    linear-gradient(25deg, transparent 48%, rgba(197, 139, 41, 0.09) 49%, transparent 50%) 0 0 / 210px 155px,
    linear-gradient(155deg, transparent 48%, rgba(197, 139, 41, 0.06) 49%, transparent 50%) 45px 12px / 260px 190px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.command-center-panel:not(.signed-out-view) .command-center-card::after {
  width: 360px;
  height: 360px;
  right: -150px;
  top: 90px;
  border: 1px solid rgba(217, 167, 66, 0.09);
  border-radius: 50%;
  box-shadow:
    0 0 0 62px rgba(217, 167, 66, 0.025),
    0 0 0 124px rgba(217, 167, 66, 0.018);
}

.command-home,
.command-profile-view {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.command-home.hidden,
.command-profile-view.hidden {
  display: none;
}

.command-profile-button {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  padding: 0;
  border: 1px solid #e4b84e;
  border-radius: 50%;
  color: #edc768;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 225, 137, 0.17), transparent 38%),
    #07192c;
  box-shadow:
    inset 0 0 0 4px rgba(229, 178, 67, 0.08),
    0 0 20px rgba(218, 158, 44, 0.2);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

button.command-profile-button:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 4px rgba(229, 178, 67, 0.12),
    0 0 28px rgba(218, 158, 44, 0.32);
}

.command-profile-button-static {
  cursor: default;
}

.command-profile-silhouette {
  position: relative;
  width: 34px;
  height: 32px;
}

.command-profile-silhouette::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 14px;
  height: 16px;
  content: "";
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd66d, #c98b22);
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(249, 193, 67, 0.32);
}

.command-profile-silhouette::after {
  position: absolute;
  right: 3px;
  bottom: 0;
  left: 3px;
  height: 14px;
  content: "";
  border-radius: 15px 15px 4px 4px;
  background: linear-gradient(180deg, #f3c75d, #aa6d15);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.command-home-masthead,
.command-profile-masthead {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(22px, 4vw, 40px);
  min-width: 0;
  max-width: 100%;
  min-height: 190px;
  padding: 26px 94px 24px 0;
}

.command-home-masthead > div,
.command-profile-masthead > div {
  min-width: 0;
  flex: 1 1 auto;
}

.command-profile-masthead {
  min-height: 215px;
  padding-right: 0;
}

.command-insignia {
  display: grid;
  flex: 0 0 auto;
  width: clamp(88px, 11vw, 118px);
  height: clamp(88px, 11vw, 118px);
  place-items: center;
  border: 4px double rgba(255, 232, 187, 0.78);
  border-radius: 20px;
  color: #fff7dc;
  background:
    linear-gradient(145deg, rgba(255, 142, 89, 0.95), rgba(141, 32, 25, 0.98));
  box-shadow:
    inset 0 0 22px rgba(255, 220, 153, 0.36),
    0 0 26px rgba(220, 87, 31, 0.34);
  font-size: clamp(3.2rem, 7vw, 5rem);
  line-height: 1;
  transform: rotate(-5deg);
}

.command-home-kicker {
  margin: 0 0 5px;
  color: #e0a42f;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.72rem, 1.8vw, 1rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
}

.command-home-masthead h2,
.command-profile-masthead h2 {
  color: #f4efe3;
  font-size: clamp(3.1rem, 8vw, 6rem);
  line-height: 0.98;
  letter-spacing: 0.055em;
  overflow-wrap: anywhere;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.7);
}

.command-home-tagline,
.command-profile-name {
  margin: 12px 0 0;
  color: #aeb8c8;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-style: italic;
  letter-spacing: 0.025em;
}

.command-profile-name {
  color: #d9ae54;
  text-align: center;
  font-family: "Manrope", sans-serif;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.command-ornament {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 22px;
  margin: 4px 0 20px;
}

.command-ornament::before,
.command-ornament::after {
  flex: 1;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(210, 156, 49, 0.56));
}

.command-ornament::after {
  background: linear-gradient(90deg, rgba(210, 156, 49, 0.56), transparent);
}

.command-ornament span {
  width: 13px;
  height: 13px;
  border: 1px solid #dca638;
  transform: rotate(45deg);
  box-shadow: 0 0 0 4px rgba(220, 166, 56, 0.08);
}

.command-feature-card,
.command-menu-card {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  color: var(--text);
  border: 1px solid rgba(216, 181, 106, 0.47);
  background:
    linear-gradient(115deg, rgba(19, 40, 61, 0.82), rgba(5, 18, 32, 0.92));
  cursor: pointer;
  text-align: left;
  box-shadow:
    inset 3px 0 0 #e8b83e,
    inset 0 1px rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.command-feature-card:hover,
.command-menu-card:hover {
  border-color: #efbd42;
  background:
    linear-gradient(115deg, rgba(31, 55, 77, 0.94), rgba(8, 24, 40, 0.98));
  box-shadow:
    inset 3px 0 0 #ffd262,
    0 0 24px rgba(217, 161, 46, 0.12);
  transform: translateY(-2px);
}

.command-feature-card {
  gap: 26px;
  min-height: 110px;
  padding: 20px 30px;
  border-color: #efb82f;
  border-radius: 13px;
  box-shadow:
    inset 3px 0 0 #ffd259,
    0 0 22px rgba(218, 158, 43, 0.22);
}

.command-feature-icon {
  display: grid;
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  place-items: center;
  padding-left: 5px;
  border: 1px solid #dca638;
  border-radius: 50%;
  color: #ffd15a;
  background: rgba(3, 13, 25, 0.72);
  box-shadow: 0 0 18px rgba(226, 169, 48, 0.2);
  font-size: 1.65rem;
}

.command-card-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.command-card-copy strong {
  color: #f5efe2;
  font-family: "Cinzel", serif;
  font-size: clamp(1.05rem, 2.3vw, 1.55rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.command-feature-card .command-card-copy {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 22px;
}

.command-feature-card .command-card-copy strong {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.command-card-copy small {
  color: #adb8c9;
  font-size: 0.94rem;
  line-height: 1.35;
}

.command-feature-arrow {
  margin-left: auto;
  color: #f0b62f;
  font-size: 2.3rem;
}

.command-menu-section {
  margin-top: 28px;
}

.command-menu-section > h3,
.ranked-progress-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 14px;
  color: #e2a62c;
  font-family: "Orbitron", sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.command-menu-section > h3::after,
.ranked-progress-heading::after {
  flex: 1;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, rgba(215, 161, 48, 0.42), transparent);
}

.command-card-grid {
  display: grid;
  gap: 14px;
}

.command-card-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.command-card-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.command-menu-card {
  min-height: 114px;
  gap: 20px;
  padding: 18px 22px;
  border-radius: 9px;
}

.command-card-icon {
  flex: 0 0 auto;
  width: 52px;
  color: #e5b84f;
  text-align: center;
  font-size: 2.25rem;
  line-height: 1;
  text-shadow: 0 0 14px rgba(225, 170, 54, 0.25);
}

.command-card-laurel {
  font-size: 3rem;
}

.command-practice-card {
  position: relative;
  min-width: 0;
}

.command-practice-card .command-menu-card {
  height: 100%;
  padding-bottom: 38px;
}

.command-first-mission {
  position: absolute;
  right: 15px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 8px;
  border: 0;
  color: #ddb45e;
  background: transparent;
  cursor: pointer;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.command-first-mission:hover {
  color: #ffe09b;
  text-decoration: underline;
}

.command-invite-count {
  position: absolute;
  top: 12px;
  right: 13px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #ff775f;
  border-radius: 50%;
  color: #fff4ed;
  background: #a72e20;
  box-shadow: 0 0 15px rgba(215, 57, 39, 0.42);
  font-size: 0.8rem;
  font-weight: 700;
}

.command-invite-count.hidden {
  display: none;
}

.command-ornament-footer {
  margin-top: 34px;
  margin-bottom: 12px;
}

.command-home-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.command-footer-action,
.command-profile-back {
  border: 0;
  color: #aab8cb;
  background: transparent;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.command-footer-action:hover,
.command-profile-back:hover {
  color: #f1c666;
}

.command-footer-danger:hover {
  color: #ff8c7a;
}

.command-profile-view {
  min-height: 760px;
}

.command-profile-back {
  position: absolute;
  top: 8px;
  left: 0;
  z-index: 3;
  color: #d3a64b;
  font-size: 0.73rem;
}

.ranked-progress-heading {
  margin: 24px 0 18px;
  font-size: 0.95rem;
}

.ranked-mode-list {
  display: grid;
  gap: 18px;
}

.ranked-mode-card {
  --rank-accent: #d8a938;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: center;
  min-height: 235px;
  padding: 22px 30px 22px 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rank-accent) 78%, transparent);
  border-radius: 12px;
  background:
    radial-gradient(circle at 10% 50%, color-mix(in srgb, var(--rank-accent) 12%, transparent), transparent 28%),
    linear-gradient(115deg, rgba(10, 28, 47, 0.94), rgba(4, 16, 30, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.ranked-mode-card-team {
  --rank-accent: #4ebdf7;
}

.rank-badge {
  position: relative;
  width: 190px;
  height: 180px;
  overflow: hidden;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.45));
}

.rank-badge span {
  position: absolute;
  width: 640px;
  height: 640px;
  background-image: url("assets/rank-icons.png");
  background-repeat: no-repeat;
  background-size: 640px 640px;
}

.rank-badge-bronze span { transform: translate(-46px, -145px); }
.rank-badge-silver span { transform: translate(-230px, -145px); }
.rank-badge-gold span { transform: translate(-416px, -145px); }
.rank-badge-platinum span { transform: translate(-46px, -370px); }
.rank-badge-diamond span { transform: translate(-230px, -370px); }
.rank-badge-commander span { transform: translate(-416px, -370px); }

.rank-badge-unranked {
  display: grid;
  place-items: center;
}

.rank-badge-unranked span {
  position: relative;
  display: grid;
  width: 116px;
  height: 132px;
  place-items: center;
  border: 4px solid #52657a;
  border-radius: 24px 24px 45px 45px;
  background:
    linear-gradient(145deg, rgba(95, 118, 143, 0.32), rgba(9, 24, 40, 0.82));
  box-shadow:
    inset 0 0 24px rgba(132, 160, 190, 0.16),
    0 0 24px rgba(69, 98, 128, 0.2);
  transform: none;
}

.rank-badge-unranked span::after {
  content: "?";
  color: #8ea2b6;
  font-family: "Cinzel", serif;
  font-size: 3.5rem;
}

.ranked-mode-main {
  min-width: 0;
}

.ranked-mode-name {
  margin: 0 0 7px;
  color: #f1eee6;
  font-family: "Orbitron", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ranked-mode-main h3 {
  margin: 0 0 22px;
  color: var(--rank-accent);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ranked-mode-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.ranked-mode-track {
  height: 28px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rank-accent) 62%, #1c2b3c);
  border-radius: 5px;
  background: rgba(1, 9, 18, 0.72);
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.36);
}

.ranked-mode-track span {
  display: block;
  width: 0;
  height: 100%;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--rank-accent) 75%, #84580e), var(--rank-accent));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.28),
    0 0 18px color-mix(in srgb, var(--rank-accent) 45%, transparent);
  transition: width 260ms ease;
}

.ranked-mode-progress-row > strong {
  min-width: 108px;
  color: var(--rank-accent);
  font-family: "Orbitron", sans-serif;
  font-size: 1.35rem;
  text-align: right;
}

.ranked-mode-detail {
  margin: 10px 0 0;
  color: #8796aa;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
}

@media (max-width: 820px) {
  .command-center-panel:not(.signed-out-view) .command-center-card {
    padding: 30px 22px 26px;
    border-radius: 20px;
  }

  .command-home-masthead,
  .command-profile-masthead {
    justify-content: flex-start;
    min-height: 170px;
    padding-right: 76px;
  }

  .command-home-masthead h2,
  .command-profile-masthead h2 {
    font-size: clamp(2.6rem, 10vw, 4.7rem);
  }

  .command-card-grid-three {
    grid-template-columns: 1fr;
  }

  .command-card-grid-two {
    grid-template-columns: 1fr 1fr;
  }

  .ranked-mode-card {
    grid-template-columns: 155px minmax(0, 1fr);
    padding: 16px 20px 16px 2px;
  }

  .rank-badge {
    width: 150px;
    transform: scale(0.8);
    transform-origin: center;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 16px, 1400px);
    padding-top: 8px;
  }

  .command-center-panel:not(.signed-out-view) .command-center-card {
    min-height: calc(100vh - 16px);
    padding: 22px 14px;
  }

  .command-profile-button {
    width: 54px;
    height: 54px;
  }

  .command-home-masthead,
  .command-profile-masthead {
    min-height: 138px;
    gap: 15px;
    padding: 22px 55px 15px 0;
  }

  .command-home-masthead > div,
  .command-profile-masthead > div {
    min-width: 0;
  }

  .command-insignia {
    width: 66px;
    height: 66px;
    border-radius: 13px;
    font-size: 2.5rem;
  }

  .command-home-kicker {
    letter-spacing: 0.25em;
  }

  .command-home-masthead h2,
  .command-profile-masthead h2 {
    font-size: clamp(1.7rem, 9vw, 3.2rem);
  }

  .command-home-tagline,
  .command-profile-name {
    margin-top: 7px;
    font-size: 0.83rem;
  }

  .command-feature-card {
    min-height: 94px;
    gap: 14px;
    padding: 14px;
  }

  .command-feature-icon {
    width: 52px;
    height: 52px;
  }

  .command-feature-card .command-card-copy {
    display: grid;
    gap: 2px;
  }

  .command-feature-card .command-card-copy strong {
    font-size: 1.45rem;
  }

  .command-feature-arrow {
    font-size: 1.7rem;
  }

  .command-card-grid-two {
    grid-template-columns: 1fr;
  }

  .command-menu-card {
    min-height: 94px;
  }

  .command-profile-view {
    padding-top: 42px;
  }

  .command-profile-back {
    max-width: calc(100% - 72px);
    font-size: 0.62rem;
  }

  .command-profile-masthead {
    padding-right: 0;
  }

  .ranked-mode-card {
    grid-template-columns: 1fr;
    padding: 10px 16px 20px;
    text-align: center;
  }

  .rank-badge {
    justify-self: center;
    height: 150px;
    margin-bottom: -6px;
    transform: scale(0.72);
    transform-origin: center;
  }

  .ranked-mode-progress-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .ranked-mode-progress-row > strong {
    text-align: center;
  }

  .ranked-mode-main h3 {
    margin-bottom: 15px;
  }
}

/* Blocking nation selection shown after every commander locks characters. */
.nation-selection-modal {
  z-index: 130;
}

.nation-selection-backdrop {
  background: rgba(2, 8, 14, 0.86);
  backdrop-filter: blur(7px);
}

.nation-selection-card {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid rgba(218, 170, 79, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 32%),
    #0c1117;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.68), inset 0 0 0 3px rgba(218, 170, 79, 0.08);
}

.nation-selection-heading {
  margin-bottom: 20px;
  text-align: center;
}

.nation-selection-heading h2 {
  margin: 3px 0 4px;
  color: #f6e7c4;
  font-family: "Cinzel", serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nation-selection-heading p:last-child {
  margin: 0;
  color: #d9c59d;
}

.nation-selection-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.nation-selection-option {
  position: relative;
  min-height: 225px;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(216, 184, 119, 0.48);
  border-radius: 6px;
  color: #f8e8c2;
  background: #111;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.nation-selection-option:hover,
.nation-selection-option.is-selected {
  transform: translateY(-2px);
  border-color: #f1bd59;
  box-shadow: 0 0 0 2px rgba(241, 189, 89, 0.28), 0 0 26px rgba(241, 151, 53, 0.25);
}

.nation-selection-option.nation-wind.is-selected {
  border-color: #9fca68;
  box-shadow: 0 0 0 2px rgba(159, 202, 104, 0.28), 0 0 26px rgba(105, 165, 73, 0.26);
}

.nation-selection-option.nation-water.is-selected {
  border-color: #5ab9ec;
  box-shadow: 0 0 0 2px rgba(90, 185, 236, 0.3), 0 0 26px rgba(40, 135, 206, 0.28);
}

.nation-selection-option.nation-earth.is-selected {
  border-color: #d0a763;
}

.nation-selection-option:disabled {
  cursor: default;
}

.nation-selection-image,
.nation-selection-shade {
  position: absolute;
  inset: 0;
}

.nation-selection-image {
  background-image: var(--nation-image);
  background-position: center;
  background-size: cover;
  filter: saturate(0.92);
  transition: transform 260ms ease;
}

.nation-selection-option:hover .nation-selection-image,
.nation-selection-option.is-selected .nation-selection-image {
  transform: scale(1.025);
}

.nation-selection-shade {
  background: linear-gradient(180deg, rgba(3, 7, 10, 0.04) 34%, rgba(3, 7, 10, 0.9) 100%);
}

.nation-selection-copy {
  position: absolute;
  inset: auto 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.nation-selection-copy strong {
  font-family: "Cinzel", serif;
  font-size: 2rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nation-selection-copy small {
  color: rgba(255, 239, 203, 0.9);
  font-size: 0.88rem;
}

.nation-selection-status {
  min-height: 22px;
  margin: 16px 0 10px;
  color: #d9c59d;
  text-align: center;
}

.nation-selection-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.nation-selection-confirm {
  min-width: 230px;
  text-transform: uppercase;
}

.nation-selection-actions .secondary-button {
  min-width: 160px;
}

@media (max-width: 680px) {
  .nation-selection-card {
    padding: 18px;
  }

  .nation-selection-card-grid {
    grid-template-columns: 1fr;
  }

  .nation-selection-option {
    min-height: 160px;
  }
}

/* ===== Matchmaking queue modal ===== */

.queue-timer {
  margin: 0 0 4px;
  color: var(--gold);
  font-family: "Cinzel", serif;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.queue-roster {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.queue-roster:empty {
  display: none;
}

.queue-roster-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.queue-roster-entry span {
  font-weight: 600;
}

.queue-roster-entry small {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.queue-roster-bot {
  border-color: rgba(216, 181, 106, 0.35);
}

.queue-roster-bot small {
  color: var(--gold);
}