/* Yukendo — plain, warm, bold. */

:root {
  --paper: #fbf8f1;
  --paper-2: #fffdf8;
  --ink: #1c1b19;
  --ink-soft: #3b3935;
  --muted: #77715f;
  --line: #ddd6c6;
  --marker: #ffe24a;
  --marker-ink: #1c1b19;
  --peer: #f2ecdd;
  --same: #fdf0b0;
  --marker-soft: #fff6c4;
  --user: #2457c5;
  --red: #d2382a;
  --red-soft: #fbe3df;
  --radius: 10px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171614;
    --paper-2: #1f1e1b;
    --ink: #f4efe3;
    --ink-soft: #d8d2c4;
    --muted: #9c9583;
    --line: #3a3832;
    --marker: #f5d530;
    --marker-ink: #171614;
    --peer: #2f2c25;
    --same: #4a4220;
    --marker-soft: #3a3418;
    --user: #8fb1ff;
    --red: #ff7a68;
    --red-soft: #46241f;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { background: var(--marker); color: var(--marker-ink); text-decoration: none; }

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--user); outline-offset: 2px; }

mark {
  color: var(--marker-ink);
  background:
    linear-gradient(100deg, transparent 0, var(--marker) .12em, var(--marker) calc(100% - .12em), transparent 100%);
  padding: 0 .12em;
  margin: 0 -.04em;
  border-radius: .25em .5em .3em .45em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

kbd {
  font: 600 .72em/1 var(--font);
  border: 1.5px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: .15em .4em;
  color: var(--ink-soft);
  background: var(--paper-2);
}

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

/* ---------- header / footer ---------- */

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 48px);
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.wordmark {
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -.04em;
  text-decoration: none;
}
.wordmark:hover { background: none; color: inherit; }
.dot { color: var(--red); }

header nav { display: flex; align-items: center; gap: clamp(10px, 2.5vw, 28px); font-weight: 600; }
header nav a { text-decoration: none; padding: 2px 4px; border-radius: 4px; }
header nav a[aria-current="page"] { background: var(--marker); color: var(--marker-ink); }

.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.who { color: var(--muted); font-weight: 500; }
.linklike {
  background: none; border: 0; padding: 2px 4px; border-radius: 4px;
  font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.linklike:hover { background: var(--marker); color: var(--marker-ink); text-decoration: none; }

footer.site {
  margin-top: auto;
  padding: 48px 16px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- headlines ---------- */

.headline {
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.05;
  letter-spacing: -.035em;
  font-weight: 900;
  margin: 12px 0 36px;
  text-wrap: balance;
}

.label, .section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 12px;
}
.section-title { margin-top: 56px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); color: var(--ink); }

/* ---------- play layout ---------- */

main.play {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}

.game {
  display: grid;
  grid-template-columns: minmax(0, 580px) minmax(260px, 320px);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.board-col { min-width: 0; }

/* texts for every choice on top of each other, so switching never changes the height */
.stacked { display: grid; }
.stacked > span { grid-area: 1 / 1; visibility: hidden; }
.stacked > span.on { visibility: visible; }

/* the rules of the game, under the headline */
.play .lede { max-width: 580px; margin: -22px 0 26px; color: var(--ink-soft); font-size: 17px; line-height: 1.45; }

/* choosing a new game, on the board itself */
/* While choosing, the chooser takes the board's place: at least square, taller if it needs to be. */
.board-wrap.choosing > .board { display: none; }
.cover.chooser { position: relative; inset: auto; aspect-ratio: 1; gap: 0; background: var(--paper-2); box-shadow: 6px 6px 0 var(--ink); }
.chooser .cover-title { font-size: clamp(28px, 6vw, 44px); margin-bottom: 14px; }
.pick { margin-bottom: 12px; display: flex; flex-direction: column; align-items: center; }
.pick .label { margin: 0 0 7px; }
.pick .levels { gap: 6px; justify-content: center; }
.pick .help-note { min-height: 0; margin-top: 8px; max-width: 34ch; }
.new-warn { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--red); }
.chooser .row { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 4px; flex-wrap: wrap; }
.tag.mode { border-color: var(--line); }

