:root {
  --bg: var(--t-bg);
  --panel: var(--t-panel);
  --panel-deep: var(--t-panel-deep);
  --ink: var(--t-ink);
  --muted: var(--t-muted);
  --dim: var(--t-muted);
  --line: var(--t-line);
  --line-soft: var(--t-line);
  --accent: var(--t-accent);
  --kicker: #0c6b4f;
  --band-cold: #8a4741;
  --band-warm: #6e581d;
  --band-hot: #0c6b4f;
  --scrim: rgba(24, 24, 22, .55);
  --muted-deep: #5c5d59;
  --danger: var(--t-danger);
}

html[data-theme="dark"] {
  --muted-deep: var(--t-muted);
  --kicker: var(--t-accent);
  --band-cold: #e28b83;
  --band-warm: #d9b46a;
  --band-hot: var(--t-accent);
  --scrim: rgba(0, 0, 0, .72);
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  width: min(960px, calc(100% - 48px));
  min-width: 320px;
  min-height: 100vh;
  margin: 0 auto;
  color: var(--ink);
  background: var(--bg);
  font-family: Manrope, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.site-header {
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}

.wordmark-mark { display: block; flex: 0 0 auto; }
.wordmark b { align-self: flex-end; }

.wordmark span {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.045em;
}

.wordmark b,
.label,
.game-stats dt,
.target-figure figcaption,
.list-head,
.latest-distance small {
  font-family: "DM Mono", monospace;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.wordmark b { color: var(--muted); font-size: .75rem; }

.new-game,
.quiet-action,
.submit {
  border: 0;
  cursor: pointer;
}

.new-game {
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.new-game:hover:not(:disabled),
.new-game:focus-visible:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}

.new-game:disabled { opacity: .5; cursor: default; }

.game { width: min(720px, 100%); margin: 0 auto; padding: 52px 0 64px; }

.game-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  align-items: center;
  gap: 48px;
  padding-bottom: 32px;
}

.label {
  margin: 0 0 11px;
  color: var(--kicker);
  font-size: .63rem;
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.35rem);
  line-height: .98;
  letter-spacing: -.06em;
}

.overview-copy > p:not(.label) {
  max-width: 430px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.65;
}

.overview-copy > p strong { color: var(--ink); font-weight: 700; }

.game-stats {
  display: flex;
  gap: 0;
  margin: 26px 0 0;
}

.game-stats div {
  display: grid;
  min-width: 95px;
  gap: 5px;
  padding-right: 18px;
}

.game-stats div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.game-stats dt {
  color: var(--dim);
  font-size: .625rem;
}

.game-stats dd {
  margin: 0;
  color: var(--ink);
  font: 500 .75rem/1.3 "DM Mono", monospace;
}

#connection-status dd { display: flex; align-items: center; gap: 6px; }

#connection-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--t-warn);
}

#connection-status[data-state="online"] i { background: var(--t-accent-ink); }
#connection-status[data-state="offline"] i { background: var(--danger); }

.target-figure { margin: 0; }

#target-canvas {
  display: block;
  width: 176px;
  height: 176px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-deep);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.target-figure figcaption {
  margin-top: 9px;
  color: var(--dim);
  font-size: .625rem;
  text-align: right;
}

.play-area {
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.play-area > label {
  display: block;
  margin-bottom: 9px;
  font-size: .73rem;
  font-weight: 700;
}

.guess-input-row { display: grid; grid-template-columns: 1fr auto; }

#guess-input {
  min-width: 0;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: var(--panel-deep);
  font-size: .9rem;
  font-weight: 600;
}

#guess-input::placeholder { color: var(--muted-deep); font-weight: 500; }

#guess-input:focus {
  border-color: var(--accent);
  box-shadow: inset 3px 0 var(--accent);
}

.submit {
  min-width: 106px;
  min-height: 44px;
  padding: 0 16px;
  color: #0b1c16;
  background: var(--accent);
  font-size: .78rem;
  font-weight: 800;
}

.submit span { margin-left: 7px; font: 500 .8rem/1 "DM Mono", monospace; }
.submit:hover:not(:disabled) { background: #68d5af; }

.submit:focus-visible,
.quiet-action:focus-visible,
.new-game:focus-visible,
.wordmark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.submit:disabled { cursor: not-allowed; opacity: .55; }
.quiet-action:disabled { cursor: not-allowed; opacity: .55; }

.play-meta {
  display: flex;
  min-height: 25px;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 10px;
}

#server-message {
  position: relative;
  overflow: hidden;
  padding-left: 13px;
  color: var(--muted);
  font-size: .69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* small dot shown while the session is being prepared */
#server-message::before {
  content: "";
  position: absolute;
  top: calc(50% - 3px);
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  visibility: hidden;
}

