:root {
  --ink: #1c1a16;
  --paper: #efe8d8;
  --paper-2: #e4dcc8;
  --night: #0b0e17;
  --hud-bg: rgba(10, 13, 22, 0.86);
  --hud-line: rgba(255, 255, 255, 0.08);
  --hud-text: #e9e6df;
  --hud-dim: #9aa0ab;
  --calm: #6fbf73;
  --warn: #e0a43a;
  --bad: #e2533f;
  --blue: #1f4e9c;
  --red: #c8102e;
  --candle: #ffcf73;
  --accent: #f1c24b;
  --series-crowd: #c27a1c;   /* dav: svíčkově jantarová (ověřeno validátorem proti #0e111a) */
  --series-police: #5b8def;  /* policie: modrá majáku VB */
  --font-head: "Oswald", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "PT Serif", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark; /* noční hra má záměrně jen tmavý vzhled */
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--night); color: var(--hud-text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: none; }
.hidden { display: none !important; }

button {
  font: inherit; color: inherit; cursor: pointer;
  border: 1px solid rgba(0,0,0,.25); border-radius: 4px;
  background: transparent; padding: 8px 14px;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--hud-bg); border-bottom: 1px solid var(--hud-line);
  backdrop-filter: blur(6px);
  font-size: 12px; z-index: 5;
}
.hud-title { min-width: 0; }
#hud-date { font-family: var(--font-head); font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
#hud-place { color: var(--hud-dim); font-size: 11px; white-space: nowrap; }
.hud-clock { text-align: center; }
#hud-clock { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--candle); }
.hud-timebar { width: 64px; height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.hud-timebar i { display: block; height: 100%; width: 0; background: var(--candle); }
.meters { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; overflow: hidden; }
.meter label, .stat label, .voice label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--hud-dim); white-space: nowrap;
}
.meter .bar, .voice .bar { width: 84px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 3px; }
.meter .bar i, .voice .bar i { display: block; height: 100%; width: 50%; background: var(--calm); transition: width .2s linear, background-color .3s; }
.stat b { font-family: var(--font-mono); font-size: 15px; font-weight: 600; white-space: nowrap; }
.stat.bad b { color: var(--bad); }
.stat .rec { color: #ff6a5a; font-size: 12px; }
.stat.small b { font-size: 12px; }
.stat.special b { color: var(--accent); }
.hud-buttons { display: flex; gap: 6px; }
.icon-btn { width: 32px; height: 32px; padding: 0; border-color: var(--hud-line); background: rgba(255,255,255,.05); color: var(--hud-text); }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn.off { opacity: .45; }
.text-btn { height: 32px; padding: 0 10px; border-color: var(--hud-line); background: rgba(255,255,255,.05); color: var(--hud-text); font-size: 12px; letter-spacing: .04em; position: relative; }
.text-btn:hover { background: rgba(255,255,255,.12); }
.text-btn.on { border-color: var(--accent); }
.text-btn.mod::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.text-btn.small, .icon-btn.small { height: 24px; font-size: 11px; }
.icon-btn.small { width: 24px; }

#director {
  position: absolute; right: 10px; z-index: 6; width: 300px; max-width: calc(100% - 20px);
  max-height: calc(100% - 200px); overflow-y: auto;
  background: rgba(10,13,22,.92); border: 1px solid var(--hud-line); border-radius: 8px;
  padding: 8px 12px 10px; backdrop-filter: blur(6px);
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
#app.dir-open #log { right: 320px; }
@media (max-width: 900px) { #app.dir-open #log { display: none; } }
.dir-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dir-head h5 { flex: 1; margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--hud-text); }
.dir-row { padding: 5px 0 3px; border-top: 1px solid var(--hud-line); }
.dir-row:first-child { border-top: 0; }
.dir-row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.dir-row .top label { color: var(--hud-text); }
.dir-row .top output { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--hud-dim); }
.dir-row .top output.changed { color: var(--accent); }
.dir-row input[type=range] { width: 100%; margin: 4px 0 0; accent-color: var(--accent); height: 18px; cursor: pointer; }
.dir-row .desc { font-size: 11px; color: var(--hud-dim); line-height: 1.3; }
.dir-note { margin: 6px 0 0; font-size: 11px; line-height: 1.4; color: var(--hud-dim); }
.dir-flag { margin: 12px auto 0; max-width: 760px; text-align: center; font-size: 12px; color: var(--accent); font-family: var(--font-mono); }

