:root {
  --bg: #070b16;
  --text: #eaf0ff;
  --muted: #94a2c0;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --card: rgba(255, 255, 255, 0.045);
  --teal: #5eead4;
  --teal-dim: rgba(94, 234, 212, 0.16);
  --indigo: #9aa8ff;
  --indigo-dim: rgba(154, 168, 255, 0.16);
  --pink: #f472b6;
  --danger: #fb7185;
  --radius: 24px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 45% at 12% 0%, rgba(94, 234, 212, 0.16), transparent 62%),
    radial-gradient(55% 45% at 88% 4%, rgba(154, 168, 255, 0.2), transparent 64%),
    radial-gradient(70% 50% at 50% 110%, rgba(244, 114, 182, 0.12), transparent 62%),
    #070b16;
}

.app {
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app.playing {
  justify-content: flex-start;
  padding-top: calc(16px + env(safe-area-inset-top));
}

.hidden { display: none !important; }

/* ---------- home ---------- */

.brand {
  text-align: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 24px;
  font-size: 27px;
  font-weight: 600;
  color: var(--teal);
  background: linear-gradient(150deg, rgba(94, 234, 212, 0.22), rgba(154, 168, 255, 0.22));
  border: 1px solid var(--line-strong);
  box-shadow: 0 22px 60px -24px rgba(94, 234, 212, 0.65);
}

h1 {
  margin: 18px 0 8px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
}

.tagline {
  margin: 0 auto;
  max-width: 340px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
  text-wrap: balance;
}

#btn-resume {
  margin-top: 10px;
  border-color: rgba(94, 234, 212, 0.35);
  color: #b9f7ec;
}

.home-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.join-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

#join-code {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-weight: 600;
  padding-left: calc(16px + 0.4em);
}

#join-code::placeholder {
  font-weight: 400;
  letter-spacing: 0.1em;
  padding-left: 0;
}

.rules {
  margin: 22px auto 0;
  max-width: 420px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--muted);
}

.rules summary {
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.08em;
  list-style: none;
}

.rules summary::-webkit-details-marker { display: none; }

.rules summary::before { content: "＋ "; color: var(--teal); }

.rules[open] summary::before { content: "－ "; }

.rules ol {
  margin: 12px 0 0;
  padding-left: 20px;
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.btn:active { transform: scale(0.985); }

.btn-primary {
  color: #06121a;
  background: linear-gradient(135deg, #5eead4, #7dd3fc 46%, #9aa8ff);
  box-shadow: 0 16px 36px -16px rgba(94, 234, 212, 0.8);
}

.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.btn-lg { width: 100%; min-height: 54px; font-size: 16px; }

.btn-sm { min-height: 42px; padding: 9px 14px; font-size: 13px; border-radius: 12px; }

.btn[disabled] { opacity: 0.55; pointer-events: none; }

input {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder { color: rgba(148, 162, 192, 0.7); }

input:focus {
  border-color: rgba(94, 234, 212, 0.6);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.12);
}

/* ---------- room bar ---------- */

.room-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.room-chip {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
}

.room-chip-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

.room-chip-code {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.09); }
.icon-btn:active { transform: scale(0.94); }

.qr-box {
  width: fit-content;
  margin: 0 auto 16px;
  padding: 14px 14px 10px;
  border-radius: 18px;
  background: #fff;
  color: #0b1220;
  text-align: center;
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.85);
}

.qr-box p {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #4b5563;
}

#qrcode { display: grid; place-items: center; }
#qrcode img, #qrcode canvas { display: block; border-radius: 6px; }

.stage { flex: 1; }

/* ---------- panels ---------- */

.panel {
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.028));
  box-shadow: 0 26px 60px -34px rgba(0, 0, 0, 0.85);
  animation: rise 0.34s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.lead {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.tiny {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--muted);
}

.tiny b { color: var(--teal); font-weight: 600; }

.mono { letter-spacing: 0.2em; }