#server-message[data-busy="1"]::before { visibility: visible; }

.play-meta > div { display: flex; flex: 0 0 auto; gap: 15px; }

.quiet-action {
  padding: 3px 0;
  color: var(--muted);
  background: transparent;
  font-size: .68rem;
  font-weight: 700;
}

.quiet-action:hover:not(:disabled) { color: var(--accent); }
.quiet-action.danger:hover:not(:disabled) { color: var(--danger); }

.latest-reading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 64px;
  min-height: 90px;
  align-items: center;
  gap: 22px;
  margin-top: 12px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-deep);
}

.latest-word { min-width: 0; }
.latest-word .label { margin-bottom: 5px; color: var(--muted-deep); }

#guess-status {
  display: block;
  overflow: hidden;
  color: var(--muted-deep);
  font-size: .88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#guess-status[data-state="submitted"] { color: var(--ink); }

.latest-distance { display: grid; justify-items: end; gap: 4px; }
.latest-distance small { color: var(--muted-deep); font-size: .625rem; }

#last-distance {
  display: inline-block;
  color: var(--kicker);
  font: 500 1.25rem/1 "DM Mono", monospace;
}

.heat-gauge { display: block; width: 24px; height: 14px; margin-bottom: 3px; }
.heat-gauge .gauge-arc { stroke: color-mix(in srgb, var(--t-ink) 60%, var(--t-bg)); }
.heat-gauge .gauge-fill { transition: stroke-dashoffset 300ms ease, stroke 300ms ease; }

#last-canvas {
  display: block;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.guess-history { margin-top: 42px; }

.guess-history > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding-bottom: 13px;
}

.guess-history h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -.035em;
}

.guess-history header .label { margin-bottom: 6px; }

.guess-history header > span {
  color: var(--dim);
  font: 500 .625rem/1 "DM Mono", monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.list-head,
.guess-row-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, .8fr) 64px;
  gap: 18px;
}

.list-head {
  padding: 11px 12px;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  font-size: .625rem;
}

.list-head span:nth-child(2),
.list-head span:nth-child(3) { text-align: right; }

.guess-list { display: grid; }

.guess-row-item.row-enter { animation: row-in 240ms ease both; }
@keyframes row-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.rc-letter { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .rc-letter { animation: letter-in 320ms cubic-bezier(.2, .8, .2, 1) both; transform-origin: 50% 100%; }
  /* 20ms per-letter cascade (letters are the only children of their container) */
  .rc-letter:nth-child(1) { animation-delay: 0ms; }
  .rc-letter:nth-child(2) { animation-delay: 20ms; }
  .rc-letter:nth-child(3) { animation-delay: 40ms; }
  .rc-letter:nth-child(4) { animation-delay: 60ms; }
  .rc-letter:nth-child(5) { animation-delay: 80ms; }
  .rc-letter:nth-child(6) { animation-delay: 100ms; }
  .rc-letter:nth-child(7) { animation-delay: 120ms; }
  @keyframes letter-in { from { opacity: 0; transform: rotateX(90deg); } to { opacity: 1; transform: none; } }
  #target-canvas.reveal { animation: target-reveal 400ms ease both; }
  @keyframes target-reveal { from { opacity: 0; filter: contrast(.7) brightness(1.15); } to { opacity: 1; filter: none; } }
  #server-message[data-busy="1"]::before { animation: busy-pulse 1s ease-in-out infinite; }
  @keyframes busy-pulse { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
}

.guess-row-item {
  min-height: 70px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.guess-row-item:first-child { background: color-mix(in srgb, var(--band-hot) 13%, transparent); }

.guess-identity { display: flex; min-width: 0; align-items: center; gap: 12px; }

.guess-rank {
  width: 28px;
  flex: 0 0 auto;
  color: var(--dim);
  font: 500 .625rem/1 "DM Mono", monospace;
}

.guess-row-item:first-child .guess-rank { width: auto; color: var(--t-accent-ink); background: var(--t-panel); border: 1px solid var(--t-line-strong); border-radius: 4px; padding: 1px 8px; }

.guess-word {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  font-size: .84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guess-hint-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--band-warm);
  border: 1px solid var(--line);
  font: 500 10px/1 "DM Mono", monospace;
}

.distance-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 13px;
}

