/* TU-95 — Oberfläche im Stil sowjetischer Plakatgrafik:
   Tiefrot, Creme, harte Kanten, schmale Versalien. */

:root {
  --red: #b3201e;
  --red-deep: #7d1512;
  --cream: #e8e2d4;
  --cream-dim: #bdb6a6;
  --ink: #14161a;
  --ink-soft: #1e2228;
  --steel: #6f7884;
  --green: #6ee08a;
  --amber: #ffb33c;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #0c1016;
  touch-action: none;
}

/* ---------------------------------------------------------------- */
/* Bildschirme                                                       */
/* ---------------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  z-index: 10;
  background:
    radial-gradient(120% 90% at 50% 0%, #2b3038 0%, #14161a 55%, #0b0d10 100%);
}

/* Auf dem Titelbild läuft ein Vorführflug — der Hintergrund lässt ihn durch. */
.screen--title {
  background:
    radial-gradient(90% 70% at 50% 45%, rgba(10, 12, 16, 0.30), rgba(10, 12, 16, 0.66) 70%);
  backdrop-filter: blur(1px);
}
.screen[hidden] { display: none; }

.screen--overlay { background: rgba(10, 12, 15, 0.86); backdrop-filter: blur(3px); }

.screen--title::before {
  /* Diagonale Strahlen wie auf einem Propagandaplakat */
  content: "";
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(
    from 0deg at 50% 18%,
    rgba(179, 32, 30, 0.07) 0deg 7deg,
    transparent 7deg 14deg
  );
  pointer-events: none;
}

/* ---------------------------------------------------------------- */
/* Titel                                                             */
/* ---------------------------------------------------------------- */
.poster {
  position: relative;
  width: min(760px, 100%);
  text-align: center;
  padding: 28px 30px 22px;
  background: linear-gradient(180deg, rgba(22, 25, 30, 0.94), rgba(14, 16, 20, 0.97));
  border: 2px solid rgba(232, 226, 212, 0.16);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 6px rgba(179, 32, 30, 0.1);
}

.poster__star {
  position: absolute;
  top: -26px; left: 50%;
  width: 52px; height: 52px;
  transform: translateX(-50%);
  background: var(--red);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  box-shadow: 0 0 26px rgba(179, 32, 30, 0.7);
}

.kicker {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.logo {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(58px, 13vw, 124px);
  line-height: 0.86;
  letter-spacing: -0.03em;
  color: var(--cream);
  text-shadow: 5px 5px 0 var(--red), 10px 10px 0 rgba(0, 0, 0, 0.45);
}

.tagline {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--cream-dim);
  letter-spacing: 0.02em;
}

.silhouette {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 14px auto 6px;
  fill: rgba(232, 226, 212, 0.5);
}

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 16px 0 18px;
}

/* ---------------------------------------------------------------- */
/* Schaltflächen                                                     */
/* ---------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 2px solid rgba(232, 226, 212, 0.32);
  background: rgba(232, 226, 212, 0.05);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
.btn:hover { background: rgba(232, 226, 212, 0.13); border-color: var(--cream); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn--primary { background: var(--red); border-color: var(--red); }
.btn--primary:hover { background: #cf2a27; border-color: #cf2a27; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------------------------------------------------------------- */
/* Einstellungen                                                     */
/* ---------------------------------------------------------------- */
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 6px;
}

.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field > span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.field input {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(232, 226, 212, 0.24);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 12px;
  width: 190px;
}
.field input:focus { outline: none; border-color: var(--amber); }

.seg { display: flex; }
.seg button {
  appearance: none;
  border: 2px solid rgba(232, 226, 212, 0.24);
  border-right-width: 0;
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream-dim);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 15px;
  cursor: pointer;
}
.seg button:last-child { border-right-width: 2px; }
.seg button[aria-checked="true"] { background: var(--red); color: #fff; border-color: var(--red); }

.diff-blurb {
  min-height: 32px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--cream-dim);
}

.poster__foot {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(232, 226, 212, 0.14);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(189, 182, 166, 0.65);
}

