:root {
  color-scheme: dark;
  --bg: #101314;
  --panel: #171c1f;
  --panel-strong: #20282c;
  --text: #f4f0e8;
  --muted: #a8b0ad;
  --line: #334047;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --hot: #f97316;
  --good: #86efac;
  --bad: #fb7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(45, 212, 191, 0.18), transparent 26rem),
    linear-gradient(135deg, #101314 0%, #191615 48%, #0d1517 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(920px, calc(100% - 2rem));
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem 0;
  align-items: stretch;
}

.game-board {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(23, 28, 31, 0.88);
  box-shadow: var(--shadow);
}

.game-board {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  min-height: calc(100vh - 2rem);
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 8px;
}

.top-actions {
  min-width: 0;
}

.topbar,
.stats-strip,
.prompt-meta,
.top-actions,
.brand-lockup,
.brand-mark {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 1rem;
}

.stat-label,
.prompt-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h2,
p {
  margin: 0;
}

h2 {
  font-size: 0.95rem;
  letter-spacing: 0;
}

.top-actions {
  justify-content: flex-end;
  gap: 0.75rem;
}

.help-button {
  min-height: 2.4rem;
  padding: 0 0.8rem;
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 850;
}

.help-button:hover,
.help-button:focus {
  color: #051312;
  background: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.brand-lockup {
  gap: 0.55rem;
  flex: 0 0 auto;
}

.brand-mark {
  justify-content: center;
  position: relative;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 8px;
  color: var(--text);
  background: #0f1416;
  border: 1px solid rgba(45, 212, 191, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 26px rgba(45, 212, 191, 0.16);
  font-weight: 950;
}

.brand-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 6px;
  color: #051312;
  background: var(--accent);
}

.brand-question {
  font-size: 1.18rem;
  line-height: 1;
}

.brand-cursor {
  width: 0.22rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--hot);
}

.brand-name {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stats-strip > div {
  min-width: 0;
  padding: 0.9rem;
  border-radius: 8px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.stats-strip strong {
  display: block;
  margin-top: 0.25rem;
  font-size: clamp(1.25rem, 4vw, 2rem);
}

.style-select {
  width: 100%;
  min-height: 2.5rem;
  margin-top: 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 0.65rem;
  color: var(--text);
  background: #0f1416;
  font-weight: 850;
  outline: none;
}

.style-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.13);
}

.prompt-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 18rem;
  padding: clamp(1rem, 4vw, 2rem);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.13), rgba(249, 115, 22, 0.08)),
    #111719;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.game-board.is-complete .prompt-panel {
  flex: 0 1 auto;
  min-height: 11rem;
  justify-content: flex-start;
}

.game-board.is-complete .prompt-text {
  max-width: 28ch;
  font-size: clamp(1.55rem, 4vw, 3rem);
  line-height: 1.12;
}

.game-board.is-complete .cursor-row {
  display: none;
}