.notice {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(251, 113, 133, 0.32);
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- waiting ---------- */

.waiting { text-align: center; }

.pulse { display: inline-flex; gap: 6px; margin-bottom: 14px; }

.pulse i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  animation: bounce 1.2s infinite ease-in-out;
}

.pulse i:nth-child(2) { animation-delay: 0.15s; background: #7dd3fc; }
.pulse i:nth-child(3) { animation-delay: 0.3s; background: var(--indigo); }
.pulse.small { margin: 8px 0 0; }
.pulse.small i { width: 6px; height: 6px; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 10px;
  text-align: left;
}

.link-row input {
  flex: 1 1 140px;
  min-width: 0;
  min-height: 46px;
  padding: 11px 14px;
  font-size: 11.5px;
  letter-spacing: 0;
  color: var(--muted);
}

.link-row .btn { flex: 0 0 auto; }

/* ---------- round ---------- */

.round-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.round-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: var(--teal-dim);
  color: var(--teal);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.round-badge.success {
  background: rgba(94, 234, 212, 0.22);
  color: #adf7e9;
}

.round-sub { font-size: 12px; color: var(--muted); }

.hints {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(154, 168, 255, 0.1), rgba(94, 234, 212, 0.05));
}

.hint-head {
  margin-bottom: 10px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.hint-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  word-break: break-all;
}

.chip.mine {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.1);
  color: #b9f7ec;
}

.chip.theirs {
  border-color: rgba(154, 168, 255, 0.4);
  background: rgba(154, 168, 255, 0.1);
  color: #cbd2ff;
}

.hint-arrow { font-size: 13px; color: var(--muted); }

.hint-tip { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }

.word-form {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}

.word-form input {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.word-form .btn { flex: 0 0 auto; padding-left: 22px; padding-right: 22px; }

.submitted {
  margin-bottom: 6px;
  padding: 18px 12px;
  border-radius: 18px;
  border: 1px dashed rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.07);
  text-align: center;
}

.submitted-word {
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #b9f7ec;
  word-break: break-all;
}

.submitted .lead { margin-bottom: 8px; font-size: 12.5px; }

.status-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

.status { display: inline-flex; align-items: center; gap: 7px; }

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.status.on i {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.16);
}

/* ---------- reveal ---------- */

.reveal { text-align: center; }

.pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
}

.word-card {
  min-width: 118px;
  max-width: 100%;
  padding: 15px 18px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.word-card small {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.word-card b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  word-break: break-all;
}

.word-card.mine {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.08);
  color: #c9fbf0;
}

.word-card.theirs {
  border-color: rgba(154, 168, 255, 0.4);
  background: rgba(154, 168, 255, 0.08);
  color: #d6dbff;
}

.neq { font-size: 20px; color: var(--muted); }

.reveal .lead { margin-top: 10px; }

.reveal .btn { margin-top: 4px; }

/* ---------- match ---------- */

.match {
  position: relative;
  overflow: hidden;
  text-align: center;
}

.match .glow {
  position: absolute;
  inset: -45% -20% auto;
  height: 280px;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(94, 234, 212, 0.35), rgba(154, 168, 255, 0.18), transparent);
  animation: glowPulse 3.4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.match-word {
  position: relative;
  margin: 16px 0 6px;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #d8fff7;
  text-shadow: 0 0 40px rgba(94, 234, 212, 0.45);
  word-break: break-all;
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}

.match h2 {
  position: relative;
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: #eafffb;
}

.match .btn { position: relative; margin-top: 18px; }

/* ---------- trail ---------- */