/* ---------------------------------------------------------------- */
/* Blätter (Missionen, Briefing, Debriefing)                         */
/* ---------------------------------------------------------------- */
.sheet {
  width: min(800px, 100%);
  max-height: 100%;
  padding: 30px 32px;
  background: linear-gradient(180deg, rgba(22, 25, 30, 0.97), rgba(14, 16, 20, 0.99));
  border: 2px solid rgba(232, 226, 212, 0.18);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.sheet--narrow { width: min(420px, 100%); text-align: center; }
.sheet--brief { width: min(700px, 100%); }

.sheet h2 {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sheet h3 {
  margin: 24px 0 10px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.sheet__sub { margin: 0 0 18px; color: var(--cream-dim); font-size: 14px; }
.sheet__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.sheet__actions--column { flex-direction: column; }
.hint { margin: 16px 0 0; font-size: 12px; color: var(--cream-dim); }

/* Missionsliste */
.missions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mission {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  background: rgba(232, 226, 212, 0.04);
  border: 2px solid rgba(232, 226, 212, 0.14);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mission:hover:not([disabled]) { background: rgba(232, 226, 212, 0.1); border-color: rgba(232, 226, 212, 0.4); }
.mission[disabled] { opacity: 0.42; cursor: not-allowed; }
.mission__no {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  color: var(--red);
}
.mission__name { font-family: var(--mono); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.mission__sub { font-size: 12.5px; color: var(--cream-dim); margin-top: 3px; }
.mission__best { font-family: var(--mono); font-size: 12px; color: var(--green); text-align: right; }
.mission__lock { font-family: var(--mono); font-size: 11px; color: var(--cream-dim); }

/* Briefing */
.brief-text { font-size: 14.5px; line-height: 1.6; color: #d6d0c2; margin: 10px 0 18px; }
.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.brief-grid div { background: rgba(0, 0, 0, 0.32); border-left: 3px solid var(--red); padding: 9px 12px; }
.brief-grid dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.brief-grid dd { margin: 3px 0 0; font-family: var(--mono); font-size: 15px; font-weight: 700; }
.brief-obj { display: grid; gap: 6px; }
.brief-obj span {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 7px 10px;
  background: rgba(255, 179, 60, 0.08);
  border-left: 3px solid var(--amber);
}

/* Landeskizze */
.landing-chart {
  margin: 4px 0 18px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.32);
  border-left: 3px solid var(--red);
}
.landing-chart[hidden] { display: none; }
.landing-chart svg { display: block; width: 100%; height: auto; }
.landing-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.landing-chart__legend b { color: var(--cream); font-weight: 700; }

/* Wertung */
.score { width: 100%; border-collapse: collapse; margin: 14px 0 0; }
.score td { padding: 7px 0; border-bottom: 1px solid rgba(232, 226, 212, 0.1); font-size: 14px; }
.score td:last-child { text-align: right; font-family: var(--mono); font-weight: 700; }
.score .neg td:last-child { color: #ff7a6a; }
.score-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid var(--red);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--cream-dim);
}
.score-total strong { font-size: 34px; color: var(--cream); letter-spacing: 0; }

.board { margin-top: 20px; }
.board table { width: 100%; border-collapse: collapse; }
.board th {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-align: left;
  padding-bottom: 6px;
}
.board td { padding: 5px 0; font-size: 13px; border-bottom: 1px solid rgba(232, 226, 212, 0.08); }
.board td:last-child, .board th:last-child { text-align: right; font-family: var(--mono); }
.board .me td { color: var(--amber); font-weight: 700; }
.board__empty { font-size: 13px; color: var(--cream-dim); }
.board h4 {
  margin: 18px 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* Steuerungstabelle */
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 6px 0; font-size: 14px; border-bottom: 1px solid rgba(232, 226, 212, 0.08); }
.keys td:first-child {
  width: 150px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.06em;
}
.tips { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.7; color: #d6d0c2; }
.tips strong { color: var(--cream); }

/* ---------------------------------------------------------------- */
/* Touch                                                             */
/* ---------------------------------------------------------------- */
.touch {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  pointer-events: none;
  z-index: 5;
}
.touch[hidden] { display: none; }
.touch-col { display: flex; gap: 8px; pointer-events: auto; }
/* Die Zusatztasten liegen als flaches Raster zwischen den Daumen, nie als
   Spalte quer durchs Bild. */
.touch-mid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  grid-auto-rows: auto;
  justify-content: center;
  gap: 6px;
}
.tbtn {
  width: 68px;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid rgba(232, 226, 212, 0.4);
  border-radius: 10px;
  background: rgba(16, 20, 26, 0.68);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.tbtn small { font-size: 9px; letter-spacing: 0.1em; opacity: 0.75; }
.tbtn-sm { width: 56px; height: 56px; font-size: 15px; }
.tbtn-sm small { font-size: 8px; }
.tbtn.is-active { background: var(--red); border-color: var(--red); }

/* ---------------------------------------------------------------- */
@media (max-width: 440px) {
  .tbtn { width: 52px; height: 52px; font-size: 16px; }
  .tbtn-sm { width: 42px; height: 42px; font-size: 12px; }
  .touch-mid { grid-template-columns: repeat(2, auto); }
}

@media (max-width: 560px) {
  .tbtn { width: 58px; height: 58px; font-size: 17px; }
  .tbtn-sm { width: 46px; height: 46px; font-size: 13px; }
  .tbtn small { font-size: 8px; }
  .touch { gap: 4px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
}

@media (max-width: 720px) {
  .poster { padding: 22px 18px 18px; }
  .sheet { padding: 22px 18px; }
  .options { flex-direction: column; align-items: stretch; }
  .field input { width: 100%; }
  .mission { grid-template-columns: 34px 1fr; }
  .mission__best { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}


/* Einsatzprotokoll in der Auswertung: was unterwegs passiert ist, in der
   Reihenfolge, in der es passiert ist. */
.log { margin-top: 18px; text-align: left; }
.log h3 {
  margin: 0 0 8px;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.log ol { margin: 0; padding: 0; list-style: none; max-height: 190px; overflow-y: auto; }
.log li {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  font: 400 13px/1.35 var(--mono);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.log li:last-child { border-bottom: 0; }
.log time { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.log li.good span { color: #7ee08a; }
.log li.bad span { color: #ff8b7a; }