#objectives {
  position: absolute; left: 10px; top: 64px; z-index: 4;
  background: rgba(10,13,22,.72); border: 1px solid var(--hud-line); border-radius: 6px;
  padding: 7px 10px; font-size: 12px; max-width: 290px; pointer-events: none;
}
#objectives h5 { margin: 0 0 4px; font-family: var(--font-head); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--hud-dim); }
#objectives .obj { display: flex; gap: 6px; line-height: 1.35; }
#objectives .obj .chk { width: 12px; flex: none; color: var(--hud-dim); }
#objectives .obj.ok .chk { color: var(--calm); }
#objectives .obj.fail .chk { color: var(--bad); }
#objectives .obj.ok { color: #cfe8cf; }
#objectives .obj.fail { color: #f0b3a8; }

#tension {
  position: absolute; left: 10px; z-index: 4; width: 290px;
  background: rgba(10,13,22,.78); border: 1px solid var(--hud-line); border-radius: 6px;
  padding: 6px 8px 4px;
}
.tension-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#tension h5 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--hud-dim); }
.tension-legend { display: flex; gap: 9px; font-size: 11px; color: var(--hud-dim); white-space: nowrap; }
.tension-legend b { color: var(--hud-text); font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.tension-legend .sw { display: inline-block; width: 9px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.tension-legend .sw.crowd { background: var(--series-crowd); }
.tension-legend .sw.police { background: var(--series-police); }
.tension-legend .tri { display: inline-block; width: 0; height: 0; margin-right: 3px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--bad); vertical-align: middle; }
#tension[data-at] h5::after { content: ' · ' attr(data-at); color: var(--hud-text); text-transform: none; letter-spacing: 0; font-family: var(--font-mono); font-weight: 400; }
#tension-chart { display: block; width: 100%; height: 84px; margin-top: 3px; cursor: crosshair; }

#log {
  position: absolute; right: 10px; top: 64px; z-index: 4; width: 330px; max-width: calc(100% - 20px);
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
#log .msg {
  background: rgba(10,13,22,.8); border-left: 3px solid var(--hud-dim);
  padding: 5px 9px; font-size: 12.5px; line-height: 1.35; border-radius: 0 4px 4px 0;
  animation: logIn .25s ease-out; transition: opacity .8s;
}
#log .msg .tm { font-family: var(--font-mono); color: var(--hud-dim); margin-right: 6px; font-size: 11px; }
#log .msg.police { border-color: #6f8fb8; }
#log .msg.police::before { content: "📢 "; }
#log .msg.bad { border-color: var(--bad); }
#log .msg.good { border-color: var(--calm); }
#log .msg.hint { border-color: var(--accent); color: #f6e7bf; }
#log .msg.fade { opacity: 0; }
@keyframes logIn { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }

