/* —— BLACKOUT CROSS — briefing document style —— */
:root {
  --paper: #f2f1eb;
  --paper-2: #e8e6de;
  --ink: #111111;
  --ink-soft: #3a3a3a;
  --muted: #6a6a6a;
  --line: #111111;
  --font-display: "Black Ops One", "Anton", Impact, sans-serif;
  --font-head: "Anton", Impact, sans-serif;
  --font-mono: "Share Tech Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: #1a1a1a;
  color: var(--ink);
  font-family: var(--font-mono);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}

/* outer double frame */
.doc-frame {
  position: absolute;
  inset: 8px;
  border: 2px solid var(--ink);
  pointer-events: none;
  z-index: 20;
}

.doc-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--ink);
}

.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--ink) 0 3px,
      transparent 3px 6px
    );
  z-index: 1;
}

.corner.tl { top: -1px; left: -1px; }
.corner.tr { top: -1px; right: -1px; }
.corner.bl { bottom: -1px; left: -1px; }
.corner.br { bottom: -1px; right: -1px; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1;
  padding: 18px;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.screen[hidden] {
  display: none !important;
}

/* —— Watermark seal —— */
.seal-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background:
    center 42% / min(70vw, 280px) no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Ccircle cx='60' cy='60' r='56' fill='none' stroke='%23000' stroke-width='3'/%3E%3Ccircle cx='60' cy='60' r='44' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3Cpath d='M60 22 L68 46 L94 46 L74 62 L82 88 L60 72 L38 88 L46 62 L26 46 L52 46 Z' fill='%23000'/%3E%3Ccircle cx='60' cy='14' r='3' fill='%23000'/%3E%3Ccircle cx='42' cy='100' r='2.5' fill='%23000'/%3E%3Ccircle cx='60' cy='104' r='2.5' fill='%23000'/%3E%3Ccircle cx='78' cy='100' r='2.5' fill='%23000'/%3E%3C/svg%3E");
}

/* —— Briefing header —— */
.doc-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding-top: max(4px, env(safe-area-inset-top));
  margin-bottom: 10px;
}

.seal-mini {
  flex-shrink: 0;
}

.doc-title-block {
  min-width: 0;
  text-align: center;
}

.brand-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 8vw, 2.2rem);
  letter-spacing: 0.06em;
  line-height: 1;
  font-weight: 400;
}

.brand-sub {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  margin-top: 4px;
  color: var(--ink-soft);
}

.class-box {
  border: 2px solid var(--ink);
  padding: 4px 6px;
  text-align: center;
  min-width: 72px;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 4px,
      rgba(0, 0, 0, 0.06) 4px,
      rgba(0, 0, 0, 0.06) 8px
    );
}

.class-label {
  display: block;
  font-size: 0.45rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.class-value {
  display: block;
  font-family: var(--font-head);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

/* hazard stripes */
.hazard-bar {
  height: 14px;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    -45deg,
    var(--ink) 0 8px,
    var(--paper) 8px 16px
  );
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.hazard-bar.thin {
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    var(--ink) 0 5px,
    var(--paper) 5px 10px
  );
}

.section-bar {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-head);
  letter-spacing: 0.18em;
  font-size: 0.95rem;
  padding: 8px 12px;
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-bar::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--paper);
}

.brief-body {
  flex: 1;
  overflow: auto;
  padding: 14px 4px 10px;
  min-height: 0;
}

.ops-line {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  color: var(--ink-soft);
}

.brief-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brief-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink);
}

.brief-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 9px solid var(--ink);
}

.brief-list strong {
  font-weight: 700;
  border-bottom: 2px solid var(--ink);
}

/* BEGIN NOW button — matches briefing CTA */
.btn-begin {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 18px;
  margin: 10px 0;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--ink);
  font-family: var(--font-head);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-begin:active {
  background: var(--ink);
  color: var(--paper);
}

.btn-begin:active .play-tri {
  border-left-color: var(--paper);
}

.btn-begin.compact {
  padding: 12px 16px;
  margin-bottom: 8px;
}

.play-tri {
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid var(--ink);
  flex-shrink: 0;
}

.btn-begin-text {
  font-size: 1.35rem;
  letter-spacing: 0.12em;
}

.btn-ghost {
  appearance: none;
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.btn-ghost:active {
  background: var(--ink);
  color: var(--paper);
}

/* footer meta boxes */
.doc-footer {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 6px;
  margin-top: auto;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.foot-box {
  border: 2px solid var(--ink);
  padding: 6px 4px;
  text-align: center;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.foot-box.warn {
  background: repeating-linear-gradient(
    -45deg,
    var(--paper) 0 4px,
    #ddd9ce 4px 8px
  );
}

.foot-label {
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.foot-value {
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.barcode {
  display: block;
  width: 70%;
  height: 14px;
  margin: 2px 0;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    transparent 2px 3px,
    var(--ink) 3px 4px,
    transparent 4px 6px,
    var(--ink) 6px 9px,
    transparent 9px 10px
  );
}

.warn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  font-family: var(--font-head);
  font-size: 0.7rem;
  line-height: 1;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: var(--ink);
  color: var(--paper);
  margin-bottom: 2px;
}

/* —— Game HUD —— */
#screen-game {
  padding: 0;
  background: var(--paper);
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  padding: max(14px, calc(env(safe-area-inset-top) + 6px)) 14px 8px;
  pointer-events: none;
}

.hud-box {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  width: fit-content;
}

.hud-box.right {
  margin-left: auto;
  text-align: right;
  align-items: flex-end;
}

.hud-mid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
}

.hud-protocol {
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 8px;
}

.hud-label {
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}

#score-value,
#goal-value {
  font-family: var(--font-head);
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

.hazard-bar.game-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  height: 8px;
  border: none;
  border-bottom: 2px solid var(--ink);
}

.hazard-bar.game-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  height: 10px;
  border: none;
  border-top: 2px solid var(--ink);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* —— Overlays —— */
.screen.overlay {
  align-items: center;
  justify-content: center;
  background: rgba(242, 241, 235, 0.94);
  padding: 28px 22px;
  z-index: 10;
}

.panel {
  width: 100%;
  max-width: 340px;
  text-align: center;
  border: 2px solid var(--ink);
  padding: 0;
  background: var(--paper);
  animation: panel-in 0.35s ease;
  box-shadow: 6px 6px 0 var(--ink);
}

.panel > *:not(.hazard-bar) {
  padding-left: 18px;
  padding-right: 18px;
}

.panel .hazard-bar:first-child {
  margin-bottom: 16px;
}

.panel .hazard-bar:last-child {
  margin-top: 16px;
}

.panel .btn-begin,
.panel .btn-ghost {
  width: calc(100% - 36px);
  margin-left: 18px;
  margin-right: 18px;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-weight: 400;
}

.panel-score {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  margin-bottom: 18px;
  color: var(--ink-soft);
}

.unlock-box {
  border: 2px solid var(--ink);
  margin: 0 18px 14px;
  padding: 12px !important;
  background: var(--paper);
}

.unlock-label {
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 8px;
}

#unlock-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--ink);
}

@media (min-width: 481px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #app {
    height: min(100vh, 900px);
    box-shadow: 0 0 0 2px var(--ink), 12px 12px 0 #000;
  }
}

@media (max-height: 700px) {
  .doc-footer {
    display: none;
  }

  .brand-sub {
    display: none;
  }

  .brief-list li {
    font-size: 0.75rem;
    gap: 6px;
  }
}
