/* "How do I become President?" (js/president-film.js, Gage 11-03): a walkthrough film over the War Room or the Campaign screen.
   The map fills the screen under letterbox bars (the war replay's .wm-lb, taller at the foot for the captions); the beat's panel
   (the War Room's own insignia, ballots and meters) sits above the captions on a phone and to the right in landscape.
   It sits under the live takeover (.lv, 9800) so a strike that lands meanwhile still plays on every screen. Calm: no motion. */
.pf { position: fixed; inset: 0; z-index: 9500; overflow: hidden; color: #f2eee6; background: #0e1d29; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; animation: pf-in .35s ease-out both; }
.pf.out { opacity: 0; transition: opacity .3s; pointer-events: none; }
@keyframes pf-in { from { opacity: 0; } }
.pf-stage { position: absolute; inset: 0; will-change: transform; }
.pf-map { position: absolute; left: 0; top: 0; display: block; }
.pf-vig { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse 85% 70% at 50% 46%, transparent 55%, #000a 100%); transition: background .8s; }
.pf[data-beat="dictator"] .pf-vig { background: radial-gradient(ellipse 80% 65% at 50% 46%, #5a0d0a22 30%, #3a0503cc 100%); }
.pf[data-beat="end"] .pf-vig { background: #050403b8; }

/* the letterbox (the replay's bars), its foot tall enough for two lines of caption */
.pf .pf-lb i.t { height: calc(var(--safe-t, 0px) + 58px); }
.pf .pf-lb i.b { height: calc(var(--safe-b, 0px) + 178px); background: linear-gradient(#0000, #000 22%); }

.pf-top { position: absolute; left: 0; right: 0; top: 0; z-index: 7; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t, 0px) + 8px) 12px 0; pointer-events: none; animation: pf-fade .6s .15s both; }
.pf-id { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; flex: 1; overflow: hidden; }
.pf-id em { font: 400 11px/1 var(--display); font-style: normal; letter-spacing: .2em; text-transform: uppercase; color: #d6b25e; }
.pf-id b { overflow: hidden; font: 400 17px/1.15 var(--display); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; color: #fff; }
.pf[data-beat="title"] .pf-id b { visibility: hidden; }
.pf-step { flex: none; font: 400 15px var(--display); letter-spacing: .1em; color: #c9b48c; font-variant-numeric: tabular-nums; }
.pf-skip { flex: none; pointer-events: auto; min-height: 44px; padding: 0 14px; font: 400 17px var(--display); letter-spacing: .08em; text-transform: uppercase; color: #f4e4ce; background: #1a1611e6; border: 1px solid #8a7254; box-shadow: 2px 3px 0 #000; cursor: pointer; }
.pf-skip:active, .pf-go:active, .pf-again:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 #000; }
@keyframes pf-fade { from { opacity: 0; } }

/* the captions: big, in the foot bar */
.pf-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; display: grid; gap: 8px; padding: 0 18px calc(var(--safe-b, 0px) + 12px); pointer-events: none; }
.pf-cap { display: grid; gap: 5px; min-height: 112px; align-content: end; text-align: center; }
.pf-cap b { font: 400 31px/1.02 var(--display); letter-spacing: .04em; text-transform: uppercase; color: #fff; text-shadow: 2px 2px 0 #000; }
.pf-cap p { margin: 0; font: 600 16px/1.3 var(--body, system-ui, sans-serif); color: #eadfca; text-shadow: 1px 1px 0 #000; }
.pf-cap.in b { animation: pf-cap .55s cubic-bezier(.2,.8,.2,1) both; }
.pf-cap.in p { animation: pf-cap .55s .12s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pf-cap { from { opacity: 0; transform: translateY(8px); letter-spacing: .12em; } }
.pf-bar { display: block; height: 4px; background: #ffffff1f; }
.pf-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c79a3f, #ffe08a); box-shadow: 0 0 8px #ffd36e88; }
.pf-hint { justify-self: center; font: 400 12px var(--display); letter-spacing: .16em; text-transform: uppercase; color: #a8957a; animation: pf-hint 1s 4s forwards; }
@keyframes pf-hint { to { opacity: 0; } }
.pf.ended .pf-cap, .pf.ended .pf-hint { visibility: hidden; }

/* the beat's panel */
.pf-panel { position: absolute; z-index: 6; left: 12px; right: 12px; bottom: calc(var(--safe-b, 0px) + 186px); display: flex; justify-content: center; pointer-events: none; }
.pf-panel[hidden] { display: none; }
.pf-panel > * { animation: pf-up .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pf-up { from { opacity: 0; transform: translateY(14px); } }
.pf-card { position: relative; width: min(100%, 380px); padding: 10px 12px; background: linear-gradient(#1d1915f2, #12100df2); border: 1px solid #8a7254; outline: 1px solid #0d0b09; box-shadow: 3px 4px 0 #000; }
.pf-card::before, .pf-card::after { content: ''; position: absolute; width: 10px; height: 10px; border: 2px solid #d6b25e; pointer-events: none; }
.pf-card::before { left: -3px; top: -3px; border-right: 0; border-bottom: 0; }
.pf-card::after { right: -3px; bottom: -3px; border-left: 0; border-top: 0; }
.pf-card h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 400 18px/1.05 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.pf-card h4 > span { display: grid; flex: 1; min-width: 0; }
.pf-card h4 small { font: 400 12px/1.2 var(--display); letter-spacing: .1em; color: #c9b48c; }
.pf-card .wi { width: 24px; height: 24px; flex: none; }
.pf-card .wi img { width: 100%; height: 100%; image-rendering: pixelated; }
.pf-k { font: 400 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: #d6b25e; }
.pf-count { font-variant-numeric: tabular-nums; }
.pf-redact { display: inline-block; width: 64px; height: 10px; background: #0d0b09; box-shadow: inset 0 0 0 1px #3a332b; }
.pf-meter { display: block; height: 8px; background: #0d0b09; box-shadow: inset 0 0 0 1px #4a4036; }
.pf-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c79a3f, #ffe08a); }

/* pick a side */
.pf-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(100%, 380px); }
.pf-sd { position: relative; display: grid; justify-items: center; gap: 8px; padding: 14px 8px 12px; background: #15120ef0; border: 2px solid #0d0b09; box-shadow: 3px 4px 0 #000; transition: transform .35s, box-shadow .35s; }
.pf-sd.us { border-top: 4px solid #4f86de; }
.pf-sd.ca { border-top: 4px solid #d8423a; }
.pf-sd b { font: 400 18px/1.05 var(--display); letter-spacing: .05em; text-transform: uppercase; text-align: center; }
.pf-sd u { position: absolute; top: -12px; right: -6px; padding: 3px 7px 2px; font: 400 12px/1 var(--display); letter-spacing: .14em; text-decoration: none; text-transform: uppercase; color: #1a120a; background: #ffd36e; border: 2px solid #0d0b09; transform: rotate(4deg) scale(.6); opacity: 0; transition: opacity .25s, transform .35s cubic-bezier(.3,1.6,.5,1); }
.pf-sd.pick.on { transform: translateY(-4px); box-shadow: 3px 8px 0 #000, 0 0 0 2px #ffd36e; }
.pf-sd.pick.on u { opacity: 1; transform: rotate(4deg); }

/* fight battles: the effort counter */
.pf-effort { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px; width: auto; min-width: 230px; }
.pf-effort .pf-k { grid-column: 1; }
.pf-effort .pf-count { grid-column: 1; font: 400 40px/1 var(--display); color: #ffe08a; text-shadow: 2px 2px 0 #000; }
.pf-effort ul { grid-column: 2; grid-row: 1 / span 2; display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pf-effort li { display: flex; align-items: baseline; gap: 8px; opacity: .25; transform: translateX(8px); transition: opacity .3s, transform .3s; }
.pf-effort li.on { opacity: 1; transform: none; }
.pf-effort li em { font: 400 22px/1 var(--display); font-style: normal; color: #7cf08a; }
.pf-effort li small { font: 400 13px var(--display); letter-spacing: .1em; text-transform: uppercase; color: #e6dccb; }

/* the war ranks */
.pf-ranks h4 { justify-content: space-between; }
.pf-ranks h4 .pf-k { display: inline-flex; align-items: baseline; gap: 6px; }
.pf-ranks h4 .pf-count { font: 400 22px/1 var(--display); letter-spacing: .02em; color: #ffe08a; }
.pf-ranks ol { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 0; padding: 0; list-style: none; }
.pf-ranks li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 6px; padding: 2px 4px; opacity: .45; border: 1px solid transparent; transition: opacity .2s, background .2s; }
.pf-ranks li .ins { width: 24px; height: 24px; }
.pf-ranks li b { overflow: hidden; font: 400 15px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; }
.pf-ranks li em { font: 400 12px var(--display); font-style: normal; color: #a8957a; font-variant-numeric: tabular-nums; }
.pf-ranks li.done { opacity: .85; }
.pf-ranks li.me { opacity: 1; border-color: #ffd36e; background: linear-gradient(90deg, #c9a24a40, transparent); }
.pf-ranks li.me b { color: #ffe08a; }

/* the Generals: the week's top ten */
.pf-gens ol { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin: 0; padding: 0; list-style: none; }
.pf-gens li { display: grid; grid-template-columns: 18px 22px auto 1fr; align-items: center; gap: 5px; padding: 1px 3px; opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; }
.pf-gens li.on { opacity: 1; transform: none; }
.pf-gens li em { font: 400 13px var(--display); font-style: normal; color: #c9b48c; text-align: right; }
.pf-gens li .ins { width: 22px; height: 22px; }
.pf-gens li .pf-redact { width: 44px; height: 8px; }
.pf-gens li b { font: 400 14px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.pf-gens li i { display: block; height: 5px; width: var(--w); background: #6d5b44; }
.pf-gens li.me i { background: #ffd36e; }
.pf-gens li.me.lit { outline: 2px solid #ffd36e; background: #c9a24a33; }
.pf-gens li.me b { color: #ffe08a; }
.pf.calm .pf-gens li { opacity: 1; transform: none; }

/* the weekly election: a ballot with vote bars */
.pf-cand { display: grid; grid-template-columns: 26px 70px 1fr; align-items: center; gap: 8px; padding: 3px 0; }
.pf-cand .ins { width: 26px; height: 26px; }
.pf-cand b { font: 400 16px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.pf-cand.me b { color: #ffe08a; }
.pf-vb { display: block; height: 12px; background: #0d0b09; box-shadow: inset 0 0 0 1px #4a4036; }
.pf-vb i { display: block; height: 100%; width: 0; background: #8a7b66; }
.pf-cand.me .pf-vb i { background: linear-gradient(90deg, #c79a3f, #ffe08a); }
.pf-won { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 8px; border: 2px solid #ffd36e; background: #c9a24a2e; opacity: 0; transform: scale(.92); transition: opacity .3s, transform .4s cubic-bezier(.3,1.6,.5,1); }
.pf-won.on { opacity: 1; transform: none; }
.pf-won .ins { width: 34px; height: 34px; }
.pf-won span { display: grid; }
.pf-won small { font: 400 12px var(--display); letter-spacing: .14em; text-transform: uppercase; color: #d6b25e; }
.pf-won b { font: 400 20px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #fff; }

/* President and the Cabinet */
.pf-chain { display: grid; justify-items: center; gap: 6px; }
.pf-pres { display: flex; align-items: center; gap: 10px; }
.pf-pres .ins.big { width: 58px; height: 58px; }
.pf-pres span { display: grid; }
.pf-pres small, .pf-dict small, .pf-chip small { font: 400 12px var(--display); letter-spacing: .14em; text-transform: uppercase; color: #d6b25e; }
.pf-pres b { font: 400 26px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #ffe08a; }
.pf-line { display: block; width: 2px; height: 10px; background: #8c6b3e; }
.pf-cab { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
.pf-cab > div { display: grid; justify-items: center; gap: 4px; padding: 6px 2px; text-align: center; border: 1px solid #4a4036; background: #0d0b0980; opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.pf-cab > div.on { opacity: 1; transform: none; }
.pf-cab .ins { width: 32px; height: 32px; }
.pf-cab small { font: 400 11px/1.1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #e6dccb; }
.pf.calm .pf-cab > div { opacity: 1; transform: none; }

/* the Offensive and the strategy: one chip */
.pf-chip { display: flex; align-items: center; gap: 10px; width: auto; max-width: 100%; }
.pf-chip .wi, .pf-chip .arm { width: 30px; height: 30px; }
.pf-chip > span { display: grid; min-width: 0; }
.pf-chip b { overflow: hidden; font: 400 20px/1.05 var(--display); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; }
.pf-chip em, .pf-dict em { margin-left: auto; padding: 4px 8px 3px; font: 400 18px/1 var(--display); font-style: normal; color: #1a120a; background: #ffd36e; border: 2px solid #0d0b09; }

/* War Power and the strategic weapons */
.pf-power h4 { justify-content: space-between; }
.pf-power h4 .pf-count { font: 400 26px/1 var(--display); color: #ffe08a; }
.pf-power ul { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin: 10px 0 4px; padding: 0; list-style: none; }
.pf-power li { display: grid; justify-items: center; gap: 3px; padding: 4px 0; border: 1px solid #3a332b; background: #0d0b0980; opacity: .3; transition: opacity .2s, border-color .2s; }
.pf-power li.on { opacity: 1; border-color: #c79a3f; }
.pf-power li .arm { width: 26px; height: 26px; }
.pf-power li small { font: 400 11px var(--display); color: #c9b48c; font-variant-numeric: tabular-nums; }
.pf-power p { display: flex; justify-content: space-between; margin: 0; }
.pf-power p b { font: 400 13px var(--display); letter-spacing: .08em; text-transform: uppercase; color: #e6dccb; }

/* the other road: a dictatorship and the coup */
.pf-dict { display: grid; gap: 8px; }
.pf-row { display: flex; align-items: center; gap: 10px; }
.pf-row > span { display: grid; flex: 1; min-width: 0; gap: 3px; }
.pf-row b { font: 400 20px/1.05 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.pf-dict .ins.big { width: 48px; height: 48px; }
.pf-coup { opacity: .35; transition: opacity .3s; }
.pf-coup.on { opacity: 1; }
.pf-coup .wi { width: 30px; height: 30px; }
.pf-coup em { background: #e8e0d0; }
.pf.calm .pf-coup { opacity: 1; }

/* the end card */
.pf-panel.pf-end { inset: calc(var(--safe-t, 0px) + 58px) 12px calc(var(--safe-b, 0px) + 16px); align-items: center; pointer-events: auto; }
.pf-endin { position: relative; display: grid; justify-items: center; gap: 10px; width: min(100%, 400px); padding: 22px 18px 18px; text-align: center; background: linear-gradient(#1d1915f5, #12100df5); border: 1px solid #8a7254; outline: 1px solid #0d0b09; box-shadow: 4px 6px 0 #000; cursor: default; }
.pf-endin .ins.big { width: 72px; height: 72px; }
.pf-endin h2 { margin: 0; font: 400 34px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; color: #fff; text-shadow: 2px 2px 0 #000; }
.pf-endin p { margin: 0; font: 600 16px/1.35 var(--body, system-ui, sans-serif); color: #eadfca; }
.pf-go { width: 100%; min-height: 52px; margin-top: 4px; font: 400 22px var(--display); letter-spacing: .08em; text-transform: uppercase; color: #1a120a; background: linear-gradient(#ffe08a, #d6a640); border: 2px solid #0d0b09; box-shadow: 3px 4px 0 #000; cursor: pointer; }
.pf-again { min-height: 44px; padding: 0 16px; font: 400 16px var(--display); letter-spacing: .1em; text-transform: uppercase; color: #e6dccb; background: transparent; border: 1px solid #8a7254; cursor: pointer; }

/* landscape: the panel to the right of the map, the caption under both */
@media (min-aspect-ratio: 23/20) {
  .pf .pf-lb i.t { height: calc(var(--safe-t, 0px) + 46px); }
  .pf .pf-lb i.b { height: calc(var(--safe-b, 0px) + 104px); }
  .pf-top { padding-top: calc(var(--safe-t, 0px) + 4px); }
  .pf-skip { min-height: 38px; font-size: 15px; }
  .pf-foot { gap: 5px; padding: 0 calc(var(--safe-r, 0px) + 18px) calc(var(--safe-b, 0px) + 8px) calc(var(--safe-l, 0px) + 18px); }
  .pf-cap { min-height: 70px; gap: 3px; }
  .pf-cap b { font-size: 24px; }
  .pf-cap p { font-size: 14px; }
  .pf-hint { display: none; }
  .pf-panel { left: auto; right: calc(var(--safe-r, 0px) + 12px); top: calc(var(--safe-t, 0px) + 52px); bottom: calc(var(--safe-b, 0px) + 112px); width: min(46vw, 380px); align-items: center; }
  .pf-card { padding: 8px 10px; }
  .pf-card h4 { margin-bottom: 5px; font-size: 16px; }
  .pf-ranks li { padding: 1px 3px; }
  .pf-ranks li .ins { width: 20px; height: 20px; }
  .pf-ranks li b { font-size: 13px; }
  .pf-gens li { gap: 4px; }
  .pf-gens li .ins { width: 18px; height: 18px; }
  .pf-cand { padding: 1px 0; }
  .pf-cand .ins { width: 22px; height: 22px; }
  .pf-pres .ins.big { width: 46px; height: 46px; }
  .pf-cab .ins { width: 26px; height: 26px; }
  .pf-effort .pf-count { font-size: 32px; }
  .pf-panel.pf-end { inset: calc(var(--safe-t, 0px) + 48px) 12px calc(var(--safe-b, 0px) + 8px); width: auto; }
  .pf-endin { gap: 6px; padding: 12px 16px; }
  .pf-endin .ins.big { width: 48px; height: 48px; }
  .pf-endin h2 { font-size: 26px; }
  .pf-endin p { font-size: 14px; }
  .pf-go { min-height: 44px; font-size: 18px; }
}
@media (max-width: 360px) { .pf-cap b { font-size: 26px; } .pf-cap p { font-size: 15px; } .pf-ranks li b { font-size: 13px; } }
@media (max-height: 640px) and (max-aspect-ratio: 23/20) { .pf .pf-lb i.b { height: calc(var(--safe-b, 0px) + 158px); } .pf-panel { bottom: calc(var(--safe-b, 0px) + 164px); } .pf-cap { min-height: 96px; } .pf-cap b { font-size: 26px; } }

/* calm: stills (no slides, fades or counting) */
.pf.calm, .pf.calm .pf-top, .pf.calm .pf-lb i, .pf.calm .pf-cap.in b, .pf.calm .pf-cap.in p, .pf.calm .pf-panel > *, .pf.calm .pf-hint { animation: none; }
.pf.calm * { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .pf, .pf-top, .pf-cap.in b, .pf-cap.in p, .pf-panel > * { animation: none; } }

/* the entry points: WarHelp's climb (the President rung) and the Command sheet */
.wh-pres, .cc-howto { display: flex; align-items: center; gap: 8px; }
.wh-climb .wh-pres { margin-top: 8px; }
.cc-howto { width: 100%; margin: 10px 0 4px; padding: 8px 10px; text-align: left; color: #fff; background: linear-gradient(90deg, #c9a24a33, #1a1611e6); border: 2px solid #c79a3f; box-shadow: 2px 3px 0 #0d0b09; cursor: pointer; }
.cc-howto .ins { width: 32px; height: 32px; }
.cc-howto span { display: grid; gap: 2px; }
.cc-howto b { font: 400 17px/1.05 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.cc-howto small { font: 400 12px var(--display); letter-spacing: .1em; text-transform: uppercase; color: #d6b25e; }
.cc-howto:active, .wh-pres:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 #0d0b09; }
.wh-pres .wh-play, .cc-howto .wh-play { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: #ffd36e; border: 2px solid #0d0b09; }
.wh-pres .wh-play::after, .cc-howto .wh-play::after { content: ''; margin-left: 3px; border-left: 8px solid #0d0b09; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
