/* ==========================================================================
   ActiveVitPH — puzzle page chrome
   The frame every puzzle sits in: atmosphere, header, HUD, board housing,
   result overlay, side panels. Puzzle-specific boards live at the bottom.
   ========================================================================== */

.pz {
  position: relative;
  isolation: isolate;
  padding: 122px 0 40px;
  overflow: hidden;
}

.pz__bg { position: absolute; inset: 0; z-index: -1; }
.pz__bg .mesh { opacity: 0.5; }

.pz__bg .glow--brass { width: 720px; height: 720px; top: -280px; left: 30%; }
.pz__bg .glow--teal { width: 520px; height: 520px; top: 34%; right: -220px; opacity: 0.6; }
.pz__bg .glow--violet { width: 480px; height: 480px; bottom: -180px; left: -160px; opacity: 0.55; }

/* --------------------------------------------------------- breadcrumb --- */

.pz__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 0.84rem;
  color: var(--text-3);
  transition: color var(--t-fast), gap var(--t-fast) var(--ease-out);
}

.pz__back:hover { color: var(--brass); gap: 12px; }
.pz__back svg { width: 13px; height: 13px; }

/* ------------------------------------------------------------- header --- */

.pz__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(20px, 4vw, 48px);
  padding-bottom: clamp(26px, 4vw, 40px);
  margin-bottom: clamp(26px, 4vw, 40px);
  border-bottom: 1px solid var(--line-soft);
}

.pz__tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }

.pz__head h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.pz__head p {
  margin-top: 14px;
  max-width: 34em;
  color: var(--text-2);
  font-size: 0.98rem;
}

/* The stored personal best, presented as a small brass plaque. */
.plaque {
  position: relative;
  min-width: 168px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(230, 174, 93, 0.14), transparent 62%),
    linear-gradient(160deg, var(--ink-850), var(--ink-950));
  border: 1px solid var(--line);
  box-shadow: var(--sh-2), var(--sh-inset);
}

.plaque span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 6px;
}

.plaque b {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--brass-hi);
}

.plaque small { display: block; margin-top: 4px; font-size: 0.72rem; color: var(--text-4); }

@media (max-width: 760px) {
  .pz__head { grid-template-columns: 1fr; align-items: start; }
  .plaque { min-width: 0; }
}

/* -------------------------------------------------------------- stage --- */

.pz__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 306px;
  gap: clamp(20px, 3vw, 42px);
  align-items: start;
}

.pz__main { min-width: 0; }

@media (max-width: 1000px) {
  .pz__stage { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- HUD --- */

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin-bottom: clamp(16px, 2vw, 22px);
}

.hud__pill {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 96px;
  padding: 11px 17px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--sh-1), var(--sh-inset);
}

.hud__pill span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-4);
}

.hud__pill b {
  font-family: var(--font-mono);
  font-size: 1.24rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--text);
}

.hud__pill--accent b { color: var(--brass-hi); }
.hud__pill--cool b { color: var(--teal); }

.hud__spacer { flex: 1 1 auto; }

.hud__pill b.is-bump { animation: bump 380ms var(--ease-out); }

@keyframes bump {
  0% { transform: scale(1); }
  38% { transform: scale(1.16); color: var(--brass-hi); }
  100% { transform: scale(1); }
}

@media (max-width: 560px) {
  .hud__pill { min-width: 78px; padding: 9px 13px; }
  .hud__pill b { font-size: 1.06rem; }
}

/* ------------------------------------------------------- board housing --- */

