/* Fine-Tuned Heist — Guess Who UI (terminal phosphor theme) */

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

:root {
  --vv-height: 100dvh;
  --vv-offset-top: 0px;
  --bg: #0a0a0a;
  --bg-bezel: #050705;
  --bg-chrome: #0b0f0b;
  --bg-raised: #101610;
  --bg-inset: #070907;
  --green: #33ff33;
  --green-bright: #c8ffc8;
  --green-soft: #7dff7d;
  --green-mid: #22c422;
  --green-dim: #1a8a1a;
  --green-mute: #0e5a0e;
  --green-faint: rgba(51, 255, 51, 0.10);
  --green-ghost: rgba(51, 255, 51, 0.06);
  --border: #1c7a1c;
  --border-dim: #0f4a0f;
  --font: "IBM Plex Mono", "Nimbus Mono PS", "Courier New", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100%;
  overflow: auto;
  background: var(--bg-bezel);
  color: var(--green);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 0 1px rgba(51, 255, 51, 0.35);
}

.page {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 42%, #0d160d 0%, #050705 62%, #030403 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

.dim { color: var(--green-dim); text-shadow: none; }
.mute { color: var(--green-mute); text-shadow: none; }
.soft { color: var(--green-soft); }

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 5;
}
.modal {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 680px;
  background: #070a07;
  border: 2px solid var(--green);
  box-shadow:
    0 0 0 1px #000,
    0 0 40px rgba(51, 255, 51, 0.18),
    inset 0 0 30px rgba(51, 255, 51, 0.04);
  padding: 0;
}
.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: #0b120b;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--green-soft);
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.4);
}
.modal-body {
  padding: 26px 32px 28px;
}

