:root {
  color-scheme: light;
  --ink: #172019;
  --muted: #667069;
  --paper: #f5f2e9;
  --card: #fffdf7;
  --line: #d9d5c9;
  --green: #16835b;
  --yellow: #e6ad17;
  --red: #b43d35;
  --shadow: 0 18px 50px rgba(43, 48, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(230, 173, 23, 0.18), transparent 30rem),
    radial-gradient(circle at 95% 22%, rgba(22, 131, 91, 0.14), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.site-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--ink);
  color: white;
}

.hero {
  max-width: 720px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.96;
}

.intro {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.game-card,
.rules,
.history-card {
  margin-top: 16px;
  padding: clamp(22px, 5vw, 40px);
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid rgba(217, 213, 201, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stats {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.stats div {
  display: flex;
  flex-direction: column;
}

.stats span,
.guess-panel span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stats strong {
  margin-top: 4px;
  font-size: 1.35rem;
}

.guess-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 32px 0;
  padding: 30px;
  background: var(--ink);
  border-radius: 18px;
  color: white;
}

.guess-panel span {
  color: #b7c0b9;
}

.guess-panel strong {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(3rem, 12vw, 5.6rem);
  letter-spacing: 0.16em;
  line-height: 1;
}

.inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
}

label > span {
  font-weight: 800;
}

label small {
  grid-column: 1;
  margin-top: 4px;
  color: var(--muted);
}

input {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 72px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: #f1eee5;
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
}

.green-field:focus-within {
  border-color: var(--green);
}

.yellow-field:focus-within {
  border-color: var(--yellow);
}

button {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  padding: 15px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

button:hover {
  filter: brightness(0.94);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.secondary {
  width: auto;
  margin: 4px 0 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message {
  min-height: 24px;
  margin: 18px 0 0;
  font-weight: 650;
}

.message.info {
  color: var(--muted);
}

.message.error {
  color: var(--red);
}

.message.success {
  color: var(--green);
}

h2 {
  margin: 0 0 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 500;
}

.rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.rule-grid article {
  display: flex;
  gap: 14px;
}

.rule-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border-radius: 50%;
}

.dot.green {
  background: var(--green);
}

.dot.yellow {
  background: var(--yellow);
}

.example {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
}

.about {
  max-width: 760px;
  margin: 0 auto;
}

.about-header {
  margin: 42px 0 28px;
}

.about h1 {
  max-width: 720px;
}

.about section {
  margin-top: 16px;
  padding: clamp(22px, 5vw, 38px);
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid rgba(217, 213, 201, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.about section p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.about section p:first-of-type {
  margin-top: 0;
}

.formula {
  margin: 20px 0;
  padding: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f1eee5;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  text-align: center;
  white-space: nowrap;
}

.comparison {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding: 18px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
}

.comparison div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.comparison span {
  color: #b7c0b9;
}

.comparison code {
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

.steps {
  margin: 0;
  padding-left: 24px;
  color: var(--muted);
}

.steps li {
  padding: 5px 0;
  line-height: 1.5;
}

.play-link {
  display: block;
  min-height: 48px;
  margin-top: 20px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 620px) {
  main {
    width: min(100% - 20px, 920px);
    padding-top: 20px;
  }

  .inputs,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .game-card,
  .rules,
  .history-card,
  .about section {
    padding: 20px;
    border-radius: 18px;
  }

  .about-header {
    margin-top: 20px;
  }

  .guess-panel {
    margin: 22px 0;
    padding: 22px 12px;
  }

  .guess-panel strong {
    font-size: clamp(2.75rem, 17vw, 4.25rem);
    letter-spacing: 0.1em;
  }

  label {
    min-height: 82px;
    padding: 14px;
  }

  .stats {
    gap: 12px;
  }

  .stats strong {
    font-size: 1.15rem;
  }

  button.secondary {
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 2.1rem;
  }

  .game-card,
  .rules,
  .history-card,
  .about section {
    padding: 16px;
  }

  .guess-panel strong {
    font-size: 2.7rem;
    letter-spacing: 0.08em;
  }
}