.prompt-meta {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.prompt-text {
  width: 100%;
  max-width: 20ch;
  font-size: clamp(1.85rem, 5vw, 4.4rem);
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.prompt-word {
  position: relative;
  display: inline-block;
  border-radius: 6px;
  padding: 0 0.08em;
}

.prompt-word.correct {
  color: var(--good);
  background: rgba(134, 239, 172, 0.13);
}

.prompt-word.wrong {
  color: var(--bad);
  background: rgba(251, 113, 133, 0.13);
}

.prompt-word.has-tooltip {
  cursor: help;
}

.prompt-word.just-guessed {
  animation: word-reveal 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.prompt-word.just-guessed.correct {
  animation:
    word-reveal 420ms cubic-bezier(0.16, 1, 0.3, 1),
    correct-glow 620ms ease-out;
}

.prompt-word.just-guessed.wrong {
  animation: word-reveal-wrong 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

.guess-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  z-index: 5;
  display: grid;
  gap: 0.45rem;
  width: min(17rem, 78vw);
  padding: 0.6rem;
  border-radius: 8px;
  color: var(--text);
  background: #0f1416;
  border: 1px solid rgba(45, 212, 191, 0.45);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(0.25rem);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.chosen-line,
.probability-title {
  display: block;
}

.chosen-line {
  color: var(--muted);
}

.chosen-word {
  display: inline-block;
  margin-left: 0.2rem;
  padding: 0.08rem 0.28rem;
  border-radius: 5px;
  color: #0f1416;
  background: var(--bad);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  font-weight: 900;
}

.prompt-word.correct .chosen-word {
  background: var(--good);
}

.probability-title {
  color: var(--text);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.probability-list {
  display: grid;
  gap: 0.2rem;
}

.probability-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.probability-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--probability, 0%);
  min-width: 0.18rem;
  border-radius: inherit;
  background: rgba(168, 176, 173, 0.16);
  z-index: 0;
}

.probability-row.is-answer {
  color: var(--good);
  background: rgba(134, 239, 172, 0.06);
}

.probability-row.is-answer .probability-bar {
  background: rgba(134, 239, 172, 0.28);
}

.probability-row.is-picked:not(.is-answer) {
  color: var(--bad);
  background: rgba(251, 113, 133, 0.06);
}

.probability-row.is-picked:not(.is-answer) .probability-bar {
  background: rgba(251, 113, 133, 0.3);
}

.probability-word {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.probability-value {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.prompt-word.has-tooltip:hover .guess-tooltip,
.prompt-word.has-tooltip:focus .guess-tooltip,
.prompt-word.has-tooltip.is-tooltip-open .guess-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cursor-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  margin-top: 1.5rem;
}

.blank-token {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  max-width: 100%;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  color: #071313;
  background: var(--accent);
  font-weight: 800;
}

.typing-dot {
  width: 0.6rem;
  height: 1.8rem;
  background: var(--hot);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
}

.choice-grid button {
  min-width: 0;
  min-height: 3.15rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: var(--text);
  background: #0f1416;
  border: 1px solid var(--line);
  font-weight: 850;
  overflow-wrap: anywhere;
  transform-origin: center;
}

.choice-grid button:hover,
.choice-grid button:focus {
  border-color: var(--accent);
  color: #051312;
  background: var(--accent);
  outline: none;
}

.choice-grid button.correct {
  color: #052012;
  background: var(--good);
  border-color: var(--good);
}

.choice-grid button.wrong {
  color: #2d0610;
  background: var(--bad);
  border-color: var(--bad);
}

.choice-grid button.just-picked.correct {
  animation: button-pop 430ms cubic-bezier(0.16, 1, 0.3, 1);
}

.choice-grid button.just-picked.wrong {
  animation: button-shake 380ms ease-out;
}

@keyframes word-reveal {
  0% {
    opacity: 0;
    transform: translateY(0.32em) scale(0.92);
    filter: blur(0.08em);
  }
  70% {
    opacity: 1;
    transform: translateY(-0.04em) scale(1.04);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes correct-glow {
  0% {
    box-shadow: 0 0 0 rgba(134, 239, 172, 0);
  }
  35% {
    box-shadow: 0 0 0 0.18em rgba(134, 239, 172, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(134, 239, 172, 0);
  }
}

@keyframes word-reveal-wrong {
  0% {
    opacity: 0;
    transform: translateY(0.32em) scale(0.92);
    filter: blur(0.08em);
  }
  24% {
    opacity: 1;
    transform: translateY(-0.02em) translateX(-0.08em) scale(1.03) rotate(-1.5deg);
    filter: blur(0);
  }
  48% {
    transform: translateY(0) translateX(0.08em) scale(1.02) rotate(1.5deg);
  }
  72% {
    transform: translateY(0) translateX(-0.04em) scale(1) rotate(-0.8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1) rotate(0deg);
    filter: blur(0);
  }
}

@keyframes button-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.07);
    box-shadow: 0 0 0 0.22rem rgba(134, 239, 172, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

@keyframes button-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-0.22rem);
  }
  40% {
    transform: translateX(0.2rem);
  }
  60% {
    transform: translateX(-0.12rem);
  }
  80% {
    transform: translateX(0.08rem);
  }
}

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

.end-screen {
  position: relative;
  display: block;
  align-self: start;
  width: min(100%, 28rem);
  margin-left: auto;
  padding: 0;
  border-radius: 8px;
  outline: none;
}

.end-trigger,
.end-dashboard {
  background:
    linear-gradient(135deg, rgba(134, 239, 172, 0.1), rgba(45, 212, 191, 0.08)),
    #0f1416;
  border: 1px solid rgba(45, 212, 191, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.end-screen[hidden] {
  display: none;
}

.end-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(5, 8, 9, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.end-screen.is-open::before {
  opacity: 1;
  pointer-events: auto;
}

.end-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.75rem;
  align-items: center;
  min-height: 4.2rem;
  padding: 0.8rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}

.end-trigger strong {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--accent);
  font-size: 1.55rem;
  line-height: 1;
}

.end-trigger-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.end-dashboard {
  position: fixed;
  left: 50%;
  top: max(1rem, env(safe-area-inset-top));
  z-index: 6;
  display: grid;
  gap: 1rem;
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100vh - 2rem));
  max-height: min(42rem, calc(100dvh - max(1rem, env(safe-area-inset-top)) - max(1rem, env(safe-area-inset-bottom))));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1rem, 3vw, 1.35rem);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.35rem);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.end-screen.is-open .end-dashboard {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.end-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 1rem;
}

.end-kicker {
  color: var(--good);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.end-header h2 {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.end-close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.25rem;
  line-height: 1;
}

.end-close:hover,
.end-close:focus {
  color: #2d0610;
  background: var(--bad);
  border-color: var(--bad);
  outline: none;
}

.end-stats {
  display: grid;
  grid-template-columns: 1.25fr repeat(2, 1fr);
  gap: 0.65rem;
}

.end-stat,
.end-source,
.share-card {
  min-width: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.end-stat {
  padding: 0.85rem;
}

.end-stat strong {
  display: block;
  margin-top: 0.3rem;
  font-size: clamp(1.45rem, 4vw, 2.35rem);
  line-height: 1;
}

.end-stat.primary {
  border-color: rgba(45, 212, 191, 0.38);
  background: rgba(45, 212, 191, 0.08);
}

.end-stat.primary strong {
  color: var(--accent);
}

.score-stats {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 0.65rem;
  align-items: stretch;
  min-width: 0;
  padding: 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.score-stats strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--accent);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1;
}

.score-stats > div > span:last-child {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.score-histogram {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.55rem;
  min-width: 0;
  min-height: 7.25rem;
  padding: 0.65rem;
  border-radius: 8px;
  background: rgba(15, 20, 22, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.histogram-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.histogram-heading strong {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  white-space: nowrap;
}

.histogram-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0.45rem, 1fr);
  align-items: end;
  gap: 0.16rem;
  min-width: 0;
  min-height: 5rem;
  padding-top: 1.15rem;
  border-bottom: 1px solid rgba(168, 176, 173, 0.16);
}

.histogram-column {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  justify-content: center;
  min-width: 0;
  height: 100%;
  color: var(--muted);
}

.histogram-bar {
  display: block;
  width: 100%;
  height: var(--bar-height, 3%);
  min-height: 0.18rem;
  border-radius: 5px 5px 2px 2px;
  background: rgba(168, 176, 173, 0.28);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.histogram-column.has-count .histogram-bar {
  background: rgba(168, 176, 173, 0.46);
}

.histogram-column.is-empty .histogram-bar {
  min-height: 0;
  opacity: 0;
}

.histogram-column.is-empty {
  pointer-events: none;
}

.histogram-column.is-player .histogram-bar {
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.35);
}

.histogram-column:hover .histogram-bar,
.histogram-column:focus-within .histogram-bar {
  transform: translateY(-0.08rem);
  background: var(--hot);
}

.histogram-column.is-empty:hover .histogram-bar,
.histogram-column.is-empty:focus-within .histogram-bar {
  transform: none;
}

.histogram-column.is-player:hover .histogram-bar,
.histogram-column.is-player:focus-within .histogram-bar {
  background: var(--accent);
}

.histogram-count {
  position: absolute;
  left: 50%;
  top: -1.05rem;
  transform: translateX(-50%);
  color: transparent;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
}

.histogram-column.has-count:hover .histogram-count,
.histogram-column.is-player .histogram-count {
  color: var(--text);
}

.histogram-score {
  min-height: 0.9rem;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 850;
  line-height: 1;
}

.histogram-you {
  position: absolute;
  left: 50%;
  bottom: -1.05rem;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.histogram-empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.end-source {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  color: inherit;
  text-decoration: none;
}

.end-source-name {
  color: var(--accent);
  font-weight: 850;
  text-decoration: underline;
  text-decoration-color: rgba(45, 212, 191, 0.45);
  text-underline-offset: 0.18rem;
}

.end-source:hover,
.end-source:focus {
  border-color: rgba(45, 212, 191, 0.55);
  background: rgba(45, 212, 191, 0.07);
  outline: none;
}

.end-source:hover .end-source-name,
.end-source:focus .end-source-name {
  color: var(--text);
  text-decoration-color: var(--accent);
}

.end-source blockquote {
  margin: 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--hot);
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 750;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.share-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
}

.share-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.share-card-header > span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.share-card pre {
  margin: 0;
  max-height: 7.2rem;
  overflow: auto;
  padding: 0.65rem;
  border-radius: 8px;
  color: var(--text);
  background: rgba(15, 20, 22, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.end-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.end-action {
  justify-self: end;
  min-height: 2.8rem;
  padding: 0 1rem;
  border-radius: 8px;
  color: #051312;
  background: var(--accent);
  font-weight: 900;
}

.end-action.secondary {
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.end-action:hover,
.end-action:focus {
  background: var(--accent-strong);
  outline: none;
}

.end-action:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: #14191b;
  border: 1px solid var(--line);
  opacity: 0.62;
}

.end-action:disabled:hover,
.end-action:disabled:focus {
  color: var(--muted);
  background: #14191b;
}

.end-action.secondary:hover,
.end-action.secondary:focus {
  color: #051312;
  background: var(--accent);
  border-color: var(--accent);
}

.feedback {
  position: fixed;
  left: 50%;
  bottom: 4.5rem;
  z-index: 30;
  max-width: min(34rem, calc(100vw - 2rem));
  min-height: 0;
  padding: 0.75rem 0.95rem;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(15, 20, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(0.5rem);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.feedback:not(:empty) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feedback.good {
  color: var(--good);
}

.feedback.bad {
  color: var(--bad);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(1rem);
  max-width: calc(100% - 2rem);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  color: #071313;
  background: var(--text);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

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

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(5, 8, 9, 0.54);
}

.help-modal[hidden] {
  display: none;
}

.help-panel {
  display: grid;
  gap: 1rem;
  width: min(32rem, 100%);
  max-height: min(34rem, calc(100dvh - 2rem));
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 1.35rem);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.1), rgba(249, 115, 22, 0.06)),
    #0f1416;
  border: 1px solid rgba(45, 212, 191, 0.32);
  box-shadow: var(--shadow);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.help-header h2 {
  font-size: 1rem;
  font-weight: 900;
}

.help-close {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 1.25rem;
  line-height: 1;
}

.help-close:hover,
.help-close:focus {
  color: #051312;
  background: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.help-copy {
  display: grid;
  gap: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 840px) {
  .shell {
    width: min(100% - 1rem, 920px);
    min-height: auto;
  }

  .game-board {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 1rem, 1120px);
    padding: 0.5rem 0;
  }

  .game-board {
    padding: 0.8rem;
  }

  .stats-strip {
    grid-template-columns: 1fr 1fr;
  }

  .stats-strip > div:last-child {
    grid-column: 1 / -1;
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prompt-word.has-tooltip {
    position: static;
  }

  .guess-tooltip {
    position: fixed;
    left: max(0.75rem, env(safe-area-inset-left));
    right: max(0.75rem, env(safe-area-inset-right));
    top: max(0.75rem, env(safe-area-inset-top));
    bottom: auto;
    z-index: 20;
    width: auto;
    max-height: min(70vh, 28rem);
    max-height: min(44dvh, 22rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.75rem;
    font-size: 0.82rem;
    transform: translateY(-0.75rem);
  }

  .prompt-word.has-tooltip:hover .guess-tooltip,
  .prompt-word.has-tooltip:focus .guess-tooltip,
  .prompt-word.has-tooltip.is-tooltip-open .guess-tooltip {
    transform: translateY(0);
  }

  .probability-list {
    gap: 0.28rem;
  }

  .probability-row {
    min-height: 1.9rem;
    grid-template-columns: minmax(0, 1fr) minmax(2.7rem, auto);
  }

  .end-screen {
    width: 100%;
  }

  .end-dashboard {
    width: calc(100vw - max(1rem, env(safe-area-inset-left) + env(safe-area-inset-right) + 1rem));
    max-height: calc(100vh - max(1rem, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 1rem));
    max-height: calc(100dvh - max(1rem, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 1rem));
    top: max(0.5rem, env(safe-area-inset-top));
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    transform: translate(-50%, 0.35rem);
    align-content: start;
    gap: 0.7rem;
    padding: 0.85rem;
  }

  .end-screen.is-open .end-dashboard {
    transform: translate(-50%, 0);
  }

  .end-header,
  .end-stats,
  .score-stats {
    grid-template-columns: 1fr;
  }

  .end-header {
    display: grid;
    align-items: start;
  }

  .end-header h2,
  .end-action {
    justify-self: start;
    margin-left: 0;
  }

  .end-stat,
  .score-stats,
  .end-source,
  .share-card {
    padding: 0.7rem;
  }

  .score-histogram {
    min-height: 6rem;
  }

  .histogram-bars {
    min-height: 4rem;
  }
}
