html, body { margin: 0; height: 100%; overflow: hidden; background: #a6d6f2; }
body { font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; color: #2f4256; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#game.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---- film look: colour grade, vignette, captions (no letterbox) ---- */
#film { position: fixed; inset: 0; pointer-events: none; }
#film .grade { position: absolute; inset: 0; mix-blend-mode: soft-light;
  background: linear-gradient(180deg, rgba(120, 180, 255, 0.06) 0%, rgba(255, 240, 210, 0.04) 55%, rgba(255, 200, 140, 0.12) 100%); }
#film .vignette { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 48%, rgba(0,0,0,0) 62%, rgba(22, 40, 64, 0.2) 100%); }
#film .caption { position: absolute; left: 0; right: 0; top: 42%; text-align: center; opacity: 0;
  transition: opacity 1.8s ease-in-out; color: #fffaf0; text-shadow: 0 2px 18px rgba(10, 20, 30, 0.55); }
#film .caption.on { opacity: 1; }
#film .caption .main { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 300; font-size: clamp(20px, 2.8vw, 38px);
  letter-spacing: 0.32em; text-transform: uppercase; }
#film .caption .sub { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 300;
  font-size: clamp(14px, 1.6vw, 22px); letter-spacing: 0.15em; margin-top: 8px; opacity: 0.85; }
#film .caption.small { top: auto; bottom: 11vh; }
#film .caption.small .main { font-size: clamp(13px, 1.4vw, 19px); letter-spacing: 0.4em; opacity: 0.9; }
/* tilt-shift: blur the top and bottom bands for a miniature / diorama feel (T toggles) */
#film .tilt { position: absolute; left: 0; right: 0; height: 30%; pointer-events: none;
  -webkit-backdrop-filter: blur(2.5px); backdrop-filter: blur(2.5px); transition: opacity 1s; }
#film .tilt.top { top: 0; -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent); }
#film .tilt.bottom { bottom: 0; -webkit-mask-image: linear-gradient(transparent, #000); mask-image: linear-gradient(transparent, #000); }
#film.notilt .tilt, #film:not(.cinema) .tilt { opacity: 0; -webkit-backdrop-filter: none; backdrop-filter: none; } /* off in setup / map view */

/* ---- HUD: soft toy-box panels, shown in setup, faded out in battle ---- */
#hud { position: fixed; inset: 0; pointer-events: none; font-size: 13px; line-height: 1.45; }
#hud .panel { position: absolute; left: 16px; top: 16px; padding: 10px 14px; pointer-events: auto;
  background: rgba(255, 252, 244, 0.82); border-radius: 14px; box-shadow: 0 6px 24px rgba(40, 70, 100, 0.18);
  transition: opacity 1.2s ease-in-out; }
#hud .panel.hidden { opacity: 0; pointer-events: none; }
#hud .panel.setup { left: auto; right: 16px; max-width: 330px; }
#hud .row { margin: 4px 0; white-space: pre; }
#hud .row.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#hud .title { color: #3d5a78; font-weight: 800; letter-spacing: 0.06em; }
#hud .usn { color: #3d6fb0; font-weight: 700; }
#hud .ijn { color: #c0504a; font-weight: 700; }
#hud .dim { color: #7a8a98; }
#hud .small { font-size: 11px; }
#hud .btn { font: inherit; font-size: 12px; font-weight: 700; color: #3d5a78; background: #eef4f8; border: none;
  border-radius: 9px; padding: 5px 10px; margin-right: 5px; cursor: pointer; box-shadow: 0 2px 0 rgba(60, 90, 120, 0.18); }
#hud .btn:hover { background: #dfeaf2; }
#hud .btn.on { background: #ffd98a; color: #4a3a18; }
#hud .btn.go { background: #9fd8a0; color: #1f4a22; }
#hud .corner { position: absolute; left: 10px; top: 10px; pointer-events: auto; transition: opacity 0.4s ease-in-out; }
#hud .corner.hidden { opacity: 0; pointer-events: none; }
#hud .btn.menu { margin-right: 4px; font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 7px;
  opacity: 0.45; transition: opacity 0.4s ease-in-out; }
#hud .btn.menu:hover, #hud .btn.menu.on { opacity: 1; }
body.idle, body.idle canvas { cursor: none; } /* infinite mode, no input for a few seconds (ui.js) */
#hud input.vol { width: 120px; vertical-align: middle; accent-color: #3d5a78; cursor: pointer; }
#hud .row.tod { display: flex; align-items: center; gap: 6px; }
#hud .todlbl { min-width: 118px; color: #3d5a78; font-weight: 700; }
#hud input.vol.tod { width: auto; flex: 1; min-width: 70px; }
#hud input.vol.tod.rnd { opacity: 0.55; }
#hud .tod .btn { margin-right: 0; padding: 3px 8px; font-size: 11px; }
#hud select.wxsel { flex: 1; min-width: 70px; font: inherit; font-size: 11px; color: #3d5a78; background: rgba(255,255,255,0.6); border: 1px solid rgba(61,90,120,0.35); border-radius: 6px; padding: 2px 4px; cursor: pointer; }
#hud .msg { display: none; position: absolute; left: 0; right: 0; bottom: 12vh; text-align: center;
  font-weight: 700; color: #fffaf0; text-shadow: 0 2px 10px rgba(10, 20, 30, 0.6); }

/* ---- plot table (plot_table.js): a 2D canvas over the 3D view in map view ---- */
#plot { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; opacity: 0;
  transition: opacity 0.7s ease-in-out; background: #4a2e1b; }