.board-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 34px;
}
.level-label { font-weight: 800; font-size: 20px; letter-spacing: -.01em; white-space: nowrap; }
/* small tags under the level: mode, help taken, mistakes. One fixed-height row, so the board never moves. */
.board-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; margin: -4px 0 12px; }
.board-tags .tag { white-space: nowrap; }
.board-tags .tag[hidden] { display: none; }
.cover-link { margin-top: 12px; font-weight: 700; }
.timer-wrap { display: flex; align-items: center; gap: 10px; }
.timer { font: 700 22px/1 var(--font-num); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }

/* ---------- board ---------- */

.board-wrap { position: relative; }

/* The lines are the gaps between boxes and cells, so thick and thin lines
   never meet as mitred borders. */
.board {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 2.5px;
  aspect-ratio: 1;
  width: 100%;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 6px 6px 0 var(--ink);
}

.box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  font: 500 6.4cqi/1 var(--font-num);
  color: var(--user);
  cursor: pointer;
  transition: background-color .08s;
}

.cell.given { color: var(--ink); font-weight: 700; }
.cell.peer { background: var(--peer); }
.cell.same { background: var(--same); }
.cell.sel { background: var(--marker); color: var(--marker-ink); }
.cell.sel.user { color: var(--marker-ink); }
.cell.conflict { color: var(--red); }
.cell.conflict:not(.sel) { background: var(--red-soft); }
.cell.given.conflict { color: var(--ink); }

/* Yukendo: an n×n grid; cages get a thick line on their right and bottom
   edges (the board's border does the outside). */
.board.cages {
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}
.cages .cell { font-size: calc(57cqi / var(--n)); }
.cages .cell::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 0 solid var(--ink);
  pointer-events: none;
  z-index: 1;
}
.cages .cell.e-r::before { border-right-width: 3px; }
.cages .cell.e-b::before { border-bottom-width: 3px; }
.cage-label {
  position: absolute;
  top: 5%;
  left: 7%;
  z-index: 2;
  font: 700 calc(20cqi / var(--n))/1 var(--font);
  letter-spacing: -.02em;
  color: var(--ink);
  pointer-events: none;
}
.cell.sel .cage-label { color: var(--marker-ink); }
.cages .notes { inset: 30% 5% 4%; font-size: calc(17cqi / var(--n)); }

.cell.pop .v { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: .3; } }

.cell.flash { animation: flash .6s ease-out; }
@keyframes flash { 30% { background: var(--marker); } }

.notes {
  position: absolute;
  inset: 6%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font: 600 2.35cqi/1 var(--font-num);
  color: var(--muted);
}
.notes span { display: grid; place-items: center; }
.notes span.hl { color: var(--marker-ink); background: var(--marker); border-radius: 30%; }

