@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-28b38c55.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-regular-0ea8ecfd.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-medium-ead9c30a.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-004e2f9d.woff2") format("woff2");
}

:root {
  --paper: #f3f1ea;
  --surface: #fffefa;
  --ink: #171814;
  --muted: #6c6e63;
  --soft-muted: #6d6e65;
  --line: #e2ded2;
  --line-strong: #d3cec0;
  --unspent: #dcd7c9;
  --pine: #12574a;
  --pine-hover: #0b3e34;
  --ember: #a23a2b;
  --icon: #3f4139;
  --flag-canvas: #fff;
  --flag-outline: rgba(23, 24, 20, .10);
  --flag-shadow: rgba(23, 24, 20, .40);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #121311;
  --surface: #1c1e19;
  --ink: #f0eee4;
  --muted: #969889;
  --soft-muted: #838678;
  --line: #2e312a;
  --line-strong: #3b3f36;
  --unspent: #3b3f36;
  --pine: #6fc7a2;
  --pine-hover: #94ddbc;
  --ember: #e3897a;
  --icon: #c6c4b8;
  --flag-outline: rgba(240, 238, 228, .14);
  --flag-shadow: rgba(0, 0, 0, .80);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121311;
    --surface: #1c1e19;
    --ink: #f0eee4;
    --muted: #969889;
    --soft-muted: #838678;
    --line: #2e312a;
    --line-strong: #3b3f36;
    --unspent: #3b3f36;
    --pine: #6fc7a2;
    --pine-hover: #94ddbc;
    --ember: #e3897a;
    --icon: #c6c4b8;
    --flag-outline: rgba(240, 238, 228, .14);
    --flag-shadow: rgba(0, 0, 0, .80);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: 100%;
  max-width: 83.125rem;
  margin: 0 auto;
  padding: 2.75rem 3rem 3.5rem;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.brand h1 {
  margin: 0;
  font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  font-size: 1.4375rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.025em;
}

.date,
.attempt-label,
.score-breakdown,
.section-heading span,
.keyboard-help,
.guess-name,
.shortcut {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

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

.header-actions {
  display: flex;
  gap: .375rem;
}

.icon-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-button:hover {
  border-color: var(--pine);
  color: var(--pine);
  transform: translateY(-1px);
}

.icon-button svg,
.share svg {
  width: 1.0625rem;
  height: 1.0625rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }

  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 38.75rem) minmax(0, 34.625rem);
  gap: 3.75rem;
  align-items: start;
}

.puzzle-column,
.action-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1.75rem;
}

.flag-frame {
  display: grid;
  width: 100%;
  place-items: center;
}

.flag-frame svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--flag-canvas);
  box-shadow: 0 0 0 1px var(--flag-outline), 0 18px 40px -20px var(--flag-shadow);
}

.scoreboard {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin: 0;
  padding: .9375rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--muted);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.stake,
.stat .n {
  font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  font-variant-numeric: tabular-nums;
}

.stake {
  margin-top: .375rem;
  color: var(--pine);
  font-size: 2.875rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.035em;
}

[data-state="lost"] .stake {
  color: var(--muted);
}

.scoreboard-detail {
  text-align: right;
}

.pips {
  display: flex;
  justify-content: flex-end;
  gap: .4375rem;
  margin-bottom: .625rem;
}

.pip {
  display: inline-block;
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: var(--unspent);
}

.pip--spent {
  background: var(--ember);
}

.pip--current {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--pine);
}

.attempt-label,
.score-breakdown {
  color: var(--muted);
  font-size: .75rem;
}

.verdict {
  font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
}

.answer {
  margin-top: .25rem;
  color: var(--muted);
  font-size: .8125rem;
}

.score-breakdown {
  margin-top: .375rem;
  font-size: .6875rem;
}

.revealed-hints {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .625rem;
}

.section-heading h2,
.modal-heading h2 {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.2;
}

.section-heading span {
  color: var(--muted);
  font-size: .6875rem;
}

.hint-heading h2 {
  color: var(--pine);
}

.hint p {
  margin: 0;
  padding: .875rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--pine);
  border-radius: .75rem;
  background: var(--surface);
  font-size: .90625rem;
  line-height: 1.5;
}

.pool {
  display: flex;
  gap: .5rem;
}

.pool form {
  min-width: 0;
  flex: 1 1 0;
  margin: 0;
}

