#screen-alloc.active {
  height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
body.alloc-active .footer-chrome,
body.alloc-active .footer-bottom,
body.alloc-active .vortex-msg { display: none; }

/* WAR INFO BAR */
.war-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 14px;
  border: 1px solid #333;
  margin-bottom: 4px;
  font-size: 12px;
  color: #aaa;
  flex-shrink: 0;
}
.war-bar .threshold { color: #ff4444; font-weight: bold; }

/* HP BARS */
.hp-section { margin-bottom: 4px; flex-shrink: 0; }
.hp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #ccc;
  margin-bottom: 3px;
  font-weight: bold;
}
.hp-labels .hp-pct { color: #ff4444; }
.hp-track {
  width: 100%;
  height: 20px;
  background: #111;
  border: 1px solid #444;
  overflow: hidden;
  display: flex;
}
.hp-fill-left { background: #fff; height: 100%; transition: width 0.4s; }
.hp-fill-right { background: #666; height: 100%; transition: width 0.4s; margin-left: auto; }

/* BOARD LAYOUT */
.board {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.board-side {
  flex: 1;
  border: 1px solid #444;
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.board-side-header {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}
.board-side-header .side-bank { color: #ccc; font-size: 12px; }
.board-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: #555;
  padding: 0 4px;
  align-self: center;
  flex-shrink: 0;
}

/* CARD GRID */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  flex: 1;
  align-content: stretch;
}

/* BATTALION CARD */
.batt-card {
  border: 1px solid #555;
  background: #000;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  position: relative;
}
.batt-card.eliminated {
  opacity: 0.2;
  pointer-events: none;
}
.batt-card.nav-selected { border-color: #fff; border-width: 2px; }
.batt-card.nav-editing {
  border-color: #fff;
  border-width: 2px;
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.batt-card .card-stats {
  font-size: 13px;
  color: #ccc;
  text-align: center;
  margin-bottom: 2px;
  width: 100%;
  font-weight: bold;
}
.batt-card .card-stats .hp-val { color: #fff; }
.batt-card .card-stats .force-val { color: #aaa; }
.batt-card .card-name {
  font-size: 10px;
  text-align: center;
  margin-bottom: 2px;
  color: #888;
  font-weight: bold;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.batt-card .card-sprite {
  width: 64px;
  height: 64px;
  margin: 4px 0;
  image-rendering: pixelated;
  flex-shrink: 1;
  flex-grow: 1;
  object-fit: contain;
  max-height: 120px;
}

.batt-card .card-input-wrap {
  margin-top: auto;
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 4px;
}
.batt-card .card-input {
  width: 52px;
  background: #111;
  border: 1px solid #444;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  padding: 4px 5px;
  text-align: center;
}
.batt-card .card-input:focus {
  outline: none;
  border-color: #fff;
}
.batt-card .card-input.atk { border-color: #888; }
.batt-card .card-input.def { border-color: #888; }

/* Spec mode: per-battalion controls */
.batt-card .spec-controls {
  margin-top: auto;
  width: 100%;
  padding-top: 3px;
  font-size: 10px;
  color: #888;
}
.spec-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 2px;
  justify-content: center;
}
.spec-row label { font-size: 9px; color: #777; min-width: 18px; }
.spec-row .card-input { width: 40px; font-size: 12px; padding: 2px 3px; }
.spec-row select {
  background: #111;
  border: 1px solid #444;
  color: #fff;
  font-family: inherit;
  font-size: 9px;
  padding: 2px;
  max-width: 70px;
}
.spec-row select:focus { outline: none; border-color: #fff; }
.batt-force-remaining {
  font-size: 9px;
  text-align: center;
  color: #40c060;
  margin-top: 1px;
}
.batt-force-remaining.over { color: #ff4444; }

/* ALLOCATION FOOTER */
.alloc-bottom {
  flex-shrink: 0;
  padding: 6px 0 2px;
  border-top: 1px solid #333;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.alloc-bottom .force-info { color: #ccc; font-size: 14px; }
.alloc-bottom .force-info strong { color: #fff; font-size: 16px; }
.alloc-bottom .force-remaining { color: #40c060; font-size: 14px; }
.alloc-bottom .force-remaining.over { color: #ff4444; }
.alloc-bottom .btn { padding: 6px 18px; }

/* RANDOMIZATION SCREEN */
.randomize-panel {
  max-width: 500px;
  margin: 40px auto;
  text-align: center;
}
.randomize-panel h2 {
  font-size: 18px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 40px;
  color: #ccc;
}
.rand-slot {
  margin-bottom: 36px;
  transition: opacity 0.5s;
}
.rand-label {
  font-size: 12px;
  color: #888;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.rand-spinner {
  border: 2px solid #333;
  display: inline-block;
  padding: 14px 40px;
  min-width: 160px;
  position: relative;
  overflow: hidden;
}
.rand-spinner.spinning { border-color: #666; }
.rand-spinner.landed {
  border-color: #fff;
  box-shadow: 0 0 20px rgba(255,255,255,0.15);
}
.rand-value {
  font-size: 48px;
  font-weight: bold;
  letter-spacing: 4px;
  min-height: 60px;
  line-height: 60px;
}
.rand-range {
  font-size: 10px;
  color: #555;
  margin-top: 8px;
  letter-spacing: 1px;
}
.rand-status {
  font-size: 12px;
  color: #666;
  letter-spacing: 1px;
  margin-bottom: 20px;
  min-height: 20px;
}

/* HANDOFF */
.handoff { max-width: 480px; margin: 60px auto; text-align: center; }
.handoff h2 { font-size: 18px; letter-spacing: 3px; margin-bottom: 14px; }
.handoff p { color: #888; margin-bottom: 20px; font-size: 12px; }

/* REVEAL */
.reveal-wrapper { max-width: 1300px; margin: 0 auto; width: 100%; }
.reveal-generals {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.reveal-side { border: 1px solid #444; padding: 8px; }
.reveal-side-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #333;
}
.reveal-side-header .stats { color: #ccc; font-size: 12px; }

.reveal-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  border: 1px solid #333;
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.5s;
}
.reveal-event.visible { opacity: 1; transform: translateY(0); }
.reveal-event .dmg { color: #ff4444; font-weight: bold; }
.reveal-event .blocked { color: #40c060; }
.reveal-event .elim { color: #ff4444; font-weight: bold; letter-spacing: 1px; }

/* Reveal card mini */
.reveal-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.reveal-mini-card {
  border: 1px solid #333;
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
}
.reveal-mini-card.eliminated { opacity: 0.2; text-decoration: line-through; }
.reveal-mini-card .mini-sprite {
  width: 48px;
  height: 48px;
  margin: 3px auto;
  image-rendering: pixelated;
}
.reveal-mini-card .mini-name { color: #aaa; margin-bottom: 2px; font-size: 10px; }
.reveal-mini-card .mini-stats { color: #888; font-weight: bold; }

/* SUMMARY */
.summary-panel {
  max-width: 600px;
  margin: 16px auto;
  border: 1px solid #444;
  padding: 20px;
}
.summary-panel h2 {
  text-align: center;
  margin-bottom: 14px;
  font-size: 14px;
  letter-spacing: 2px;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 14px;
}
.summary-table th, .summary-table td {
  padding: 5px 8px;
  text-align: center;
  border-bottom: 1px solid #222;
}
.summary-table th { color: #888; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; }

.war-result {
  text-align: center;
  font-size: 18px;
  letter-spacing: 3px;
  padding: 12px;
  margin: 12px 0;
}

.timer-display {
  font-size: 16px;
  text-align: center;
  margin: 2px 0;
  letter-spacing: 2px;
  flex-shrink: 0;
}
.timer-display.urgent { color: #ff4444; }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
  .header h1 { font-size: 16px; letter-spacing: 4px; }
  .header .subtitle { font-size: 8px; }
  .header { padding: 4px 0 1px; }
  .vortex-msg { margin: 0 0 2px; font-size: 8px; }
  .game-container { padding: 0 6px; }
  #screen-alloc.active { height: calc(100vh - 60px); }
  .war-bar { font-size: 10px; padding: 3px 8px; flex-wrap: wrap; gap: 2px; }
  .hp-labels { font-size: 11px; }
  .hp-track { height: 16px; }
  .hp-section { margin-bottom: 2px; }
  .board { flex-direction: column; gap: 4px; }
  .board-vs { padding: 2px 0; font-size: 14px; }
  .card-grid { grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .batt-card { padding: 3px; }
  .batt-card .card-sprite { width: 44px; height: 44px; margin: 2px 0; }
  .batt-card .card-stats { font-size: 11px; }
  .batt-card .card-name { font-size: 8px; }
  .batt-card .card-input { width: 40px; font-size: 12px; padding: 3px; }
  .alloc-bottom .force-info { font-size: 12px; }
  .alloc-bottom .force-info strong { font-size: 14px; }
  .reveal-generals { grid-template-columns: 1fr; gap: 6px; }
  .reveal-generals .board-vs { display: none; }
  .footer-chrome { display: none; }
  .footer-bottom { font-size: 9px; padding: 2px 0 4px; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 14px; letter-spacing: 3px; }
  .header .subtitle, .header .credit { font-size: 7px; }
  .vortex-msg { font-size: 7px; }
  #screen-alloc.active { height: calc(100vh - 50px); }
  .war-bar { font-size: 9px; padding: 2px 6px; }
  .hp-labels { font-size: 10px; flex-direction: column; gap: 1px; }
  .hp-track { height: 14px; }
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; }
  .batt-card .card-sprite { width: 36px; height: 36px; margin: 1px 0; }
  .batt-card .card-stats { font-size: 9px; }
  .batt-card .card-name { font-size: 7px; }
  .batt-card .card-input { width: 34px; font-size: 10px; }
  .timer-display { font-size: 14px; }
  .reveal-card-grid { grid-template-columns: repeat(3, 1fr); }
}
