/* Bloody April — Aces over Arras, 1917 */

:root {
  --ink: #2a2118;
  --paper: #e8dcc0;
  --paper-dark: #d6c6a2;
  --brass: #b08d3c;
  --brass-bright: #d4af5a;
  --red: #8c2f24;
  --allied: #33507a;
  --german: #5a5a5a;
  --shadow: rgba(20, 14, 6, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #14100a;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--ink);
}

#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ============ OVERLAYS ============ */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto;
}

#menu {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(232,220,192,0.06), transparent 60%),
    linear-gradient(#171209, #0e0b06);
}

.menu-inner {
  width: min(1060px, 94vw);
  margin: 4vh auto;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 30% 10%, rgba(255,250,235,0.5), transparent 55%),
    radial-gradient(ellipse at 80% 95%, rgba(120,90,40,0.18), transparent 50%);
  border: 1px solid #9c8a60;
  outline: 4px double #7a6a44;
  outline-offset: -12px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.8);
  padding: 44px 52px 36px;
}

.masthead { text-align: center; }
.masthead-rule {
  height: 3px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  margin: 10px 60px;
}
.masthead h1 {
  font-size: clamp(44px, 7vw, 76px);
  letter-spacing: 0.12em;
  font-weight: 700;
  margin: 8px 0 2px;
  color: var(--ink);
}
.subtitle {
  font-size: 15px; letter-spacing: 0.42em; color: #6b5636;
  margin-bottom: 10px;
}
.briefing {
  max-width: 640px; margin: 18px auto 6px;
  font-size: 16px; line-height: 1.55; font-style: italic; color: #4a3c28;
}
.briefing-strong {
  margin: 14px 0 6px; letter-spacing: 0.28em; font-size: 13px; font-weight: 700;
  color: var(--red);
}

/* ============ ROSTER ============ */
.roster { display: flex; gap: 34px; margin-top: 18px; }
.roster-col { flex: 1; min-width: 0; }

.roster-head {
  font-size: 17px; letter-spacing: 0.24em; text-align: center;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 14px;
}
.roster-head span {
  display: block; font-size: 11px; letter-spacing: 0.3em; font-weight: 400;
  color: #7a6544; margin-top: 3px;
}
.roster-head.allied { color: var(--allied); border-color: var(--allied); }
.roster-head.german { color: #3d3d3d; border-color: #3d3d3d; }

.pilot-card {
  display: flex; gap: 14px; align-items: center;
  padding: 10px 12px; margin-bottom: 10px;
  background: rgba(255,252,242,0.45);
  border: 1px solid #b3a077;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s;
}
.pilot-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(60,40,10,0.25); border-color: var(--brass); }
.pilot-card.selected {
  border: 2px solid var(--red);
  background: rgba(255,248,230,0.85);
  box-shadow: 0 4px 18px rgba(140,47,36,0.3);
}

.pilot-photo {
  width: 64px; height: 78px; flex: none;
  object-fit: cover; object-position: top center;
  filter: sepia(0.55) contrast(1.05) brightness(0.98);
  border: 3px solid #fffdf5;
  outline: 1px solid #8a7550;
  box-shadow: 0 3px 8px rgba(40,25,5,0.4);
}