/* overlays on top of the board */
.cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  z-index: 2;
}
.cover[hidden] { display: none; }
.cover.soft { background: color-mix(in srgb, var(--paper) 70%, transparent); font-weight: 600; }
.cover-title { font-size: clamp(40px, 9vw, 72px); font-weight: 900; letter-spacing: -.04em; margin: 0; line-height: 1; }
.cover-time { font: 800 clamp(28px, 6vw, 44px)/1.2 var(--font-num); margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.cover-note { margin: 4px 0 18px; font-size: 18px; color: var(--ink-soft); max-width: 30ch; }
.cover-small { margin: 18px 0 0; font-size: 15px; color: var(--muted); max-width: 34ch; }
.won .cover-title { animation: rise .45s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes rise { from { transform: translateY(14px) rotate(-3deg); opacity: 0; } }

/* ---------- panel ---------- */

.panel { display: flex; flex-direction: column; gap: 32px; padding-top: 46px; }
.block { display: flex; flex-direction: column; gap: 14px; }
.block .label { margin-bottom: 0; }

.levels { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  border: 2px solid var(--ink);
  background: transparent;
  border-radius: 999px;
  padding: 6px 15px;
  font-weight: 700;
  font-size: 16px;
  transition: background-color .1s, transform .1s;
}
.pill:hover { background: var(--marker); color: var(--marker-ink); }
.pill[aria-checked="true"], .pill[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.pill.small { padding: 3px 12px; font-size: 14px; }


.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pad button {
  position: relative;
  aspect-ratio: 1.15;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  font: 700 30px/1 var(--font-num);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s, background-color .1s;
}
.pad button:hover { background: var(--marker); color: var(--marker-ink); }
.pad button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.pad button small {
  position: absolute;
  right: 7px;
  bottom: 5px;
  font: 600 11px/1 var(--font);
  color: var(--muted);
}
.pad button.done { opacity: .28; box-shadow: none; }
.pad.notes-mode button { font-size: 20px; font-weight: 600; color: var(--muted); }
.pad.notes-mode button:hover { color: var(--marker-ink); }
.pad[data-n="4"] { grid-template-columns: repeat(2, 1fr); }

.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}
.tool:hover { background: var(--peer); }
.tool kbd { font-size: 10px; margin-top: 2px; }
.tool-icon { font-size: 22px; line-height: 1.1; }
.tool[aria-pressed="true"] { border-color: var(--ink); background: var(--marker); color: var(--marker-ink); }
.tool[aria-pressed="true"] kbd { color: var(--marker-ink); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
  transition: background-color .1s, color .1s;
}
a.btn { text-decoration: none; }
.btn:hover { background: var(--marker); color: var(--marker-ink); }
.btn.small { padding: 7px 16px; font-size: 15px; }
.btn.wide { width: 100%; }

.hint { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.9; }

/* ---------- stats / forms ---------- */

main.narrow {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
}

.note {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 4px 20px;
  box-shadow: 5px 5px 0 var(--marker);
}

.big-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 40px;
}
.big-numbers > div { display: flex; flex-direction: column; }
.num { font: 900 clamp(48px, 10vw, 84px)/1 var(--font); letter-spacing: -.05em; white-space: nowrap; }
.num small { font-size: .4em; color: var(--muted); letter-spacing: 0; }
.cap { color: var(--muted); font-weight: 600; margin-top: 6px; }

.levels-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.levels-table th { text-align: left; font-size: 14px; color: var(--muted); font-weight: 600; padding: 6px 0; }
.levels-table td { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 19px; }
.levels-table td:first-child { font-weight: 800; }
.levels-table th:not(:first-child), .levels-table td:not(:first-child) { text-align: right; }

.badges {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.badges li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  line-height: 1.35;
  font-size: 16px;
}
.badges li:not(.done) strong { color: var(--muted); }
.badges li.done { border: 2px solid var(--ink); background: var(--paper-2); }
.check {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  font-weight: 900; font-size: 15px;
}
.done .check { background: var(--marker); border-color: var(--ink); color: var(--marker-ink); }

.recent { list-style: none; padding: 0; margin: 0; }
.recent li {
  display: grid;
  grid-template-columns: 1fr auto 9.5em;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.recent .time { font-weight: 700; }
.recent li > :last-child { text-align: right; }

.form-page .lede { font-size: 20px; color: var(--ink-soft); margin-top: -16px; max-width: 34em; }
.form { display: flex; flex-direction: column; gap: 18px; max-width: 420px; margin: 28px 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.form label .muted { font-weight: 500; }
.form input {
  font: 500 18px var(--font);
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
}
.form input:focus { outline: none; box-shadow: 4px 4px 0 var(--marker); }
.form .btn { align-self: flex-start; margin-top: 6px; }
.error {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 700;
}

/* ---------- legal pages & data ---------- */

footer.site .legal { margin-top: 6px; }
footer.site .legal a {
  color: var(--muted);
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent);
  transition: color .15s, text-decoration-color .15s, text-decoration-thickness .15s;
}
footer.site .legal a:hover {
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--marker);
  text-decoration-thickness: 3px;
}

.prose h2 { font-size: 22px; letter-spacing: -.01em; margin: 40px 0 8px; }
.prose p, .prose li { max-width: 40em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 6px 0; }
.prose .stand { margin-top: 40px; font-size: 15px; }
code { font: .88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--peer); padding: .1em .35em; border-radius: 4px; }