#plot.on { opacity: 1; }

/* ---- war diary card (war_diary.js): typed on a ruled index card ---- */
#diary { position: fixed; right: 18px; top: 50%; width: min(300px, 24vw); max-height: 78vh; overflow: hidden;
  transform: translate(calc(100% + 40px), -50%) rotate(1.2deg); opacity: 0; pointer-events: none;
  transition: transform 0.8s cubic-bezier(.2,.8,.2,1), opacity 0.6s; padding: 14px 16px 12px;
  font: 11.5px/1.45 'Special Elite', 'Courier New', monospace; color: #2b2622;
  background: repeating-linear-gradient(180deg, transparent 0 16.5px, rgba(110, 140, 190, 0.2) 16.5px 17.5px),
    radial-gradient(ellipse at 30% 20%, #fbf6e6, #efe4c6);
  box-shadow: 0 10px 26px rgba(30, 15, 5, 0.45), inset 0 0 30px rgba(150, 110, 50, 0.15); border-radius: 2px; }
#diary.on { transform: translate(0, -50%) rotate(1.2deg); opacity: 1; }
#diary.film { top: auto; bottom: 18px; transform: translate(calc(100% + 40px), 0) rotate(0.8deg); max-height: 40vh; width: min(270px, 30vw); font-size: 10.5px; }
#diary.film.on { transform: translate(0, 0) rotate(0.8deg); opacity: 0.93; }
#diary .dh { font: 600 17px/1 'Cormorant Garamond', Georgia, serif; letter-spacing: 0.3em; text-transform: uppercase; color: #3b3328;
  border-bottom: 1px solid rgba(210, 90, 80, 0.5); padding-bottom: 5px; }
#diary .ds { font-size: 10px; color: #7a6a58; margin: 4px 0 8px; }
#diary .de { display: grid; grid-template-columns: 34px 26px 1fr; gap: 0 4px; margin: 0 0 3px; }
#diary .de b { font-weight: normal; color: #6a5a48; }
#diary .de i { font-style: normal; font-size: 9px; padding-top: 1px; }
#diary .de i.usn, #aar .usn h3 { color: #33547e; }
#diary .de i.ijn, #aar .ijn h3 { color: #8a3a33; }
#diary .de.p3 span { font-weight: bold; }
#diary .de.p0 { opacity: 0.7; }
#diary .de.last span { animation: typed 2.2s ease-out; }
@keyframes typed { from { background: rgba(255, 210, 90, 0.55); } to { background: transparent; } }

/* ---- after-action report (aar_card.js): a typed report on old paper ---- */
#aar { position: fixed; left: 50%; top: 50%; width: min(640px, 92vw); max-height: 86vh; overflow: auto;
  transform: translate(-50%, -46%) rotate(-0.6deg); opacity: 0; pointer-events: none; transition: opacity 1.2s, transform 1.2s;
  padding: 22px 28px 18px; font: 12.5px/1.5 'Special Elite', 'Courier New', monospace; color: #2b2622; box-sizing: border-box;
  background: radial-gradient(ellipse at 20% 10%, rgba(255, 255, 245, 0.9), rgba(0, 0, 0, 0) 60%),
    radial-gradient(circle at 85% 80%, rgba(160, 110, 50, 0.16), rgba(0, 0, 0, 0) 40%), linear-gradient(180deg, #f6eed6, #ead9b4);
  box-shadow: 0 18px 50px rgba(20, 10, 0, 0.5), inset 0 0 50px rgba(140, 100, 40, 0.22); }
#aar.on { opacity: 1; transform: translate(-50%, -50%) rotate(-0.6deg); pointer-events: auto; cursor: pointer; }
#aar .hd { font: 600 26px/1 'Cormorant Garamond', Georgia, serif; letter-spacing: 0.35em; text-transform: uppercase; text-align: center; }
#aar .meta { text-align: center; color: #7a6a58; font-size: 11px; margin: 6px 0 12px; }
#aar .res { text-align: center; font-size: 17px; letter-spacing: 0.12em; text-transform: uppercase;
  border-top: 1px solid #8a7a64; border-bottom: 1px solid #8a7a64; padding: 7px 0; }
#aar .res span { display: block; font-size: 12px; text-transform: none; letter-spacing: 0; color: #5a4a38; }
#aar .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 12px 0 6px; }
#aar h3 { margin: 0 0 4px; font: 600 15px/1.2 'Cormorant Garamond', Georgia, serif; letter-spacing: 0.08em; text-transform: uppercase; }
#aar p { margin: 0 0 5px; }
#aar u { text-decoration: none; color: #7a6a58; font-size: 10.5px; text-transform: uppercase; display: block; }
#aar .km { border-top: 1px dashed #8a7a64; padding-top: 8px; margin-top: 4px; }
#aar .km b { font-weight: normal; color: #6a5a48; }
#aar .sig { text-align: right; font-style: italic; color: #6a5a48; margin-top: 10px; font-size: 11px; }
#aar .stamp { position: absolute; right: 24px; top: 16px; transform: rotate(9deg); color: rgba(180, 40, 35, 0.6);
  border: 2px solid rgba(180, 40, 35, 0.55); padding: 2px 10px; font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase; border-radius: 3px; }
@media (max-width: 560px) { #aar .cols { grid-template-columns: 1fr; } #diary, #diary.film { width: 70vw; } }

#hud .row.adm { white-space: pre-line; max-width: 300px; line-height: 1.35; }