.dist-line { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

.guess-distance {
  color: var(--muted);
  font: 500 .72rem/1 "DM Mono", monospace;
  text-align: right;
}

.band-chip {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  color: var(--band-cold);
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 500 10px/1 "DM Mono", monospace;
}
.guess-row-item[data-band="warm"] .band-chip { color: var(--band-warm); }
.guess-row-item[data-band="hot"] .band-chip { color: var(--band-hot); }

.distance-track { height: 6px; background: color-mix(in srgb, var(--t-ink) 60%, var(--t-bg)); border-radius: 3px; }

.distance-track span {
  display: block;
  width: var(--match, 0%);
  height: 100%;
  min-width: 2px;
  border-radius: 3px;
  background: var(--band-cold);
  transition: width 220ms ease;
}

.guess-row-item[data-band="warm"] .distance-track span { background: var(--band-warm); }
.guess-row-item[data-band="hot"] .distance-track span { background: var(--band-hot); }
.guess-row-item[data-band="hot"] .guess-distance { color: var(--band-hot); }

.guess-row-item canvas.guess-mini-canvas {
  width: 48px !important;
  height: 48px !important;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.guess-empty {
  display: grid;
  min-height: 128px;
  place-items: center;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.empty-state { display: grid; gap: 5px; }
.empty-state-icon { display: none; }
.empty-state strong { color: var(--ink); font-size: .76rem; }
.empty-state span:last-child { color: var(--dim); font-size: .67rem; }

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--scrim);
}

.modal.hidden { display: none; }

.modal-card {
  position: relative;
  width: min(390px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--t-radius, 10px);
  background: var(--panel);
  box-shadow: 0 24px 70px rgb(0 0 0 / .35);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font: 500 18px/1 "DM Mono", monospace;
  cursor: pointer;
}
.modal-close:hover { color: var(--ink); background: var(--panel-deep); }

.modal-card h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -.05em;
}

.modal-card > p:not(.label) {
  margin: 11px 0 23px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.6;
}