.pool button {
  width: 100%;
  height: 3rem;
  padding: 0 .5rem;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: .75rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .84375rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.pool button:hover {
  border-color: var(--pine);
  color: var(--pine);
  transform: translateY(-1px);
}

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

.choices form {
  display: contents;
}

.choice {
  display: flex;
  width: 100%;
  height: 3.625rem;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: .625rem;
  padding: 0 .875rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.choice:hover {
  border-color: var(--pine);
  transform: translateY(-1px);
}

.choice--eliminated,
.choice--eliminated:hover {
  border: 1px dashed var(--unspent);
  background: transparent;
  color: var(--soft-muted);
  text-decoration: line-through;
  cursor: default;
  transform: none;
}

.shortcut {
  flex: 0 0 auto;
  padding: .125rem .3125rem;
  border: 1px solid var(--line);
  border-radius: .3125rem;
  color: var(--soft-muted);
  font-size: .65625rem;
  line-height: 1.2;
  text-decoration: none;
}

.keyboard-help {
  margin: 0;
  color: var(--muted);
  font-size: .71875rem;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.result-grid-heading,
.result-row {
  display: grid;
  grid-template-columns: 2.75rem 2.75rem minmax(0, 1fr);
  gap: .5rem;
  align-items: center;
}

.result-grid-heading {
  margin-bottom: .625rem;
}

.result-grid-heading span {
  color: var(--muted);
  font-size: .5625rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}

.result-grid {
  display: flex;
  flex-direction: column;
}

.result-row + .result-row {
  margin-top: .4375rem;
}

.result-cell {
  display: inline-grid;
  width: 1.625rem;
  height: 1.625rem;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line-strong);
  border-radius: .4375rem;
}

.result-cell--hint {
  border-color: var(--pine);
}

.result-cell--hint span {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--pine);
}

.result-cell--wrong {
  border-color: var(--ember);
  background: var(--ember);
}

.result-cell--right {
  border-color: var(--pine);
  background: var(--pine);
}

.guess-name {
  color: var(--soft-muted);
  font-size: .6875rem;
}

.share {
  display: flex;
  width: 100%;
  height: 3.125rem;
  align-items: center;
  justify-content: center;
  gap: .5625rem;
  border: 0;
  border-radius: .75rem;
  background: var(--pine);
  color: var(--paper);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.share:hover {
  background: var(--pine-hover);
  transform: translateY(-1px);
}

.result-stats {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

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

.stat .n {
  color: var(--ink);
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1;
}

.stat .k {
  margin-top: .3125rem;
  color: var(--muted);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.stat .countdown-value {
  color: var(--pine);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
}

.error {
  margin: -1.25rem 0 1.5rem;
  padding: .625rem .875rem;
  border: 1px solid var(--ember);
  border-radius: .75rem;
  color: var(--ember);
  font-size: .8125rem;
}

.modal {
  width: min(24rem, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .875rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.modal::backdrop {
  background: rgba(18, 19, 17, .52);
  backdrop-filter: blur(2px);
}

.modal-card {
  margin: 0;
  padding: 1.25rem;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-heading h2 {
  font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  font-size: 1.125rem;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
}

.modal-card p + p {
  margin-top: .75rem;
}

.stats--dialog {
  padding: 1rem 0 .25rem;
  border-top: 1px solid var(--line);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pine) 45%, transparent);
  outline-offset: 2px;
}

@media (max-width: 56rem) {
  .shell {
    max-width: 40rem;
    padding: 1.125rem 1.25rem 2rem;
  }

  .top {
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .brand {
    display: block;
  }

  .brand h1 {
    font-size: 1.1875rem;
    letter-spacing: -.02em;
  }

  .date {
    margin-top: .1875rem;
    font-size: .6875rem;
  }

  .play-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .puzzle-column,
  .action-column {
    width: 100%;
    gap: 1.5rem;
  }

  .flag-frame svg {
    border-radius: .875rem;
    box-shadow: 0 0 0 1px var(--flag-outline), 0 10px 24px -12px var(--flag-shadow);
  }

  .scoreboard {
    padding: .8125rem 0;
  }

  .stake {
    font-size: 2.375rem;
  }

  .pool button {
    height: 2.875rem;
    font-size: .8125rem;
  }

  .choice {
    height: 3.5rem;
  }

  .shortcut,
  .keyboard-help {
    display: none;
  }

  .result {
    gap: 1.5rem;
  }
}

@media (max-width: 24rem) {
  .shell {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .choices {
    gap: .4375rem;
  }

  .choice {
    padding: 0 .75rem;
    font-size: .875rem;
  }

  .pool {
    gap: .375rem;
  }

  .pool button {
    padding: 0 .3125rem;
    font-size: .75rem;
  }

  .result-stats {
    gap: .5rem;
  }

  .stats {
    gap: .5rem;
  }
}

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