.frame {
  position: relative;
  isolation: isolate;
  width: min(100%, var(--frame-max, 560px));
  margin-inline: auto;
  padding: clamp(9px, 1.5vw, 16px);
  border-radius: var(--r-lg);
  background: linear-gradient(168deg, #141924 0%, #0a0d13 58%, #06080c 100%);
  border: 1px solid var(--line-strong);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    0 34px 70px -24px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Warm rim along the top edge, as if the board were lit from above. */
.frame::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(to bottom, rgba(230, 174, 93, 0.16), transparent 26%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Light pooling under the board so it reads as floating, not pasted on. */
.frame__pool {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -34px;
  height: 96px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(230, 174, 93, 0.22), transparent 72%);
  filter: blur(34px);
  pointer-events: none;
}

.frame--cool .frame::before,
.frame--cool::before { background: linear-gradient(to bottom, rgba(90, 211, 204, 0.32), transparent 42%); }
.frame--cool .frame__pool { background: radial-gradient(ellipse, rgba(90, 211, 204, 0.2), transparent 72%); }

/* ------------------------------------------------------------ controls --- */

.pz__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(18px, 2.5vw, 26px);
}

/* Number / symbol pad shared by Sudoku and Pixel Logic. */
.pad {
  display: grid;
  grid-template-columns: repeat(var(--pad-cols, 5), minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 372px);
  margin: clamp(16px, 2vw, 22px) auto 0;
}

.pad button {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease-out);
}

.pad button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.pad button.is-on {
  color: #1a1206;
  background: linear-gradient(160deg, var(--brass-hi), var(--brass-deep));
  border-color: rgba(255, 217, 160, 0.5);
  box-shadow: 0 6px 18px -4px var(--brass-glow);
}

.pad button.is-done { opacity: 0.28; }

.pad button svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------- result --- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 34px);
  border-radius: inherit;
  background: rgba(5, 7, 11, 0.86);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-mid) var(--ease-out), visibility var(--t-mid);
}

.overlay.is-open { opacity: 1; visibility: visible; }

.result { text-align: center; max-width: 330px; }

.result .chip { margin-bottom: 16px; }

.result__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  background: linear-gradient(100deg, var(--brass-hi), var(--brass) 46%, var(--brass-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result__note { margin-top: 12px; font-size: 0.9rem; color: var(--text-2); }

.result__stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.result__stat {
  flex: 1 1 92px;
  padding: 12px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-soft);
}

.result__stat span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 5px;
}

.result__stat b { font-size: 1.06rem; font-weight: 600; }

.result__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 24px; }

/* --------------------------------------------------------- side rail --- */

.pz__side { display: flex; flex-direction: column; gap: 13px; }

.card {
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line-soft);
  box-shadow: var(--sh-1);
}

.card > h2,
.card > h3 {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 14px;
}

.card p { font-size: 0.865rem; line-height: 1.6; color: var(--text-2); }
.card p + p { margin-top: 0.75em; }

.card__steps { counter-reset: step; }

.card__steps li {
  position: relative;
  padding-left: 26px;
  font-size: 0.865rem;
  line-height: 1.55;
  color: var(--text-2);
}

.card__steps li + li { margin-top: 11px; }

.card__steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(230, 174, 93, 0.14);
  border: 1px solid rgba(230, 174, 93, 0.32);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--brass-hi);
}

.card__keys { display: flex; flex-direction: column; gap: 9px; }

.card__keys div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.83rem;
  color: var(--text-2);
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  color: var(--text);
  white-space: nowrap;
}

/* A guide cross-link, styled as a warm invitation rather than a nav item. */
.card--guide {
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(230, 174, 93, 0.12), transparent 60%),
    linear-gradient(168deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border-color: rgba(230, 174, 93, 0.2);
}

.card--guide strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 7px;
}

.card--guide a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--brass);
  transition: gap var(--t-fast) var(--ease-out);
}

.card--guide a:hover { gap: 11px; }
.card--guide a svg { width: 13px; height: 13px; }

/* ---------------------------------------------------------- selectors --- */

.field { display: flex; flex-direction: column; gap: 9px; }
.field + .field { margin-top: 16px; }

.field > label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-4);
}

.seg {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line-soft);
}

.seg button {
  flex: 1 1 0;
  padding: 0.55em 0.5em;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease-out);
}

.seg button:hover { color: var(--text); background: rgba(255, 255, 255, 0.055); }

.seg button.is-on {
  color: #1a1206;
  background: linear-gradient(160deg, var(--brass-hi), var(--brass-deep));
  box-shadow: 0 4px 14px -4px var(--brass-glow);
}

