:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --line-strong: #d4d4d4;
  --panel: #ffffff;
  --soft: #f7f7f7;
  --good: #14804a;
  --warn: #c81e1e;
  --pencil: #111111;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-feature-settings: "ss01" on, "cv11" on;
}

body {
  min-height: 100svh;
}

h1,
.word,
.timer {
  font-weight: 600;
  letter-spacing: -0.035em;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0.72rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
}

button.secondary {
  background: #fff;
  color: var(--ink);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

a {
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.6rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand.compact {
  align-items: flex-start;
}

.orb {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 30% 28%, #fff 0 12%, transparent 18%),
    conic-gradient(from 210deg, #6ee7f5, #8b5cf6, #f472b6, #f59e0b, #6ee7f5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.nav-label,
.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.chip {
  margin: 0;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  background: #fff;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3.25rem 1.5rem 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 2.5rem 3rem;
  align-items: start;
  margin-bottom: 3rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  line-height: 1.05;
  grid-column: 1;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 34rem;
  grid-column: 2;
  padding-top: 0.35rem;
}

.hero-actions {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.hero .error {
  grid-column: 1 / -1;
}

.host-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
}

.host-grid::before,
.host-grid::after,
.panel::before,
.panel::after {
  content: "+";
  position: absolute;
  color: #c8c8c8;
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}

.host-grid::before {
  top: -6px;
  left: -4px;
}

.host-grid::after {
  top: -6px;
  right: -4px;
}

.panel {
  background: var(--panel);
  padding: 1.6rem 1.5rem 1.7rem;
  position: relative;
  min-height: 22rem;
}

.panel:first-child {
  border-right: 1px solid var(--line);
}

.panel::before {
  bottom: -6px;
  left: -4px;
}

.panel:last-child::after {
  bottom: -6px;
  right: -4px;
}

.link-row {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.link-row input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 0.75rem 0.9rem;
  color: var(--ink);
  border-radius: 999px;
}

.link-row input:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 1.1rem;
}

.qr-wrap[hidden] {
  display: none;
}

.qr-wrap canvas {
  border: 1px solid var(--line);
  background: #fff;
  width: 180px;
  height: 180px;
  border-radius: 1.4rem;
}

.meta {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 0.75rem;
}

.meta strong {
  color: var(--ink);
  font-weight: 600;
}

.timer {
  font-size: 3.1rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 0.55rem 0 0;
}

.timer.low {
  color: var(--warn);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.1rem;
  max-height: 28rem;
  overflow: auto;
}

.bubble {
  max-width: 94%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 1.15rem;
}

.bubble.you {
  align-self: flex-end;
  background: var(--soft);
}

.bubble.system {
  align-self: stretch;
  background: var(--soft);
  color: var(--muted);
}

.bubble .who {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.bubble .text {
  white-space: pre-wrap;
}

.badge {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge.miss,
.pill.miss {
  color: var(--warn);
}

.badge.hit,
.pill.hit,
.status-ok {
  color: var(--good);
}

.pill.miss {
  border-color: #f0c4c4;
}

.draw-body {
  background: var(--soft);
}

.draw-frame {
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.draw-top,
.draw-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.draw-bottom {
  border-bottom: 0;
  border-top: 1px solid var(--line);
}

.word {
  font-size: 1.55rem;
  margin: 0.1rem 0 0;
}

.canvas-wrap {
  position: relative;
  background: #fff;
}

#board {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.guess-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.pill {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  padding: 1.5rem;
}

.overlay.show {
  display: grid;
}

.note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.error {
  color: var(--warn);
  min-height: 1.2em;
}

@media (max-width: 720px) {
  .hero,
  .host-grid {
    grid-template-columns: 1fr;
  }

  .hero h1,
  .lede,
  .hero-actions,
  .hero .error {
    grid-column: 1;
  }

  .panel:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .shell {
    padding-top: 2rem;
  }

  .word {
    font-size: 1.25rem;
  }

  .timer {
    font-size: 2.2rem;
  }

  .topbar {
    padding-inline: 1rem;
  }
}
