@font-face {
  font-family: DM Sans;
  src: url(fonts/sans.woff2) format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: DM Serif Text;
  src: url(fonts/serif.woff2) format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: DM Serif Text;
  src: url(fonts/serif-italic.woff2) format('woff2');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
:root {
  --ink: #1d302a;
  --muted: #54665d;
  --line: #cdd4c7;
  --green: #204d3e;
  --paper: #f6f5ee;
  --white: #fffef9;
  --serif: 'DM Serif Text', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
}
a {
  color: inherit;
  text-underline-offset: 0.2em;
}
button,
input,
select {
  font: inherit;
}
button,
summary {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #aa711a;
  outline-offset: 3px;
}
.mast {
  border-bottom: 1px solid var(--line);
}
.mast-inner,
main,
footer {
  width: min(1120px, calc(100% - 64px));
  margin-inline: auto;
}
.mast-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font: 2rem/1 var(--serif);
  text-decoration: none;
  letter-spacing: -0.06em;
}
.brand-site {
  font: 600 0.85rem var(--sans);
  letter-spacing: 0.025em;
  border-left: 1px solid #adb8aa;
  padding-left: 12px;
  margin-left: 2px;
  color: var(--muted);
}
.mosaic {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 3px;
  transform: rotate(-6deg);
}
.mosaic i {
  width: 9px;
  height: 9px;
  background: #416d4e;
  border-radius: 1px;
}
.mosaic i:nth-child(2) {
  background: #d7aa54;
}
.mosaic i:nth-child(3) {
  background: #8da886;
}
nav,
nav form {
  display: flex;
  align-items: center;
}
nav {
  gap: 22px;
  font-size: 0.88rem;
  font-weight: 600;
}
nav a,
.nav-button {
  text-decoration: none;
  color: var(--muted);
}
nav a:hover,
nav a[aria-current],
.nav-button:hover {
  color: var(--green);
  text-decoration: underline;
}
.nav-button {
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  padding: 0 0 0 16px;
}
main {
  flex: 1;
  padding-block: clamp(22px, 6vh, 68px);
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  min-height: 64px;
  border-top: 1px solid var(--line);
  font-size: 0.77rem;
  color: var(--muted);
}
footer span span {
  margin: 0 5px;
  color: #8b9b8c;
}
footer a {
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}
h1,
h2,
p {
  margin: 0;
}
h1,
h2 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.035em;
}
h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
}
h2 {
  font-size: 2rem;
}
.entry {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: var(--white);
}
.poster {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #1f463a;
  color: #fff4d9;
  padding: clamp(32px, 4.6vw, 66px);
  min-height: 545px;
}
.poster-grid {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(90deg, #ebf9d00b 1px, transparent 1px), linear-gradient(#ebf9d00b 1px, transparent 1px),
    radial-gradient(ellipse at 86% 96%, #53836a 0, transparent 60%);
  background-size:
    36px 36px,
    36px 36px,
    auto;
}
.poster h1 {
  font-size: clamp(3.3rem, 5.3vw, 4.95rem);
  line-height: 0.98;
}
.poster h1 em {
  color: #ecd59f;
}
.poster p {
  margin-top: 18px;
  color: #e1e6d3;
  font-size: 0.98rem;
}
.tile-art {
  position: relative;
  width: min(78%, 345px);
  margin: 38px auto 0;
  transform: rotate(-9deg) skewX(-5deg);
  filter: drop-shadow(3px 14px 8px #112c2880);
}
.art-row {
  display: flex;
  gap: 5px;
  margin: 6px 0;
}
.art-row b {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  flex: 1;
  border: 1px solid #b6b9a2;
  border-radius: 5px;
  color: #314638;
  background: #e5e3c9;
  box-shadow:
    0 4px 0 #9c9b82,
    0 6px 0 #27473c;
  font: clamp(1.3rem, 2.4vw, 2.25rem)/1 var(--serif);
}
.art-row.first {
  transform: translateX(-11%);
}
.art-row.third {
  transform: translateX(10%);
}
.art-row.first b:nth-child(n + 3),
.art-row.second b:first-child,
.art-row.second b:nth-child(4),
.art-row.third b {
  background: #a6c798;
  border-color: #c5d5a5;
  box-shadow:
    0 4px 0 #648568,
    0 6px 0 #27473c;
}
.art-row.second b:nth-child(2),
.art-row.second b:nth-child(3),
.art-row.second b:nth-child(5) {
  background: #e2b05e;
  border-color: #eaca85;
  box-shadow:
    0 4px 0 #a77c40,
    0 6px 0 #27473c;
}
.entry-panel {
  align-self: center;
  padding: clamp(28px, 5vw, 72px);
  width: 100%;
}
.entry-panel h2 {
  font-size: clamp(2.2rem, 3.8vw, 3.45rem);
}
.muted {
  color: var(--muted);
}
.entry-panel > .muted {
  margin: 12px 0 30px;
}
.stack {
  display: grid;
  gap: 18px;
}
.stack label,
.filters label {
  font-weight: 650;
  font-size: 0.9rem;
}
input[type='email'],
input[type='password'],
input[type='text'],
input#guess-word,
select {
  width: 100%;
  border: 1px solid #aeb9aa;
  background: #fffefa;
  color: var(--ink);
  border-radius: 8px;
  min-height: 47px;
  padding: 10px 13px;
}
.auth-form input {
  margin-top: 6px;
}
.auth-form small {
  margin-top: -12px;
  color: var(--muted);
}
button.primary,
a.primary,
.secondary {
  border-radius: 8px;
  min-height: 46px;
  padding: 10px 19px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-decoration: none;
}
.primary {
  background: var(--green);
  color: white;
  border: 1px solid var(--green);
}
.primary:hover {
  background: #133c2e;
}
.primary span {
  font-size: 1.25rem;
}
.secondary {
  background: var(--white);
  border: 1px solid #aab8a7;
  color: var(--ink);
}
.secondary:hover {
  background: #e7ecdf;
}
.entry-alt {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.entry-alt a,
.text-link {
  color: var(--green);
  font-weight: 700;
}
.notice {
  border: 1px solid #d5ab69;
  background: #fff4d9;
  color: #583b18;
  border-radius: 8px;
  padding: 10px 16px;
  margin: 0 auto 15px;
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}
legend {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.segments {
  display: flex;
  border: 1px solid #adb9aa;
  border-radius: 9px;
  overflow: hidden;
}
.segments label {
  flex: 1;
  position: relative;
  text-align: center;
  cursor: pointer;
}
.segments input,
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.segments span {
  display: block;
  padding: 10px;
}
.segments input:checked + span {
  background: #deeadb;
  color: #204e3a;
  box-shadow: inset 0 -3px #4e7656;
}
.segments input:focus-visible + span {
  outline: 2px solid #a47328;
  outline-offset: -3px;
}
.mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mode strong,
.legend strong {
  display: block;
}
.mode small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}
input.switch {
  appearance: none;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 15px;
  background: #b9c3b9;
  position: relative;
  cursor: pointer;
  margin: 0;
}
input.switch:before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
}
input.switch:checked {
  background: var(--green);
}
input.switch:checked:before {
  left: 19px;
}
.confirm {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #69523a;
  line-height: 1.4;
}
.confirm input {
  accent-color: var(--green);
  margin-top: 4px;
}
.paper,
.board-panel,
.side-card {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 18px;
}
.paper {
  max-width: 780px;
  margin: auto;
  padding: clamp(22px, 4vw, 48px);
}
.back {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 20px;
}
.rules p {
  margin: 12px 0 24px;
}
.rules h2,
.stats h2,
.side-card h2 {
  font-size: 1.65rem;
}
.legend {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 11px;
}
.legend i {
  width: 17px;
  height: 17px;
  border-radius: 3px;
  display: block;
  flex-shrink: 0;
}
.rules-list {
  margin: 18px 0 24px;
}
.rules-list .tile {
  width: 45px;
  height: 45px;
  font-size: 1.5rem;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(240px, 1fr);
  gap: 22px;
  max-width: 990px;
  margin: auto;
}
.board-panel {
  padding: clamp(18px, 3vw, 34px);
  text-align: center;
}
.game-meta {
  color: var(--green);
  font-size: 0.83rem;
  font-weight: 750;
}
.game-meta span {
  color: #99ab96;
  padding: 0 6px;
}
.board-head h1 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  margin: 7px 0 4px;
}
.board-head p {
  font-size: 0.92rem;
}
.board {
  width: min(100%, 302px);
  display: grid;
  gap: 5px;
  margin: 18px auto 22px;
}
.board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 5px;
  font: 700 clamp(1.35rem, 3vw, 1.85rem)/1 var(--sans);
}
.empty {
  border: 1.5px solid #c9d2c4;
  background: #fafbf5;
}
#active-row .empty {
  border-color: #869984;
}
#active-row .filled {
  border: 2px solid var(--green);
  background: #eff4e8;
}
.correct {
  background: #447452;
  color: white;
}
.present {
  background: #e0b65f;
  color: #392d18;
}
.absent {
  background: #67746b;
  color: white;
}
@media (prefers-reduced-motion: no-preference) {
  .board-panel {
    --flip-time: 320ms;
  }
  .reveal-row > .tile {
    animation:
      tile-flip var(--flip-time) ease-in-out backwards,
      tile-front calc(var(--flip-time) / 2) linear backwards;
    animation-delay: calc(var(--column, 0) * var(--flip-time));
  }
  .reveal-row > :nth-child(2) { --column: 1; }
  .reveal-row > :nth-child(3) { --column: 2; }
  .reveal-row > :nth-child(4) { --column: 3; }
  .reveal-row > :nth-child(5) { --column: 4; }

  .revealing-result .board-head h1,
  .revealing-result .board-head p,
  .revealing-result .next-game {
    animation: show-result 0s calc(5 * var(--flip-time)) backwards;
  }
}
@keyframes tile-flip {
  0%, 100% { transform: perspective(500px) rotateX(0deg); }
  50% { transform: perspective(500px) rotateX(90deg); }
}
/* Keep the typed face visible through the delay and the first half-turn. */
@keyframes tile-front {
  from, to {
    background-color: #eff4e8;
    color: var(--ink);
    box-shadow: inset 0 0 0 2px var(--green);
  }
}
@keyframes show-result {
  from { visibility: hidden; }
  to { visibility: visible; }
}
.guess-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  max-width: 345px;
}
.guess-form.sr:focus-within {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  margin-bottom: 8px;
}
.keyboard {
  display: grid;
  gap: 5px;
  margin: auto;
  max-width: 540px;
}
.keyboard > div {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}
.keyboard button {
  flex: 0 1 9%;
  padding: 0;
  border: 0;
  border-radius: 5px;
  min-width: 0;
  height: 43px;
  background: #e4e9df;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.94rem;
}
.keyboard button.wide {
  flex-basis: 15%;
  font-size: 0.85rem;
}
.keyboard button.correct {
  background: #447452;
  color: white;
}
.keyboard button.present {
  background: #e0b65f;
  color: #392d18;
}
.keyboard button.absent {
  background: #67746b;
  color: white;
}
.game-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-card {
  padding: 24px;
}
.side-card summary {
  font: 1.6rem/1.1 var(--serif);
}
.side-card .setup-form {
  margin-top: 20px;
}
.side-link {
  display: flex;
  justify-content: space-between;
  padding: 15px 20px;
  font-weight: 650;
  color: var(--green);
}
.filters {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 22px 0;
}
.filters label {
  flex: 1;
}
.filters select {
  margin-top: 4px;
}
.figures {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 24px 0 32px;
}
.figures div {
  background: #edf1e8;
  border-radius: 8px;
  padding: 14px 9px;
}
.figures strong {
  display: block;
  font: 2rem var(--serif);
}
.figures span {
  font-size: 0.78rem;
  color: var(--muted);
}
.histogram {
  margin-top: 16px;
  display: grid;
  gap: 6px;
}
.histogram div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.histogram meter {
  flex: 1;
  height: 20px;
  appearance: none;
  background: #eef0e9;
  border: 0;
  border-radius: 3px;
}
.histogram meter::-webkit-meter-bar {
  height: 16px;
  background: #eef0e9;
  border: none;
  border-radius: 3px;
}
.histogram meter::-webkit-meter-optimum-value {
  background: #588063;
  border-radius: 3px;
}
.histogram meter::-moz-meter-bar {
  background: #588063;
}
.histogram b {
  min-width: 2ch;
}
@media (max-width: 760px) {
  .mast-inner,
  main,
  footer {
    width: calc(100% - 32px);
  }
  .mast-inner {
    min-height: 65px;
  }
  .entry {
    grid-template-columns: 1fr;
  }
  .poster {
    min-height: 0;
    padding: 30px 28px;
  }
  .poster h1 {
    font-size: 2.9rem;
  }
  .poster p {
    max-width: 50%;
    font-size: 0.85rem;
  }
  .tile-art {
    position: absolute;
    right: 5%;
    top: 38%;
    width: 30%;
    margin: 0;
  }
  .art-row {
    gap: 2px;
    margin: 3px 0;
  }
  .art-row b {
    font-size: clamp(0.65rem, 2.2vw, 1.1rem);
    border-radius: 3px;
  }
  .entry-panel {
    padding: 28px;
  }
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .game-aside .side-link {
    grid-column: 1/-1;
  }
  .brand-site {
    display: none;
  }
  nav {
    gap: 12px;
    font-size: 0.8rem;
  }
  main {
    padding-block: 20px;
  }
  .figures {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 480px) {
  .brand {
    font-size: 1.55rem;
    gap: 5px;
  }
  .mosaic {
    grid-template-columns: repeat(2, 6px);
    gap: 2px;
  }
  .mosaic i {
    width: 6px;
    height: 6px;
  }
  nav {
    gap: 8px;
    font-size: 0.72rem;
  }
  .nav-button {
    padding-left: 7px;
  }
  .mast-inner,
  main,
  footer {
    width: calc(100% - 22px);
  }
  .poster h1 {
    font-size: 2.4rem;
  }
  .poster {
    padding: 25px 22px;
  }
  .poster p {
    margin-top: 12px;
  }
  .entry {
    border-radius: 15px;
  }
  .entry-panel {
    padding: 24px 21px;
  }
  .game-aside {
    display: flex;
  }
  .game-aside > * {
    width: 100%;
  }
  .board-panel {
    padding: 18px 5px;
  }
  .board {
    width: min(69vw, 275px);
  }
  .keyboard > div {
    gap: 3px;
  }
  .keyboard button {
    height: 44px;
  }
  .filters {
    flex-wrap: wrap;
  }
  .filters label {
    min-width: 36%;
  }
  .filters .secondary {
    min-height: 36px;
  }
  .side-card {
    padding: 18px;
  }
  .entry-panel > .muted {
    margin-bottom: 20px;
  }
}