.seg--cool button.is-on {
  color: #04201f;
  background: linear-gradient(160deg, #a8f0eb, #2f9c96);
  box-shadow: 0 4px 14px -4px var(--teal-glow);
}

/* Four or more choices read better as an even grid than as a wrapped row. */
.seg--wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ------------------------------------------------------------- toggle --- */

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch i {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line);
  transition: background-color var(--t-mid) var(--ease-out), border-color var(--t-mid);
}

.switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--t-mid) var(--ease-out), background-color var(--t-mid);
}

.switch input:checked + i { background: rgba(230, 174, 93, 0.28); border-color: rgba(230, 174, 93, 0.45); }
.switch input:checked + i::after { transform: translateX(16px); background: var(--brass-hi); }
.switch input:focus-visible + i { outline: 2px solid var(--brass); outline-offset: 2px; }

/* -------------------------------------------------------------- toast --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 860;
  max-width: min(90vw, 420px);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: rgba(14, 18, 26, 0.92);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--sh-3);
  font-size: 0.87rem;
  color: var(--text);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 18px);
  transition:
    opacity var(--t-mid) var(--ease-out),
    transform var(--t-mid) var(--ease-out),
    visibility var(--t-mid);
}

.toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast--warn { border-color: rgba(239, 114, 105, 0.42); color: #ffd7d3; }
.toast--good { border-color: rgba(92, 217, 145, 0.4); color: #cdf5dd; }

/* ==================================================== board: sudoku ==== */

/* Nested 3x3 of 3x3 blocks, so the heavy seams come from the layout itself
   instead of a pile of per-cell border rules. */
.sudoku {
  display: grid;
  /* minmax(0,...) because a plain 1fr keeps an auto minimum, and the digits
     inside then hold the three block tracks wider than the frame. */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  /* The seam between blocks shrinks on small screens so it does not dominate
     the cells. Measured in vw, not cqw: a container cannot query itself. */
  gap: clamp(4px, 1.3vw, 7px);
  padding: 3px;
  aspect-ratio: 1 / 1;
  /* Lets the cells below size against the board instead of the viewport. */
  container-type: inline-size;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  touch-action: manipulation;
}

/* The board is focused on purpose so you can type straight away; the default
   offset outline read as an alarm around the whole frame. */
.sudoku:focus-visible {
  outline: none;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(230, 174, 93, 0.45);
}

.sudoku__block {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 2px;
}

.sudoku__cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.032);
  font-family: var(--font-mono);
  /* 11cqw is one cell; a digit at just under half of that sits inside it with
     room to spare, and now tracks the board rather than the window. */
  font-size: clamp(0.75rem, 5.3cqw, 1.7rem);
  font-weight: 500;
  line-height: 1;
  color: var(--teal);
  transition:
    background-color 110ms linear,
    color 110ms linear,
    box-shadow 110ms linear;
}

.sudoku__cell:hover { background: rgba(255, 255, 255, 0.075); }

.sudoku__cell.is-given {
  color: var(--text);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.062);
  cursor: default;
}

/* Row, column and block of the selected cell. */
.sudoku__cell.is-peer { background: rgba(255, 255, 255, 0.058); }

.sudoku__cell.is-twin {
  color: var(--brass-hi);
  background: rgba(230, 174, 93, 0.13);
}

.sudoku__cell.is-bad {
  color: var(--bad);
  background: rgba(239, 114, 105, 0.15);
}

.sudoku__cell.is-sel {
  background: rgba(230, 174, 93, 0.2);
  box-shadow: inset 0 0 0 2px var(--brass), 0 0 16px -2px var(--brass-glow);
}

.sudoku__cell.just-set { animation: drop-in 240ms var(--ease-out); }

