/* The phone page (D-121, P13.1): the Netrunner look on a phone. The theme's own faces (copied next to
   this file at build time from @fontsource, OFL), its colors, chamfered panels, and a clock that stays
   pinned on top while a round is open. */
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 600;
  font-display: swap;
  src: url(chakra-petch-600.woff2) format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 700;
  font-display: swap;
  src: url(chakra-petch-700.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 500;
  font-display: swap;
  src: url(jetbrains-mono-500.woff2) format('woff2');
}
@font-face {
  font-family: 'Archivo Black';
  font-weight: 400;
  font-display: swap;
  src: url(archivo-black-400.woff2) format('woff2');
}

:root {
  --bg: #0e1117;
  --surface: #161a22;
  --raised: #1d222c;
  --line: #343b48;
  --text: #e9ecf2;
  --muted: #939cad;
  --accent: #ffd23f;
  --accent-2: #2ee6c8;
  --warn: #ff9f43;
  --alert: #ff4d63;
  --display: 'Chakra Petch', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --wordmark: 'Archivo Black', 'Chakra Petch', sans-serif;
  --cut: 14px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--display);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* The big screen's backdrop, quietly: a faint grid and a teal glow from below. */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 60% at 50% 115%, rgba(46, 230, 200, 0.16), transparent 70%),
    linear-gradient(rgba(233, 236, 242, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233, 236, 242, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  background-attachment: fixed;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100dvh;
  /* A title stamping in scales past the edge for a moment; clip it, so the page never pans sideways
     (clip, not hidden: the pinned clock still sticks). */
  overflow-x: clip;
  padding: max(16px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
}

[hidden] {
  display: none !important;
}

/* On a narrow phone the handle needs the room more than the 9XAI tag does. */
@media (max-width: 400px) {
  .brand i {
    display: none;
  }
}

/* The top bar: the wordmark, and whose phone this is. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.brand b {
  font-family: var(--wordmark);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.brand i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent-2);
}

.who {
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid rgba(255, 210, 63, 0.45);
  padding: 4px 8px;
}

.who:empty {
  display: none;
}

.label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* The clock, pinned to the top of the screen while a round is open. */
.clock {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -18px;
  padding: 10px 18px 12px;
  background: rgba(14, 17, 23, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.clock-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.level {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent-2);
  text-transform: uppercase;
}

.clock-main {
  justify-content: flex-start;
  gap: 12px;
  margin-top: 2px;
}

.timer {
  font-family: var(--display);
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.unit {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.bar {
  position: relative;
  height: 8px;
  margin-top: 10px;
  background: var(--line);
  overflow: hidden;
}

.bar i {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background: var(--accent);
  transition: transform 0.25s linear, background-color 0.3s;
}

/* The last 10 s warm up, the last 5 s turn red and beat once a second. */
.clock.warn .timer {
  color: var(--warn);
}
.clock.warn .bar i {
  background: var(--warn);
}
.clock.low .timer {
  color: var(--alert);
}
.clock.low .bar i {
  background: var(--alert);
}
.clock.beat .timer {
  animation: beat 0.45s ease-out;
}

@keyframes beat {
  from {
    transform: scale(1.18);
  }
  to {
    transform: scale(1);
  }
}

/* A message: one chamfered panel in the middle of the screen. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-block: auto;
  padding: 28px 22px 26px;
  background: var(--surface);
  border-left: 4px solid var(--accent-2);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}

.card.warn {
  border-left-color: var(--alert);
}

.card.good {
  border-left-color: var(--accent-2);
}

.card.gold {
  border-left-color: var(--accent);
}

.badge {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.badge:empty {
  display: none;
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.card.good .title {
  color: var(--accent-2);
}

.card.warn .title {
  color: var(--alert);
}

.card.gold .title {
  color: var(--accent);
}

.card.stamp .title {
  animation: stamp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes stamp {
  from {
    transform: scale(1.5) rotate(-3deg);
    opacity: 0.2;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* A round's score, or the game's total (P13.3). */
.score {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.pct {
  font-family: var(--display);
  font-weight: 700;
  font-size: 72px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.pts {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.total {
  margin: 4px 0 0;
  padding-top: 12px;
  width: 100%;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.total b {
  color: var(--text);
  font-weight: 500;
}

.line {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.35;
  color: var(--muted);
}

.line:empty {
  display: none;
}

/* After a round (P14.7): the real prompt, in gold like the big screen's, over this phone's guess. */
.recap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 4px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.recap dd {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  color: var(--text);
}

.recap dd:last-child {
  margin-bottom: 0;
}

.recap .prompt {
  color: var(--accent);
}

.recap .none {
  color: var(--muted);
}

/* The other side at the end: the AI in solo, the rival in a 1v1. */
.versus {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.versus b {
  color: var(--text);
  font-weight: 500;
}

/* Every round so far and the ones to come, one cell each. */
.rounds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 6px;
  width: 100%;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.rounds li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  background: var(--raised);
  border-bottom: 2px solid var(--line);
}

.rounds .r {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.rounds b {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.rounds i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

.rounds .good {
  border-bottom-color: var(--accent-2);
}

.rounds .good b {
  color: var(--accent-2);
}

.rounds .gold {
  border-bottom-color: var(--accent);
}

.rounds .gold b {
  color: var(--accent);
}

.rounds .warn {
  border-bottom-color: var(--alert);
}

.rounds .warn b {
  color: var(--alert);
}

.rounds .now {
  border-bottom-color: var(--text);
}

.rounds .later b {
  color: var(--line);
}

/* What's coming next. */
.next {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent-2);
}

/* Typing. */
.pic {
  margin: 0;
  aspect-ratio: 3 / 2;
  background: var(--surface);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}

.pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-top {
  display: flex;
  justify-content: space-between;
}

.count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.guess {
  width: 100%;
  /* 16px or more, so iOS doesn't zoom in on focus. */
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.3;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 14px 14px 12px;
  resize: none;
  outline: none;
  caret-color: var(--accent);
}

.guess:focus {
  border-color: var(--accent);
  background: var(--raised);
}

.guess::placeholder {
  color: #5d6576;
}

.send {
  appearance: none;
  border: 0;
  padding: 18px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.18em;
  color: var(--bg);
  background: var(--accent);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  transition: transform 0.08s;
}

.send:active {
  transform: scale(0.98);
}

.send:disabled {
  background: var(--line);
  color: var(--muted);
}

/* HINT, under SEND (P14.5): quieter than SEND, and it names the next hint and what it costs. */
.hint {
  appearance: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-family: var(--display);
  color: var(--text);
  background: rgba(22, 26, 34, 0.85);
  border: 1px solid var(--accent-2);
  border-radius: 0;
  text-align: left;
  transition: transform 0.08s;
}

.hint:active {
  transform: scale(0.98);
}

.hint-k {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent-2);
}

.hint-next {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-align: right;
}

.hint:disabled {
  border-color: var(--line);
  color: var(--muted);
}

.hint:disabled .hint-k {
  color: var(--muted);
}

/* The hints this phone took, above the field: each key word's role, then its shape or first
   letters, then the WORD BANK's chips. Clear of the pinned clock when it scrolls into view. */
.help {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  background: rgba(22, 26, 34, 0.92);
  border-left: 2px solid var(--accent-2);
  scroll-margin-top: 150px;
}

.help-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.help-cost {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--warn);
}

.help-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-rows:empty {
  display: none;
}

.help-rows li {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.help-rows .role {
  flex: 0 0 72px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent-2);
}

.help-rows .words {
  font-family: var(--mono);
  font-size: 19px;
  letter-spacing: 0.14em;
  line-height: 1.25;
  color: var(--text);
}

.bank-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  appearance: none;
  padding: 10px 14px 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 0;
  transition: transform 0.08s;
}

.chip:active {
  transform: scale(0.96);
}

.chip:disabled {
  color: var(--muted);
  background: transparent;
  text-decoration: line-through;
}

/* WHAT SCORES, under the button. */
.tips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.tips li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 10px 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text);
  background: rgba(22, 26, 34, 0.85);
  border-left: 2px solid var(--accent-2);
}

.tips b {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  color: var(--accent);
}

.net {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--alert);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .clock.beat .timer,
  .card.stamp .title {
    animation: none;
  }
}