.intro-overlay { position: absolute; inset: 0; z-index: 20; }
.intro-overlay.done { display: none; }
.choice-btn {
  text-align: left;
  font: inherit;
  color: var(--green);
  background: #0b100b;
  border: 1px solid var(--border-dim);
  padding: 8px 10px;
  cursor: pointer;
  line-height: 1.35;
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.choice-btn:hover { border-color: var(--green-dim); text-shadow: 0 0 6px rgba(51, 255, 51, 0.35); }

/* ---------- mobile viewport ---------- */
@media (max-width: 900px) {
  html, body {
    overflow: hidden;
    overscroll-behavior: none;
    min-height: 100%;
    height: 100%;
  }

  .page {
    width: 100%;
    max-width: 100vw;
    height: var(--vv-height, 100dvh);
    max-height: var(--vv-height, 100dvh);
    min-height: var(--vv-height, 100dvh);
    margin: 0;
    padding: 0
      env(safe-area-inset-right, 0)
      env(safe-area-inset-bottom, 0)
      env(safe-area-inset-left, 0);
    transform: translateY(var(--vv-offset-top, 0px));
  }
}

/* Guess Who */
.gw-page.page {
  padding: 12px;
  gap: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.gw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 0 0 auto;
}
.gw-header h1,
.gw-brand-title {
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.3;
  max-width: min(100%, 28rem);
  margin: 0;
  font-weight: inherit;
  flex: 1 1 auto;
  min-width: 0;
}
.gw-brand-mobile { display: none; }

.fth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #6a9a5b;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
}
.fth-brand-icon { flex: 0 0 auto; }
.fth-brand-text {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.25em;
  white-space: nowrap;
}
.fth-brand-wordmark { line-height: 1; }
.fth-brand-cursor {
  display: block;
  flex: 0 0 auto;
  width: 0.5em;
  height: 1em;
  background: #6a9a5b;
  animation: fth-brand-cursor-blink 1s step-end infinite;
}
@keyframes fth-brand-cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fth-brand-cursor { animation: none; opacity: 1; }
}
.fth-brand--compact {
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.045em;
  gap: 0.45rem;
  max-width: 100%;
}
.fth-brand--compact .fth-brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}
.fth-brand--compact .fth-brand-wordmark {
  display: block;
  font-size: 14px;
  line-height: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fth-brand--compact .fth-brand-icon {
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
}
.gw-patience { display: flex; align-items: center; gap: 8px; }
.gw-patience-label { font-size: 10px; letter-spacing: 0.1em; color: var(--green-dim); text-transform: uppercase; }
.gw-pip { width: 12px; height: 12px; border: 1px solid var(--border); opacity: 0.35; flex: 0 0 auto; }
.gw-pip.on { background: var(--green-mid); opacity: 1; }
.gw-columns { display: flex; flex: 1 1 auto; min-height: 0; gap: 16px; }
.gw-board { flex: 1 1 52%; min-width: 0; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.gw-chat {
  flex: 1 1 48%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.gw-chat-messages {
  flex: 0 0 50%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.gw-chat-messages .msg {
  display: flex;
  flex-direction: column;
  max-width: min(68%, 100%);
  gap: 6px;
  margin: 0;
}
.gw-chat-messages .msg.them { align-self: flex-start; }
.gw-chat-messages .msg.you { align-self: flex-end; align-items: flex-end; }
.gw-chat-messages .msg .byline {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--green-dim);
  text-shadow: none;
}
.gw-chat-messages .msg .bubble {
  border: 1px solid var(--border);
  background: #0b100b;
  padding: 9px 12px 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--green-soft);
}
.gw-chat-messages .msg.you .bubble {
  background: rgba(51, 255, 51, 0.08);
  border-color: var(--green-mid);
  color: var(--green);
}
.gw-chat-messages .msg.them .bubble { border-color: var(--border); }
.gw-chat-actions {
  flex: 0 0 50%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}
.gw-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gw-card { border: 1px solid var(--border-dim); padding: 8px; background: var(--bg-raised); font-size: 11px; }
.gw-card h2 { font-size: 12px; margin-bottom: 4px; }
.gw-card.dim { opacity: 0.3; }
.gw-card.highlight { border-color: var(--green-bright); box-shadow: 0 0 8px var(--green-faint); }
.gw-struck { text-decoration: line-through; font-size: 10px; color: var(--green-dim); }
.gw-fact { margin-top: 6px; color: var(--green-soft); }
.gw-options { display: flex; flex-direction: column; gap: 8px; }
.gw-tag { display: inline-block; font-size: 10px; border: 1px solid var(--border); padding: 0 4px; margin-right: 6px; }
.gw-phrase-panel { border: 1px solid var(--border); padding: 12px; margin: 0; }
.gw-phrase { display: block; margin: 8px 0; word-break: break-word; }
.gw-loss-banner { color: var(--green-dim); margin: 8px 0; }
.gw-loss-fact { color: var(--green-soft); }
.gw-debug { font-size: 10px; max-height: 120px; overflow: auto; opacity: 0.8; }
.gw-error { color: #ff6666; }
.gw-inline-error { border: 1px solid #ff6666; color: #ffaaaa; padding: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gw-retry { font-size: 11px; padding: 4px 8px; }
.gw-card ul { margin: 0; padding-left: 0; list-style: none; }
.gw-card li { margin: 2px 0; }
.gw-topic { opacity: 0.85; }
.gw-val-sep { opacity: 0.55; margin: 0 4px; }
.gw-template-notice { font-size: 11px; color: var(--green-dim); margin: 0 0 8px; flex: 0 0 auto; }
.gw-boot-status {
  flex: 0 0 auto;
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  color: var(--green-dim);
}
.gw-pending-status { font-size: 12px; margin: 0; flex: 0 0 auto; }
.gw-intro-overlay { position: fixed; inset: 0; z-index: 100; }
.gw-intro-modal { width: min(92vw, 520px); position: relative; top: auto; left: auto; transform: none; margin: auto; }
.gw-intro-modal .modal-body { font-size: 13px; line-height: 1.45; display: flex; flex-direction: column; gap: 10px; }
.gw-intro-start { align-self: flex-start; margin-top: 8px; }
.gw-wake-hint { font-size: 11px; margin: 0; }
.gw-wake-sub { font-size: 11px; margin: 8px 0 0; max-width: 28rem; }
.gw-mobile-tabs { display: none; }
.gw-loading-dots {
  display: inline-block;
  min-width: 1.25em;
  text-align: left;
  font-family: inherit;
  letter-spacing: 0;
}
@media (max-width: 900px) {
  .gw-page.page {
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .gw-brand-desktop { display: none; }
  .gw-brand-mobile { display: block; }
  .gw-header {
    flex: 0 0 50px;
    min-height: 50px;
    max-height: 50px;
    padding: 0 4px;
    border-bottom: 1px solid rgba(51, 255, 51, 0.08);
  }
  .gw-header .gw-brand-title { max-width: none; }
  .gw-patience { flex: 0 0 auto; gap: 5px; }
  .gw-patience-label {
    font-size: 8px;
    letter-spacing: 0.05em;
  }
  .gw-pip { width: 10px; height: 10px; }
  .gw-boot-status { padding-top: 32px; }
  .gw-chat-messages .msg { max-width: min(92%, 100%); }
  .gw-mobile-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    margin-bottom: 8px;
  }
  .gw-tab {
    flex: 1;
    min-height: 44px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid var(--border-dim);
    background: var(--bg-raised);
    color: var(--green-dim);
  }
  .gw-tab.active {
    border-color: var(--green-mid);
    color: var(--green-soft);
  }
  .gw-columns { flex-direction: column; flex: 1; min-height: 0; }
  .gw-board.gw-panel-off,
  .gw-chat.gw-panel-off { display: none; }
  .gw-board.gw-panel-on,
  .gw-chat.gw-panel-on {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
  .gw-board.gw-panel-on { overflow: auto; }
  .gw-intro-modal { width: min(94vw, 520px); margin: max(12px, env(safe-area-inset-top)) auto max(12px, env(safe-area-inset-bottom)); }
  .gw-intro-modal .modal-body { padding: 14px 16px 18px; gap: 12px; }
  .gw-intro-overlay { padding: 8px; align-items: flex-start; overflow-y: auto; }
}
@media (min-width: 901px) {
  .gw-brand-mobile { display: none; }
  .gw-brand-desktop { display: block; }
  .gw-board.gw-panel-off,
  .gw-chat.gw-panel-off { display: flex; }
  .gw-board.gw-panel-off { flex-direction: column; }
}
@media (max-width: 500px) {
  .gw-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .gw-card { font-size: 10px; padding: 6px; }
  .gw-card h2 { font-size: 11px; }
}
@media (max-width: 380px) {
  .gw-patience-label {
    font-size: 7px;
    letter-spacing: 0.03em;
  }
  .gw-patience { gap: 4px; }
}
