/* Cradle of Conquest: Normandy 1944
   Palette: staff-map browns and olives, Admiralty chart blues, signal-flimsy cream. */

:root {
  --bg:        #0b0f15;
  --panel:     #141a22;
  --panel-2:   #1b232d;
  --line:      #2a3544;
  --ink:       #e6e2d6;
  --ink-dim:   #97a0ad;
  --allied:    #6f9ede;
  --german:    #b0705e;
  --ok:        #6cc57a;
  --warn:      #e2bd4c;
  --bad:       #dd6a54;
  --gold:      #d8b46a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

button {
  font: inherit;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #26313d; border-color: #3d4c5e; }
button:disabled { opacity: .38; cursor: not-allowed; }
button.on { background: var(--gold); color: #17202b; border-color: var(--gold); font-weight: 600; }

h1, h2, h3, h4 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 600; }

/* ===================== Publisher splash ===================== */
#publisher-splash {
  position: fixed; inset: 0; z-index: 400;
  background: #0a0704;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 28px;
  cursor: pointer;
  transition: opacity .4s ease;
}
#publisher-splash.gone { opacity: 0; pointer-events: none; }
#publisher-splash .jhs-mark {
  width: 200px; height: 200px;
  opacity: 0;
  animation: jhsLogoIn 1.2s ease-out .2s forwards;
  filter: drop-shadow(0 0 40px rgba(224,168,60,.5));
}
#publisher-splash .jhs-word {
  text-align: center;
  opacity: 0;
  animation: jhsLogoIn 1.2s ease-out .6s forwards;
}
#publisher-splash .jhs-name {
  font-family: "Courier New", monospace;
  font-size: 26px; font-weight: 700; letter-spacing: .3em;
  color: #f0b93c; text-shadow: 0 0 20px rgba(224,168,60,.6);
}
#publisher-splash .jhs-tag {
  font-family: "Courier New", monospace;
  font-size: 11px; letter-spacing: .3em;
  color: rgba(224,168,60,.55); margin-top: 10px;
}
@keyframes jhsLogoIn {
  0%   { opacity: 0; transform: scale(.94); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===================== Startup ===================== */
#startup {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 24px; overflow: auto;
  background:
    radial-gradient(120% 90% at 50% 0%, #1c2836 0%, #0a0e14 60%),
    #0a0e14;
}
#startup.gone, #startup.pending { display: none; }

.startup-top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.startup-top-row .startup-kicker { margin-bottom: 0; }
.edu-badge {
  font: 700 10px/1 system-ui; letter-spacing: .14em; text-transform: uppercase;
  color: #f0b93c; background: rgba(240,185,60,.12);
  border: 1px solid rgba(240,185,60,.4);
  padding: 4px 9px; border-radius: 3px; white-space: nowrap;
}

.jhs-footer {
  position: absolute; bottom: 16px; left: 0; right: 0;
  text-align: center; font-size: 11.5px; color: #5c6673;
  letter-spacing: .02em;
}
.jhs-footer a { color: #d8b46a; text-decoration: none; }
.jhs-footer a:hover { text-decoration: underline; }

.app-footer {
  flex: 0 0 auto;
  padding: 4px 16px;
  text-align: center; font-size: 10.5px; color: #4e5762;
  letter-spacing: .02em;
  background: #0c1118; border-top: 1px solid var(--line);
}
.app-footer a { color: #8b7a4a; text-decoration: none; }
.app-footer a:hover { color: var(--gold); text-decoration: underline; }

.startup-card {
  max-width: 720px;
  background: linear-gradient(180deg, #161d27, #10151d);
  border: 1px solid #2c3a4b;
  border-radius: 10px;
  padding: 40px 44px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
.startup-kicker {
  font: 600 12px/1 system-ui; letter-spacing: .34em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 14px;
}
.startup-card h1 { font-size: 46px; letter-spacing: .01em; margin-bottom: 6px; }
.startup-sub { color: var(--ink-dim); margin: 0 0 24px; font-size: 15px; }
.startup-body { color: #cfd6df; margin: 0 0 16px; }

.startup-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px;
  margin: 26px 0; padding: 18px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.startup-facts div { display: flex; flex-direction: column; }
.startup-facts b { color: var(--gold); font-size: 15px; }
.startup-facts span { color: var(--ink-dim); font-size: 12.5px; }

.startup-row { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.startup-row label { color: var(--ink-dim); font-size: 13px; }
.startup-row input {
  width: 92px; margin-left: 6px; padding: 6px 8px;
  background: #0c1118; color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px;
}
#begin-btn {
  background: var(--gold); color: #16202b; border-color: var(--gold);
  font-weight: 700; padding: 10px 22px; font-size: 15px;
}
.startup-note { color: #78828f; font-size: 12px; margin: 18px 0 0; }

/* ===================== Layout ===================== */
#app { display: flex; flex-direction: column; height: 100%; }

#topbar {
  display: flex; align-items: center; gap: 26px;
  padding: 8px 16px;
  background: linear-gradient(180deg, #171f29, #111720);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
#title-block { display: flex; align-items: baseline; gap: 10px; min-width: 220px; }
.game-title { font-family: Georgia, serif; font-size: 19px; font-weight: 600; letter-spacing: .01em; }
#version-badge { color: #5f6a77; font-size: 11px; }
#beta-badge {
  background: #e05252; color: #fff; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 3px; font-size: 10.5px;
}

#clock-block { flex: 0 0 300px; }
#clock-time { font-family: Georgia, serif; font-size: 21px; letter-spacing: .02em; }
.clock-meta { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-dim); }
#clock-day { color: var(--gold); font-weight: 600; }
.light-night    { color: #7d8fb5; }
.light-twilight { color: #c79a6a; }
.light-daylight { color: #e0cf8a; }
#hour-track { height: 3px; background: #232d3a; border-radius: 2px; margin-top: 6px; overflow: hidden; }
#hour-bar { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }

#turn-controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }
#end-hour-btn { background: #2c5a8c; border-color: #3d75ad; font-weight: 600; }
#end-hour-btn:hover { background: #356ba4; }
.speed { font-size: 11.5px; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.speed input { width: 84px; }

/* ---- force bar ---- */
#force-bar {
  display: flex; align-items: center; gap: 18px;
  padding: 5px 16px; font-size: 12px;
  background: #10161e; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.force { display: flex; align-items: center; gap: 12px; color: var(--ink-dim); }
.force-label { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5px; }
.force.allied .force-label { color: var(--allied); }
.force.german .force-label { color: var(--german); }
.force .loss { color: #9a6a60; }
.beach-strip { display: flex; gap: 6px; margin: 0 auto; }
.beach-chip {
  padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 600;
  color: #10161e; background: var(--c); text-decoration: none; cursor: pointer;
}
.beach-chip:hover { filter: brightness(1.12); text-decoration: underline; }
.beach-chip.lost { background: #4a2822; color: #d99; text-decoration: line-through; }

.wiki-link {
  display: inline-block; font-size: 10.5px; color: var(--gold);
  text-decoration: none; margin-top: 3px;
}
.wiki-link:hover { text-decoration: underline; }

main { flex: 1 1 auto; display: flex; min-height: 0; }

/* ===================== Map ===================== */
#map-container { position: relative; flex: 1 1 auto; min-width: 0; }
#map-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

#view-modes {
  position: absolute; top: 12px; left: 12px;
  display: flex; gap: 4px;
  background: rgba(12,17,24,.86); padding: 4px; border-radius: 6px;
  border: 1px solid var(--line);
}
#view-modes button { padding: 4px 11px; font-size: 12px; }

#map-toggles {
  position: absolute; top: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(12,17,24,.86); padding: 8px 11px; border-radius: 6px;
  border: 1px solid var(--line); font-size: 11.5px; color: var(--ink-dim);
}
#map-toggles label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

#legend {
  position: absolute; bottom: 12px; left: 12px;
  display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 480px;
  background: rgba(12,17,24,.86); padding: 7px 11px; border-radius: 6px;
  border: 1px solid var(--line); font-size: 11px; color: var(--ink-dim);
}
#legend span { display: flex; align-items: center; gap: 5px; }
#legend i { width: 11px; height: 11px; border-radius: 2px; display: block; }

#toast {
  position: absolute; bottom: 16px; left: 50%; transform: translate(-50%, 14px);
  background: rgba(10,15,21,.96); border: 1px solid #344356;
  padding: 9px 18px; border-radius: 6px; font-size: 13px; max-width: 70%;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================== Sidebar ===================== */
#sidebar {
  flex: 0 0 380px; display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line);
  min-height: 0;
}
#side-tabs { display: flex; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.side-tab {
  flex: 1; border: 0; border-radius: 0; background: transparent;
  padding: 10px 4px; font-size: 12.5px; color: var(--ink-dim);
  border-bottom: 2px solid transparent;
}
.side-tab.on { color: var(--gold); border-bottom-color: var(--gold); background: transparent; font-weight: 600; }
.side-body { display: none; flex: 1 1 auto; overflow-y: auto; padding: 14px; min-height: 0; }
.side-body.on { display: block; }

/* ---- formation panel ---- */
.empty { color: var(--ink-dim); }
.empty .hint { font-size: 12.5px; line-height: 1.7; margin-top: 14px; color: #7d8794; }
.empty b { color: var(--gold); }

.unit-head { padding-bottom: 10px; border-bottom: 2px solid; margin-bottom: 12px; }
.unit-head.allied { border-color: var(--allied); }
.unit-head.german { border-color: var(--german); }
.unit-name { font-family: Georgia, serif; font-size: 17px; }
.unit-sub { color: var(--ink-dim); font-size: 12px; margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.stat-grid div { background: var(--panel-2); border-radius: 4px; padding: 7px 9px; }
.stat-grid label { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .07em; color: #6e7885; margin-bottom: 2px; }
.stat-grid b { font-size: 15px; font-weight: 600; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

.unit-where { font-size: 12.5px; color: #b9c1cb; margin-bottom: 10px; line-height: 1.9; }
.unit-where b { color: var(--ink); }
.tag, .fort {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 9px; font-size: 10.5px; background: #263140; color: #9fb0c4;
}
.fort { background: #4a2320; color: #e39c8c; }
.tag.warn { background: #4a3d18; color: var(--warn); }

.unit-note {
  font-size: 12px; line-height: 1.65; color: #9aa6b4;
  border-left: 2px solid var(--gold); padding: 4px 0 4px 11px; margin-bottom: 12px;
  font-style: italic;
}
.order-line { font-size: 12.5px; color: var(--ok); margin-bottom: 10px; }
.mini { padding: 1px 8px; font-size: 11px; margin-left: 6px; }

.assault-block { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.assault-block h4 { font-size: 13px; color: var(--gold); margin-bottom: 9px; }
.target-row { background: var(--panel-2); border-radius: 5px; padding: 9px 10px; margin-bottom: 8px; }
.target-row b { font-size: 13px; }
.target-row .muted { display: block; color: #757f8c; font-size: 11px; }
.odds { font-size: 11.5px; margin: 6px 0 8px; }
.target-buttons { display: flex; gap: 6px; }
.target-buttons button { flex: 1; padding: 5px 6px; font-size: 11.5px; }

.unit-buttons { display: flex; gap: 8px; margin-top: 14px; }
.unit-buttons button { flex: 1; }

/* ---- fleet ---- */
.force-group { margin-bottom: 16px; }
.force-group h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--gold); margin-bottom: 7px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.ship-row {
  padding: 8px 10px; border-radius: 5px; margin-bottom: 5px;
  background: var(--panel-2); cursor: pointer; border: 1px solid transparent;
}
.ship-row:hover { border-color: #3a4b5f; }
.ship-row.sel { border-color: var(--gold); background: #2a2a20; }
.ship-row.off { opacity: .48; }
.ship-name { font-size: 13px; font-weight: 600; }
.ship-stats { display: flex; flex-wrap: wrap; gap: 4px 11px; font-size: 11px; color: #7e8895; margin-top: 2px; }
.ship-class { color: var(--allied); }

/* ---- objectives ---- */
.score-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.score-num { font-family: Georgia, serif; font-size: 34px; color: var(--gold); }
.score-num span { font-size: 15px; color: #6e7885; }
.score-band { font-family: Georgia, serif; font-size: 15px; }
.score-bar { height: 5px; background: #232d3a; border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.score-bar i { display: block; height: 100%; background: var(--gold); }

.obj {
  padding: 9px 11px; border-radius: 5px; margin-bottom: 6px;
  background: var(--panel-2); border-left: 3px solid #384555; cursor: pointer;
}
.obj:hover { background: #212b36; }
.obj.held { border-left-color: var(--ok); }
.obj.part { border-left-color: var(--warn); }
.obj-top { display: flex; justify-content: space-between; align-items: baseline; }
.obj-top b { font-size: 13px; }
.obj-vp { font-size: 11.5px; color: var(--gold); }
.obj-detail { font-size: 11.5px; color: #8b95a2; margin-top: 2px; }
.obj-brief { font-size: 11px; line-height: 1.6; color: #6b7480; margin-top: 5px; }

/* ---- log ---- */
.log-line {
  font-size: 12px; line-height: 1.6; padding: 4px 0 4px 54px;
  border-bottom: 1px solid #1c242e; position: relative; color: #b3bcc7;
}
.log-h { position: absolute; left: 0; color: #5c6673; font-variant-numeric: tabular-nums; }
.log-line.landing { color: var(--allied); }
.log-line.drop    { color: #9fc9a0; }
.log-line.combat  { color: #d9a89a; }
.log-line.naval   { color: var(--gold); }
.log-line.note    { color: #6f7a87; font-style: italic; padding-left: 66px; }
.log-line.end     { color: var(--gold); font-weight: 600; }

/* ===================== Result ===================== */
#result-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: none; place-items: center; padding: 30px; overflow: auto;
  background: rgba(6,9,14,.94);
}
#result-overlay.show { display: grid; }
.result-card {
  max-width: 820px; width: 100%;
  background: linear-gradient(180deg, #161d27, #10151d);
  border: 1px solid #2c3a4b; border-radius: 10px; padding: 40px 44px;
}
.result-kicker { font-size: 11.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.result-card h1 { font-size: 40px; margin: 10px 0 14px; }
.result-text { color: #cfd6df; font-size: 15px; line-height: 1.75; margin: 0 0 22px; }
.result-score { font-family: Georgia, serif; font-size: 30px; color: var(--gold); margin-bottom: 22px; }
.result-score span { font-size: 15px; color: #6e7885; }
.result-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 24px; }
.result-cols h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-dim); margin-bottom: 9px; }
.rline { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0;
  border-bottom: 1px solid #1c242e; }
.rline.ok  { color: var(--ok); }
.rline.bad { color: #8b95a2; }
.rline.muted { color: #5c6673; }
.result-foot { border-top: 1px solid var(--line); padding-top: 18px; }
.result-foot p { color: #7d8794; font-size: 12.5px; line-height: 1.7; margin: 0 0 16px; }
.result-foot button { background: var(--gold); color: #16202b; border-color: var(--gold);
  font-weight: 700; padding: 9px 20px; }

/* scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #0e131a; }
::-webkit-scrollbar-thumb { background: #2c3846; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a5c; }

/* ---- Run Simulation ---- */
.ai-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-dim); cursor: pointer; white-space: nowrap;
}
#ai-doctrine {
  font: inherit; font-size: 11.5px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; max-width: 190px;
}
#ai-doctrine:disabled { opacity: .4; }
body.ai-commanding #topbar { box-shadow: inset 0 -2px 0 var(--gold); }
body.ai-commanding .ai-toggle { color: var(--gold); font-weight: 600; }
.ai-state {
  background: #2a2a20; border-left: 3px solid var(--gold);
  padding: 9px 11px; border-radius: 4px; margin-bottom: 14px; font-size: 12px;
}
.ai-state b { display: block; color: var(--gold); margin-bottom: 3px; }
.ai-state span { color: #a9b3bf; line-height: 1.6; }