.trail {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.trail summary {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.trail summary::-webkit-details-marker { display: none; }

.trail summary::before { content: "▸ "; color: var(--teal); }

.trail[open] summary::before { content: "▾ "; }

.trail ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.trail li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.trail li.hit {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.1);
}

.tr-round {
  flex: 0 0 26px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
  color: var(--muted);
}

.tr-mine { color: #b9f7ec; word-break: break-all; }
.tr-theirs { color: #cbd2ff; word-break: break-all; }
.tr-sep { color: var(--muted); }

/* ---------- error / loading ---------- */

.error { text-align: center; }

.error-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
  font-size: 24px;
  font-weight: 700;
}

.btn-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.loading {
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--teal);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: 88vw;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(12, 18, 32, 0.92);
  color: var(--text);
  font-size: 12.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.24s ease, transform 0.24s ease;
  backdrop-filter: blur(10px);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .link-row input { flex-basis: 100%; }
}

@media (max-width: 420px) {
  h1 { font-size: 26px; }
  .brand-mark { width: 58px; height: 58px; font-size: 23px; border-radius: 20px; }
  .match-word { font-size: 34px; }
  .panel { padding: 18px 16px; }
  .word-form .btn { padding-left: 16px; padding-right: 16px; }
  .status-row { gap: 14px; }
}

/* ---------- lobby / hub ---------- */

.lobby h2 { text-align: center; }

.lobby > .lead { text-align: center; }

.lobby-status {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 14px 14px 13px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.08);
}

.game-card:active { transform: scale(0.98); }

.game-card:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.gc-icon { font-size: 22px; line-height: 1.2; }

.gc-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.gc-blurb {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- game shell ---------- */

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.game-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
}

.gt-icon { font-size: 17px; }

.game-body { display: block; }

.game-body.blocked {
  pointer-events: none;
  opacity: 0.55;
  filter: saturate(0.7);
}

.away-banner {
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ---------- shared game bits ---------- */

.num-secret {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.25);
  background: rgba(94, 234, 212, 0.07);
  font-size: 12.5px;
  color: var(--muted);
}

.num-secret b {
  color: var(--teal);
  font-size: 17px;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
}

.turn-banner {
  margin: 4px 0 14px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.turn-banner.mine {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.1);
  color: #b9f7ec;
}

.win-badge {
  display: block;
  width: fit-content;
  margin: 0 auto 10px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.14);
  color: #b9f7ec;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.num-col h3 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.num-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.num-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.num-index {
  flex: 0 0 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 10.5px;
  color: var(--muted);
}

.num-digits {
  flex: 1;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}

.num-fb {
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.btn-block { width: 100%; margin-top: 8px; }

.quiz-q {
  margin: 14px 0 14px;
  font-size: 21px;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

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

.opt-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.opt-btn:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.07);
}

.opt-btn:active:not(:disabled) { transform: scale(0.99); }

.opt-btn:disabled { cursor: default; }

.opt-key {
  flex: 0 0 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.opt-text { flex: 1; }

.opt-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.18);
  color: #b9f7ec;
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.opt-tag.other {
  background: rgba(154, 168, 255, 0.18);
  color: #cbd2ff;
}

.opt-btn.picked {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.09);
}

.opt-btn.theirs { border-color: rgba(154, 168, 255, 0.5); }

.opt-btn.same {
  border-color: rgba(94, 234, 212, 0.7);
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.16), rgba(154, 168, 255, 0.12));
}

.quiz-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.tag-ok,
.tag-no {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

.tag-ok {
  background: rgba(94, 234, 212, 0.16);
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: #b9f7ec;
}

.tag-no {
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #fecdd3;
}

.quiz-score {
  font-size: 12px;
  color: var(--muted);
}

.quiz-opts + .quiz-reveal + .btn,
.quiz-reveal + .btn { margin-top: 14px; width: 100%; }

.quiz-results {
  margin: 16px 0 18px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  text-align: left;
}

.quiz-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.quiz-result-row.hit {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.07);
}

.qr-index {
  flex: 0 0 18px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.qr-q {
  flex: 1;
  color: var(--text);
  line-height: 1.4;
}

.qr-answers {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.qr-mine,
.qr-theirs {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 10.5px;
  background: rgba(94, 234, 212, 0.14);
  color: #b9f7ec;
}

.qr-theirs {
  background: rgba(154, 168, 255, 0.14);
  color: #cbd2ff;
}

.qr-mark { flex: 0 0 18px; text-align: center; color: var(--muted); }

.quiz-result-row.hit .qr-mark { color: var(--teal); }

.qa-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.qa-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
}

.qa-item.hit {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.08);
}