.todo { background: var(--red-soft); color: var(--red); font-weight: 700; padding: 0 .25em; border-radius: 4px; }

.store-group { margin-top: 28px; }
.store-where {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink);
  margin: 0 0 12px;
}
.where-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--marker); border: 2px solid var(--ink); flex: none; }

.datum {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 16px 20px 18px;
  margin-bottom: 12px;
}
.datum h4 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.datum-what { margin: 2px 0 14px; color: var(--muted); font-size: 16px; }
.datum dl {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 18px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.datum dt { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.datum dd { margin: 0; font-size: 16px; line-height: 1.45; }

.explain {
  margin-top: 48px;
  padding: 4px 22px 10px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.explain h2 { font-size: 22px; margin: 18px 0 6px; letter-spacing: -.01em; }
.explain h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 6px; }
.explain ul { padding-left: 1.2em; }
.explain li { margin: 6px 0; }

.form-note { margin: 0; font-size: 15px; color: var(--muted); }

.flash-note { margin: -20px 0 28px; padding: 10px 16px; border-radius: var(--radius); background: var(--marker); color: var(--marker-ink); font-weight: 700; display: inline-block; }

.danger { margin-top: 24px; }
.danger summary { cursor: pointer; font-weight: 700; color: var(--red); }
.danger .form { margin-top: 12px; }
.danger-btn { background: var(--red); border-color: var(--red); color: #fff; }
.danger-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- error pages ---------- */

.error-page {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 72px) clamp(16px, 4vw, 48px) 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.err-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  width: clamp(200px, 28vw, 300px);
  aspect-ratio: 1;
  background: var(--line);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(-3deg);
}
.err-box span {
  display: grid;
  place-items: center;
  background: var(--paper-2);
  font: 700 clamp(34px, 5vw, 52px)/1 var(--font-num);
  color: var(--ink);
}
.err-box span.code { background: var(--marker); color: var(--marker-ink); font-weight: 800; }
.err-box span.zero {
  background: var(--red-soft);
  color: var(--red);
  text-decoration: line-through;
  text-decoration-thickness: 4px;
}

.err-code { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.err-text .headline { margin: 0 0 18px; }
.err-lede { font-size: 20px; color: var(--ink-soft); margin: 0 0 30px; max-width: 32em; }
.err-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

/* ---------- Groschen & hints ---------- */

.coin {
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-right: .3em;
  vertical-align: -.08em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3a6 0 18%, var(--marker) 19% 58%, #e0b800 59%);
  border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 15%, transparent);
}
.num .coin { width: .62em; height: .62em; border-width: 4px; vertical-align: .02em; }
.price .coin, .won-earn .coin, .wallet .coin { border-width: 1.5px; box-shadow: none; }
.wallet .coin { width: 14px; height: 14px; }


.tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1.5px solid var(--muted);
  color: var(--muted);
}
.tag.clean { border-color: var(--ink); color: var(--ink); background: var(--marker-soft, transparent); }

.cell.hinted { color: var(--ink); font-weight: 700; }
.cell.hinted::after {
  content: "";
  position: absolute;
  top: 9%;
  right: 9%;
  width: 1.7cqi;
  height: 1.7cqi;
  border-radius: 50%;
  background: var(--marker);
  border: 1.5px solid var(--ink);
}
.cell.wrong { color: var(--red); text-decoration: line-through; text-decoration-thickness: .3cqi; }
.cell.wrong:not(.sel) { background: var(--red-soft); }
.cell.ok { animation: ok 1s ease-out; }
@keyframes ok { 25% { background: #b8e6b0; } }

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  max-width: calc(100% - 32px);
  width: max-content;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 3px 3px 0 var(--ink);
  animation: toast-in .25s cubic-bezier(.2, .9, .3, 1.3);
  text-align: center;
}
.toast[hidden] { display: none; }
.toast.good { background: #d9f2d3; color: #1c1b19; }
.toast.bad { background: var(--red-soft); color: var(--red); }
/* badge earned while playing */
.badge-pop { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; }
.badge-pop[hidden] { display: none; }
.badge-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 48px);
  padding: 20px 30px 18px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--marker);
  color: var(--marker-ink);
  box-shadow: 6px 6px 0 var(--ink);
  text-align: center;
  cursor: pointer;
}
.badge-card.in { animation: badge-in .5s cubic-bezier(.2, .9, .3, 1.4); }
.badge-kicker { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.badge-title { font-size: clamp(22px, 4vw, 30px); font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.badge-reward { font: 700 16px/1 var(--font-num); }
.badge-reward .coin { border-width: 1.5px; box-shadow: none; }
@keyframes badge-in { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }

.confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.confetti i {
  position: absolute;
  width: 8px;
  height: 13px;
  margin: -6px 0 0 -4px;
  background: var(--c);
  border-radius: 2px;
  opacity: 0;
  animation: confetti var(--t) cubic-bezier(.15, .7, .4, 1) forwards;
}
.confetti i.round { width: 9px; height: 9px; border-radius: 50%; }
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0) scale(.4); opacity: 1; }
  35% { transform: translate(var(--dx), var(--dy)) rotate(calc(var(--r) / 2)) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.25), calc(var(--dy) + 240px)) rotate(var(--r)); opacity: 0; }
}