@keyframes drop-in {
  0% { transform: scale(0.55); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Pencil marks */
.sudoku__notes {
  position: absolute;
  inset: 3px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  pointer-events: none;
}

.sudoku__notes i {
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  /* Scales with the board like the digits do, so a mark keeps its share of a
     cell on a phone instead of filling the whole third of it. */
  font-size: clamp(0.4rem, 1.9cqw, 0.58rem);
  font-style: normal;
  line-height: 1;
  color: var(--text-4);
}

.sudoku__cell.is-sel .sudoku__notes i { color: var(--text-3); }

/* Dealing state, shown while the generator proves uniqueness. */
.frame.is-busy .sudoku { opacity: 0.25; filter: blur(2px); pointer-events: none; }

.dealing {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  place-items: center;
  border-radius: inherit;
}

.frame.is-busy .dealing { display: grid; }

.dealing span {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}

.dealing i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(230, 174, 93, 0.28);
  border-top-color: var(--brass);
  animation: spin 720ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================== board: minesweeper ==== */

/* Boards range from 9x9 to 30x16, so the frame hugs its board and the wide
   one scrolls sideways instead of shrinking cells below thumb size. */
.frame--fit { width: fit-content; max-width: 100%; }

.scroller {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--r-xs);
  -webkit-overflow-scrolling: touch;
}

.mines {
  display: grid;
  grid-template-columns: repeat(var(--cols, 9), var(--cell, 32px));
  gap: 2px;
  padding: 3px;
  margin-inline: auto;
  width: max-content;
  border-radius: var(--r-xs);
  background: rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
}

.mines[data-cols="9"] { --cell: clamp(32px, 8.5vw, 48px); }
.mines[data-cols="16"] { --cell: clamp(26px, 5vw, 34px); }
.mines[data-cols="30"] { --cell: 26px; }

.mines:focus-visible { outline: none; box-shadow: 0 0 0 1px rgba(230, 174, 93, 0.45); }

.mine-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: calc(var(--cell, 32px) * 0.5);
  font-weight: 600;
  line-height: 1;
  /* Unopened cells are raised; opened ones are recessed. */
  background: linear-gradient(160deg, #242c3b, #161b26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 1px 2px rgba(0, 0, 0, 0.55);
  transition: background-color 90ms linear, box-shadow 90ms linear;
}

.mine-cell:hover { background: linear-gradient(160deg, #2e3749, #1c2230); }

.mine-cell.is-open {
  background: rgba(255, 255, 255, 0.022);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.mine-cell.is-open:hover { background: rgba(255, 255, 255, 0.045); }

.mine-cell svg { width: 58%; height: 58%; }

/* Number colours: warm for the crowded clues, cool for the quiet ones. */
.mine-cell[data-n="1"] { color: #6fb7f5; }
.mine-cell[data-n="2"] { color: #5cd991; }
.mine-cell[data-n="3"] { color: #e6ae5d; }
.mine-cell[data-n="4"] { color: #8d7cf7; }
.mine-cell[data-n="5"] { color: #ef7269; }
.mine-cell[data-n="6"] { color: #5ad3cc; }
.mine-cell[data-n="7"] { color: #e9ebf2; }
.mine-cell[data-n="8"] { color: #737a8f; }

.mine-cell.is-flag { color: var(--brass-hi); }
.mine-cell.is-flag::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 55%, rgba(230, 174, 93, 0.2), transparent 70%);
}

.mine-cell.is-mine { color: var(--bad); }

.mine-cell.is-boom {
  background: radial-gradient(circle, rgba(239, 114, 105, 0.55), rgba(120, 30, 26, 0.7));
  box-shadow: 0 0 22px -2px rgba(239, 114, 105, 0.6);
  color: #fff;
}

.mine-cell.is-wrong { color: var(--text-4); }
.mine-cell.is-wrong::before {
  content: "";
  position: absolute;
  inset: 22%;
  background: linear-gradient(45deg, transparent 44%, var(--bad) 44%, var(--bad) 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, var(--bad) 44%, var(--bad) 56%, transparent 56%);
}

.mines.is-over .mine-cell { pointer-events: none; }

/* ================================================ board: nonogram ====== */

.nono {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.nono__corner { grid-area: 1 / 1; }

.nono__cols {
  grid-area: 1 / 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 2px;
  align-items: end;
}

.nono__rows {
  grid-area: 2 / 1;
  display: grid;
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 2px;
}

.nono__grid {
  grid-area: 2 / 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 2px;
}

/* Clue strips: numbers read towards the board, and dim once the line is done. */
.clues {
  display: flex;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: clamp(0.56rem, 1.6vw, 0.78rem);
  font-weight: 600;
  line-height: 1;
  color: var(--text-2);
  transition: opacity var(--t-mid) linear, color var(--t-mid) linear;
}

.clues i { font-style: normal; }

.nono__cols .clues { flex-direction: column; align-items: center; padding-bottom: 4px; }
.nono__rows .clues { justify-content: flex-end; align-items: center; padding-right: 5px; }

.clues.is-done { opacity: 0.3; color: var(--brass); }

.nono__cell {
  aspect-ratio: 1 / 1;
  position: relative;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.042);
  transition: background-color 90ms linear, box-shadow 90ms linear;
}

.nono__cell:hover { background: rgba(255, 255, 255, 0.1); }

.nono__cell.sep-r { margin-right: 4px; }
.nono__cell.sep-b { margin-bottom: 4px; }

.nono__cell.is-fill {
  background: linear-gradient(158deg, var(--brass-hi), var(--brass-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.nono__cell.is-mark::before,
.nono__cell.is-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 22%;
  width: 1.6px;
  height: 56%;
  background: var(--text-4);
  border-radius: 2px;
}

.nono__cell.is-mark::before { transform: translateX(-50%) rotate(45deg); }
.nono__cell.is-mark::after { transform: translateX(-50%) rotate(-45deg); }

/* ============================================== board: lights out ====== */

.lights {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(7px, 1.6vw, 13px);
}

.light {
  aspect-ratio: 1 / 1;
  border-radius: clamp(9px, 1.8vw, 16px);
  background: linear-gradient(162deg, #1b212d, #0c0f16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 18px rgba(0, 0, 0, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.5);
  transition:
    background 200ms var(--ease-out),
    box-shadow 200ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.light:hover { transform: translateY(-2px); }
.light:active { transform: scale(0.96); }

.light.is-on {
  background: linear-gradient(162deg, var(--brass-hi), var(--brass) 46%, var(--brass-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 26px -2px var(--brass-glow),
    0 0 60px -14px rgba(230, 174, 93, 0.55);
}

/* Cells a worked solution wants pressed, marked without changing their state. */
.light { position: relative; }

.light.is-hint::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  border: 2px solid var(--teal);
  box-shadow: 0 0 12px var(--teal-glow);
}

.light.is-on.is-hint::after { border-color: #04201f; box-shadow: none; }

/* ---------------------------------------------------- level selector --- */

.levels {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.levels button {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-3);
  transition: all var(--t-fast) var(--ease-out);
}

.levels button:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

.levels button.is-on {
  color: #1a1206;
  background: linear-gradient(158deg, var(--brass-hi), var(--brass-deep));
  border-color: transparent;
}

.levels button.is-clear {
  color: var(--teal);
  border-color: rgba(90, 211, 204, 0.35);
  background: rgba(90, 211, 204, 0.09);
}

.levels button.is-on.is-clear { color: #1a1206; }

/* ================================================= board: sokoban ====== */

.sokoban {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell, 40px));
  gap: 2px;
  width: max-content;
  margin-inline: auto;
  --cell: clamp(28px, 6vw, 46px);
}

.sok {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
}

.sok--void { background: none; }

.sok--floor {
  background: rgba(255, 255, 255, 0.028);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.022);
}

.sok--wall {
  background: linear-gradient(158deg, #2c3446, #171c26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Goal marks sit under everything else. */
.sok--goal::before {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 3px;
  border: 2px dashed rgba(90, 211, 204, 0.55);
}

.sok__crate {
  position: absolute;
  inset: 9%;
  border-radius: 4px;
  background: linear-gradient(158deg, var(--brass-hi), var(--brass-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 3px 8px -1px rgba(0, 0, 0, 0.7);
  transition: background 180ms linear, box-shadow 180ms linear;
}

.sok__crate::before,
.sok__crate::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-top: 1.5px solid rgba(0, 0, 0, 0.35);
  transform-origin: center;
}

.sok__crate::before { transform: rotate(45deg) scaleX(1.35); }
.sok__crate::after { transform: rotate(-45deg) scaleX(1.35); }

.sok--goal .sok__crate {
  background: linear-gradient(158deg, #a8f0eb, #2f9c96);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 0 18px -2px var(--teal-glow);
}

.sok__crate.is-stuck {
  background: linear-gradient(158deg, #f6a29b, #8e2a24);
  box-shadow: 0 0 18px -2px rgba(239, 114, 105, 0.6);
}

.sok__player {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #ffffff, #b9c0d3 62%, #6a7285);
  box-shadow: 0 3px 9px -1px rgba(0, 0, 0, 0.75), inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

.sok__player::after {
  content: "";
  position: absolute;
  inset: 26% 30%;
  border-radius: 50%;
  background: rgba(10, 13, 19, 0.5);
}

/* =========================================== board: sliding puzzle ===== */

.slider {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

/* The tile is a transparent positioning box exactly one cell wide, so a
   translate of 100% always lands on the next cell. Its child carries the
   visuals and the gutter. */
.stile {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% / var(--n));
  height: calc(100% / var(--n));
  padding: 0;
  background: none;
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%));
  transition: transform 155ms var(--ease-out);
}

.stile > i {
  position: absolute;
  inset: 3px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: clamp(0.95rem, 3.4vw, 1.6rem);
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(158deg, #2a3244, #171d28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 3px 8px -2px rgba(0, 0, 0, 0.7);
  transition: background 200ms linear, color 200ms linear, box-shadow 200ms linear;
}

.stile:hover > i { background: linear-gradient(158deg, #354056, #1f2634); }

.stile.is-home > i {
  color: #1a1206;
  background: linear-gradient(158deg, var(--brass-hi), var(--brass-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 10px -2px var(--brass-glow);
}

/* ============================================ board: tower of hanoi ==== */

.hanoi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.4vw, 14px);
  aspect-ratio: 16 / 9;
  align-items: end;
}

.peg {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  padding-bottom: 10px;
  border-radius: var(--r-sm);
  transition: background-color var(--t-fast) linear;
}

.peg:hover { background: rgba(255, 255, 255, 0.03); }
.peg.is-armed { background: rgba(230, 174, 93, 0.09); box-shadow: inset 0 0 0 1px rgba(230, 174, 93, 0.3); }

/* The rod, then the plinth it stands on. */
.peg::before {
  content: "";
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 5px;
  height: 72%;
  transform: translateX(-50%);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to bottom, #39435a, #1e2431);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.07);
}

.peg::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 4%;
  right: 4%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to bottom, #3c4658, #1b202b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.disc {
  position: relative;
  z-index: 1;
  height: clamp(11px, 2.2vw, 19px);
  border-radius: var(--r-pill);
  background: linear-gradient(to bottom, var(--brass-hi), var(--brass) 55%, var(--brass-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 5px -1px rgba(0, 0, 0, 0.7);
  transition: transform 140ms var(--ease-out), box-shadow 200ms linear;
}

.disc.is-lifted {
  transform: translateY(-9px);
  box-shadow: 0 0 20px -2px var(--brass-glow), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.disc--cool { background: linear-gradient(to bottom, #a8f0eb, #5ad3cc 55%, #23807b); }

/* ============================================ board: memory match ===== */

.memory {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(6px, 1.3vw, 11px);
}

.mcard {
  aspect-ratio: 3 / 4;
  perspective: 700px;
  background: none;
}

/* A span by default is inline, and an inline box gives the absolutely
   positioned faces nothing to size against. */
.mcard__inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 400ms var(--ease-out);
}

.mcard.is-up .mcard__inner,
.mcard.is-done .mcard__inner { transform: rotateY(180deg); }

.mcard__back,
.mcard__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: clamp(6px, 1.2vw, 10px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mcard__back {
  background: linear-gradient(158deg, #283142, #171d28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 3px 8px -2px rgba(0, 0, 0, 0.7);
}

/* A quiet monogram on the back, so the deck reads as one object. */
.mcard__back::after {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.09);
  transform: rotate(45deg);
}

.mcard__face {
  transform: rotateY(180deg);
  background: linear-gradient(158deg, #1d2431, #12161f);
  box-shadow: inset 0 0 0 1px rgba(230, 174, 93, 0.28);
  color: var(--brass-hi);
  font-size: clamp(1.1rem, 3.4vw, 1.8rem);
}

.mcard:hover:not(.is-up):not(.is-done) .mcard__inner { transform: translateY(-3px); }

.mcard.is-done .mcard__face {
  box-shadow: inset 0 0 0 1px rgba(90, 211, 204, 0.4);
  color: var(--teal);
  opacity: 0.55;
}

.mcard__face svg { width: 46%; height: 46%; }

/* ============================================= board: word search ===== */

.wordgrid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 2px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.wl {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 2.2vw, 1rem);
  font-weight: 500;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.028);
  transition: background-color 90ms linear, color 90ms linear;
}

.wl.is-hit {
  color: #1a1206;
  background: linear-gradient(158deg, var(--brass-hi), var(--brass-deep));
  font-weight: 600;
}

.wl.is-drag {
  color: #04201f;
  background: linear-gradient(158deg, #a8f0eb, #2f9c96);
}

.wordlist {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: clamp(16px, 2vw, 22px);
  justify-content: center;
}

.wordlist span {
  padding: 0.36em 0.8em;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-2);
  transition: all var(--t-mid) var(--ease-out);
}

.wordlist span.is-found {
  color: var(--text-4);
  border-color: transparent;
  background: rgba(255, 255, 255, 0.015);
  text-decoration: line-through;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 1.5px;
}

/* ============================================ board: connect four ===== */

.c4 {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(4px, 0.9vw, 8px);
  padding: clamp(6px, 1.2vw, 12px);
  border-radius: var(--r-md);
  background: linear-gradient(168deg, #1c2331, #10141d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -8px 20px rgba(0, 0, 0, 0.5);
}

.c4__col {
  display: grid;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, 0.9vw, 8px);
  border-radius: var(--r-sm);
  transition: background-color var(--t-fast) linear;
}

.c4__col:hover { background: rgba(255, 255, 255, 0.05); }
.c4__col.is-full { background: none; cursor: default; }

.c4__hole {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 34%, #05070b, #0b0e15);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.c4__hole.a,
.c4__hole.b { animation: drop 260ms var(--ease-out); }

.c4__hole.a {
  background: radial-gradient(circle at 38% 30%, var(--brass-hi), var(--brass) 48%, #8d6021);
  box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.35), 0 0 14px -3px var(--brass-glow);
}

.c4__hole.b {
  background: radial-gradient(circle at 38% 30%, #b6f5f0, var(--teal) 48%, #1d6f6b);
  box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.35), 0 0 14px -3px var(--teal-glow);
}

.c4__hole.is-win {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 26px -2px rgba(255, 255, 255, 0.6);
  z-index: 1;
}

@keyframes drop {
  0% { transform: translateY(-160%); }
  100% { transform: translateY(0); }
}

/* Whose turn it is, shown as two facing plates rather than a text label. */
.turns { display: flex; gap: 10px; }

.turn {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.022);
  transition: all var(--t-mid) var(--ease-out);
}

.turn i {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.turn--a i { background: linear-gradient(158deg, var(--brass-hi), #8d6021); }
.turn--b i { background: linear-gradient(158deg, #b6f5f0, #1d6f6b); }

.turn b { display: block; font-family: var(--font-display); font-size: 0.9rem; }
.turn span { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-4); }

.turn.is-live { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.turn--a.is-live { box-shadow: inset 3px 0 0 var(--brass); }
.turn--b.is-live { box-shadow: inset 3px 0 0 var(--teal); }

/* ============================================== other puzzles on rail === */

.more { padding: clamp(56px, 7vw, 92px) 0 0; }

.more__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.more__item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 17px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line-soft);
  transition: all var(--t-mid) var(--ease-out);
}

.more__item:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.055);
}

.more__item svg { width: 34px; height: 34px; border-radius: 8px; flex: none; }

.more__item b {
  display: block;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.more__item span { font-size: 0.75rem; color: var(--text-4); }
