:root {
  --ink: #241c16;
  --muted: #5c534c;
  --card: #fffaf6;
  --line: #eadfd4;
  --coral: #c4512c;
  --coral-dark: #9a3d1e;
  --cream: #f3ebe3;
  --green: #0e7a45;
  --green-soft: #e5f6ec;
  --amber: #f6c945;
  --amber-ink: #2a2118;
  --gray: #5e5852;
  --warn: #8a3d12;
  --shadow: 0 18px 50px rgba(70, 36, 12, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
  min-height: 100%;
  background-color: #f6f1e6;
  background-image:
    linear-gradient(to right, rgba(78, 108, 156, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(78, 108, 156, 0.16) 1px, transparent 1px),
    linear-gradient(to right, rgba(78, 108, 156, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(78, 108, 156, 0.28) 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px, 110px 110px, 110px 110px;
  background-position: -1px -1px;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 14px 36px;
}

body.show-intro {
  justify-content: center;
}

.card {
  width: min(100%, 460px);
  background: rgba(255, 250, 246, 0.78);
  border-radius: 28px;
  border: 1px solid rgba(90, 48, 20, 0.08);
  box-shadow: var(--shadow);
  padding: 22px 18px 20px;
}

.intro-card {
  width: min(100%, 420px);
  text-align: center;
  padding: 36px 24px 28px;
}

.intro-card .lede {
  margin: 16px 0 22px;
}

.intro-card .check {
  margin-top: 22px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 8px;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
}

h1 {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: 2.7rem;
  letter-spacing: -0.045em;
  line-height: 0.9;
  font-weight: 700;
}

h1 .mark {
  color: var(--coral);
  display: inline-block;
  transform: rotate(8deg);
  margin-left: 1px;
}

.date {
  margin: 0;
  text-align: right;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.date span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.lede {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}

.equation {
  position: relative;
  margin: 6px 0 40px;
  padding: 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fbf7f0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.equation canvas {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}

.equation-door {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #efe4d6;
  box-shadow: -10px 0 18px rgba(70, 36, 12, 0.12);
  transform: translateX(0);
  pointer-events: none;
}

.equation.reveal .equation-door {
  transform: translateX(100%);
  transition: transform 1.5s cubic-bezier(0.45, 0, 0.2, 1);
}

.tok { display: inline-flex; align-items: center; justify-content: center; }
.tok.op { color: #8d8176; font-weight: 600; padding: 0 0.02em; }
.tok.eq { color: var(--coral); padding: 0 0.12em; }
.tok.num { color: var(--ink); }
.tok.blank {
  min-width: 1.15em;
  margin: 0 0.04em;
  padding: 0.08em 0.16em 0.04em;
  border-radius: 8px;
  background: #fff1e6;
  color: var(--coral);
  box-shadow: inset 0 -3px 0 #e7b497;
}
.tok.blank.green { background: #d9f5e4; color: #0b5c34; box-shadow: inset 0 -3px 0 #8ed4ad; }
.tok.blank.red { background: #fde8e6; color: #8c1c1c; box-shadow: inset 0 -3px 0 #e3a29c; }

fieldset { border: 0; margin: 0; padding: 0; }

.fields {
  display: flex;
  flex-direction: row;
  gap: 10px;
}
.field { flex: 1; min-width: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--coral);
  font-size: 0.86rem;
}

input {
  width: 100%;
  min-height: 64px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 700 32px/1 Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  text-align: center;
  padding: 0 8px;
}

button,
a,
input,
select,
textarea,
label {
  -webkit-tap-highlight-color: rgba(227, 154, 116, 0.25);
}

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:active,
button:active {
  outline: 3px solid rgba(227, 154, 116, 0.25);
  outline-offset: 2px;
}

input.green { background: #b7ebc9; border-color: #0e7a45; color: #0b5c34; }
input.blue { background: #c5d7ff; border-color: #124a9a; color: #0d3d82; }
input.red { background: #ffc4be; border-color: #a32020; color: #8c1c1c; }
input:disabled { opacity: 1; color: var(--ink); }

input.given {
  background: var(--cream);
  border-style: dashed;
  border-color: #c4b5a6;
  color: var(--ink);
  cursor: not-allowed;
}

.check {
  margin-top: 12px;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: var(--coral);
  color: #fff;
  font: 800 1.12rem/1 inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(196, 81, 44, 0.28);
}

.check:hover:not(:disabled) { background: var(--coral-dark); }
.check:active:not(:disabled) { transform: translateY(1px); }
.check:disabled { cursor: default; opacity: 0.55; box-shadow: none; }

.status {
  min-height: 3.2em;
  margin: 14px 0 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f7f1eb;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.status.win { background: var(--green-soft); color: #0b5c34; }
.status.lose { background: #fdece6; color: #6e2e16; }
.status.warn { background: #fff4e8; color: var(--warn); }

.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
}

.pips { display: flex; gap: 6px; }
.pip {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: #e6ddd4;
  box-shadow: inset 0 0 0 1px rgba(60, 40, 20, 0.06);
}
.pip.used { background: var(--coral); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}
.swatch.green { background: var(--green); }
.swatch.blue { background: #124a9a; }
.swatch.red { background: #a32020; }

.history-wrap h2 {
  margin: 16px 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

#history, .guess {
  list-style: none;
  margin: 0;
  padding: 0;
}

#history { display: flex; flex-direction: column; gap: 6px; }

.guess { display: flex; gap: 4px; }

.tile {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: block;
  font-size: 0;
  box-shadow: none;
  animation: pop 0.18s ease both;
}
.tile:nth-child(2) { animation-delay: 0.04s; }
.tile:nth-child(3) { animation-delay: 0.08s; }
.tile.green { background: var(--green); color: #fff; }
.tile.blue { background: #124a9a; color: #fff; }
.tile.red { background: #a32020; color: #fff; }
.tile.open {
  background: transparent;
  color: transparent;
  box-shadow: none;
  border: 2px dashed var(--line);
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.foot {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes pop {
  from { transform: scale(0.86); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.fields.shake { animation: shake 0.28s linear; }

@media (prefers-reduced-motion: reduce) {
  .tile, .fields.shake { animation: none; }
  .equation-door { display: none; }
}

@media (min-width: 800px) {
  body { padding-top: 48px; }

  .card {
    width: min(100%, 760px);
    padding: 36px 44px 28px;
    border-radius: 32px;
  }

  h1 { font-size: 3.4rem; }

  .lede { font-size: 1.05rem; }

  .equation {
    margin-bottom: 26px;
  }

  .fields {
    flex-direction: row;
    gap: 16px;
  }

  .field { flex: 1; }

  input {
    min-height: 72px;
    font-size: 1.8rem;
  }

  .check {
    width: auto;
    min-width: 200px;
    display: block;
    margin: 16px auto 0;
    min-height: 56px;
    padding: 0 36px;
  }

  .tile { width: 58px; height: 58px; font-size: 1.35rem; }

  .status { font-size: 1.05rem; }

  body.show-intro { padding-top: 24px; }

  .intro-card {
    width: min(100%, 480px);
    padding: 48px 44px 40px;
  }
}

.lang-q {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: clamp(1.55rem, 4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
}

.lang-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}

.lang-choices .check {
  width: 100%;
  min-width: 0;
  margin: 0;
}

@media (max-width: 799px) {
  body { padding: 8px 8px 12px; }
  .card { padding: 16px 14px 12px; border-radius: 22px; }
  .stats { margin-top: 0; font-size: 0.86rem; }
  .lede { margin: 6px 0 8px; }
  .equation { margin: 4px 0 12px; }
  .fields { gap: 8px; }
  .field { gap: 4px; }
  input { min-height: 48px; font-size: 1.3rem; }
  .check { min-height: 48px; margin-top: 10px; }
  .status { min-height: 0; margin: 10px 0 6px; padding: 8px 10px; }
  .meta { margin-bottom: 4px; }
  .history-wrap h2 { margin: 8px 0 4px; }
  .foot { margin-top: 10px; }
}

.howto {
  margin: 18px auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
  max-width: 28rem;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.4;
}
.howto li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.howto .swatch { flex: none; }

.share[hidden] { display: none; }

.share {
  margin-top: 14px;
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 2px solid var(--coral);
  background: transparent;
  color: var(--coral);
  font: 800 1.05rem/1 inherit;
  cursor: pointer;
}
.share:hover { background: #fff1e6; }
.share-note {
  margin: 8px 0 0;
  text-align: center;
  color: var(--ink);
  font-weight: 800;
}
.share-text {
  width: 100%;
  min-height: 9em;
  margin-top: 8px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 600 1rem/1.45 ui-monospace, "Cascadia Mono", monospace;
  padding: 10px 12px;
  resize: vertical;
}
@media (min-width: 800px) {
  .share {
    width: auto;
    min-width: 200px;
    display: block;
    margin: 16px auto 0;
    padding: 0 36px;
  }
}

.ghost {
  margin-top: 10px;
  width: 100%;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--coral);
  font: 800 1.05rem/1 inherit;
  cursor: pointer;
}
.tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0;
}
.mini {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 800 0.92rem/1 inherit;
  cursor: pointer;
  padding: 6px 0;
}
.mini:hover { color: var(--coral); }

.equation.win-flash { animation: binga-win 0.9s ease; }
@keyframes binga-win {
  0% { box-shadow: inset 0 0 0 0 rgba(14, 122, 69, 0); }
  40% { box-shadow: inset 0 0 0 5px rgba(14, 122, 69, 0.45); }
  100% { box-shadow: inset 0 0 0 0 rgba(14, 122, 69, 0); }
}
.steps {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f7f1eb;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}
.steps h3 {
  margin: 10px 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.steps h3:first-child { margin-top: 0; }
.steps p { margin: 0 0 2px; font-variant-numeric: tabular-nums; }
.steps .steps-end { margin-top: 8px; font-weight: 800; }
input.hint-lock {
  background: var(--cream);
  border-style: dashed;
  border-color: #c4b5a6;
}
.pad { display: none; }
.sample-ad {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(36, 28, 22, 0.45);
}
.sample-ad[hidden] { display: none; }
.sample-ad-card {
  width: min(100%, 360px);
  background: #fffaf6;
  border-radius: 24px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}
#ad-step {
  margin: 10px 0 0;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-count {
  margin: 12px 0 0;
  font: 800 2rem/1 Georgia, serif;
  color: var(--coral);
}
@media (max-width: 799px) {
  .pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
  }
  .pad button {
    min-height: 52px;
    border-radius: 12px;
    border: 2px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: 800 1.25rem/1 inherit;
  }
  #hint { margin-top: 8px; }
}
@media (min-width: 800px) {
  #hint {
    width: auto;
    min-width: 160px;
    display: block;
    margin: 10px auto 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .equation.win-flash { animation: none; }
}

.pad[hidden] { display: none !important; }
#hint:disabled:not(.hint-spent) {
  opacity: 0.45;
  cursor: default;
}
#hint.hint-spent {
  visibility: hidden;
  pointer-events: none;
}

.a11y {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 6px 0 0;
}
.mini[aria-pressed="true"] {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mark-word { display: none; }
body.no-color .mark-word:not(:empty) {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--ink);
}
body.no-color .tile {
  height: auto;
  min-height: 52px;
  padding: 4px 2px;
}
body.no-color .tile .mark-word:not(:empty) {
  color: #fff;
  font-size: 0.62rem;
  letter-spacing: 0;
  margin-top: 1px;
}
body.no-color .tile.open .mark-word { display: none; }
body.large-text input {
  min-height: 76px;
  font-size: 1.95rem;
}
body.large-text .status,
body.large-text .lede,
body.large-text .legend,
body.large-text .foot { font-size: 1.12rem; }
body.contrast .card { border: 3px solid #1c140f; }
body.contrast input { border-width: 3px; border-color: #1c140f; }
body.contrast input.green { background: #b6efc9; border-color: #046b32; color: #04210f; }
body.contrast input.blue { background: #c5d7ff; border-color: #08306b; color: #041433; }
body.contrast input.red { background: #ffc7c2; border-color: #8d1212; color: #3b0707; }
body.contrast .tile.green { background: #046b32; color: #fff; }
body.contrast .tile.blue { background: #08306b; color: #fff; }
body.contrast .tile.red { background: #8d1212; color: #fff; }
body.contrast .swatch.green { background: #046b32; }
body.contrast .swatch.blue { background: #08306b; }
body.contrast .swatch.red { background: #8d1212; }
body.contrast .pip { box-shadow: inset 0 0 0 2px #1c140f; }
.ad-actions { display: flex; gap: 10px; margin-top: 16px; }
.ad-actions .check,
.ad-actions .ghost { flex: 1; margin-top: 0; }

.stats-card {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f7f1eb;
  color: var(--ink);
}
.stats-card[hidden] { display: none; }
.stats-card h2 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats-summary { margin: 0; font-weight: 700; }
.dist { list-style: none; margin: 10px 0 0; padding: 0; }
.dist li {
  display: grid;
  grid-template-columns: 1.2rem 1fr 2rem;
  gap: 8px;
  align-items: center;
  margin: 4px 0;
  font-size: 0.85rem;
  font-weight: 700;
}
.dist .bar { height: 10px; border-radius: 99px; background: #eadfd4; overflow: hidden; }
.dist .bar span { display: block; height: 100%; background: var(--coral); border-radius: 99px; }
.sound-pick { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--muted); font-size: 0.92rem; }
.sound-pick[hidden] { display: none; }
.sound-pick select { font: inherit; color: var(--ink); }

.puzzle-no {
  margin: 6px 0 0;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--coral);
}
.freeze-line { margin: 4px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.freeze-note { margin: 6px 0 0; font-weight: 700; color: var(--green); }
.freeze-note[hidden], #freeze-ready[hidden], .blue-tip[hidden] { display: none; }
#freeze-ready { font-weight: 800; color: var(--muted); }
.blue-tip { margin: 8px 0 0; font-weight: 700; color: #124a9a; }
html.dark {
  color-scheme: dark;
  --ink: #e7eef8;
  --muted: #b7c4d6;
  --card: #243044;
  --line: #3a4c66;
  --cream: #2c3a4e;
  --green-soft: #143526;
  --warn: #f0b089;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  background-color: #1a2433;
  background-image:
    linear-gradient(to right, rgba(170, 198, 230, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(170, 198, 230, 0.14) 1px, transparent 1px),
    linear-gradient(to right, rgba(170, 198, 230, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(170, 198, 230, 0.28) 1px, transparent 1px);
}
html.dark .card {
  background: rgba(36, 48, 68, 0.9);
  border-color: rgba(170, 198, 230, 0.18);
}
html.dark .equation { background: #243044; }
html.dark .equation-door {
  background: #1e2a3c;
  box-shadow: -10px 0 18px rgba(0, 0, 0, 0.35);
}
html.dark input,
html.dark .share-text,
html.dark .sound-pick select,
html.dark .pad button {
  background: #1a2433;
  color: var(--ink);
  border-color: #5c7090;
}
html.dark .ghost,
html.dark .mini,
html.dark .share { color: #f0c2b0; }
html.dark .share:hover { background: #2c3a4e; }
html.dark .status,
html.dark .stats-card,
html.dark .sample-ad-card,
html.dark .a11y {
  background: #2c3a4e;
  color: var(--ink);
}
html.dark .dist .bar { background: #3a4c66; }
html.dark .blue-tip { color: #8eb4f0; }
html.dark .steps {
  background: #2c3a4e;
  color: #e7eef8;
}
html.dark .steps h3 { color: #b7c4d6; }
html.dark .pip { background: #3a4c66; }

.next-puzzle {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}
.next-puzzle[hidden] { display: none; }
.week {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
}
.week li {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  background: #eadfd4;
  color: var(--ink);
}
.week li.won { background: var(--green); color: #fff; }
.week li.missed { background: #a32020; color: #fff; }
.week li.open { background: transparent; box-shadow: inset 0 0 0 2px var(--coral); color: var(--coral); }
.stats-card h3 {
  margin: 12px 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
html.dark .week li { background: #3a4c66; color: var(--ink); }
html.dark .week li.won { background: #0e7a45; color: #fff; }
html.dark .week li.missed { background: #8d1212; color: #fff; }

#intro #practice-entry { display: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.actions .check,
.actions .ghost,
.actions .share {
  width: auto;
  flex: 1 1 120px;
  margin-top: 0;
  min-height: 48px;
}
.actions .share[hidden] { display: none; }
.actions .found-eq,
.actions .steps { flex: 1 1 100%; }
.found-eq {
  margin: 4px 0 0;
  text-align: center;
  font: 700 1.25rem/1.35 Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  color: var(--ink);
}
.found-eq[hidden] { display: none; }

@media (max-width: 799px) {
  .equation {
    position: sticky;
    top: 8px;
    z-index: 3;
    margin-bottom: 32px;
  }
  .actions { margin-top: 8px; }
  .pad { margin-top: 16px; }
  body { padding-bottom: 36px; }
  .card { scroll-margin-top: 12px; }
}
#game.fade-in { animation: binga-fade 0.45s ease; }
#howto.fade-out { animation: binga-fade 0.28s ease reverse; }
@keyframes binga-fade { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 520px) {
  .field input { font-size: 36px; min-height: 72px; }
}
body.large-text .field input { font-size: 44px; min-height: 84px; }
@media (prefers-reduced-motion: reduce) {
  #game.fade-in, #howto.fade-out { animation: none; }
}
html.dark .stats-card h2, html.dark .stats-card h3 { color: #b7c4d6; }

.banner-slot {
  margin: 0 0 10px;
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: rgba(255, 247, 240, 0.85);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.dark .banner-slot {
  background: #243044;
  color: #b7c4d6;
  border-color: #3a4c66;
}

html.dark input.green { background: #145c36; color: #e9fff3; border-color: #7dcea0; }
html.dark input.blue { background: #1a3f72; color: #e7f0ff; border-color: #8eb4f0; }
html.dark input.red { background: #6e2420; color: #ffe8e6; border-color: #f0a8a2; }

/* Text size: make the whole game bigger, keyboard included. */
html:has(body.large-text) { font-size: 120%; }
body.large-text button,
body.large-text select,
body.large-text label { font-size: 1.1rem; }
body.large-text .check,
body.large-text #hint,
body.large-text .share { min-height: 60px; font-size: 1.3rem; }
body.large-text .tile { width: 70px; height: 70px; font-size: 1.6rem; }
body.large-text .pad { gap: 10px; }
body.large-text .pad button {
  min-height: 72px;
  font-size: 2rem;
  border-radius: 14px;
}
body.large-text #pad-clear,
body.large-text #pad-next { font-size: 1.35rem; }
body.large-text .tools,
body.large-text .a11y { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
body.large-text .sound-pick select { font-size: 1.1rem; max-width: 100%; }

.privacy-card:focus { outline: 3px solid rgba(227, 154, 116, 0.25); outline-offset: 2px; }
.privacy-card .privacy-date { margin: 0 0 6px; font-weight: 700; color: var(--muted); font-size: 0.85rem; }
.privacy-card .privacy-section p { margin: 2px 0 0; line-height: 1.45; font-size: 0.92rem; }
.privacy-card .privacy-note {
  margin-top: 12px;
  padding: 8px 10px;
  border-left: 4px solid var(--coral);
  border-radius: 8px;
  background: rgba(196, 81, 44, 0.07);
}
.privacy-card .privacy-note h3 { margin-top: 0; }