@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

.wallet {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 3px 9px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
}
.wallet strong { font: 800 16px/1 var(--font-num); font-variant-numeric: tabular-nums; display: inline-block; }
.wallet strong.bump { animation: bump .5s ease-out; }
@keyframes bump { 30% { transform: scale(1.35); color: var(--red); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.paid-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -4px; }
.paid {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s, background-color .1s;
}
.paid:hover:not(:disabled) { background: var(--marker); color: var(--marker-ink); }
.paid:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
.paid:disabled { opacity: .35; cursor: default; box-shadow: none; }
.paid .price { font: 800 15px/1 var(--font-num); display: inline-flex; align-items: center; white-space: nowrap; }
.paid .price .coin { width: 13px; height: 13px; margin-right: 3px; }
.paid-label { flex: 1; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.paid kbd { font-size: 10px; white-space: nowrap; }
.help-note { margin: 0; font-size: 14px; color: var(--muted); min-height: 2.7em; line-height: 1.35; }

.won-earn { list-style: none; padding: 0; margin: 0 0 18px; width: min(100%, 300px); font-size: 15px; }
.won-earn:empty { display: none; }
.won-earn li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); text-align: left; }
.won-earn li b { white-space: nowrap; font-family: var(--font-num); }
.won-earn li.badge { font-weight: 700; }
.won-earn li.badge span:first-child { background: var(--marker); color: var(--marker-ink); padding: 0 .3em; border-radius: 4px; }

.small { font-size: 15px; }

.big-numbers.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.big-numbers.four .num { font-size: clamp(40px, 7.5vw, 64px); }

