/* Shared styles for jjs.dk and its daily games. */
:root {
  --bg: #f4f6f9;
  --fg: #1a1a2e;
  --muted: #5b6275;
  --card: #ffffff;
  --border: #e2e6ea;
  --accent: #2f6fed;
  --accent-2: #ff7a59;
  --blob-1: #c9d8ff;
  --blob-2: #ffd9cc;
  --robot: #e9edf7;
  --robot-shade: #cfd6e6;
  --screen: #1a1a2e;

  /* Feedback colours differ in brightness as well as hue, so they stay apart with colour
     blindness: dark green, bright yellow (dark letters), dark grey. */
  --correct: #2e8540;
  --present: #f5c542;
  --present-fg: #1a1a2e;
  --present-text: #946c00;
  --absent: #3d4147;
  --tile-border: #d3d6da;
  --tile-border-filled: #878a8c;
  --key-bg: #dde2ea;
  --key-fg: #1a1a2e;
  /* Wordle keyboard: unused keys stay bright, used (absent) letters fade clearly into the background. */
  --kb-bg: #d9dee7;
  --kb-fg: #1a1a2e;
  --kb-used-bg: #3d4147;
  --kb-used-fg: #a9adb4;
  --good: #2e9d57;
  --bad: #d64545;
  --miss: #a3336b;
  --btn-fg: #ffffff;
  --shadow: 0 8px 30px rgba(20, 24, 50, .07);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11121c;
    --fg: #eef0f6;
    --muted: #9aa1b5;
    --card: #1a1b29;
    --border: #2a2c3f;
    --accent: #6f9bff;
    --accent-2: #ff9a7f;
    --blob-1: #1f2d5c;
    --blob-2: #4a2a26;
    --robot: #d9deeb;
    --robot-shade: #aeb6ca;
    --screen: #0b0c14;

    --correct: #2f8a40;
    --present: #f5c842;
    --present-fg: #1a1a2e;
    --present-text: #f5c842;
    --absent: #3a3a3c;
    --tile-border: #3a3b4c;
    --tile-border-filled: #6b6d80;
    --key-bg: #2f3244;
    --key-fg: #eef0f6;
    --kb-bg: #666b85;
    --kb-fg: #ffffff;
    --kb-used-bg: #1b1c26;
    --kb-used-fg: #6d7185;
    --good: #4cc27a;
    --bad: #ff6b6b;
    --miss: #a3336b;
    --btn-fg: #0b0c14;
    --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--btn-fg);
  font-weight: 650;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; filter: none; transform: none; }
.btn-secondary { background: var(--card); color: var(--fg); border-color: var(--border); }
.btn-good { background: var(--good); }
.btn-bad { background: var(--bad); }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--muted); }

/* ── Game page chrome ─────────────────────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.topbar-home { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.topbar-home:hover { color: var(--fg); }
.topbar-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px; text-align: center; }
.topbar-actions { display: flex; gap: 8px; justify-content: flex-end; }
.game {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.subtitle { color: var(--muted); font-size: .9rem; text-align: center; }
.loading { color: var(--muted); padding: 40px 0; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 650;
  font-size: .92rem;
  box-shadow: var(--shadow);
  animation: toast-in .15s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ── Modal ────────────────────────────────────────────────────────────────── */
dialog.modal {
  margin: auto;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--fg);
  padding: 24px 22px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog.modal::backdrop { background: rgba(10, 12, 25, .55); }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { background: var(--bg); color: var(--fg); }
.modal h2 { font-size: 1.3rem; margin-bottom: 12px; padding-right: 32px; }
.modal h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 18px 0 8px; }
.modal p { margin-bottom: 10px; }
.modal ul { margin: 0 0 10px 20px; }
.modal li { margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
.answer-reveal { font-size: 1.1rem; margin-bottom: 4px; }
.answer-reveal strong { text-transform: uppercase; letter-spacing: 2px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .72rem; color: var(--muted); }

.dist { display: grid; gap: 4px; }
.dist-row { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; font-size: .85rem; }
.dist-bar {
  background: var(--absent);
  color: #fff;
  font-weight: 700;
  text-align: right;
  padding: 1px 8px;
  border-radius: 4px;
  min-width: 26px;
  width: var(--w, 0%);
}
.dist-bar.hl { background: var(--correct); }

.countdown { text-align: center; margin-top: 14px; color: var(--muted); font-size: .9rem; }
.countdown strong { display: block; font-size: 1.5rem; color: var(--fg); font-variant-numeric: tabular-nums; }

/* ── Wordle ───────────────────────────────────────────────────────────────── */
.board {
  --tile: min(60px, calc((100vw - 32px - (var(--len) - 1) * 6px) / var(--len)), calc((100dvh - 340px) / var(--rows) - 6px));
  display: grid;
  grid-template-rows: repeat(var(--rows), var(--tile));
  gap: 6px;
  margin: 4px 0;
}
.board-row { display: grid; grid-template-columns: repeat(var(--len), var(--tile)); gap: 6px; }
.board-row.shake { animation: shake .45s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--tile-border);
  font-size: calc(var(--tile) * .52);
  font-weight: 800;
  text-transform: uppercase;
  user-select: none;
}
.tile.filled { border-color: var(--tile-border-filled); animation: pop .1s; }
@keyframes pop { 50% { transform: scale(1.1); } }
.tile.correct, .tile.present, .tile.absent { color: #fff; border-color: transparent; }
.tile.correct { background: var(--correct); }
.tile.present { background: var(--present); color: var(--present-fg); }
.tile.absent { background: var(--absent); }
.tile.flip { animation: flip .5s ease both; animation-delay: calc(var(--i) * 220ms); }
@keyframes flip {
  0% { transform: rotateX(0); background: var(--card); color: var(--fg); border-color: var(--tile-border-filled); }
  49% { background: var(--card); color: var(--fg); border-color: var(--tile-border-filled); }
  50% { transform: rotateX(-90deg); }
  100% { transform: rotateX(0); }
}
.tile.win { animation: bounce .5s ease; animation-delay: calc(var(--i) * 90ms); }
@keyframes bounce { 40% { transform: translateY(-18px); } 70% { transform: translateY(4px); } }

.keyboard { width: 100%; max-width: 500px; display: grid; gap: 7px; margin-top: auto; user-select: none; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1 1 0;
  min-width: 0;
  height: 54px;
  border: 0;
  border-radius: 6px;
  background: var(--kb-bg);
  color: var(--kb-fg);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}
.key.wide { flex: 1.6 1 0; font-size: .75rem; }
.key.correct { color: #fff; }
.key.correct { background: var(--correct); }
.key.present { background: var(--present); color: var(--present-fg); }
.key.absent { background: var(--kb-used-bg); color: var(--kb-used-fg); }
.key:active { filter: brightness(.9); }

.tabs { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.tab {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
  font-weight: 650;
  font-size: .9rem;
  cursor: pointer;
  color: var(--muted);
}
.tab[aria-selected="true"] { background: var(--accent); color: var(--btn-fg); }
.tab .done { margin-left: 4px; }

/* ── Flagle ───────────────────────────────────────────────────────────────── */
.flag-frame {
  position: relative;
  width: min(360px, 100%);
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card);
}
.flag-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.flag-tiles { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.flag-tile {
  background: var(--key-bg);
  border: 1px solid var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 800;
  font-size: 1.4rem;
  transition: opacity .6s ease, transform .6s ease;
}
.flag-tile.open { opacity: 0; transform: scale(.85); }
.guess-form { position: relative; width: min(360px, 100%); display: flex; gap: 8px; }
.guess-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
}
.guess-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 230px;
  overflow-y: auto;
  z-index: 10;
}
.suggestions li { padding: 9px 14px; cursor: pointer; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--bg); }
.guess-list { width: min(360px, 100%); display: grid; gap: 6px; }
.guess-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: .92rem;
}
.guess-item.hit { border-color: var(--correct); background: color-mix(in srgb, var(--correct) 18%, var(--card)); }
.guess-item.empty { color: var(--muted); border-style: dashed; background: transparent; }
.guess-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess-dist, .guess-prox { font-variant-numeric: tabular-nums; color: var(--muted); }
.guess-arrow { display: inline-block; width: 1.3em; text-align: center; }

