* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: #0d1218;
  color: #e8eef5;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
  overflow: hidden;
}
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.92), rgba(10, 14, 20, 0.55));
  border-bottom: 1px solid rgba(36, 48, 68, 0.55);
  pointer-events: none;
}
header h1,
header .meta,
header .meta * {
  pointer-events: auto;
}
header h1 {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: #7ec8ff;
}
header .meta { font-size: 0.85rem; color: #9bb0c7; display: flex; gap: 16px; flex-wrap: wrap; }
#stage-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0a0f14;
  min-height: 0;
  z-index: 1;
}
canvas#game {
  display: block;
  /* Largest box that keeps 1500×800 — element box matches drawable area (clicks OK) */
  width: min(100vw, calc(100vh * 1500 / 800));
  height: min(100vh, calc(100vw * 800 / 1500));
  max-width: 100%;
  max-height: 100%;
  background: #152018;
  cursor: crosshair;
  border: none;
}
/* Transparent Pixi Spine overlay — synced to game camera; clicks pass through */
canvas#spine-overlay {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 2;
  background: transparent;
  display: none;
}

/* Three.js GLB hero overlay — under Origins VFX; clicks pass through */
canvas#glb-overlay {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 2;
  background: transparent;
  display: none;
}

/* Origins Battle Kit additive VFX — clicks pass through to Den/Spire */
canvas#origins-vfx-overlay {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 3;
  background: transparent;
  mix-blend-mode: plus-lighter;
}
@supports not (mix-blend-mode: plus-lighter) {
  canvas#origins-vfx-overlay { mix-blend-mode: lighter; }
}
#hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 0 12px 12px;
  background: transparent;
  border-top: none;
  font-size: 0.85rem;
  pointer-events: none;
}
#hud .panel {
  pointer-events: auto;
}
.panel {
  background: #1a2433;
  border: 1px solid #2a3a50;
  border-radius: 8px;
  padding: 10px;
  min-height: 0;
}
.lane-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.panel h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7ec8ff;
  margin-bottom: 8px;
}
#axie-select { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.axie-btn {
  flex: 1;
  min-width: 70px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #3a4f6a;
  background: #243044;
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.8rem;
}
.axie-btn.active { outline: 2px solid #7ec8ff; border-color: #7ec8ff; }
.axie-btn.dead { opacity: 0.45; }
.axie-btn-row { display: flex; align-items: center; gap: 6px; justify-content: center; }
.axie-thumb {
  width: 28px;
  height: 21px;
  object-fit: contain;
  image-rendering: auto;
  flex-shrink: 0;
}
.axie-btn small { display: block; margin-top: 2px; opacity: 0.85; }

#skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.skill {
  background: #243044;
  border: 1px solid #3a4f6a;
  border-radius: 6px;
  padding: 6px;
  text-align: center;
}
.skill .key { font-weight: 700; color: #ffd27a; }
.skill.ready { border-color: #5ad48a; }
.skill.cd { opacity: 0.55; }
#shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #3a4f6a;
  background: #243044;
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.8rem;
}
.shop-btn:hover { background: #2d3d55; }
.shop-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#log {
  height: 72px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: #b7c7d9;
  line-height: 1.35;
}
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 16, 0.72);
  z-index: 5;
}
#overlay.hidden { display: none; }
#overlay .card {
  background: #1a2433;
  border: 1px solid #3a4f6a;
  border-radius: 12px;
  padding: 28px 36px;
  text-align: center;
  max-width: 420px;
}
#overlay h2 { color: #7ec8ff; margin-bottom: 10px; }
#overlay p { color: #b7c7d9; margin-bottom: 16px; line-height: 1.4; }
#overlay button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: #3d9e4a;
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.bar {
  flex: 1;
  height: 10px;
  background: #0d1218;
  border-radius: 4px;
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: #3d9e4a; }
.bar.enemy > span { background: #c45a1a; }
.hint { color: #8095ad; font-size: 0.75rem; margin-top: 6px; }
#channel {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  background: #1a2433ee;
  border: 1px solid #ffd27a;
  color: #ffd27a;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 4;
  display: none;
}

.zoom-hold-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #3a4f6a;
  background: #243044;
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  user-select: none;
  touch-action: none;
}
.zoom-hold-btn:hover { background: #2d3d55; border-color: #7ec8ff; }
.zoom-hold-btn:active,
.zoom-hold-btn.held {
  background: #3d5a80;
  border-color: #ffd27a;
  color: #ffd27a;
}

/* Den / Spire upgrade modals */
#den-modal,
#spire-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
#den-modal.hidden,
#spire-modal.hidden { display: none; }
.den-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 16, 0.55);
}
.den-modal-card {
  position: relative;
  z-index: 1;
  width: min(400px, 92%);
  background: #1a2433;
  border: 1px solid #3a4f6a;
  border-radius: 12px;
  padding: 18px 20px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.den-modal-card h2 {
  color: #7ec8ff;
  font-size: 1.05rem;
  margin-bottom: 10px;
  padding-right: 28px;
}
.den-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: #243044;
  color: #e8eef5;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.den-modal-close:hover { background: #2d3d55; color: #ffd27a; }
.den-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  color: #b7c7d9;
  font-size: 0.88rem;
}
.den-modal-row strong { color: #e8eef5; }
.den-modal-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.den-modal-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #3a4f6a;
  background: #243044;
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.85rem;
}
.den-modal-btn:hover:not(:disabled) { background: #2d3d55; border-color: #7ec8ff; }
.den-modal-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.den-modal-btn.primary { border-color: #3d9e4a; background: #2a4a34; }
.den-modal-btn.primary:hover:not(:disabled) { background: #356848; }
.den-parent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.den-parent-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid #3a4f6a;
  background: #243044;
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.75rem;
}
.den-parent-btn img {
  width: 44px;
  height: 33px;
  object-fit: contain;
}
.den-parent-btn.selected {
  outline: 2px solid #7ec8ff;
  border-color: #7ec8ff;
  background: #2a3d55;
}
.den-parent-btn.dead {
  opacity: 0.72;
}
.den-parent-btn.dead img { filter: grayscale(0.55); }
.den-parent-btn:hover { background: #2d3d55; }
.den-breed-result {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #2a4a34;
  border: 1px solid #3d9e4a;
  color: #c8f0d0;
  font-size: 0.85rem;
  text-align: center;
}
.den-breed-result strong { color: #ffd27a; }
#den-modal.breed-flash .den-modal-card {
  animation: den-breed-pulse 0.55s ease-out;
}
@keyframes den-breed-pulse {
  0% { box-shadow: 0 0 0 0 rgba(126, 200, 255, 0.55); }
  40% { box-shadow: 0 0 0 10px rgba(126, 200, 255, 0.15); }
  100% { box-shadow: 0 12px 40px rgba(0,0,0,0.45); }
}
.den-modal-hint { color: #8095ad; font-size: 0.75rem; margin-top: 10px; line-height: 1.35; }
.den-modal-inspect { color: #ffd27a; font-size: 0.8rem; margin-bottom: 6px; }

/* Top-left combat vitals overlay (over canvas) */
#combat-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: min(220px, 42%);
  padding: 8px 10px;
  background: rgba(14, 20, 30, 0.78);
  border: 1px solid #2a3a50;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  font-size: 0.72rem;
  color: #c8d6e6;
}
#combat-axies { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.combat-axie {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
}
.combat-axie.selected .combat-axie-name { color: #fff; }
.combat-axie.dead { opacity: 0.45; }
.combat-axie-name {
  font-weight: 600;
  color: #e8eef5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combat-axie-hpnum {
  color: #9bb0c7;
  font-variant-numeric: tabular-nums;
}
.combat-axie .combat-bar { grid-column: 1 / -1; }
.combat-nest-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.combat-nest-label { color: #9bb0c7; white-space: nowrap; }
.combat-nest-row.enemy .combat-nest-label { color: #d4a08f; }
.combat-bar {
  height: 7px;
  background: #0d1218;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #1a2433;
}
.combat-bar > span {
  display: block;
  height: 100%;
  background: #3d9e4a;
  transition: width 0.12s linear;
}
.combat-bar.enemy > span { background: #c45a1a; }
.combat-axie.selected .combat-bar { outline: 1px solid rgba(126, 200, 255, 0.45); }

.species-line { color: #b8e0c8; }
.class-chart {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.35;
  color: #8aa0b8;
  border-top: 1px solid #1a2433;
  padding-top: 6px;
  cursor: help;
}
.den-breed-result { color: #c8e8a0; }



/* ============================================================
   Origins Battle Kit HUD theme — clean dark chrome
   Keep HP / skill / energy kit art; never stretch BattleUis masks as panels.
   Assets: assets/ui/origins/
   ============================================================ */
:root {
  --origins-gold: #e8c46a;
  --origins-amber: #ffd27a;
  --origins-gold-dim: #b8923a;
  --origins-ink: #0a0e14;
  --origins-panel: #141a22;
  --origins-panel-2: #1a222c;
  --origins-text: #f2e6c9;
  --origins-muted: #a89878;
  --origins-hp: #3d9e4a;
  --origins-hp-enemy: #c45a1a;
  --origins-edge: rgba(232, 196, 106, 0.28);
}

body.origins-battle {
  background: radial-gradient(ellipse at 50% 0%, #1a2430 0%, #0a0e14 55%, #07090d 100%);
  color: var(--origins-text);
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

body.origins-battle header {
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.88), rgba(10, 14, 20, 0.35), transparent);
  border-bottom: none;
  box-shadow: none;
}
body.origins-battle header h1 {
  color: var(--origins-amber);
  text-shadow: 0 0 12px rgba(232, 196, 106, 0.3);
  letter-spacing: 0.06em;
}
body.origins-battle header .meta { color: var(--origins-muted); }
body.origins-battle header .meta strong { color: var(--origins-amber); }

#hud.origins-hud {
  background: linear-gradient(0deg, rgba(6, 8, 12, 0.55) 0%, transparent 42%);
  border-top: none;
  gap: 12px;
  padding: 18px 14px 14px;
  justify-content: space-between;
}

/* Solid floating panels — separated modules over the map */
#hud.origins-hud .panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(26, 34, 44, 0.92), rgba(16, 20, 28, 0.94));
  border: 1px solid var(--origins-edge);
  border-radius: 10px;
  padding: 10px 10px 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 22px rgba(0, 0, 0, 0.45);
  min-height: 0;
  border-image: none;
  backdrop-filter: blur(6px);
  flex: 0 1 auto;
}
#hud.origins-hud .panel-axies { flex: 1 1 200px; max-width: 280px; }
#hud.origins-hud .panel-lanes { flex: 0 1 180px; max-width: 200px; }
#hud.origins-hud .panel-skills { flex: 0 1 220px; max-width: 248px; }
#hud.origins-hud .panel-shop { flex: 0 1 200px; max-width: 240px; }
#hud.origins-hud .panel-log { flex: 0 1 200px; max-width: 260px; }
#hud.origins-hud .panel-log #log { height: 88px; }
#hud.origins-hud .panel-skills #passives { margin-top: 4px; font-size: 0.68rem; line-height: 1.25; }
#hud.origins-hud .panel-skills.panel-skills--compact { padding: 6px 6px 4px; }
#hud.origins-hud .panel-skills.panel-skills--compact h2 { margin-bottom: 6px; padding: 3px 6px 4px; font-size: 0.66rem; }
#hud.origins-hud .genes-more {
  margin-top: 4px;
  border-top: 1px solid rgba(232, 196, 106, 0.12);
  padding-top: 2px;
}
#hud.origins-hud .genes-more > summary {
  cursor: pointer;
  list-style: none;
  color: var(--origins-muted);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
  padding: 2px 0;
}
#hud.origins-hud .genes-more > summary::-webkit-details-marker { display: none; }
#hud.origins-hud .genes-more > summary::before {
  content: '▸ ';
  color: var(--origins-amber);
}
#hud.origins-hud .genes-more[open] > summary::before { content: '▾ '; }
#hud.origins-hud .genes-more:not([open]) #passives,
#hud.origins-hud .genes-more:not([open]) #class-chart { display: none; }
#hud.origins-hud .zoom-hold-btn {
  width: 100%;
  margin-top: 2px;
  padding: 6px 8px;
  font-size: 0.75rem;
}

#hud.origins-hud .panel h2 {
  color: var(--origins-amber);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 0 #000;
  margin-bottom: 10px;
  padding: 5px 10px 6px;
  background: linear-gradient(180deg, #2a3340, #1c2430);
  border: 1px solid rgba(232, 196, 106, 0.22);
  border-radius: 6px;
  text-align: center;
}

/* Axie / lane buttons */
body.origins-battle .axie-btn,
body.origins-battle .zoom-hold-btn,
body.origins-battle .den-modal-btn,
body.origins-battle .den-parent-btn {
  background: linear-gradient(180deg, #2a3340, #1a222c);
  border: 1px solid rgba(232, 196, 106, 0.32);
  color: var(--origins-text);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
body.origins-battle .axie-btn:hover,
body.origins-battle .zoom-hold-btn:hover,
body.origins-battle .den-modal-btn:hover:not(:disabled) {
  border-color: var(--origins-amber);
  filter: brightness(1.08);
}
body.origins-battle .axie-btn.active {
  outline: 2px solid var(--origins-amber);
  border-color: var(--origins-amber);
  box-shadow: 0 0 10px rgba(232, 196, 106, 0.3);
}
body.origins-battle .zoom-hold-btn:active,
body.origins-battle .zoom-hold-btn.held {
  border-color: var(--origins-amber);
  color: var(--origins-amber);
  background: #3a3020;
}

/* Skills — kit card frame only where it fits */
#skills .skill,
.skill.origins-skill {
  position: relative;
  background:
    linear-gradient(180deg, rgba(20, 24, 32, 0.72), rgba(10, 12, 18, 0.88)),
    url("../assets/ui/origins/InBattle/card.png") center / 100% 100% no-repeat;
  border: 1px solid rgba(232, 196, 106, 0.35);
  border-radius: 8px;
  padding: 4px 2px 3px;
  min-height: 52px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  overflow: hidden;
}
.panel-skills--compact #skills { gap: 4px; }
.panel-skills--compact .skill .skill-name {
  font-size: 0.58rem;
  max-width: 52px;
}
.panel-skills--compact .skill .skill-icon {
  width: 22px;
  height: 22px;
}
.panel-skills--compact .skill .key { font-size: 0.72rem; }
.panel-skills--compact .skill .skill-cd { font-size: 0.58rem; }
.skill .key {
  color: var(--origins-amber);
  font-size: 0.85rem;
  text-shadow: 0 0 6px rgba(255, 210, 122, 0.35);
}
.skill .skill-name {
  font-size: 0.68rem;
  line-height: 1.15;
  color: #e8dcc0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}
.skill .skill-cd {
  font-size: 0.65rem;
  color: var(--origins-muted);
}
.skill .skill-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.skill.ready {
  border-color: #6ecf7a;
  box-shadow: 0 0 10px rgba(90, 212, 138, 0.22);
}
.skill.cd { opacity: 0.58; filter: saturate(0.7); }

/* Shop — solid dark rows, no red/blue log plates */
.shop-btn.origins-shop,
body.origins-battle .shop-btn {
  background: linear-gradient(90deg, #1c2430, #222a36);
  border: 1px solid rgba(232, 196, 106, 0.28);
  border-radius: 8px;
  color: var(--origins-text);
  gap: 8px;
  padding: 8px 10px;
}
body.origins-battle .shop-btn:hover:not(:disabled) {
  border-color: var(--origins-amber);
  filter: brightness(1.08);
}
.shop-btn .shop-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
.shop-btn .shop-label { flex: 1; text-align: left; }
.shop-btn .shop-cost {
  color: var(--origins-amber);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#log {
  background: rgba(12, 16, 22, 0.92);
  border: 1px solid rgba(232, 196, 106, 0.18);
  border-radius: 6px;
  padding: 6px 8px;
  color: #d8cbb0;
  height: 76px;
}

/* Overlay + modal cards — solid, no base_under splatters */
#overlay .card.origins-card,
.den-modal-card.origins-card {
  background: linear-gradient(180deg, #1a222c 0%, #10161e 100%);
  border: 1px solid var(--origins-gold-dim);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(232, 196, 106, 0.12),
    0 16px 48px rgba(0, 0, 0, 0.55);
  color: var(--origins-text);
}
#overlay h2,
.den-modal-card h2 {
  color: var(--origins-amber);
  text-shadow: 0 0 10px rgba(232, 196, 106, 0.25);
}
#overlay p { color: #c8b898; }
#overlay .hint,
.den-modal-hint { color: var(--origins-muted); }
#overlay button#start-btn {
  background: linear-gradient(180deg, #c9a227, #8a6a18);
  border: 1px solid var(--origins-amber);
  color: #1a1408;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(232, 196, 106, 0.22);
}
#overlay button#start-btn:hover { filter: brightness(1.08); }

.overlay-flag {
  display: block;
  width: min(280px, 70%);
  height: auto;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}
.overlay-flag.hidden { display: none; }
#overlay.end-victory .card {
  box-shadow: 0 0 40px rgba(90, 212, 138, 0.18), 0 16px 48px rgba(0, 0, 0, 0.55);
}
#overlay.end-defeat .card {
  box-shadow: 0 0 40px rgba(196, 90, 26, 0.22), 0 16px 48px rgba(0, 0, 0, 0.55);
}

.den-modal-close {
  background: url("../assets/ui/origins/InBattle/icon_close.png") center / 18px 18px no-repeat,
    #243044;
  color: transparent;
  font-size: 0;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(232, 196, 106, 0.25);
}
.den-modal-close:hover { filter: brightness(1.2); }
.den-modal-btn.primary {
  border-color: var(--origins-gold-dim);
  background: linear-gradient(180deg, #3a4a28, #2a3a20);
}
.den-parent-btn.selected {
  outline-color: var(--origins-amber);
  border-color: var(--origins-amber);
}
.den-breed-result {
  background: rgba(42, 74, 52, 0.85);
  border-color: var(--origins-gold-dim);
}
.den-breed-result strong { color: var(--origins-amber); }

/* Combat HUD — clean frame + kit HP fills */
#combat-hud.origins-panel {
  z-index: 12;
  background: linear-gradient(180deg, rgba(18, 24, 32, 0.94), rgba(10, 14, 20, 0.96));
  border: 1px solid rgba(232, 196, 106, 0.32);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  width: min(240px, 46%);
  padding: 10px 10px 8px;
  color: var(--origins-text);
}
.combat-axie-name { color: var(--origins-text); }
.combat-axie.selected .combat-axie-name { color: var(--origins-amber); }
.combat-axie-hpnum { color: var(--origins-muted); }
.combat-nest-label {
  color: var(--origins-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.combat-nest-row.enemy .combat-nest-label { color: #d4a08f; }

.origins-hp {
  position: relative;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  background:
    #0a0e12
    url("../assets/ui/origins/HpBar/slice9-hp-frame.png") center / 100% 100% no-repeat;
  border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(232, 196, 106, 0.12);
  grid-column: 1 / -1;
}
.origins-hp::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("../assets/ui/origins/InBattle/hp_bar.png") center / 100% 100% no-repeat;
  opacity: 0.75;
  mix-blend-mode: soft-light;
}
.origins-hp-fill {
  display: block;
  height: 100%;
  width: 100%;
  background:
    linear-gradient(180deg, #5ad48a 0%, #2e7a3a 100%),
    url("../assets/ui/origins/InBattle/hp_fill.png") left center / auto 100% no-repeat;
  background-blend-mode: multiply;
  transition: width 0.12s linear;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.origins-hp.enemy .origins-hp-fill,
.combat-nest-hp.enemy .origins-hp-fill {
  background:
    linear-gradient(180deg, #e07840 0%, #8a3010 100%),
    url("../assets/ui/origins/InBattle/hp_fill.png") left center / auto 100% no-repeat;
  background-blend-mode: multiply;
}
.combat-axie .origins-hp { height: 10px; }
.combat-nest-hp { height: 11px; }
.combat-axie.selected .origins-hp {
  box-shadow: inset 0 0 0 1px rgba(232, 196, 106, 0.12), 0 0 0 1px rgba(232, 196, 106, 0.4);
}

.combat-bar {
  background: #0a0e12;
  border: 1px solid rgba(232, 196, 106, 0.2);
}
.combat-bar > span {
  background: linear-gradient(180deg, #5ad48a, #2e7a3a);
}
.combat-bar.enemy > span {
  background: linear-gradient(180deg, #e07840, #8a3010);
}

#channel {
  background: linear-gradient(180deg, #2a3340, #1a222c);
  border: 1px solid var(--origins-amber);
  color: var(--origins-amber);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.origins-battle .hint { color: var(--origins-muted); }
body.origins-battle .species-line { color: #c8e0b0; }
body.origins-battle .class-chart {
  color: #9a8a68;
  border-top-color: rgba(232, 196, 106, 0.15);
}

.origins-energy-badge {
  display: inline-block;
  width: 18px;
  height: 22px;
  vertical-align: -4px;
  margin-right: 4px;
  background: url("../assets/ui/origins/InBattle/energy_jar.png") center / contain no-repeat;
}

body.origins-battle .meta-gold {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px 2px 4px;
  background: linear-gradient(180deg, #2a3340, #1c2430);
  border-radius: 6px;
  border: 1px solid rgba(232, 196, 106, 0.28);
}
body.origins-battle .meta-gold strong {
  color: var(--origins-amber);
  font-variant-numeric: tabular-nums;
}

#combat-hud .combat-axie {
  position: relative;
  padding-left: 4px;
  border-left: 3px solid transparent;
  background: linear-gradient(90deg, rgba(20, 24, 32, 0.35), transparent 70%);
}
#combat-hud .combat-axie.selected {
  border-left-color: var(--origins-amber);
  background: linear-gradient(90deg, rgba(232, 196, 106, 0.12), transparent 75%);
  padding-left: 8px;
}
#combat-hud .combat-axie.selected .combat-axie-name {
  text-shadow: 0 0 8px rgba(232, 196, 106, 0.3);
}

body.origins-battle #stage-wrap {
  background: radial-gradient(ellipse at 50% 40%, #15202c 0%, #0a0e14 70%);
}


/* --- Multiplayer lobby (Round 1) --- */
#overlay .card.overlay-card--lobby { max-width: 480px; text-align: left; }
#overlay .overlay-card--lobby h2,
#overlay .overlay-card--lobby #overlay-body,
#overlay .overlay-card--lobby #overlay-hint { text-align: center; }
.mp-mode-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0 14px;
}
.mp-mode-btn {
  flex: 1;
  padding: 8px 10px !important;
  background: #2a3544 !important;
  border: 1px solid #4a5f7a !important;
  color: #c8b898 !important;
  font-weight: 600;
}
.mp-mode-btn.active {
  background: #3d6e4a !important;
  border-color: #6bcf7a !important;
  color: #fff !important;
}
#solo-panel { text-align: center; }
#mp-panel { margin-top: 4px; }
.mp-label {
  display: block;
  color: #a89878;
  font-size: 0.8rem;
  margin-bottom: 10px;
}
.mp-label input,
.mp-join-row input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #4a5f7a;
  background: #0d1218;
  color: #e8dcc8;
  box-sizing: border-box;
  font-size: 0.95rem;
}
.mp-join-row {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}
.mp-join-row input {
  flex: 1;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0;
}
.mp-actions button,
.mp-join-row button {
  padding: 8px 14px !important;
}
.mp-leave { background: #6a3a3a !important; }
.mp-lobby {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a4f6a;
  background: rgba(0,0,0,0.25);
}
.mp-invite { color: #c8b898; margin-bottom: 6px; text-align: center; }
.mp-invite strong {
  font-size: 1.25rem;
  letter-spacing: 0.18em;
  color: #7ec8ff;
}
.mp-link-btn {
  padding: 2px 8px !important;
  font-size: 0.75rem !important;
  background: #2a4058 !important;
  margin-left: 6px;
}
.mp-status { color: #8095ad; font-size: 0.8rem; margin-bottom: 8px; text-align: center; }
.mp-players {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #d0c4a8;
}
.mp-players li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(80,100,120,0.35);
}
.mp-players .side-tag { color: #7ec8ff; font-weight: 600; }
.mp-players .ready-yes { color: #6bcf7a; }
.mp-players .ready-no { color: #c45a1a; }
.mp-error {
  color: #ff8a7a;
  font-size: 0.8rem;
  margin-top: 8px;
  text-align: center;
}
.mp-endpoint-hint { text-align: center; margin-top: 10px; }
.mp-endpoint-hint code { color: #7ec8ff; font-size: 0.72rem; }
#mp-panel.hidden,
#mp-lobby.hidden,
#mp-error.hidden,
#mp-start.hidden,
#solo-panel.hidden { display: none !important; }

/* Thumbnail HUD — still readable after ~0.43× (1500×800 → 640×360).
   Wide camera is js/game.js wideFraming / ZOOM_OUT. */
body.origins-battle header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 10px 48px 0;
  background: transparent;
}
body.origins-battle header h1 {
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
  opacity: 0.8;
  text-shadow: 0 1px 2px #000;
}
.match-readout {
  justify-self: center;
  display: flex;
  gap: 12px;
  pointer-events: none;
  z-index: 21;
}
.readout-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 168px;
  height: 58px;
  padding: 0 14px;
  background: rgba(8, 10, 14, 0.92);
  border: 3px solid #e8c46a;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 0 #000;
}
.readout-chip .readout-k {
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d7c49a;
}
.readout-chip strong {
  font-size: 32px;
  color: #ffe08a;
  font-variant-numeric: tabular-nums;
}
body.origins-battle header .meta {
  font-size: 14px;
  font-weight: 700;
  margin-top: 16px;
  color: #f2e6c9;
  text-shadow: 0 1px 2px #000;
}

.side-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}
.side-you {
  left: 0;
  background: #1a6cff;
}
.side-enemy {
  right: 0;
  background: #e23a2c;
  transform: rotate(180deg);
}

#hud.origins-hud {
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 0 60px 12px;
  background: linear-gradient(0deg, rgba(6, 8, 12, 0.72) 0%, rgba(6, 8, 12, 0.2) 70%, transparent 100%);
}
#hud.origins-hud .panel-skills {
  flex: 0 0 auto;
  max-width: none;
  min-width: 540px;
  order: 2;
  padding: 8px 10px 8px;
}
#hud.origins-hud .panel-axies,
#hud.origins-hud .panel-lanes,
#hud.origins-hud .panel-shop,
#hud.origins-hud .panel-log {
  flex: 0 1 150px;
  max-width: 170px;
  max-height: 108px;
  overflow: hidden;
}
#hud.origins-hud .panel-skills h2 {
  font-size: 14px;
  margin-bottom: 6px;
  padding: 4px 8px;
}
#hud.origins-hud #skills {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
}
#hud.origins-hud #skills .skill,
#hud.origins-hud #skills .skill.origins-skill {
  min-width: 84px;
  min-height: 84px;
  padding: 6px 4px 4px;
  gap: 2px;
}
#hud.origins-hud #skills .skill .key {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  color: #ffd27a;
}
#hud.origins-hud #skills .skill .skill-name {
  font-size: 15px;
  font-weight: 700;
  max-width: 110px;
  color: #fff;
}
#hud.origins-hud #skills .skill .skill-cd {
  font-size: 14px;
  font-weight: 700;
}
#hud.origins-hud #skills .skill .skill-icon {
  width: 22px;
  height: 22px;
}

/* ============================================================
   Capture polish — map sits above the HUD (no lane hidden under panels),
   title on the right, H toggles a clean HUD-free view for screenshots.
   --hud-h is measured in js/main.js (ResizeObserver on #hud).
   ============================================================ */
#stage-wrap {
  top: var(--hdr-h, 0px);
  bottom: var(--hud-h, 0px);
  container-type: size;
}
canvas#game {
  width: min(100cqw, calc(100cqh * 1500 / 800));
  height: min(100cqh, calc(100cqw * 800 / 1500));
}
/* Vitals now live in the bottom band, not over the map */
#hud.origins-hud #combat-hud.panel-vitals {
  position: relative;
  top: auto;
  left: auto;
  width: auto;
  flex: 0 1 230px;
  max-width: 240px;
  max-height: none;
  overflow: visible;
  order: 0;
  font-size: 0.74rem;
}
#hud.origins-hud .panel-skills { order: 2; }
#hud.origins-hud .panel-log { order: 3; }
/* Bottom band: one intentional console strip under the map */
#hud.origins-hud {
  align-items: flex-end;
  padding: 8px 56px 10px;
  background: linear-gradient(180deg, #121821 0%, #0a0e14 100%);
  border-top: 2px solid rgba(232, 196, 106, 0.45);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.5);
}
/* Vitals rows are the Axie selector; the separate list was a duplicate */
#hud.origins-hud .panel-axies { display: none; }
#hud.origins-hud #combat-hud.panel-vitals { pointer-events: auto; }
#hud.origins-hud .combat-axie { cursor: pointer; border-radius: 4px; padding: 1px 3px; }
#hud.origins-hud .combat-axie:hover { background: rgba(232, 196, 106, 0.1); }
#hud.origins-hud .panel-lanes,
#hud.origins-hud .panel-shop,
#hud.origins-hud .panel-log {
  flex: 0 1 170px;
  max-width: 190px;
  max-height: 190px;
  overflow: hidden;
}
#hud.origins-hud .panel-shop { overflow-y: auto; }
@media (max-width: 1500px) {
  #hud.origins-hud .panel-skills { min-width: 460px; }
  #hud.origins-hud #skills .skill .key { font-size: 28px; }
  #hud.origins-hud #skills .skill .skill-name { font-size: 13px; }
}
#hud.origins-hud .panel-log #log { height: 118px; overflow-y: auto; }
#hud.origins-hud #class-chart { display: none; }
/* Header sits in its own strip above the map */
body.origins-battle header {
  padding: 6px 56px 6px;
  align-items: center;
  background: linear-gradient(180deg, #121821 0%, #0a0e14 100%);
  border-bottom: 2px solid rgba(232, 196, 106, 0.45);
}
body.origins-battle header h1 {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  margin-top: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 1;
  color: #ffe08a;
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(232, 196, 106, 0.45);
}
body.origins-battle header .match-readout { grid-column: 2; grid-row: 1; }
body.origins-battle header .meta { display: none; }

/* CPU spectator: player-only controls do nothing — hide them */
body.cpu-demo #hud.origins-hud .panel-axies,
body.cpu-demo #hud.origins-hud .panel-lanes,
body.cpu-demo #hud.origins-hud .panel-shop { display: none; }

/* H — clean capture view */
body.hud-hidden #hud,
body.hud-hidden #combat-hud,
body.hud-hidden .match-readout { display: none !important; }
body.hud-hidden #stage-wrap { top: 0; bottom: 0; }
body.hud-hidden header { background: transparent; border-bottom: none; }
#hud.origins-hud #combat-hud.panel-vitals > h2 { display: none; }
#hud.origins-hud .lane-row { gap: 4px; }
#hud.origins-hud .lane-row .axie-btn { flex: 1 1 0; min-width: 0; padding: 6px 2px; font-size: 0.78rem; white-space: nowrap; }

/* ---- Upgrades: scrollable Shop list + Den / Spire modals ---- */
.upgrade-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
/* Standard props would override the always-visible WebKit styling in Chrome */
@supports not selector(::-webkit-scrollbar) {
  .upgrade-scroll {
    scrollbar-width: thin;
    scrollbar-color: #b8923a rgba(8, 10, 14, 0.6);
  }
}
.upgrade-scroll::-webkit-scrollbar { width: 8px; }
.upgrade-scroll::-webkit-scrollbar-track {
  background: rgba(8, 10, 14, 0.6);
  border-radius: 4px;
}
.upgrade-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e8c46a, #b8923a);
  border-radius: 4px;
  border: 1px solid #0a0e14;
}
.upgrade-scroll::-webkit-scrollbar-thumb:hover { background: #ffd27a; }

/* Shop: heading stays put, items scroll */
#hud.origins-hud .panel-shop {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#hud.origins-hud .panel-shop > h2 { flex: 0 0 auto; }
#hud.origins-hud #shop-list {
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 2px;
}