.ledger-box { margin-top: 8px; }
.ledger-box summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ledger-box summary::-webkit-details-marker { display: none; }
.ledger-box summary::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  transform: rotate(-45deg);
  transition: transform .15s;
}
.ledger-box[open] summary::before { transform: rotate(45deg) translate(-2px, -2px); }
.ledger-box summary:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.tag.paper { border-color: var(--ink); color: var(--paper); background: var(--ink); }
.btn.submit { margin-top: 18px; padding: 14px 26px; font-size: 18px; box-shadow: 4px 4px 0 var(--marker); }
.btn.submit[hidden] { display: none; }
.btn.submit:disabled { opacity: .35; cursor: default; box-shadow: none; }
.btn.submit:disabled:hover { background: var(--ink); color: var(--paper); }
.badge-group.paper .section-title::before { content: "✎ "; }
.badge-group.paper .badges li.done { box-shadow: 4px 4px 0 var(--marker); }
.tag.relaxed { border-color: var(--ink); color: var(--ink); }
.tag.relaxed.has { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.badge-group.relaxed .section-title::before { content: "○ "; }
.badge-group.yukendo .section-title::before { content: "▦ "; }
.badge-group.yukendo .badges li.done { box-shadow: 4px 4px 0 var(--user); }
.sub-title { font-size: 15px; font-weight: 800; margin: 26px 0 4px; }
.badge-group.relaxed .badges li.done { box-shadow: 4px 4px 0 var(--red-soft); }

.section-title .count { float: right; letter-spacing: .04em; color: var(--muted); }

/* In badge groups the line under the title is a progress bar: one segment
   per badge, unlocked ones first. They fill one after another on load. */
.badge-group .section-title { border-bottom: 0; margin-bottom: 0; }
.bar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  height: 6px;
  margin: 0 0 16px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--line);
}
.bar i { background: linear-gradient(var(--ink), var(--ink)) left / 0 100% no-repeat; }
.bar i.on { background-size: 100% 100%; animation: fill-up 0.08s linear backwards; }
.badge-group.complete .bar i.on { background-image: linear-gradient(var(--marker), var(--marker)); }
.badge-group.complete .bar { box-shadow: inset 0 0 0 1px var(--ink); }
@keyframes fill-up { from { background-size: 0 100%; } }
.bar i:nth-child(1) { animation-delay: 0.20s; }
.bar i:nth-child(2) { animation-delay: 0.28s; }
.bar i:nth-child(3) { animation-delay: 0.36s; }
.bar i:nth-child(4) { animation-delay: 0.44s; }
.bar i:nth-child(5) { animation-delay: 0.52s; }
.bar i:nth-child(6) { animation-delay: 0.60s; }
.bar i:nth-child(7) { animation-delay: 0.68s; }
.bar i:nth-child(8) { animation-delay: 0.76s; }
.bar i:nth-child(9) { animation-delay: 0.84s; }
.bar i:nth-child(10) { animation-delay: 0.92s; }
.bar i:nth-child(11) { animation-delay: 1.00s; }
.bar i:nth-child(12) { animation-delay: 1.08s; }
.bar i:nth-child(13) { animation-delay: 1.16s; }
.bar i:nth-child(14) { animation-delay: 1.24s; }
.bar i:nth-child(15) { animation-delay: 1.32s; }
.bar i:nth-child(16) { animation-delay: 1.40s; }
.bar i:nth-child(17) { animation-delay: 1.48s; }
.bar i:nth-child(18) { animation-delay: 1.56s; }
.bar i:nth-child(19) { animation-delay: 1.64s; }
.bar i:nth-child(20) { animation-delay: 1.72s; }
.group-note { margin: -2px 0 16px; color: var(--muted); font-size: 16px; }
.badge-body { display: flex; flex-direction: column; gap: 2px; }
.badge-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.reward { font: 700 13px/1 var(--font-num); color: var(--ink); }
.badges li:not(.done) .reward { color: var(--muted); }