.qa-index { flex: 0 0 18px; color: var(--muted); font-size: 10.5px; text-align: center; }
.qa-text { flex: 1; line-height: 1.45; word-break: break-word; }

.qa-tag {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.qa-tag.yes { background: rgba(94, 234, 212, 0.16); color: #b9f7ec; }
.qa-tag.no { background: rgba(251, 113, 133, 0.12); color: #fecdd3; }
.qa-tag.unknown { background: rgba(154, 168, 255, 0.14); color: #cbd2ff; }
.qa-tag.ok { background: rgba(94, 234, 212, 0.2); color: #b9f7ec; }

.qa-pending {
  margin: 14px 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(154, 168, 255, 0.35);
  background: rgba(154, 168, 255, 0.08);
}

.qa-pending.wait {
  border-color: rgba(94, 234, 212, 0.3);
  background: rgba(94, 234, 212, 0.06);
}

.qa-pending-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.qa-pending-text {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 12px;
  word-break: break-word;
}

.qa-answer-row { display: flex; gap: 8px; flex-wrap: wrap; }

.qa-answer-row .btn { flex: 1; min-height: 42px; }

.gomoku-board {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 1px;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 14px 0 18px;
  padding: 2px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.cell {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: #e9dfc8;
  cursor: pointer;
}

.cell:hover { background: #f3ead6; }

.cell::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.cell.black::after,
.cell.white::after { opacity: 1; }

.cell.black::after {
  background: radial-gradient(circle at 34% 30%, #4b5563, #0b1220 72%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cell.white::after {
  background: radial-gradient(circle at 34% 30%, #ffffff, #cbd5e1 72%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.cell.last::before {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  border: 1px solid rgba(239, 68, 68, 0.85);
  z-index: 1;
}

.cell.win { background: #f9e7a8; }

.cell.win::after { box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.75); }

.rps-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 4px;
}

.rps-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.rps-btn:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.08);
  transform: translateY(-2px);
}

.rps-btn:disabled { cursor: default; opacity: 0.5; }

.rps-btn.picked {
  border-color: rgba(94, 234, 212, 0.7);
  background: rgba(94, 234, 212, 0.12);
  opacity: 1;
}

.rps-emoji { font-size: 30px; line-height: 1.1; }

.rps-hands {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px 0 10px;
}

.rps-hand {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.07);
  text-align: center;
}

.rps-hand.theirs {
  border-color: rgba(154, 168, 255, 0.35);
  background: rgba(154, 168, 255, 0.07);
}

.rps-hand small { display: block; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.rps-hand span { display: block; font-size: 34px; line-height: 1.35; }
.rps-hand b { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.rps-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 10px 0 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.rps-score b { color: var(--text); font-size: 17px; font-variant-numeric: tabular-nums; }

.rps-target { font-size: 10.5px; letter-spacing: 0.08em; }

.canvas-box {
  margin: 12px 0;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: #fff;
  overflow: hidden;
}

.draw-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.drawer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.pen-bar { display: flex; align-items: center; gap: 8px; margin-right: auto; }

.pen-dot {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: var(--dot);
  cursor: pointer;
}

.pen-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.3);
}

.draw-log { margin-top: 16px; }

.draw-guesses {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
}

.draw-guesses li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
}

.draw-guesses li.hit {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.08);
}

.dg-who {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 10.5px;
  color: var(--muted);
}

.dg-text { flex: 1; word-break: break-word; }
.dg-mark { color: var(--teal); }

.round-end {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.round-end .lead { margin-bottom: 12px; }

.draw .rps-score { margin-top: 4px; }

@media (max-width: 420px) {
  .game-grid { gap: 8px; }
  .game-card { padding: 12px; border-radius: 16px; }
  .gc-blurb { font-size: 10.5px; }
  .quiz-q { font-size: 18.5px; }
  .two-col { grid-template-columns: 1fr; }
  .rps-emoji { font-size: 26px; }
  .rps-hand { min-width: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