/* win / loss art */
.end-art { display: grid; justify-items: center; gap: 12px; margin: 20px 0 6px; }
.end-art canvas {
  width: 140px;
  height: 140px;
  border: 1px solid var(--line);
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.end-word {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.end-word .rc-letter { color: var(--band-hot); }

.win-card .modal-card h2, .modal-card h2.pulse { animation: title-pulse 300ms ease; }
@keyframes title-pulse { 50% { transform: scale(1.04); } }

.confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: inherit;
}

/* help modal */
.help-card .modal-card { width: min(430px, 100%); }
.help-body p { font-size: .8rem; line-height: 1.6; color: var(--muted); margin: 10px 0; }
.help-body p:first-of-type { margin-top: 14px; }
.help-body strong { color: var(--ink); }
.help-band-row { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0; font-size: .75rem; color: var(--muted); }
.help-band-row span { display: inline-flex; align-items: center; gap: 6px; }
.help-band-row .chip {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 500 10px/1 "DM Mono", monospace;
}
.help-band-row .chip-c { color: var(--band-cold); }
.help-band-row .chip-w { color: var(--band-warm); }
.help-band-row .chip-h { color: var(--band-hot); }
.help-mosaic { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; margin: 16px 0 4px; }
.help-mosaic canvas {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.help-footer { display: flex; justify-content: flex-end; margin-top: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: scrim-in 150ms ease both; }
  .modal .modal-card { animation: card-in 180ms ease both; }
  @keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes card-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

@media (max-width: 640px) {
  body { width: min(100% - 28px, 480px); }
  .game { padding: 34px 0 48px; }

  .game-overview {
    grid-template-columns: 1fr 104px;
    align-items: end;
    gap: 20px;
    padding-bottom: 26px;
  }

  .overview-copy > p:not(.label) { font-size: .79rem; }
  .game-stats div { min-width: 75px; padding-right: 10px; }
  .game-stats div + div { padding-left: 10px; }
  #connection-status { display: none; }

  #target-canvas { width: 104px; height: 104px; }
  .target-figure figcaption { display: none; }
  .play-area { padding: 16px; }

  .play-meta {
    display: grid;
    min-height: 45px;
    align-items: start;
    gap: 7px;
  }

  .play-meta > div { grid-row: 1; }
  #server-message { grid-row: 2; }

  .latest-reading {
    grid-template-columns: minmax(0, 1fr) auto 52px;
    gap: 12px;
    min-height: 76px;
    padding: 11px 11px 11px 14px;
  }

  #last-canvas { width: 52px; height: 52px; }
  .guess-history { margin-top: 34px; }
  .list-head { display: none; }

  .guess-list { border-top: 1px solid var(--line-soft); }

  .guess-row-item {
    grid-template-columns: minmax(105px, 1fr) 92px 48px;
    gap: 8px;
    padding: 8px 4px;
  }

  .guess-identity { gap: 5px; }
  .guess-rank { width: 23px; font-size: .54rem; }
  .guess-word { font-size: .76rem; }
  .distance-cell { display: block; }
  .distance-track { display: block; width: 100%; height: 4px; margin-top: 7px; }
}

@media (max-width: 390px) {
  .game-overview { grid-template-columns: 1fr 82px; gap: 14px; }
  #target-canvas { width: 82px; height: 82px; }
  .game-stats { margin-top: 20px; }
  .game-stats div { min-width: 70px; }
  .submit { min-width: 84px; }
  .latest-word .label { font-size: .625rem; margin-bottom: 2px; }
  #guess-status { font-size: .8rem; }
  .latest-reading { gap: 10px; grid-template-columns: minmax(0, 1fr) auto 44px; }
  #last-canvas { width: 44px; height: 44px; }
  .guess-history header > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
/* Native account, mode and competitive surfaces */
.site-header{gap:18px}.play-modes{display:flex;gap:6px;padding:3px;border:1px solid var(--line);border-radius:999px;background:var(--panel-deep)}.mode-button{border:0;background:transparent;color:var(--muted);padding:8px 13px;border-radius:999px;font:600 12px Manrope,sans-serif;cursor:pointer;transition:color var(--t-speed) ease,background-color var(--t-speed) ease}.mode-button.active{background:var(--ink);color:var(--bg)}.header-tools{display:flex;align-items:center;gap:9px}.select,.account-button,.help-button{border:1px solid var(--line);background:var(--panel);color:var(--ink);border-radius:8px;padding:8px 10px;cursor:pointer;white-space:nowrap}.help-button{padding:8px 11px;font:600 13px "DM Mono",monospace;color:var(--kicker);border-color:var(--line)}.help-button:hover,.account-button:hover{border-color:var(--ink)}.online-board{margin-top:48px;border-top:1px solid var(--line);padding-top:28px}.online-board>header{display:flex;align-items:end;justify-content:space-between}.leaderboard-list{margin-top:18px;border-top:1px solid var(--line)}.leaderboard-row{display:grid;grid-template-columns:50px 1fr auto auto;gap:18px;align-items:center;padding:13px 4px;border-bottom:1px solid var(--line)}.leaderboard-row .rank{font:500 11px "DM Mono",monospace;color:var(--muted)}.leaderboard-row small{color:var(--muted)}.account-dialog{border:0;padding:0;background:transparent;color:var(--ink)}.account-dialog::backdrop{background:var(--scrim);backdrop-filter:blur(5px)}.account-shell{position:relative;width:min(520px,calc(100vw - 30px));max-height:85vh;overflow:auto;background:var(--panel);border:1px solid var(--line);padding:30px;box-shadow:0 30px 100px rgb(0 0 0 / .4)}.account-close{position:absolute;right:10px;top:10px;width:34px;height:34px;display:grid;place-items:center;border:0;border-radius:6px;background:transparent;color:var(--muted);font-size:22px;cursor:pointer}.account-close:hover{color:var(--ink);background:var(--panel-deep)}.account-shell h2{margin:0 0 8px}.account-shell p{color:var(--muted)}.account-form{display:grid;gap:10px;margin-top:20px}.account-form input{padding:12px;border:1px solid var(--line);background:var(--panel-deep);color:var(--ink)}.account-form input::placeholder{color:var(--muted)}.account-form .account-actions{display:flex;gap:8px}.account-tabs{display:flex;gap:7px;flex-wrap:wrap;margin:18px 0}.account-tabs button,.account-form button,.account-form .google{padding:10px 12px;border:1px solid var(--line);background:var(--panel-deep);color:var(--ink);cursor:pointer;font:600 13px Manrope,sans-serif}.account-tabs button:hover,.account-form button:hover,.account-form .google:hover{border-color:var(--ink)}.account-form .google{display:block;text-align:center;text-decoration:none}.achievement-card{padding:13px 0;border-top:1px solid var(--line)}.achievement-card b,.achievement-card span{display:block}.achievement-card span{color:var(--muted);font-size:12px;margin-top:4px}.account-error{color:var(--t-danger);min-height:20px}

@media(max-width:850px){.site-header{flex-wrap:wrap;height:auto;padding-block:10px;row-gap:10px}.wordmark{order:1}.header-tools{order:2;margin-left:auto}.play-modes{order:3;width:100%;justify-content:center}.new-game{height:32px;padding:0 10px;font-size:.7rem}.mode-button{padding:7px 10px;font-size:11px}.leaderboard-row{grid-template-columns:36px 1fr auto}.leaderboard-row small:last-child{display:none}}