#actions {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 7px 12px; padding-bottom: max(7px, env(safe-area-inset-bottom));
  background: var(--hud-bg); border-top: 1px solid var(--hud-line); backdrop-filter: blur(6px);
}
.voice { flex: none; }
.voice .bar { width: 96px; height: 9px; }
.voice .bar i { background: var(--accent); }
#action-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.act {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-width: 92px; height: 44px; padding: 3px 9px 3px 26px;
  border: 1px solid var(--hud-line); background: rgba(255,255,255,.05); color: var(--hud-text);
  text-align: left; font-size: 12.5px; line-height: 1.15;
}
.act:hover { background: rgba(255,255,255,.1); }
.act .k { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.act .nm { font-weight: 600; white-space: nowrap; }
.act .cost { font-size: 10.5px; color: var(--hud-dim); font-family: var(--font-mono); }
.act.armed { border-color: var(--accent); background: rgba(241,194,75,.16); }
.act.poor { opacity: .45; }
.act.locked { display: none; }
.act .cd { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); width: 0; }
.act.cam .k { color: #ff8b7a; }
.hint { color: var(--hud-dim); font-size: 11.5px; flex: 1; min-width: 180px; text-align: right; }

/* ---------- Obrazovky ---------- */
.screen {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 40%, rgba(30,34,52,.82), rgba(5,7,12,.95));
}
#screen-pause { background: rgba(5,7,12,.7); }
#screen-news { background: radial-gradient(ellipse at 50% 30%, rgba(24,28,42,.96), rgba(5,7,12,.98)); }
.paper {
  position: relative; width: 100%; max-width: 760px; max-height: 100%; overflow-y: auto;
  background: var(--paper); color: var(--ink);
  background-image:
    radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.35), rgba(0,0,0,.03));
  background-size: 3px 3px, 100% 100%;
  padding: 34px 40px 28px; border-radius: 2px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.15);
  user-select: text; -webkit-user-select: text;
}
.paper.small { max-width: 480px; }
.paper button { border-color: rgba(0,0,0,.35); color: var(--ink); background: rgba(255,255,255,.35); }
.paper button:hover { background: rgba(255,255,255,.7); }
button.primary { background: var(--ink) !important; color: var(--paper) !important; border-color: var(--ink) !important; font-weight: 600; padding: 10px 22px; letter-spacing: .03em; }
button.primary:hover { background: #3a352c !important; }

.tricolor { display: flex; height: 8px; margin: -34px -40px 26px; }
.tricolor i { flex: 1; }
.tricolor i:nth-child(1) { background: #f4f4f4; }
.tricolor i:nth-child(2) { background: var(--red); }
.tricolor i:nth-child(3) { background: var(--blue); }

.menu h1 {
  font-family: var(--font-head); font-weight: 700; font-size: clamp(54px, 11vw, 104px);
  line-height: .9; margin: 0; letter-spacing: -.01em; text-transform: uppercase;
}
.menu .sub { font-family: var(--font-mono); margin: 10px 0 18px; font-size: 13px; letter-spacing: .04em; }
.menu .lead { font-family: var(--font-serif); font-size: 18px; line-height: 1.5; margin: 0 0 14px; }
.rules { font-family: var(--font-serif); font-size: 15px; line-height: 1.5; padding-left: 20px; margin: 0 0 20px; }
.rules li { margin-bottom: 4px; }
.menu-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 8px; }
#chapter-buttons { display: contents; }
.fine { font-size: 12px; color: #5c564a; line-height: 1.45; margin: 14px 0 0; font-family: var(--font-serif); }

.typewriter { font-family: var(--font-mono); }
.typewriter h2 { font-family: var(--font-head); font-size: 40px; text-transform: uppercase; margin: 8px 0 2px; line-height: 1; }
.typewriter .date { margin: 0 0 16px; font-size: 13px; color: #5c564a; }
#brief-text p { font-size: 14px; line-height: 1.6; margin: 0 0 10px; }
.stamp {
  display: inline-block; border: 2px solid var(--red); color: var(--red);
  padding: 2px 10px; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .12em;
  transform: rotate(-2deg); font-size: 13px;
}
.goals { border-top: 1px dashed rgba(0,0,0,.3); border-bottom: 1px dashed rgba(0,0,0,.3); padding: 10px 0; margin: 14px 0; font-size: 13.5px; line-height: 1.6; }
.goals b { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 14px; font-size: 12px; margin-bottom: 18px; color: #3c372e; }
kbd { font-family: var(--font-mono); border: 1px solid rgba(0,0,0,.35); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; background: rgba(255,255,255,.5); font-size: 11px; }
#pause-actions { font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; }
#pause-actions div { margin-bottom: 4px; }

/* ---------- Noviny ---------- */
.news-wrap { width: 100%; max-width: 980px; max-height: 100%; overflow-y: auto; padding: 4px; }
.news-kicker { font-family: var(--font-head); font-weight: 400; text-transform: uppercase; letter-spacing: .2em; color: var(--hud-dim); text-align: center; margin: 0 0 12px; font-size: 14px; }
.papers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.newspaper {
  background: var(--paper); color: var(--ink); padding: 18px 22px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.5);
  font-family: var(--font-serif);
}
.newspaper.regime { transform: rotate(-.6deg); }
.newspaper.radio { transform: rotate(.5deg); background: #e9eef0; font-family: var(--font-mono); }
.masthead { font-family: var(--font-head); font-size: 30px; font-weight: 700; text-transform: uppercase; border-bottom: 3px double var(--ink); padding-bottom: 4px; margin-bottom: 10px; line-height: 1; }
.regime .masthead { color: #8d1414; }
.radio .masthead { font-size: 24px; color: #1f3d6b; }
.masthead small { display: block; font-family: var(--font-mono); font-size: 10px; font-weight: 400; letter-spacing: .08em; color: #5c564a; margin-top: 4px; }
.newspaper h4 { font-family: var(--font-head); font-size: 25px; line-height: 1.08; margin: 0 0 8px; text-transform: uppercase; }
.radio h4 { font-size: 21px; }
.newspaper p { margin: 0; font-size: 14.5px; line-height: 1.5; }
.radio p { font-size: 13px; }
.whisper { margin: 18px auto 0; max-width: 760px; text-align: center; font-family: var(--font-serif); font-style: italic; font-size: 16px; color: #d9d3c4; line-height: 1.5; }
.whisper b { font-style: normal; font-family: var(--font-head); letter-spacing: .06em; text-transform: uppercase; font-size: 13px; color: var(--accent); }
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 16px auto 0; max-width: 860px; }
.ledger .cell { background: #141824; border: 1px solid var(--hud-line); border-radius: 6px; padding: 8px 10px; }
.ledger .cell label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--hud-dim); }
.ledger .cell b { font-family: var(--font-mono); font-size: 18px; }
.ledger .cell.big { grid-column: span 2; }
.ledger .cell.big b { color: var(--accent); font-size: 22px; }
.ledger .cell .delta { font-family: var(--font-mono); font-size: 12px; color: var(--calm); margin-left: 6px; }
.ledger .cell .delta.neg { color: var(--bad); }
.choice { max-width: 760px; margin: 18px auto 0; background: var(--paper); color: var(--ink); padding: 16px 20px; border-left: 6px solid var(--red); font-family: var(--font-serif); }
.choice h4 { margin: 0 0 6px; font-family: var(--font-head); text-transform: uppercase; font-size: 20px; }
.choice p { margin: 0 0 12px; line-height: 1.5; font-size: 15px; }
.choice-buttons { display: flex; flex-direction: column; gap: 8px; }
.choice-buttons button { text-align: left; border-color: rgba(0,0,0,.35); color: var(--ink); background: rgba(255,255,255,.4); line-height: 1.35; }
.choice-buttons button small { display: block; color: #5c564a; font-size: 12.5px; }
.choice-buttons button.chosen { background: var(--ink); color: var(--paper); }
.choice-buttons button.chosen small { color: #cfc6b3; }
.choice-buttons button:disabled:not(.chosen) { opacity: .4; cursor: default; }
#btn-news-next { display: block; margin: 18px auto 6px; }
#btn-news-next:disabled { opacity: .35; cursor: default; }

/* ---------- Konec ---------- */
.end h2 { font-family: var(--font-head); font-size: clamp(34px, 6vw, 56px); text-transform: uppercase; line-height: 1; margin: 6px 0 14px; }
.end .date { font-family: var(--font-mono); font-size: 13px; color: #5c564a; margin: 0; }
#end-text p { font-family: var(--font-serif); font-size: 17px; line-height: 1.55; margin: 0 0 10px; }
.end .ledger .cell { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.12); }
.end .ledger .cell label { color: #5c564a; }
.end .ledger .cell.big b { color: var(--red); }
.history { margin-top: 18px; border-top: 1px solid rgba(0,0,0,.2); padding-top: 10px; }
.history h4 { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; font-size: 15px; }
.history p { font-family: var(--font-serif); font-size: 14px; line-height: 1.55; margin: 0; color: #2e2a23; }

#btn-skip {
  position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 12;
  background: rgba(10,13,22,.7); color: var(--hud-text); border: 1px solid var(--hud-line);
  border-radius: 6px; padding: 8px 14px; font-size: 13px; letter-spacing: .04em;
}
#btn-skip:hover { background: rgba(10,13,22,.9); }

#rotate-hint {
  position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: var(--night); font-family: var(--font-head); font-size: 22px; text-transform: uppercase; letter-spacing: .1em;
}

/* ---------- Úzké obrazovky ---------- */
@media (max-width: 900px) {
  .meter .bar { width: 56px; }
  .stat.small { display: none; }
  #log { width: 260px; }
  .act { min-width: 74px; height: 40px; font-size: 11.5px; padding-left: 22px; }
  .act .cost { display: none; }
  .hint { display: none; }
}
@media (max-width: 640px) {
  .papers { grid-template-columns: 1fr; }
  .paper { padding: 26px 18px 20px; }
  .tricolor { margin: -26px -18px 20px; }
  #hud { gap: 8px; padding: 4px 8px; }
  #hud-place, .hud-timebar { display: none; }
  .meters { gap: 8px; }
  .stat:nth-of-type(5) { display: none; }
  #objectives, #tension { display: none; }
  #log { top: auto; bottom: 110px; width: auto; left: 10px; }
  .act { min-width: 0; padding: 2px 8px 2px 20px; }
}
@media (max-height: 520px) {
  #objectives, #tension { display: none; }
  #log { width: 250px; top: 54px; }
  #log .msg { font-size: 11px; padding: 3px 7px; }
  #log .msg:nth-last-child(n+3) { display: none; }
  .act { height: 36px; }
}

/* ================= Pietní simulace (memorial) ================= */
body.memorial #game { cursor: default; }
#mem { position: absolute; inset: 0; pointer-events: none; z-index: 6; font-family: var(--font-ui); color: var(--hud-text); --arch-w: clamp(300px, 31vw, 520px); --side-w: 0px; }
#mem > * { pointer-events: auto; }
#mem .mem-top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 16px;
  padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(rgba(5,7,12,.85), rgba(5,7,12,0)); pointer-events: none; z-index: 8; transition: opacity 1s;
}
#mem .mem-top > * { pointer-events: auto; }
.mem-title { display: flex; flex-direction: column; line-height: 1.15; }
.mem-title .d { font-family: var(--font-head); font-size: 17px; letter-spacing: .02em; }
.mem-title .p { font-size: 12px; color: var(--hud-dim); }
.mem-clock { font-family: var(--font-mono); font-size: 26px; font-weight: 600; color: var(--candle); font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(255,190,90,.35); }
.mem-ctrl { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mem-ctrl button { height: 30px; padding: 0 10px; font-size: 12px; color: var(--hud-text); background: rgba(255,255,255,.06); border: 1px solid var(--hud-line); border-radius: 15px; }
.mem-ctrl button:hover { background: rgba(255,255,255,.14); }
.mem-ctrl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#mem-sound.off { color: var(--hud-dim); text-decoration: line-through; }
#mem-speed.slow { color: var(--candle); border-color: rgba(255,207,115,.45); }
#mem-sound.need { background: var(--accent); color: #1c1a16; border-color: var(--accent); font-weight: 600; animation: memPulse 1.6s ease-in-out infinite; }
@keyframes memPulse { 50% { box-shadow: 0 0 0 6px rgba(241,194,75,.18); } }

.mem-card {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, -8px); width: min(640px, calc(100% - 32px));
  text-align: center; opacity: 0; transition: opacity .7s, transform .7s; pointer-events: none;
  text-shadow: 0 2px 18px rgba(0,0,0,.9);
}
.mem-card.in { opacity: 1; transform: translate(-50%, 0); }
.mem-card.out { opacity: 0; }
.mem-card .time { font-family: var(--font-mono); color: var(--candle); font-size: 15px; letter-spacing: .08em; }
.mem-card h2 { font-family: var(--font-head); text-transform: uppercase; font-size: clamp(26px, 4vw, 44px); margin: 4px 0 6px; letter-spacing: .01em; text-wrap: balance; }
.mem-card p { font-family: var(--font-serif); font-size: clamp(15px, 1.6vw, 19px); line-height: 1.5; margin: 0 auto; max-width: 56ch; color: #e8e2d4; }
.mem-card.big { top: 50%; transform: translate(-50%, -50%); background: radial-gradient(ellipse at center, rgba(3,5,10,.82) 0%, rgba(3,5,10,.55) 60%, rgba(3,5,10,0) 100%); padding: 36px 24px; }
.mem-card.big.in { transform: translate(-50%, -50%); }
.mem-card a { color: var(--candle); pointer-events: auto; }
.mem-card.big { pointer-events: auto; }

.mem-subs { z-index: 3; position: absolute; left: calc(var(--arch-w) + 30px); right: calc(var(--side-w) + 30px); bottom: 88px; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.mem-subs .sub { background: rgba(5,7,12,.78); border-radius: 6px; padding: 5px 12px; font-size: 15px; line-height: 1.4; text-align: center; transition: opacity .7s; animation: subIn .3s ease-out; max-width: 100%; }
.mem-subs .sub.out { opacity: 0; }
.mem-subs .sub .who { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--hud-dim); margin-right: 8px; }
.mem-subs .sub.narrator { font-family: var(--font-serif); font-style: italic; font-size: 17px; color: #f2ecdd; }
.mem-subs .sub.chant .txt, .mem-subs .sub.song .txt { font-family: var(--font-head); letter-spacing: .04em; text-transform: uppercase; }
.mem-subs .sub.megaphone .who, .mem-subs .sub.radio .who, .mem-subs .sub.command .who { color: var(--series-police); }
.mem-subs .sub.orig { border: 1px solid rgba(255,207,115,.35); }
.mem-subs .sub.orig .txt { font-family: var(--font-head); letter-spacing: .04em; text-transform: uppercase; }
.mem-subs .sub.orig .who { color: var(--candle); }
@keyframes subIn { from { opacity: 0; transform: translateY(6px); } }

.mem-gloss { z-index: 7; position: absolute; left: 14px; top: 76px; width: 300px; background: rgba(239,232,216,.95); color: var(--ink); border-radius: 6px; padding: 10px 12px; font-size: 13px; line-height: 1.45; opacity: 0; transform: translateY(-6px); transition: opacity .5s, transform .5s; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.mem-gloss.in { opacity: 1; transform: none; }
.mem-gloss b { display: block; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .05em; font-size: 13px; margin-bottom: 2px; color: var(--red); }

.mem-archive { position: absolute; left: 14px; bottom: 64px; width: var(--arch-w); margin: 0; z-index: 1; background: #000; border: 1px solid var(--hud-line); border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.mem-archive.off { display: none; }
.mem-archive video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; filter: grayscale(.2) contrast(1.05); }
.mem-archive figcaption { position: relative; padding: 5px 38px 6px 8px; font-size: 11.5px; line-height: 1.35; background: rgba(10,13,22,.95); }
.mem-archive figcaption button { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; padding: 0; border-radius: 13px; border: 1px solid var(--hud-line); background: rgba(255,255,255,.07); color: var(--hud-text); font-size: 14px; line-height: 1; cursor: pointer; }
.mem-archive figcaption button:hover { background: rgba(255,255,255,.16); }
.mem-archive video { cursor: zoom-in; }
.mem-archive.big { width: min(74vw, 1000px); left: 50%; transform: translateX(-50%); bottom: 60px; z-index: 3; }
.mem-archive.big video { cursor: zoom-out; }
.mem-archive figcaption span { display: block; color: var(--hud-text); }
.mem-archive figcaption a { color: var(--hud-dim); font-size: 10.5px; }


.mem-timeline { position: absolute; left: 0; right: 0; bottom: 0; height: 60px; z-index: 2; padding: 6px 14px 0; padding-bottom: env(safe-area-inset-bottom); background: linear-gradient(rgba(5,7,12,0), rgba(5,7,12,.92)); }
.mem-timeline .bar { height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.mem-timeline .bar i { display: block; height: 100%; width: 0; background: var(--candle); }
.mem-timeline .marks { position: relative; height: 26px; }
.mem-timeline .marks span { position: absolute; top: 3px; transform: translateX(-50%); font-size: 10px; color: var(--hud-dim); white-space: nowrap; }
.mem-timeline .marks span:nth-child(even) { top: 14px; }
.mem-timeline .marks span:nth-child(even) b { display: inline; margin-right: 4px; }
.mem-timeline .marks span:nth-child(odd) b { display: inline; margin-right: 4px; }
.mem-timeline .marks span b { display: block; font-family: var(--font-mono); font-weight: 600; color: #c9c3b6; font-size: 10px; }
.mem-timeline .marks span::before { content: ''; position: absolute; left: 50%; top: -7px; width: 1px; height: 5px; background: rgba(255,255,255,.35); }
body.memorial #tension { display: none !important; }

/* svědectví z letáku: píše se jako na psacím stroji, červená páska jako na originálu, bez podkladu */
.mem-witness {
  position: absolute; left: 50%; top: 70px; width: min(780px, calc(100% - 32px)); max-height: calc(34vh - 70px + 40px); overflow: hidden;
  transform: translateX(-50%); z-index: 1; color: #ff4f62; pointer-events: none;
  opacity: 0; transition: opacity 1.2s;
}
.mem-witness.in { opacity: 1; }
.mem-witness .h { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,120,135,.75); margin-bottom: 6px; text-shadow: 0 1px 3px rgba(0,0,0,.9); }
.mem-witness .h a { color: inherit; pointer-events: auto; }
.mem-witness .t {
  margin: 0; font-family: "Special Elite", "Courier New", monospace; font-size: clamp(16px, 1.6vw, 22px); line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0,0,0,.95), 0 0 14px rgba(0,0,0,.75);
}
.mem-witness .t span, .mem-stage .tw span, .mem-stage .blk p span { position: relative; }
.mem-witness .caret, .mem-stage .caret { display: inline-block; width: .55em; height: 1.05em; margin-left: 1px; vertical-align: -.15em; background: currentColor; opacity: .8; animation: memCaret .9s steps(1) infinite; }
.mem-witness .caret.done, .mem-stage .caret.done { animation: memCaret 1.4s steps(1) infinite; }
@keyframes memCaret { 50% { opacity: 0; } }

/* epilog: fotografie z dalších dní přes celou obrazovku */
.mem-photo {
  position: absolute; inset: 0; margin: 0; padding: 62px 16px 70px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: rgba(3,5,10,.95); opacity: 0; visibility: hidden; transition: opacity 1s, visibility 0s 1s;
}
.mem-photo.in { opacity: 1; visibility: visible; transition: opacity 1s; }
#mem.epi .mem-archive, #mem.epi .mem-witness, #mem.epi .mem-gloss { visibility: hidden; }
.mem-photo .frame { position: relative; width: min(1500px, 100%); flex: 1 1 auto; min-height: 0; overflow: hidden; }
.mem-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 1.4s ease; }
.mem-photo img.on { opacity: 1; animation: memKenBurns var(--kb, 9s) linear forwards; }
@keyframes memKenBurns { from { transform: scale(1); } to { transform: scale(1.07); } }
.mem-photo figcaption { flex: none; max-width: 860px; text-align: center; }
.mem-photo .time { font-family: var(--font-mono); color: var(--candle); font-size: 14px; letter-spacing: .08em; }
.mem-photo h2 { font-family: var(--font-head); text-transform: uppercase; font-size: clamp(22px, 3vw, 34px); margin: 2px 0 4px; letter-spacing: .01em; }
.mem-photo .txt { margin: 0; font-family: var(--font-serif); font-size: clamp(15px, 1.5vw, 18px); line-height: 1.5; color: #e8e2d4; text-wrap: balance; }
.mem-photo .credit { display: block; margin-top: 6px; font-size: 11.5px; color: var(--hud-dim); }
.mem-photo .credit a { color: inherit; }

@media (max-width: 900px) {
  #mem { --arch-w: 220px; }
  .mem-timeline .marks span { display: none; }
  .mem-timeline .marks span:nth-child(odd) { display: block; }
}
@media (max-width: 640px) {
  .mem-ctrl #mem-cam, .mem-ctrl #mem-archive-toggle { display: none; }
  .mem-timeline .marks span, .mem-timeline .marks span:nth-child(odd) { display: none; }
  .mem-archive { display: none; }
  .mem-subs { bottom: 80px; left: 16px; right: 16px; }
  .mem-witness { top: 112px; width: calc(100% - 16px); }
  .mem-witness .t { font-size: 14px; }
  .mem-photo { padding: 56px 8px 52px; }
  .mem-gloss { top: auto; bottom: 150px; left: 8px; right: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  #mem-sound.need, .mem-photo img.on, .mem-witness .caret { animation: none; }
}

/* ---------- prolog a epilog: černé plátno, film, trasa, titulky ---------- */
#mem.cine .mem-top { opacity: .35; }
#mem.cine .mem-top:hover { opacity: 1; }
#mem.cine .mem-timeline { opacity: 0; }
.mem-timeline { transition: opacity 1s; }
.mem-stage {
  position: absolute; inset: 0; z-index: 5; background: #05060a;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 1.2s, visibility 0s 1.2s;
}
.mem-stage.in { opacity: 1; visibility: visible; transition: opacity 1.2s; }
.mem-stage > * { position: absolute; opacity: 0; transition: opacity 1.2s; pointer-events: none; }
.mem-stage > .on { opacity: 1; pointer-events: auto; }
.mem-stage .tw { width: min(760px, calc(100% - 48px)); font-family: "Special Elite", "Courier New", monospace; font-size: clamp(18px, 2.2vw, 28px); line-height: 1.6; color: #efe8d8; }
.mem-stage .tw p { margin: 0 0 .7em; min-height: 1.6em; }
.mem-stage .title { text-align: center; }
.mem-stage .title h1 { margin: 0; font-family: var(--font-head); font-weight: 700; text-transform: uppercase; font-size: clamp(56px, 11vw, 150px); letter-spacing: .02em; line-height: 1; color: #f4efe2; }
.mem-stage .title p { margin: 14px 0 0; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .18em; font-size: clamp(12px, 1.3vw, 16px); color: var(--candle); }
.mem-stage .blk { width: min(760px, calc(100% - 48px)); text-align: center; }
.mem-stage .blk .time { font-family: var(--font-mono); color: var(--candle); font-size: 15px; letter-spacing: .08em; }
.mem-stage .blk h2 { font-family: var(--font-head); text-transform: uppercase; font-size: clamp(28px, 4.4vw, 52px); margin: 6px 0 12px; line-height: 1.05; color: #f4efe2; }
.mem-stage .blk h2:empty { display: none; }
.mem-stage .blk p { margin: 0 auto; max-width: 56ch; font-family: var(--font-serif); font-size: clamp(17px, 1.9vw, 23px); line-height: 1.55; color: #e8e2d4; }
.mem-stage .credits { inset: 0; overflow: hidden; }
.mem-stage .credits .roll { position: absolute; left: 50%; top: 0; width: min(680px, calc(100% - 48px)); transform: translate(-50%, 100vh); text-align: center; color: #d9d3c4; font-size: 15px; line-height: 1.6; }
.mem-stage .credits .roll.go { animation: memRoll var(--roll, 30s) linear forwards; }
@keyframes memRoll { from { transform: translate(-50%, 100vh); } to { transform: translate(-50%, -100%); } }
.mem-stage .credits h1 { font-family: var(--font-head); text-transform: uppercase; font-size: clamp(40px, 6vw, 72px); margin: 0; color: #f4efe2; }
.mem-stage .credits .sub { font-family: var(--font-mono); color: var(--candle); letter-spacing: .1em; font-size: 13px; margin: 6px 0 40px; }
.mem-stage .credits h3 { font-family: var(--font-mono); font-weight: 600; text-transform: uppercase; letter-spacing: .14em; font-size: 11.5px; color: var(--hud-dim); margin: 34px 0 6px; }
.mem-stage .credits p { margin: 0; }
.mem-stage .credits a { color: inherit; }
.mem-stage .credits .ded { margin-top: 60px; font-family: var(--font-serif); font-style: italic; font-size: 20px; color: #f4efe2; }
.mem-stage .credits .again { position: absolute; left: 50%; bottom: 16vh; transform: translateX(-50%); text-align: center; opacity: 0; transition: opacity 1s; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mem-stage .credits .again.on { opacity: 1; }
#mem-again-t { font-family: var(--font-mono); color: var(--hud-dim); font-size: 13px; letter-spacing: .06em; }
#mem-again { height: 40px; padding: 0 22px; border-radius: 20px; border: 1px solid rgba(255,207,115,.5); background: rgba(255,207,115,.08); color: var(--candle); font-size: 15px; cursor: pointer; }
#mem-again:hover { background: rgba(255,207,115,.18); }
.mem-archive.film { left: 50%; top: 44%; bottom: auto; transform: translate(-50%, -50%); width: min(88vw, 104vh, 1000px); z-index: 6; display: block !important; }
.mem-archive.film video { cursor: default; }
.mem-filmcap { position: absolute; left: 50%; bottom: 5vh; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); text-align: center; z-index: 6; opacity: 0; transition: opacity 1.2s; pointer-events: none; }
.mem-filmcap.in { opacity: 1; }
.mem-filmcap .time { font-family: var(--font-mono); color: var(--candle); font-size: 14px; letter-spacing: .08em; }
.mem-filmcap h2 { font-family: var(--font-head); text-transform: uppercase; font-size: clamp(24px, 3vw, 36px); margin: 2px 0 4px; color: #f4efe2; }
.mem-filmcap p { margin: 0; font-family: var(--font-serif); font-size: clamp(15px, 1.6vw, 19px); line-height: 1.5; color: #e8e2d4; }
.mem-route { position: absolute; inset: 0; z-index: 1; background: #0b0e17; opacity: 0; visibility: hidden; transition: opacity 1.6s, visibility 0s 1.6s; }
.mem-route.in { opacity: 1; visibility: visible; transition: opacity 1.2s; }
.mem-route canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mem-route .cap { position: absolute; left: calc(var(--arch-w) + 30px); right: 30px; bottom: 82px; text-align: center; font-family: var(--font-serif); font-size: clamp(16px, 1.7vw, 21px); line-height: 1.45; color: #ede6d6; opacity: 0; transition: opacity .8s; text-shadow: 0 1px 4px #000, 0 0 18px rgba(0,0,0,.8); }
.mem-route .cap.on { opacity: 1; }
.mem-route .cap b { display: block; font-family: var(--font-mono); font-weight: 600; color: var(--candle); font-size: 15px; letter-spacing: .08em; margin-bottom: 2px; }
@media (max-width: 640px) {
  .mem-archive.film { width: calc(100% - 16px); top: 38%; }
  .mem-route .cap { bottom: 74px; left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .mem-stage .credits .roll.go { animation-duration: 1ms; transform: translate(-50%, 10vh); }
}

/* patička: autor, vidět pořád (i na černém plátně) */
.mem-foot { position: absolute; right: 14px; bottom: calc(5px + env(safe-area-inset-bottom)); z-index: 9; font-size: 11px; color: var(--hud-dim); letter-spacing: .02em; pointer-events: auto; }
.mem-foot a { color: #cfc9bb; text-decoration: none; border-bottom: 1px solid rgba(207,201,187,.35); }
.mem-foot a:hover { color: var(--candle); border-bottom-color: var(--candle); }
#mem.epi .mem-foot, #mem.cine .mem-foot { color: rgba(154,160,171,.7); }