/* Den / Spire modals cover the viewport (the stage is letterboxed) */
#den-modal,
#spire-modal {
  position: fixed;
  z-index: 40;
  padding: 16px;
}
.den-modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}
.den-modal-card > h2 { flex: 0 0 auto; }
#den-modal-body,
#spire-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 4px;
}

/* ============================================================
   Front end (SPA screens over the live board) — js/main.js router
   ============================================================ */
#frontend {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(8, 10, 14, 0.6) 0%, rgba(8, 10, 14, 0.85) 70%, rgba(8, 10, 14, 0.95) 100%);
  color: var(--origins-text);
}
#frontend.hidden { display: none; }
body.menu-open header,
body.menu-open #hud,
body.menu-open .side-marker,
body.menu-open #overlay { display: none !important; }
body.menu-open #stage-wrap { top: 0; bottom: 0; }

.fe-screen { display: none; min-height: 100%; padding: 32px 16px; }
.fe-screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }

.fe-hero { text-align: center; max-width: 920px; }
.fe-kicker {
  font-size: 13px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--origins-gold-dim); margin-bottom: 6px;
}
.fe-title {
  font-family: "Arial Black", "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(44px, 9vw, 116px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ffe08a;
  text-shadow: 0 4px 0 #1a1004, 0 0 32px rgba(232, 196, 106, 0.45);
}
.fe-tagline { margin-top: 14px; font-size: clamp(15px, 1.6vw, 19px); color: #e8dcc0; text-shadow: 0 1px 2px #000; }

.fe-actions {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.fe-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 16px 18px;
  min-height: 48px;
  border-radius: 12px;
  border: 2px solid rgba(232, 196, 106, 0.55);
  background: linear-gradient(180deg, rgba(30, 38, 50, 0.95), rgba(14, 18, 26, 0.95));
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.fe-btn small { font-size: 12.5px; font-weight: 600; color: #c8b898; }
.fe-btn:hover, .fe-btn:focus-visible { transform: translateY(-2px); border-color: #ffd27a; outline: none; }
.fe-btn-primary {
  background: linear-gradient(180deg, #f2cc6e, #c8952f);
  border-color: #ffe08a;
  color: #1a1004;
}
.fe-btn-primary small { color: #4a3410; }
.fe-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.fe-links { margin-top: 18px; }
.fe-links a, .fe-back { color: #ffd27a; font-weight: 700; text-decoration: none; }
.fe-links a:hover, .fe-back:hover { text-decoration: underline; }

.fe-roster { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.fe-roster li {
  display: grid; grid-template-columns: 48px auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 8px 16px 8px 8px; border-radius: 999px;
  background: rgba(10, 14, 20, 0.72); border: 1px solid rgba(232, 196, 106, 0.25);
}
.fe-roster img { grid-row: 1 / 3; width: 48px; height: 40px; object-fit: contain; }
.fe-roster b { font-size: 15px; color: #fff; }
.fe-roster span { font-size: 12px; color: #c8b898; }

/* Panel screens: How to play / Online */
.fe-panel.active { justify-content: flex-start; }
.fe-panel {
  max-width: 820px;
  margin: 0 auto;
}
.fe-panel.active > * { width: 100%; }
.fe-panel h2 {
  font-family: "Arial Black", "Trebuchet MS", system-ui, sans-serif;
  font-size: clamp(28px, 4vw, 40px); color: #ffe08a; text-transform: uppercase; letter-spacing: 0.04em;
}
.fe-sub { color: #ffd27a; font-size: 18px; }
.fe-muted { color: #c8b898; line-height: 1.5; }
.fe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fe-card {
  padding: 14px 16px; border-radius: 12px;
  background: rgba(14, 18, 26, 0.9); border: 1px solid rgba(232, 196, 106, 0.22);
}
.fe-card h3 { color: #ffd27a; font-size: 16px; margin-bottom: 6px; }
.fe-card p { color: #e8dcc0; line-height: 1.5; font-size: 14.5px; }
.fe-keys {
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; align-items: center;
  padding: 14px 16px; border-radius: 12px; background: rgba(14, 18, 26, 0.9); border: 1px solid rgba(232, 196, 106, 0.22);
}
.fe-keys dt { white-space: nowrap; color: #fff; font-weight: 700; }
.fe-keys dd { color: #e8dcc0; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; margin-right: 2px; text-align: center;
  border-radius: 5px; border: 1px solid #6a5a38; border-bottom-width: 3px;
  background: #1a2230; color: #ffe08a; font: 700 12.5px/1.5 ui-monospace, Menlo, monospace;
}
.fe-inline { align-self: flex-start; width: auto !important; }

/* Online lobby */
.fe-field { display: flex; flex-direction: column; gap: 6px; max-width: 360px; }
.fe-field span { font-size: 13px; font-weight: 700; color: #c8b898; text-transform: uppercase; letter-spacing: 0.08em; }
.fe-field input, .fe-code-input {
  padding: 12px 14px; min-height: 44px; border-radius: 10px;
  border: 1px solid #3a4f6a; background: #0d1218; color: #fff; font: 600 16px system-ui, sans-serif;
}
.fe-field input:focus, .fe-code-input:focus { outline: 2px solid #ffd27a; outline-offset: 1px; }
.fe-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fe-row .fe-btn { flex-direction: row; padding: 12px 20px; font-size: 16px; }
.fe-or { color: #c8b898; font-weight: 700; }
.fe-code-input { width: 8.5em; text-transform: uppercase; letter-spacing: 0.25em; text-align: center; }
.fe-error { color: #ffb4a0; background: rgba(120, 30, 20, 0.35); border: 1px solid #a04030; padding: 10px 12px; border-radius: 10px; }
.fe-warn { color: #ffe0a0; background: rgba(120, 90, 20, 0.3); border: 1px solid #a07a30; padding: 10px 12px; border-radius: 10px; line-height: 1.5; }
.fe-error.hidden, .fe-warn.hidden, .fe-lobby.hidden, #mp-start.hidden { display: none; }
.fe-lobby {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px; border-radius: 12px; background: rgba(14, 18, 26, 0.92); border: 1px solid rgba(232, 196, 106, 0.3);
}
.fe-invite { font-size: 16px; color: #e8dcc0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fe-invite strong { font: 800 26px ui-monospace, Menlo, monospace; letter-spacing: 0.2em; color: #ffe08a; }
.fe-mini {
  padding: 6px 12px; min-height: 32px; border-radius: 8px; border: 1px solid #6a5a38;
  background: #1a2230; color: #ffd27a; font-weight: 700; cursor: pointer;
}
.fe-players { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.fe-players li {
  display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 8px;
  background: #0d1218; border: 1px solid #243044; color: #fff;
}
.fe-players .side-tag { font-size: 11px; text-transform: uppercase; color: #c8b898; margin-right: 6px; }
.fe-players .ready-yes { color: #7dffb0; font-weight: 800; }
.fe-players .ready-no { color: #c8b898; }
.fe-server summary { cursor: pointer; color: #ffd27a; font-weight: 700; }
.fe-server { display: flex; flex-direction: column; gap: 8px; }
.fe-server[open] > *:not(summary) { margin-top: 8px; }
code { font-family: ui-monospace, Menlo, monospace; color: #ffe08a; overflow-wrap: anywhere; }

/* In-match menu link + end-card actions */
header .menu-link {
  grid-column: 1; grid-row: 1; justify-self: start; align-self: center;
  pointer-events: auto; color: #ffd27a; font-weight: 800; text-decoration: none;
  padding: 8px 12px; border: 1px solid rgba(232, 196, 106, 0.4); border-radius: 8px; background: rgba(8, 10, 14, 0.7);
}
header .menu-link:hover { border-color: #ffd27a; }
.overlay-actions { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.overlay-menu { color: #ffd27a; font-weight: 700; text-decoration: none; padding: 10px 14px; }
.overlay-menu:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .fe-actions { grid-template-columns: 1fr; }
  .fe-grid { grid-template-columns: 1fr; }
  .fe-keys { grid-template-columns: 1fr; }
  .fe-keys dd { margin-bottom: 6px; }
}
.fe-panel.active {
  align-items: stretch;
  min-height: auto;
  margin: 32px auto;
  padding: 28px clamp(16px, 4vw, 36px);
  gap: 16px;
  border-radius: 16px;
  background: rgba(10, 14, 20, 0.9);
  border: 1px solid rgba(232, 196, 106, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
@media (max-width: 720px) { .fe-panel.active { margin: 0; border-radius: 0; min-height: 100%; } }