.pilot-meta { min-width: 0; }
.pilot-name { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.pilot-unit { font-size: 12px; letter-spacing: 0.08em; color: #6b5636; margin: 1px 0 4px; }
.pilot-bio { font-size: 12.5px; line-height: 1.35; font-style: italic; color: #55452e; }
.pilot-score { font-size: 11px; letter-spacing: 0.14em; color: var(--red); margin-top: 4px; font-weight: 700; }

/* ============ MENU FOOTER ============ */
.menu-footer { text-align: center; margin-top: 22px; }

button {
  font-family: inherit;
  font-size: 18px; letter-spacing: 0.24em; font-weight: 700;
  padding: 14px 46px;
  background: var(--ink); color: var(--paper);
  border: 1px solid #000;
  outline: 1px solid var(--brass);
  outline-offset: -5px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
button:hover:not(:disabled) { background: var(--red); transform: translateY(-1px); }
button:disabled { opacity: 0.45; cursor: default; }

.controls-hint {
  margin-top: 16px; font-size: 12px; letter-spacing: 0.06em; color: #7a6544;
}
.controls-hint b { color: #4a3c28; letter-spacing: 0.12em; }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

.hud-panel {
  position: absolute; bottom: 18px;
  background: rgba(20, 15, 8, 0.62);
  border: 1px solid rgba(176, 141, 60, 0.55);
  padding: 10px 16px;
  color: var(--paper);
  min-width: 170px;
  backdrop-filter: blur(2px);
}
#hud-left { left: 18px; }
#hud-right { right: 18px; text-align: right; }

.gauge { display: flex; align-items: baseline; gap: 8px; margin: 3px 0; justify-content: space-between; }
.glabel { font-size: 10px; letter-spacing: 0.22em; color: var(--brass-bright); width: 74px; text-align: left; }
.gval { font-size: 20px; font-variant-numeric: tabular-nums; flex: 1; text-align: right; }
.gunit { font-size: 10px; color: #b8a888; width: 26px; text-align: left; }

.bar { flex: 1; height: 9px; background: rgba(232,220,192,0.15); border: 1px solid rgba(176,141,60,0.5); }
.bar-fill { height: 100%; width: 100%; background: var(--brass-bright); transition: width 0.15s linear; }
.bar-fill.hp { background: #7da05e; }
.bar-fill.hp.low { background: #c05a30; }

#kill-tally {
  margin-top: 8px; padding-top: 7px;
  border-top: 1px solid rgba(176,141,60,0.4);
  font-size: 15px; letter-spacing: 0.3em; color: var(--brass-bright);
  min-height: 20px;
}
#kill-tally .k { color: #e6c87a; }
#kill-tally .k-empty { color: rgba(232,220,192,0.22); }
#kill-tally .k-label { font-size: 9px; letter-spacing: 0.2em; color: #b8a888; display: block; margin-bottom: 3px; }

/* ============ BANNER (kill announcements) ============ */
#banner-wrap { position: absolute; top: 26px; left: 0; right: 0; display: flex; justify-content: center; }
#banner {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #6b5636;
  outline: 3px double #8a7550;
  outline-offset: -6px;
  padding: 12px 34px;
  font-size: 16px; letter-spacing: 0.14em; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  animation: banner-in 0.35s ease-out;
  max-width: 72vw;
}
#banner .b-kicker { display: block; font-size: 9px; letter-spacing: 0.5em; color: var(--red); margin-bottom: 4px; }
@keyframes banner-in {
  from { transform: translateY(-24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

#stall-warn {
  position: absolute; top: 34%; left: 0; right: 0; text-align: center;
  font-size: 22px; letter-spacing: 0.5em; color: #ffd9a0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  animation: stall-blink 0.5s steps(2) infinite;
}
@keyframes stall-blink { 50% { opacity: 0.25; } }

#vignette {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 200px rgba(140, 30, 15, 0);
  transition: box-shadow 0.1s;
}
#vignette.hit { box-shadow: inset 0 0 200px rgba(140, 30, 15, 0.85); }

#intro-card {
  position: absolute; top: 20%; left: 0; right: 0; text-align: center;
  color: var(--paper);
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
  pointer-events: none;
}
#intro-card h3 { font-size: 30px; letter-spacing: 0.3em; font-weight: 400; }
#intro-card p { font-size: 14px; letter-spacing: 0.2em; margin-top: 8px; color: #d9cba6; }

/* ============ SCOREBOARD ============ */
#scoreboard { background: rgba(10, 8, 4, 0.82); z-index: 15; }
.score-inner {
  background: var(--paper);
  border: 1px solid #9c8a60; outline: 4px double #7a6a44; outline-offset: -10px;
  padding: 30px 44px; width: min(820px, 92vw);
  box-shadow: 0 30px 80px rgba(0,0,0,0.8);
}
.score-inner h2 { text-align: center; letter-spacing: 0.3em; font-size: 22px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.score-cols { display: flex; gap: 30px; margin-top: 16px; }
.score-col { flex: 1; }
.score-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; border-bottom: 1px solid #c4b28a;
  font-size: 14px;
}
.score-row img {
  width: 34px; height: 40px; object-fit: cover; object-position: top center;
  filter: sepia(0.55); border: 2px solid #fffdf5; outline: 1px solid #8a7550;
}
.score-row .sname { flex: 1; font-weight: 700; }
.score-row .sname small { display: block; font-weight: 400; font-size: 10.5px; color: #7a6544; letter-spacing: 0.06em; }
.score-row .skills { font-size: 16px; letter-spacing: 0.18em; color: var(--red); min-width: 86px; text-align: right; font-weight: 700; }
.score-row.dead { opacity: 0.45; }
.score-row.you { background: rgba(176,141,60,0.16); }
.score-hint { text-align: center; margin-top: 14px; font-size: 11px; letter-spacing: 0.3em; color: #7a6544; }

/* ============ END SCREEN ============ */
#endscreen { background: rgba(10, 8, 4, 0.88); z-index: 30; }
.end-inner {
  background: var(--paper);
  border: 1px solid #9c8a60; outline: 4px double #7a6a44; outline-offset: -12px;
  padding: 40px 60px; width: min(660px, 92vw);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.85);
}
#end-kicker { font-size: 11px; letter-spacing: 0.5em; color: var(--red); font-weight: 700; }
#end-portrait-frame {
  width: 132px; height: 160px; margin: 18px auto 14px;
  border: 4px solid #fffdf5; outline: 1px solid #8a7550;
  box-shadow: 0 8px 24px rgba(40,25,5,0.5);
  overflow: hidden;
}
#end-portrait { width: 100%; height: 100%; object-fit: cover; object-position: top center; filter: sepia(0.5) contrast(1.05); }
#endscreen h1 { font-size: 38px; letter-spacing: 0.08em; margin: 4px 0; }
#end-sub { font-size: 13px; letter-spacing: 0.3em; color: #6b5636; margin-bottom: 14px; }
#end-body { font-size: 15.5px; line-height: 1.55; font-style: italic; color: #4a3c28; max-width: 460px; margin: 0 auto 24px; }
.end-buttons { display: flex; gap: 14px; justify-content: center; }
.end-buttons button { font-size: 14px; padding: 12px 28px; }

/* ============ ERA TOGGLE ============ */
.era-toggle { display: flex; gap: 14px; justify-content: center; margin: 18px 0 4px; }
.era-btn {
  font-family: inherit;
  background: rgba(255,252,242,0.4);
  color: var(--ink);
  border: 1px solid #b3a077;
  outline: none;
  padding: 10px 26px;
  font-size: 14px; letter-spacing: 0.22em; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.era-btn span {
  display: block; font-size: 10px; letter-spacing: 0.12em; font-weight: 400;
  color: #7a6544; margin-top: 3px;
}
.era-btn:hover:not(:disabled) { background: rgba(255,248,230,0.8); transform: none; border-color: var(--brass); }
.era-btn.selected {
  background: var(--ink); color: var(--paper);
  border-color: #000;
  box-shadow: 0 4px 14px rgba(40,25,5,0.35);
}
.era-btn.selected span { color: var(--brass-bright); }

/* ============ MACHINE PICKER ============ */
#machine-row { margin-bottom: 16px; }
#machine-row label {
  display: block; font-size: 11px; letter-spacing: 0.34em; font-weight: 700;
  color: var(--red); margin-bottom: 7px;
}
#plane-pick {
  font-family: inherit;
  font-size: 15px;
  padding: 9px 18px;
  background: rgba(255,252,242,0.7);
  color: var(--ink);
  border: 1px solid #b3a077;
  outline: 1px solid rgba(176,141,60,0.4);
  outline-offset: -4px;
  min-width: 340px;
  cursor: pointer;
}

/* Cockpit view: the instrument panel replaces the HUD text gauges */
#hud.cockpit .hud-panel { display: none; }

@media (max-width: 760px) {
  .roster { flex-direction: column; }
  .menu-inner { padding: 28px 22px; }
  #plane-pick { min-width: 0; width: 100%; }
}