.badge-group.pure .badges li.done { box-shadow: 4px 4px 0 var(--user); }
.badge-group.pure .section-title::before { content: "◇ "; }
.badge-group.secret .section-title::before { content: "✦ "; }
.badges li.hidden { background: repeating-linear-gradient(-45deg, transparent 0 8px, color-mix(in srgb, var(--line) 35%, transparent) 8px 16px); }
.badges li.hidden strong { letter-spacing: .2em; }
.badges li.hidden .muted { font-style: italic; }
.badge-group.secret .badges li.done { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge-group.secret .badges li.done .muted, .badge-group.secret .badges li.done .badge-meta, .badge-group.secret .badges li.done .reward { color: color-mix(in srgb, var(--paper) 75%, transparent); }

.explain.tight { margin-top: 0; }
.explain.tight p { margin: 12px 0; }

.ledger { list-style: none; padding: 0; margin: 0; font-variant-numeric: tabular-nums; }
.ledger li { display: grid; grid-template-columns: 1fr auto 9.5em; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.ledger .amount { font: 700 16px var(--font-num); }
.ledger .amount.minus { color: var(--red); }
.ledger li > :last-child { text-align: right; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .game { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .board-col { max-width: 580px; width: 100%; margin: 0 auto; }
  .panel { padding-top: 0; max-width: 580px; width: 100%; margin: 0 auto; gap: 22px; }
  .pad, .pad[data-n] { grid-template-columns: repeat(var(--n, 9), 1fr); gap: 5px; }
  .pad button { aspect-ratio: auto; height: clamp(46px, 13vw, 58px); font-size: 24px; border-radius: 8px; box-shadow: 2px 2px 0 var(--ink); }
  .pad button small { right: 0; left: 0; bottom: 4px; text-align: center; font-size: 10px; }
  .pad.notes-mode button { font-size: 18px; }
  .headline { margin-bottom: 24px; }
  .page-play .headline { display: none; }
  .page-play .lede { margin: 0 auto 16px; font-size: 15px; }
  .board { box-shadow: 4px 4px 0 var(--ink); }
  .hint { display: none; }
  .error-page { grid-template-columns: 1fr; justify-items: start; }
  .err-box { width: 200px; }
}

@media (max-width: 520px) {
  body { font-size: 17px; }
  /* logo on top, the four links in a row below it */
  header.site { padding: 14px 16px 6px; flex-wrap: wrap; row-gap: 8px; }
  .wordmark { font-size: 24px; }
  header nav { flex: 1 1 100%; justify-content: space-between; gap: 4px; font-size: 15px; }
  .who { display: none; }
  .tool kbd, .paid kbd { display: none; }
  .board-meta { flex-wrap: wrap; row-gap: 8px; }
  .levels { gap: 6px; }
  .pill { padding: 5px 11px; font-size: 15px; }
  .big-numbers { gap: 8px; }
  .big-numbers.four { grid-template-columns: repeat(2, 1fr); row-gap: 24px; }
  .ledger li { grid-template-columns: 1fr auto; }
  .ledger li > :last-child { grid-column: 1 / -1; text-align: left; margin-top: -8px; font-size: 13px; }
  .recent li { grid-template-columns: 1fr auto; }
  .recent li > :last-child { grid-column: 1 / -1; text-align: left; margin-top: -12px; font-size: 14px; }
  .datum { padding: 14px 16px 16px; }
  .datum dl { grid-template-columns: 1fr; gap: 12px; }
}

/* running games, shown on every page but the boards: one row per game */
.running {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
}
.running[hidden], .running-row[hidden] { display: none; }
.running-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 8px 10px 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-2);
  box-shadow: 4px 4px 0 var(--ink);
  animation: running-in .3s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes running-in { from { translate: 0 12px; opacity: 0; } }
.running-info { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.running-text { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.running-text span { color: var(--muted); }
.running-time { font: 700 18px/1 var(--font-num); font-variant-numeric: tabular-nums; }
.running-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.running-time { color: var(--muted); }
.running .btn.small { padding: 6px 14px; font-size: 15px; white-space: nowrap; }
body.has-running footer.site { padding-bottom: 150px; }
@media (max-width: 600px) {
  .running { left: 16px; right: 16px; width: auto; max-width: none; transform: none; align-items: stretch; }
  .running-row { border-radius: 18px; gap: 8px; flex-wrap: wrap; }
  .running-info { flex: 1 1 100%; }
  .running .pill, .running .btn.small { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- how to play: folded on the game pages, whole on /anleitung ---------- */
.howto-body h3 { font-size: 17px; font-weight: 800; margin: 20px 0 6px; }
.howto-body p, .howto-body li { font-size: 16px; line-height: 1.5; }
.howto-steps, .howto-list { padding-left: 22px; margin: 6px 0 12px; }
.howto-steps li, .howto-list li { margin-bottom: 7px; }
.howto-tip { padding: 10px 14px; border-radius: 8px; background: var(--marker-soft); font-size: 15px !important; }
.howto-caption { margin-top: 6px; font-size: 14px !important; color: var(--muted); }

/* a Sudoku row, one gap */
.strip {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  max-width: 330px;
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.strip span { display: grid; place-items: center; aspect-ratio: 1; background: var(--paper-2); font: 700 18px/1 var(--font-num); }
.strip .gap { background: var(--marker); color: var(--marker-ink); }

/* single two-cell cages */
.cage-examples { list-style: none; padding: 0; display: grid; gap: 10px; margin: 10px 0 14px; }
.cage-examples li { display: flex; align-items: center; gap: 14px; margin: 0; }
.cage-ex {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, 44px);
  height: 44px;
  gap: 1px;
  border: 3px solid var(--ink);
  border-radius: 4px;
  background: var(--line);
}
.cage-ex b { display: grid; place-items: center; padding-top: 6px; background: var(--paper-2); font: 600 20px/1 var(--font-num); color: var(--user); }
.cage-ex i { position: absolute; top: 3px; left: 4px; z-index: 1; font: 700 11px/1 var(--font); font-style: normal; color: var(--ink); }

/* the 4×4 example, drawn with the real board's styles */
.howto-example { display: flex; flex-wrap: wrap; gap: 22px; margin: 10px 0 6px; }
.howto-example figure { margin: 0; }
.howto-example figcaption { margin-top: 10px; text-align: center; font-size: 14px; color: var(--muted); }
.mini-board { width: 200px; }
.mini4 { --n: 4; }
.mini-board .board { box-shadow: 4px 4px 0 var(--ink); }
.mini-board .cell { cursor: default; }

.howto-page .howto-lede { font-size: 19px; color: var(--ink-soft); margin: -16px 0 18px; max-width: 34em; }
.howto-jump { display: flex; flex-wrap: wrap; gap: 8px; }
.howto-jump .pill { text-decoration: none; }
#spielen .howto-body > h3:first-child, .guide-play .howto-body > h3:first-child { display: none; } /* the section title says it already */
.howto-page section .btn { margin-top: 6px; }

@media (max-width: 860px) {
  .guide-hint { margin: 0 auto 14px; }
  .mini-board { width: min(200px, calc(50vw - 52px)); }
  .howto-example { gap: 14px; }
}

/* "?" in the header: opens the guide */
.guide-btn {
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: 900 15px/1 var(--font);
}
.guide-btn:hover { background: var(--marker); color: var(--marker-ink); }
.guide-hint { max-width: 580px; margin: -20px 0 22px; font-size: 15px; color: var(--muted); }
.guide-hint .linklike { font-weight: 700; color: var(--ink); }

/* the guide: a drawer from the right that opens like the cover of a book */
.guide {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(640px, 100%);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  border-left: 3px solid var(--ink);
  background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 9%, transparent), transparent 16px), var(--paper);
  color: var(--ink);
  box-shadow: -8px 0 0 color-mix(in srgb, var(--ink) 15%, transparent);
}
.guide[open] {
  display: flex;
  flex-direction: column;
  transform-origin: 0 50%;
  animation: guide-open .55s cubic-bezier(.2, .8, .25, 1);
}
.guide::backdrop { background: color-mix(in srgb, var(--paper) 55%, transparent); backdrop-filter: blur(2px); animation: guide-fade .3s ease-out; }
@keyframes guide-open {
  from { transform: perspective(1600px) rotateY(-75deg); opacity: .2; }
  45% { opacity: 1; }
  to { transform: perspective(1600px) rotateY(0); }
}
@keyframes guide-fade { from { opacity: 0; } }
.guide-bar { flex: none; display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 2px solid var(--ink); }
.guide-title { flex: 1; margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -.035em; }
.guide-bar form { margin: 0; }
.guide-bar .btn kbd { margin-left: 6px; }
.guide-page { font-size: 15px; }
.guide-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 32px; }
.guide-body .section-title { margin-top: 28px; }

.keys { display: grid; gap: 8px; margin: 12px 0 0; }
.keys > div { display: grid; grid-template-columns: 11em 1fr; gap: 12px; align-items: baseline; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; font-size: 15px; }

@media (max-width: 600px) {
  .guide-bar { padding: 12px 16px; gap: 10px; }
  .guide-title { font-size: 24px; }
  .guide-page { display: none; }
  .guide-bar .btn kbd { display: none; }
  .guide-body { padding: 0 16px 28px; }
  .keys > div { grid-template-columns: 1fr; gap: 2px; }
}