/* ── Cutle ────────────────────────────────────────────────────────────────── */
.cut-stage {
  width: min(460px, 100%);
  aspect-ratio: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  cursor: crosshair;
  overflow: hidden;
}
.cut-stage svg { width: 100%; height: 100%; display: block; }
.cut-stage.locked { cursor: default; }
.cut-shape { fill: var(--accent); }
.cut-half { transition: transform .6s cubic-bezier(.2, .9, .3, 1.2); }
.cut-half.a { fill: var(--accent); }
.cut-half.b { fill: var(--accent-2); }
.cut-line { stroke: var(--fg); stroke-width: 4; stroke-dasharray: 14 10; stroke-linecap: round; }
.cut-label {
  font-size: 54px;
  font-weight: 800;
  fill: var(--fg);
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 10px;
  text-anchor: middle;
  dominant-baseline: middle;
}
.attempts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.attempt {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.attempt.best { border-color: var(--correct); font-weight: 700; }
.attempt.empty { color: var(--muted); border-style: dashed; background: transparent; }

/* ── Higher / lower ───────────────────────────────────────────────────────── */
.hl-category { text-align: center; }
.hl-category strong { display: block; font-size: 1.15rem; }
.hl-score { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.hl-cards { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.hl-vs {
  align-self: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .8rem;
  transition: background .3s ease, color .3s ease;
}
.hl-vs.good { background: var(--good); color: #fff; border-color: transparent; }
.hl-vs.bad { background: var(--bad); color: #fff; border-color: transparent; }
.hl-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  animation: card-in .35s ease;
}
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } }
.hl-card img { width: 100%; max-width: 160px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.hl-name { font-weight: 750; font-size: 1.05rem; line-height: 1.2; }
.hl-value { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 1.6em; }
.hl-unit { font-size: .8rem; color: var(--muted); }
.hl-buttons { display: grid; gap: 8px; width: 100%; margin-top: 4px; }
.hl-progress { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.hl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.hl-dot.good { background: var(--good); }
.hl-dot.bad { background: var(--bad); }
@media (max-width: 520px) {
  .hl-cards { grid-template-columns: 1fr; }
  .hl-vs { justify-self: center; }
  .hl-card { flex-direction: row; text-align: left; flex-wrap: wrap; }
  .hl-card img { width: 90px; }
  .hl-card .hl-info { flex: 1; min-width: 0; }
  .hl-buttons { grid-template-columns: 1fr 1fr; }
}

/* ── Results ──────────────────────────────────────────────────────────────── */
.results { max-width: 760px; }
.result-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  scroll-margin-top: 16px;
}
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.result-head h2 { font-size: 1.1rem; }
.result-head a { margin-left: auto; font-size: .88rem; font-weight: 600; text-decoration: none; }
.history { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .88rem; }
.history th { text-align: left; color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; padding: 4px 0; }
.history td { padding: 6px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.history td:last-child, .history th:last-child { text-align: right; }
.muted { color: var(--muted); }
.won { color: var(--good); font-weight: 700; }
.lost { color: var(--bad); font-weight: 700; }

/* ── Game icons ───────────────────────────────────────────────────────────── */
.game-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}
.game-icon.wordle { background: var(--correct); }
.game-icon.woerdle { background: var(--present); color: var(--present-fg); }
.game-icon.flagle { background: #e0524f; }
.game-icon.cutle { background: var(--accent); }
.game-icon.hl { background: #8a5cf6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ── Pokédle ──────────────────────────────────────────────────────────────── */
.game.game-wide { max-width: 800px; }
.pk-grid { width: 100%; overflow-x: auto; padding-bottom: 6px; }
.pk-rows { display: grid; gap: 6px; }
.pk-row {
  --cell: 74px;
  display: grid;
  grid-template-columns: 96px repeat(8, var(--cell));
  gap: 6px;
  width: max-content;
  margin: 0 auto;
}
.pk-head { margin-bottom: 6px; }
.pk-head div {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  text-align: center;
  border-bottom: 2px solid var(--border);
  padding-bottom: 4px;
}
.pk-tile {
  height: var(--cell);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
  hyphens: auto;
  overflow-wrap: anywhere;
}
.pk-tile.hit { background: var(--correct); }
.pk-tile.partial { background: var(--present); color: var(--present-fg); }
.pk-tile.miss { background: var(--miss); }
.pk-tile.pk-name { background: var(--card); color: var(--fg); border: 1px solid var(--border); }
.pk-tile.pk-name.hit { border-color: var(--correct); box-shadow: inset 0 0 0 2px var(--correct); }
.pk-tile.pk-name strong { font-size: .8rem; }
.pk-tile.pk-name span { font-weight: 500; color: var(--muted); font-size: .7rem; }
.pk-arrow { font-size: 1.1rem; line-height: 1; margin-top: 2px; }
.pk-flip { animation: pk-in .45s ease both; animation-delay: calc(var(--i) * 120ms); }
@keyframes pk-in { from { transform: rotateY(90deg); opacity: 0; } to { transform: rotateY(0); opacity: 1; } }
.pk-hints { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pk-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 150px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--fg);
  font-size: .8rem;
  cursor: pointer;
}
.pk-hint span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; }
.pk-hint:disabled { cursor: default; opacity: .7; }
.pk-hint:not(:disabled):not(.open) { border-color: var(--accent); }
.pk-hint.open { border-style: solid; background: var(--card); }
.pk-legal { font-size: .72rem; color: var(--muted); text-align: center; max-width: 52ch; margin-top: auto; }
.game-icon.poke { background: #e4572e; }


/* ── Language toggle ──────────────────────────────────────────────────────── */
.lang-toggle {
  display: inline-flex;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}
.lang-toggle button {
  border: 0;
  background: transparent;
  padding: 0 9px;
  font-weight: 700;
  font-size: .78rem;
  color: var(--muted);
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--btn-fg); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.topbar { grid-template-columns: auto 1fr auto; }
.topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 6px; }
  .topbar-title { font-size: 1.1rem; }
  .topbar .icon-btn { width: 34px; height: 34px; }
  .topbar .lang-toggle { height: 34px; }
  .topbar .lang-toggle button { padding: 0 7px; }
}

/* ── Logo tiles (front page and 404) ──────────────────────────────────────── */
.logo-tiles { --lt: 56px; display: flex; align-items: center; justify-content: center; gap: calc(var(--lt) * .12); perspective: 400px; }
.lt {
  width: var(--lt);
  height: var(--lt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--lt) * .55);
  font-weight: 800;
  color: #fff;
  border-radius: calc(var(--lt) * .1);
  box-shadow: 0 4px 14px rgba(20, 24, 50, .16);
  animation: lt-flip .6s ease both;
  animation-delay: calc(var(--i, 0) * 140ms + 150ms);
}
.lt.correct { background: var(--correct); }
.lt.present { background: var(--present); color: var(--present-fg); }
.lt.absent { background: var(--absent); }
.lt-dot {
  width: calc(var(--lt) * .18);
  height: calc(var(--lt) * .18);
  border-radius: 50%;
  background: var(--fg);
  align-self: flex-end;
  margin-bottom: calc(var(--lt) * .06);
  animation: lt-pop .3s ease both;
  animation-delay: calc(var(--i, 0) * 140ms + 250ms);
}
.logo-tiles.small { --lt: 64px; margin-bottom: 12px; }
@keyframes lt-flip { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }
@keyframes lt-pop { from { transform: scale(0); } }

/* ── Game backgrounds ─────────────────────────────────────────────────────── */
body.bg { background-image: var(--pattern, none); background-attachment: fixed; }
.tile { background: var(--card); }
.bg-wordle { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill-opacity='0.14'%3E%0A  %3Crect x='14' y='18' width='30' height='30' rx='5' fill='%236aaa64' transform='rotate(-8 29 33)'/%3E%0A  %3Crect x='98' y='44' width='30' height='30' rx='5' fill='%23c9b458' transform='rotate(10 113 59)'/%3E%0A  %3Crect x='52' y='106' width='30' height='30' rx='5' fill='%23787c7e' transform='rotate(-4 67 121)'/%3E%0A  %3Crect x='128' y='120' width='20' height='20' rx='4' fill='%236aaa64' transform='rotate(14 138 130)'/%3E%3C/g%3E%3C/svg%3E"); }
.bg-woerdle { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cg opacity='0.16' font-family='sans-serif' font-weight='800' font-size='20' fill='%23ffffff' text-anchor='middle'%3E%0A  %3Crect x='14' y='18' width='32' height='32' rx='5' fill='%236aaa64' transform='rotate(-8 30 34)'/%3E%3Ctext x='30' y='41' transform='rotate(-8 30 34)'%3E%C3%86%3C/text%3E%0A  %3Crect x='104' y='46' width='32' height='32' rx='5' fill='%23c9b458' transform='rotate(10 120 62)'/%3E%3Ctext x='120' y='69' transform='rotate(10 120 62)'%3E%C3%98%3C/text%3E%0A  %3Crect x='54' y='112' width='32' height='32' rx='5' fill='%23c8102e' transform='rotate(-4 70 128)'/%3E%3Ctext x='70' y='135' transform='rotate(-4 70 128)'%3E%C3%85%3C/text%3E%3C/g%3E%3C/svg%3E"); }
.bg-flagle { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg opacity='0.2'%3E%0A  %3Cpath d='M22 18v40' stroke='%235b6275' stroke-width='2.5'/%3E%3Cpath d='M23 19h26l-7 8 7 8h-26z' fill='%23e0524f'/%3E%0A  %3Cpath d='M112 70v40' stroke='%235b6275' stroke-width='2.5'/%3E%3Cpath d='M113 71h26l-7 8 7 8h-26z' fill='%233e7bfa'/%3E%0A  %3Cpath d='M52 122v40' stroke='%235b6275' stroke-width='2.5'/%3E%3Cpath d='M53 123h26l-7 8 7 8h-26z' fill='%232f9e5e'/%3E%0A  %3Ccircle cx='150' cy='22' r='3' fill='%235b6275'/%3E%3Ccircle cx='88' cy='36' r='2' fill='%235b6275'/%3E%3Ccircle cx='150' cy='150' r='2.5' fill='%235b6275'/%3E%3C/g%3E%3C/svg%3E"); }
.bg-hl { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg opacity='0.12'%3E%0A  %3Cpath d='M30 16l14 20h-28z' fill='%232e9d57'/%3E%3Cpath d='M100 88l14-20h-28z' fill='%23d64545'/%3E%0A  %3Cpath d='M104 20l9 13h-18z' fill='%232e9d57'/%3E%3Cpath d='M36 118l9-13h-18z' fill='%23d64545'/%3E%3C/g%3E%3C/svg%3E"); }
.bg-cutle {
  background-color: #e3eee6;
  --pattern:
    linear-gradient(rgba(35, 105, 65, .24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 105, 65, .24) 1px, transparent 1px),
    linear-gradient(rgba(35, 105, 65, .1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 105, 65, .1) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}
.bg-pokedle {
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cg opacity='0.35'%3E%0A  %3Cpath d='M40 30l3 9 9 3-9 3-3 9-3-9-9-3 9-3z' fill='%23f2c230'/%3E%0A  %3Cpath d='M150 70l2 6 6 2-6 2-2 6-2-6-6-2 6-2z' fill='%236f9bff'/%3E%0A  %3Cpath d='M90 150l2.5 7.5 7.5 2.5-7.5 2.5-2.5 7.5-2.5-7.5-7.5-2.5 7.5-2.5z' fill='%23f2c230'/%3E%0A  %3Ccircle cx='170' cy='170' r='3' fill='%236f9bff'/%3E%3Ccircle cx='20' cy='120' r='2.5' fill='%236f9bff'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #e7f1ff 0%, #f3f7f0 55%, #dcefd3 100%);
}
.bg-mastermind {
  background-color: #efe3cf;
  --pattern: radial-gradient(circle, rgba(110, 72, 36, .22) 3px, transparent 4px);
  background-size: 30px 30px;
}
@media (prefers-color-scheme: dark) {
  .bg-wordle { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill-opacity='0.2'%3E%0A  %3Crect x='14' y='18' width='30' height='30' rx='5' fill='%23538d4e' transform='rotate(-8 29 33)'/%3E%0A  %3Crect x='98' y='44' width='30' height='30' rx='5' fill='%23b59f3b' transform='rotate(10 113 59)'/%3E%0A  %3Crect x='52' y='106' width='30' height='30' rx='5' fill='%236b6d80' transform='rotate(-4 67 121)'/%3E%0A  %3Crect x='128' y='120' width='20' height='20' rx='4' fill='%23538d4e' transform='rotate(14 138 130)'/%3E%3C/g%3E%3C/svg%3E"); }
  .bg-woerdle { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cg opacity='0.18' font-family='sans-serif' font-weight='800' font-size='20' fill='%2311121c' text-anchor='middle'%3E%0A  %3Crect x='14' y='18' width='32' height='32' rx='5' fill='%23538d4e' transform='rotate(-8 30 34)'/%3E%3Ctext x='30' y='41' transform='rotate(-8 30 34)'%3E%C3%86%3C/text%3E%0A  %3Crect x='104' y='46' width='32' height='32' rx='5' fill='%23b59f3b' transform='rotate(10 120 62)'/%3E%3Ctext x='120' y='69' transform='rotate(10 120 62)'%3E%C3%98%3C/text%3E%0A  %3Crect x='54' y='112' width='32' height='32' rx='5' fill='%23a50e26' transform='rotate(-4 70 128)'/%3E%3Ctext x='70' y='135' transform='rotate(-4 70 128)'%3E%C3%85%3C/text%3E%3C/g%3E%3C/svg%3E"); }
  .bg-flagle { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg opacity='0.22'%3E%0A  %3Cpath d='M22 18v40' stroke='%239aa1b5' stroke-width='2.5'/%3E%3Cpath d='M23 19h26l-7 8 7 8h-26z' fill='%23e0524f'/%3E%0A  %3Cpath d='M112 70v40' stroke='%239aa1b5' stroke-width='2.5'/%3E%3Cpath d='M113 71h26l-7 8 7 8h-26z' fill='%233e7bfa'/%3E%0A  %3Cpath d='M52 122v40' stroke='%239aa1b5' stroke-width='2.5'/%3E%3Cpath d='M53 123h26l-7 8 7 8h-26z' fill='%232f9e5e'/%3E%0A  %3Ccircle cx='150' cy='22' r='3' fill='%239aa1b5'/%3E%3Ccircle cx='88' cy='36' r='2' fill='%239aa1b5'/%3E%3Ccircle cx='150' cy='150' r='2.5' fill='%239aa1b5'/%3E%3C/g%3E%3C/svg%3E"); }
  .bg-hl { --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg opacity='0.14'%3E%0A  %3Cpath d='M30 16l14 20h-28z' fill='%234cc27a'/%3E%3Cpath d='M100 88l14-20h-28z' fill='%23ff6b6b'/%3E%0A  %3Cpath d='M104 20l9 13h-18z' fill='%234cc27a'/%3E%3Cpath d='M36 118l9-13h-18z' fill='%23ff6b6b'/%3E%3C/g%3E%3C/svg%3E"); }
  .bg-cutle {
    background-color: #0e1812;
    --pattern:
      linear-gradient(rgba(120, 210, 160, .14) 1px, transparent 1px),
      linear-gradient(90deg, rgba(120, 210, 160, .14) 1px, transparent 1px),
      linear-gradient(rgba(120, 210, 160, .06) 1px, transparent 1px),
      linear-gradient(90deg, rgba(120, 210, 160, .06) 1px, transparent 1px);
  }
  .bg-pokedle {
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cg opacity='0.3'%3E%0A  %3Cpath d='M40 30l3 9 9 3-9 3-3 9-3-9-9-3 9-3z' fill='%23f2c230'/%3E%0A  %3Cpath d='M150 70l2 6 6 2-6 2-2 6-2-6-6-2 6-2z' fill='%236f9bff'/%3E%0A  %3Cpath d='M90 150l2.5 7.5 7.5 2.5-7.5 2.5-2.5 7.5-2.5-7.5-7.5-2.5 7.5-2.5z' fill='%23f2c230'/%3E%0A  %3Ccircle cx='170' cy='170' r='3' fill='%236f9bff'/%3E%3Ccircle cx='20' cy='120' r='2.5' fill='%236f9bff'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #0f1626 0%, #11151c 55%, #0f1c12 100%);
  }
  .bg-mastermind {
    background-color: #17120d;
    --pattern: radial-gradient(circle, rgba(255, 215, 165, .09) 3px, transparent 4px);
  }
}

/* ── Mastermind ───────────────────────────────────────────────────────────── */
.game-icon.mastermind { background: conic-gradient(#e5484d 0 25%, #3e7bfa 0 50%, #2f9e5e 0 75%, #f2c230 0); text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.mm-secret, .mm-board {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.mm-secret { display: flex; gap: 8px; justify-content: center; padding: 10px 14px; border-radius: 14px; }
.modal .mm-secret { box-shadow: none; margin-top: 6px; }
.mm-board { width: min(360px, 100%); display: grid; gap: 4px; border-radius: 16px; padding: 8px; }
.mm-row { display: grid; grid-template-columns: 20px auto 1fr; align-items: center; gap: 10px; padding: 3px 8px; border-radius: 10px; }
.mm-row.current { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mm-num { color: var(--muted); font-size: .78rem; font-weight: 700; text-align: right; }
.mm-pegs { display: flex; gap: 8px; }
.mm-peg {
  --size: min(32px, 8vw);
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--peg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink, #fff);
  font-size: calc(var(--size) * .5);
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .28), inset 0 -3px 0 rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .25);
}
.mm-peg.empty { background: var(--key-bg); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .18); }
.mm-peg.hidden { background: var(--fg); color: var(--bg); font-weight: 800; }
.mm-row.current .mm-peg:not(.empty) { cursor: pointer; }
.mm-row.current .mm-peg:not(.empty):hover { outline: 2px solid var(--fg); outline-offset: 2px; }
.mm-pins { display: grid; grid-template-columns: repeat(2, 11px); gap: 4px; }
.mm-pin { width: 11px; height: 11px; border-radius: 50%; }
.mm-pin.black { background: var(--fg); }
.mm-pin.white { background: #fff; box-shadow: inset 0 0 0 2px var(--muted); }
.mm-pin.none { background: var(--key-bg); }
.mm-palette { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mm-color {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--peg);
  color: var(--ink, #fff);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25), inset 0 -4px 0 rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .22);
  transition: transform .1s ease;
}
.mm-color:active { transform: scale(.92); }
.mm-controls { display: flex; gap: 10px; width: min(360px, 100%); }
.mm-controls .btn { flex: 1; }
.mm-mini { display: inline-flex; gap: 3px; vertical-align: middle; }
.mm-mini .mm-peg { --size: 16px; font-size: 8px; box-shadow: none; }
.mm-hint { max-width: 46ch; font-size: .8rem; }

/* ── Pokédle: generations and thumbnails ──────────────────────────────────── */
.pk-gens { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; max-width: 560px; }
.pk-gens-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.pk-gen-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.pk-gen {
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
}
.pk-gen[aria-pressed="true"] { background: var(--accent); color: var(--btn-fg); border-color: transparent; }
.pk-gen:disabled { cursor: default; opacity: .6; }
.pk-gens-note { width: 100%; text-align: center; font-size: .78rem; color: var(--muted); }
.pk-today { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; }
.pk-today-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--fg); border-radius: 999px;
  padding: 3px 10px; font: inherit; font-size: .76rem; font-weight: 650; cursor: pointer;
}
.pk-today-chip.done { border-color: var(--good); color: var(--good); }
.pk-today-chip[aria-current="true"] { background: var(--accent); border-color: transparent; color: var(--btn-fg); }
.pk-more { text-align: center; font-size: .85rem; margin-top: 10px; }
.pk-sprite { image-rendering: pixelated; object-fit: contain; }
.pk-tile.pk-name { gap: 0; }
.pk-name .pk-sprite { width: 46px; height: 46px; margin: -8px 0 -4px; }
.pk-suggestions li { display: flex; align-items: center; gap: 8px; padding: 4px 12px; }
.pk-suggestions li .muted { margin-left: auto; font-size: .8rem; }
.pk-reveal { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.pk-reveal img { flex: none; width: 96px; height: 96px; background: var(--bg); border-radius: 12px; }
.pk-reveal p { margin-bottom: 4px; }
@media (max-width: 480px) {
  .pk-gen-chips { gap: 3px; }
  .pk-gen { min-width: 28px; height: 30px; padding: 0 7px; font-size: .78rem; }
}

/* Mastermind feedback: worded counts, never which pegs */
.mm-board { width: min(400px, 100%); }
.mm-legend {
  display: grid;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: .84rem;
}
.mm-legend > div { display: flex; align-items: center; gap: 10px; }
.mm-legend-note { font-size: .76rem; color: var(--muted); }
.mm-counts { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-height: 32px; justify-content: center; }
.mm-count {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
  color: #fff;
}
.mm-count.hit { background: var(--correct); }
.mm-count.near { background: var(--present); color: var(--present-fg); }
.mm-count.zero { opacity: .35; }
@media (max-width: 400px) {
  .mm-pegs { gap: 6px; }
  .mm-peg { --size: min(30px, 7.4vw); }
  .mm-row { gap: 8px; padding: 3px 6px; }
  .mm-count { padding: 2px 6px; font-size: .66rem; }
}

/* ── Tidsmaskinen ─────────────────────────────────────────────────────────── */
.game-icon.tm { background: #b7791f; }
.bg-tm { background-color: #f3ebdd; --pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'180'%20height%3D'180'%3E%3Cg%20opacity%3D'0.35'%3E%0A%20%20%3Cg%20transform%3D'rotate(-8%2040%2040)'%3E%3Crect%20x%3D'16'%20y%3D'18'%20width%3D'50'%20height%3D'40'%20rx%3D'2'%20fill%3D'%23fffaf0'%2F%3E%3Crect%20x%3D'21'%20y%3D'23'%20width%3D'40'%20height%3D'26'%20fill%3D'%23c9a36a'%2F%3E%3C%2Fg%3E%0A%20%20%3Cg%20transform%3D'rotate(7%20130%20110)'%3E%3Crect%20x%3D'106'%20y%3D'88'%20width%3D'50'%20height%3D'40'%20rx%3D'2'%20fill%3D'%23fffaf0'%2F%3E%3Crect%20x%3D'111'%20y%3D'93'%20width%3D'40'%20height%3D'26'%20fill%3D'%23c9a36a'%2F%3E%3C%2Fg%3E%0A%20%20%3Ccircle%20cx%3D'150'%20cy%3D'30'%20r%3D'9'%20fill%3D'none'%20stroke%3D'%23c9a36a'%20stroke-width%3D'2'%2F%3E%3Cpath%20d%3D'M150%2024v6l4%203'%20stroke%3D'%23c9a36a'%20stroke-width%3D'2'%20fill%3D'none'%2F%3E%0A%20%20%3Ccircle%20cx%3D'40'%20cy%3D'140'%20r%3D'2.5'%20fill%3D'%23c9a36a'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
@media (prefers-color-scheme: dark) {
  .bg-tm { background-color: #16120d; --pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'180'%20height%3D'180'%3E%3Cg%20opacity%3D'0.18'%3E%0A%20%20%3Cg%20transform%3D'rotate(-8%2040%2040)'%3E%3Crect%20x%3D'16'%20y%3D'18'%20width%3D'50'%20height%3D'40'%20rx%3D'2'%20fill%3D'%233a3026'%2F%3E%3Crect%20x%3D'21'%20y%3D'23'%20width%3D'40'%20height%3D'26'%20fill%3D'%238a6d42'%2F%3E%3C%2Fg%3E%0A%20%20%3Cg%20transform%3D'rotate(7%20130%20110)'%3E%3Crect%20x%3D'106'%20y%3D'88'%20width%3D'50'%20height%3D'40'%20rx%3D'2'%20fill%3D'%233a3026'%2F%3E%3Crect%20x%3D'111'%20y%3D'93'%20width%3D'40'%20height%3D'26'%20fill%3D'%238a6d42'%2F%3E%3C%2Fg%3E%0A%20%20%3Ccircle%20cx%3D'150'%20cy%3D'30'%20r%3D'9'%20fill%3D'none'%20stroke%3D'%238a6d42'%20stroke-width%3D'2'%2F%3E%3Cpath%20d%3D'M150%2024v6l4%203'%20stroke%3D'%238a6d42'%20stroke-width%3D'2'%20fill%3D'none'%2F%3E%0A%20%20%3Ccircle%20cx%3D'40'%20cy%3D'140'%20r%3D'2.5'%20fill%3D'%238a6d42'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); }
  .tm-map .tiles-standard .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
}
.game.game-xl { max-width: 1120px; }
.tm-header { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tm-progress { display: flex; gap: 6px; }
.tm-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
}
.tm-dot.done { background: var(--correct); color: #fff; border-color: transparent; }
.tm-dot.current { border: 2px solid var(--accent); color: var(--accent); }
.tm-score { font-variant-numeric: tabular-nums; }
.tm-layout { width: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .tm-layout { grid-template-columns: minmax(0, 1fr); } }
.tm-photo-box {
  padding: 0; border: 0; border-radius: 14px; overflow: hidden;
  background: #111; cursor: zoom-in; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.tm-photo { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.tm-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.tm-map { height: 300px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); z-index: 0; cursor: crosshair; }
.tm-map.leaflet-container { font: inherit; font-size: .75rem; }
.tm-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tm-yearbox { display: flex; flex-direction: column; gap: 6px; }
.tm-year-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.tm-year { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: center; }
.tm-yearbox input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.tm-range { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.tm-reveal { display: flex; flex-direction: column; gap: 10px; }
.tm-answer strong { font-size: 1.1rem; }
.tm-answer p { font-size: .85rem; margin-top: 4px; }
.tm-points { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tm-points > div { background: var(--bg); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.tm-points .tm-label { text-transform: none; letter-spacing: 0; font-weight: 600; }
.tm-points strong { font-size: 1.25rem; color: var(--good); font-variant-numeric: tabular-nums; }
.tm-credit { font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
.tm-credit a { color: inherit; }
.tm-zoomed { display: block; width: 100%; height: auto; border-radius: 10px; }
dialog.modal:has(.tm-zoomed) { width: min(1100px, calc(100vw - 32px)); }
.tm-summary { margin: 6px 0 0 22px; font-size: .9rem; }
.tm-summary li { margin-bottom: 3px; }
.tm-summary li strong { float: right; font-variant-numeric: tabular-nums; }
.leaflet-tooltip { font: inherit; font-weight: 700; font-size: .8rem; }

/* ── Confetti (a canvas in the top layer, never blocks clicks) ────────────── */
.confetti, .confetti:popover-open {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
  z-index: 1000;
  overflow: visible;
}

/* ── Front page tagline ───────────────────────────────────────────────────── */
.tagline {
  margin-top: 16px;
  font-size: clamp(1rem, 3.6vw, 1.25rem);
  font-weight: 650;
  letter-spacing: .5px;
  color: var(--muted);
  animation: tagline-in .6s ease both;
  animation-delay: 1.1s;
}
.tagline b { font-weight: 850; }
.tagline b:nth-of-type(1) { color: var(--correct); }
.tagline b:nth-of-type(2) { color: var(--present-text); }
.tagline b:nth-of-type(3) { color: var(--correct); }
@keyframes tagline-in { from { opacity: 0; transform: translateY(6px); } }

/* Language picker: code + caret on top of an invisible native select */
.lang-toggle { position: relative; align-items: center; gap: 5px; padding: 0 22px 0 9px; cursor: pointer; }
.lang-toggle::after {
  content: ''; position: absolute; right: 9px; top: 50%; margin-top: -2px;
  border: 4px solid transparent; border-top-color: var(--muted); pointer-events: none;
}
.lang-globe { font-size: .85rem; }
.lang-code { font-weight: 700; font-size: .8rem; color: var(--fg); }
.lang-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.lang-select option { color: #1a1a2e; background: #fff; }
.lang-toggle:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.game-icon.poke { background: #fff; box-shadow: inset 0 0 0 1px var(--border); }
@media (prefers-color-scheme: dark) { .game-icon.poke { background: #2a2c3f; box-shadow: none; } }

/* Wordle word-language tabs */
.wordle-langs { flex-wrap: wrap; justify-content: center; max-width: 100%; }
@media (max-width: 480px) {
  .wordle-langs .tab { padding: 6px 9px; font-size: .82rem; }
}

/* Zoomable photo (Tidsmaskinen) */
.tm-photo-box { cursor: default; }
.zv { position: relative; width: 100%; overflow: hidden; touch-action: pan-y; user-select: none; display: flex; justify-content: center; background: #111; }
.zv-img { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; transform-origin: 0 0; will-change: transform; cursor: zoom-in; }
.zv.zoomed .zv-img { cursor: grab; }
.zv.zoomed .zv-img:active { cursor: grabbing; }
.zv-controls { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.zv-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: rgba(15, 17, 28, .72); color: #fff; font-size: 1.1rem; font-weight: 800;
  cursor: pointer; backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
}
.zv-btn:hover { background: rgba(15, 17, 28, .9); }
.zv.fs { align-items: center; height: 100%; }
.zv.fs .zv-img { max-height: 100vh; max-width: 100vw; }

/* Tidsmaskinen on wide screens: the photo gets most of the width (about twice the old size) */
@media (min-width: 1100px) {
  .game.game-xl { max-width: 1680px; }
  .tm-layout { grid-template-columns: minmax(0, 2.6fr) minmax(320px, 1fr); }
  .tm-photo-box .zv-img { max-height: calc(100vh - 150px); }
}

/* Map preview in the panel: click to open the large map */
.tm-where { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tm-map-slot { position: relative; }
.tm-map.is-static { cursor: zoom-in; }
.tm-map.is-static .leaflet-control-zoom { display: none; }
.tm-map-open {
  position: absolute; inset: 0; z-index: 1; margin: 0; padding: 10px 0 0; border: 0; border-radius: 12px;
  background: transparent; cursor: zoom-in; display: flex; align-items: flex-start; justify-content: center;
}
.tm-map-open span {
  background: rgba(15, 17, 28, .8); color: #fff; font-weight: 700; font-size: .85rem;
  padding: 7px 14px; border-radius: 999px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.tm-map-open:hover span { background: var(--accent); }
.tm-map-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Standard / hybrid switch */
.tm-maptype { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.tm-maptype button {
  border: 0; border-radius: 999px; padding: 5px 12px; background: transparent; color: var(--muted);
  font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.tm-maptype button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Large map dialog */
dialog.tm-map-dialog {
  width: min(1500px, calc(100vw - 32px)); height: calc(100dvh - 32px); max-width: none; max-height: none;
  margin: auto; padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  background: var(--card); color: var(--fg); box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
dialog.tm-map-dialog[open] { display: flex; flex-direction: column; }
dialog.tm-map-dialog::backdrop { background: rgba(8, 10, 18, .6); }
.tm-map-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tm-map-hint { flex: 1 1 220px; min-width: 0; font-weight: 700; font-size: .92rem; }
.tm-map-done { padding: 8px 20px; }
.tm-map-stage { position: relative; flex: 1; min-height: 0; }
.tm-map-stage .tm-map { height: 100%; border: 0; border-radius: 0; }
.tm-mini {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 220px; padding: 0;
  border: 2px solid #fff; border-radius: 10px; overflow: hidden; background: #111;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35); cursor: zoom-in;
}
.tm-mini.big { width: min(50%, 640px); cursor: zoom-out; }
.tm-mini img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; }
@media (max-width: 600px) {
  dialog.tm-map-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .tm-mini { width: 120px; }
  .tm-mini.big { width: calc(100% - 20px); }
}

/* Text below each game (about, how to play, Q&A, other games) – also what search engines read */
.about {
  width: min(760px, calc(100% - 32px)); margin: 12px auto 8px; padding: 22px 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: .95rem; line-height: 1.6;
}
.about h2 { font-size: 1.12rem; margin: 22px 0 6px; }
.about h2:first-child { margin-top: 0; }
.about h3 { font-size: .98rem; margin: 14px 0 2px; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0 0 8px; padding-left: 20px; }
.about li { margin-bottom: 4px; }
.about-more { color: var(--muted); }
.about-more a { color: var(--accent); font-weight: 700; text-decoration: none; }
.about-more a:hover { text-decoration: underline; }
.site-footer { text-align: center; padding: 18px 16px 24px; font-size: .82rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
@media (max-width: 480px) { .about { padding: 18px 16px; } }

/* ── Corral ───────────────────────────────────────────────────────────────── */
:root {
  --cr-grass: #55a04a; --cr-grass-alt: #4e9744; --cr-water: #1d375a; --cr-water-2: #284b77;
  --cr-wall: #7a4a22; --cr-wall-2: #9a6232; --cr-frame: #2f5e28;
  --cr-rock: #d7dadd; --cr-rock-2: #9da3aa; --cr-gold: #f2c75c; --cr-gold-2: #e3b041;
}
@media (prefers-color-scheme: dark) {
  :root { --cr-grass: #3f7d36; --cr-grass-alt: #3a7532; --cr-water: #13253f; --cr-water-2: #1c3456; --cr-wall: #6a3f1c; --cr-wall-2: #8a5528; --cr-frame: #1f3f1b; --cr-rock: #b9bdc2; --cr-rock-2: #7d838a; --cr-gold: #d9ae45; --cr-gold-2: #c69b33; }
}
.game-icon.corral { background: #7a4a22; }
.bg-corral {
  background-color: #e5f0d8;
  --pattern: repeating-linear-gradient(90deg, rgba(122, 74, 34, .10) 0 6px, transparent 6px 46px), repeating-linear-gradient(0deg, rgba(122, 74, 34, .08) 0 4px, transparent 4px 46px);
}
@media (prefers-color-scheme: dark) { .bg-corral { background-color: #131a12; } }
.cr-bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cr-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cr-chip { font-weight: 800; font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); white-space: nowrap; }
.cr-target { color: var(--muted); font-weight: 700; }
.cr-more { text-align: center; font-size: .9rem; margin-top: 2px; }
.cr-more a { color: var(--accent); font-weight: 700; }
/* Portals: a swirl in the colour of its pair (the emoji is blue; the others are turned). */
.cr-swirl { display: inline-block; line-height: 1; }
.cr-portal-2 .cr-swirl { filter: hue-rotate(110deg) saturate(1.3); } /* red */
.cr-portal-3 .cr-swirl { filter: hue-rotate(50deg) saturate(1.3); } /* magenta */
.cr-portal-4 .cr-swirl { filter: hue-rotate(250deg) saturate(1.4); } /* green */
.cr-portal-5 .cr-swirl { filter: hue-rotate(170deg) saturate(1.5); } /* orange */
/* Result: the grass enclosed as the headline, then the best possible and the share of it. */
.answer-reveal.cr-score { font-size: 1.7rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 2px; }
.cr-best-possible { color: var(--muted); font-weight: 600; }
.cr-verdict { font-weight: 800; font-size: 1.05rem; margin-top: 4px; }
/* "Under construction" note above a game that isn't finished (and its badge on the front page). */
:root { --wip-bg: #fff1c2; --wip-fg: #6b4a00; --wip-border: #f0c850; }
@media (prefers-color-scheme: dark) { :root { --wip-bg: #3a2f10; --wip-fg: #f5d77a; --wip-border: #6b5518; } }
.wip-note {
  width: calc(100% - 32px); max-width: 528px; margin: 14px auto 0; padding: 8px 14px;
  border-radius: 12px; border: 1px solid var(--wip-border); background: var(--wip-bg); color: var(--wip-fg);
  font-size: .9rem; font-weight: 600; line-height: 1.35; text-align: center;
}
.cr-board {
  display: grid; grid-template-columns: repeat(var(--w), minmax(0, 1fr)); gap: 2px;
  /* Tiles up to 40 px, so bigger grids get a bigger board (the page column caps it). */
  width: min(100%, calc(var(--w) * 40px + 12px)); padding: 6px; border-radius: 14px; background: var(--cr-frame);
  box-shadow: var(--shadow); user-select: none; touch-action: manipulation;
}
.cr-cell {
  aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-radius: clamp(2px, calc(50vw / var(--w) / 6), 5px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(11px, calc(62vw / var(--w)), 22px); line-height: 1; cursor: pointer; color: #1a1a2e;
}
.cr-cell:disabled { cursor: default; opacity: 1; }
.cr-cell.grass { background: var(--cr-grass); }
.cr-cell.grass.alt { background: var(--cr-grass-alt); }
.cr-cell.water { background: radial-gradient(circle at 30% 30%, var(--cr-water-2), var(--cr-water) 75%); }
/* A grey stone block: blocks the horse like water. */
.cr-cell.rock { background: linear-gradient(var(--cr-rock) 0 62%, var(--cr-rock-2) 62% 100%); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18); }
/* Fenced-in pasture: golden grass. */
.cr-cell.grass.enclosed { background: repeating-linear-gradient(0deg, var(--cr-gold) 0 4px, var(--cr-gold-2) 4px 8px); }
/* A wooden fence: dark boards with lighter stripes, so walls read without relying on colour. */
.cr-cell.wall {
  background: repeating-linear-gradient(90deg, var(--cr-wall-2) 0 4px, var(--cr-wall) 4px 8px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25);
}
.cr-cell.grass:not(:disabled):hover { filter: brightness(1.08); }
/* Where the horse can go: a white outline; red dashed when it can reach the edge (escape). */
.cr-cell.reach { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .9); }
.cr-cell.reach.escape { box-shadow: inset 0 0 0 3px #e03131; outline: 2px dashed #e03131; outline-offset: -6px; }
:root { --cr-apple-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7.2c-1.6-1-5.2-1.2-6.5 1.9-1.3 3.1.2 7.8 2.7 10 1.2 1 2.5.9 3.8.3 1.3.6 2.6.7 3.8-.3 2.5-2.2 4-6.9 2.7-10-1.3-3.1-4.9-2.9-6.5-1.9z' fill='%23f5b700' stroke='%23a06d00' stroke-width='1.2'/%3E%3Cpath d='M12 7.2c0-1.7.5-3.2 1.7-4.2' stroke='%236b4a1f' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M13.3 4.6c1.5-1.6 3.6-1.7 4.8-1-.7 1.7-2.7 2.5-4.8 1z' fill='%232e8540'/%3E%3Cellipse cx='9.3' cy='11' rx='1.3' ry='2.2' fill='%23fff3b0' opacity='.8'/%3E%3C/svg%3E"); }
.cr-apple, .cr-cell.grass.cr-apple {
  background-image: var(--cr-apple-img);
  background-repeat: no-repeat; background-position: center; background-size: 72%;
}
.cr-cell.grass.cr-apple { background-color: var(--cr-grass); }
.cr-cell.grass.alt.cr-apple { background-color: var(--cr-grass-alt); }
.cr-cell.grass.enclosed.cr-apple {
  background-image: var(--cr-apple-img), repeating-linear-gradient(0deg, var(--cr-gold) 0 4px, var(--cr-gold-2) 4px 8px);
  background-size: 72%, auto; background-repeat: no-repeat, repeat; background-position: center, 0 0;
}
span.cr-apple { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -.25em; }
.cr-status { min-height: 1.5em; text-align: center; font-weight: 600; font-size: .95rem; }
.cr-status.good { color: var(--good); }
.cr-status.bad { color: var(--bad); }
.cr-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
