/* =========================================================
   GLOBAL THEME & BASE
   ========================================================= */

:root {
  --bg:    #0b1220;
  --muted: #10192e;
  --card:  #0f1830;
  --text:  #e6eefc;
  --accent:#8bd3ff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}


html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

p {
  line-height: 1.6;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
  padding: 20px 0;
}

.flex {
  display: flex;
  gap: 16px;
  align-items: center;
}

.between {
  justify-content: space-between;
}

.small {
  font-size: 14px;
  opacity: 0.8;
}

/* =========================================================
   HEADER & FOOTER
   ========================================================= */

.site-header {
  background: var(--muted);
  border-bottom: 1px solid #1a2747;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-weight: 800;
}

.nav a {
  padding: 12px 10px;
  display: inline-block;
}

/* Sticky footer layout */
main.container {
  flex: 1 0 auto;
}

.site-footer {
  border-top: 1px solid #1a2747;
  background: var(--muted);
  margin-top: 24px;
  padding: 14px 0 0;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-footer .container > div {
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.2;
}

.site-footer .ad {
  margin: 12px 0 0;
}

/* Mobile */
@media (max-width: 600px) {
  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .site-footer .container > div {
    justify-content: flex-start;
  }
}



/* Ads */
.ad {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  opacity: 0.9;
}

/* Print */
@media print {
  header,
  footer,
  .ad,
  nav {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
  .puzzle {
    border: none;
    box-shadow: none;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .puzzle {
    padding: 12px 10px 14px;
  }
}


/* Cookie banner */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0f1830;
  color: #e6eefc;
  border-top: 1px solid #20315e;
  padding: 12px;
  z-index: 9999;
}

.cookie-banner .inner {
  width: min(1100px, 92%);
  margin: 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

/* Mobile */
@media (max-width: 600px) {
  .cookie-banner .inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .cookie-banner p {
    margin: 0 0 8px;
    font-size: 0.9rem;
  }

  .cookie-banner button {
    align-self: flex-start;
  }
}



.cookie-banner button {
  border: 1px solid #20315e;
  background: #142245;
  color: #e6eefc;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

/* =========================================================
   GENERIC CARDS & GRID
   ========================================================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}

.card {
  background: var(--card);
  padding: 16px;
  border-radius: 14px;
  border: 1px solid #20315e;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 8px rgba(139,211,255,0.18);
}

.meta {
  margin: 14px 0;
  opacity: 0.85;
}

/* Archive cards */ 

.grid .archive-card {
  background: #0f1830;
  border: 1px solid #20315e;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  transition: transform .15s ease, box-shadow .15s ease;
}

.grid .archive-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 8px rgba(139,211,255,0.15);
}

.archive-links {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1rem;
}

.archive-links .btn {
  background: #142347;
  border: 1px solid #2a437c;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  padding: .45rem .85rem;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}

.archive-links .btn:hover {
  background: #1c3b7a;
  transform: translateY(-1px);
}

/* =========================================================
   FAMILY LANDING (Puzzle families overview)
   ========================================================= */

.family-landing {
  margin: 12px 0 32px;
}

.family-landing h1 {
  margin: 0 0 4px;
  font-size: 1.9rem;
}

.family-landing .meta {
  margin: 0 0 16px;
  font-size: 0.95rem;
  opacity: 0.9;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}

.diff-grid .card {
  padding: 14px 14px 10px;
  text-align: left;
}

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

/* Only 2 columns when there is a fact/insight card */
@media (min-width: 860px) {
  .info-grid:has(.fact-card),
  .info-grid:has(.insight-card) {
    grid-template-columns: 2.1fr 1.2fr;
    align-items: flex-start;
  }
}

.info-card,
.fact-card,
.insight-card {
  background: var(--card);
  border: 1px solid #20315e;
  border-radius: 14px;
  padding: 16px 18px;     /* improved consistent inner spacing */
  width: 100%;
  max-width: 100%;
  margin: 0 auto 16px;    /* consistent spacing below */
}

/* Remove bottom gap on last element inside cards */
.info-card > :last-child,
.fact-card > :last-child,
.insight-card > :last-child,
.insight-block > :last-child,
.fact-block > :last-child {
  margin-bottom: 0 !important;
}


.info-card h2,
.info-card h3,
.fact-card h2,
.fact-card h3,
.insight-card h2,
.insight-card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
  color: rgb(139,211,255);
}


/* Eyebrow / kicker inside insight/fact/info cards */
/* Eyebrow / kicker: make ALL cards match the insight-block look */
/* Headings (eyebrow/kicker) */
.insight-block .insight-eyebrow,
.info-card .small,
.fact-card .small,
.insight-card .small {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: .4px;
  margin: 0 0 14px;     /* clean space under heading */
  color: #8bd3ff;
  opacity: 1;
  text-transform: none;
}




.info-card h2:first-of-type {
  margin-top: 0;
}

/* Paragraphs inside all cards (including insight-block) */
.info-card p,
.fact-card p,
.insight-card p,
.insight-block p,
.fact-block p {
  margin: 0 0 14px;     /* consistent paragraph spacing */
  font-size: 0.95rem;
  line-height: 1.6;
}


.howto-list {
  margin: 0 0 14px;     /* align with paragraphs */
  padding: 0;
  list-style: none;
}

.howto-list li {
  position: relative;
  margin: 10px 0;       /* slightly looser than before */
  padding-left: 18px;
  line-height: 1.6;
}

/* tighter first/last bullet spacing */
.howto-list li:first-child { margin-top: 0; }
.howto-list li:last-child  { margin-bottom: 0; }

.howto-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.1em;
  line-height: 1;
}





/* Ensure lists look consistent even inside insight-block */
.insight-block .howto-list { margin: 8px 0 14px 18px; padding: 0; list-style: none; }
.insight-block .howto-list li { position: relative; margin: 8px 0; padding-left: 18px; line-height: 1.6; }
.insight-block .howto-list li::before { content: '•'; position: absolute; left: 0; color: var(--accent); font-weight: bold; font-size: 1.1em; line-height: 1; }




.fact-block {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid #20315e;
  padding: 12px 14px;
}

.fact-block .fact-eyebrow {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.archive-note {
  margin-top: 18px;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* =========================================================
   SHARED PUZZLE CARD & CONTROLS
   ========================================================= */

/* Main puzzle card wrapper used across Sudoku, Wordsearch, Kakuro, Nonogram */
.puzzle {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid #20315e;
  padding: 16px 16px 18px;
  margin: 0 auto 18px;
  width: 100%;
  max-width: 100%;          /* align with .container width */
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* Shared toolbar + buttons + sizes */

.puzzle-toolbar-top,
.puzzle-toolbar-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.puzzle-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #20315e;
  background: #0f1830;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8bd3ff;
  min-width: 90px;
}

.puzzle-btn {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid #20315e;
  background: #142245;
  color: #e6eefc;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.puzzle-btn:hover {
  background: #182b4a;
}

.puzzle-btn-secondary {
  background: #0f1830;
  color: #8bd3ff;
}

.puzzle-btn.active {
  border-color: #ee6723;
  color: #ee6723;
}

.puzzle-actions,
.puzzle-size-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.puzzle-toolbar-bottom {
  flex-direction: column;
}

.puzzle-size-buttons {
  margin-top: 2px;
}

/* Default size scaling used where appropriate (overridden per puzzle if needed) */
.puzzle-size-sm .sized-grid {
  transform: scale(0.85);
  transform-origin: center top;
}
.puzzle-size-md .sized-grid {
  transform: scale(1);
  transform-origin: center top;
}
.puzzle-size-lg .sized-grid {
  transform: scale(1.15);
  transform-origin: center top;
}

@media (max-width: 600px) {
  .puzzle-size-sm .sized-grid,
  .puzzle-size-md .sized-grid,
  .puzzle-size-lg .sized-grid {
    transform: scale(1);
  }
}

/* =========================================================
   SUDOKU
   ========================================================= */

.sudoku-wrap { 
  text-align: center; 
}


.sudoku-grid {
  border-collapse: collapse;
  margin: 12px auto;
}

.sudoku-grid td {
  width: 34px;
  height: 34px;
  text-align: center;
  border: 1px solid #3a4b77;
  font-size: 16px;
  padding: 0;
}

.sudoku-grid tr:nth-child(3n) td {
  border-bottom: 2px solid #8bd3ff;
}

.sudoku-grid td:nth-child(3n) {
  border-right: 2px solid #8bd3ff;
}

.sudoku-grid .given {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #9fb3d1;
  background: #0a1324;
  font-weight: 800;
}

.sudoku-grid input.cell {
  width: 100%;
  height: 100%;
  text-align: center;
  background: #0a1324;
  border: none;
  font-weight: 800;
  font-size: 16px;
  color: #ee6723;
  outline: none;
}

.sudoku-grid input.cell:focus {
  outline: 2px solid #8bd3ff;
  outline-offset: -2px;
}

.sudoku-grid input.cell.mistake {
  background: #5a1f2b;
}

/* Solution highlight */
.sudoku-grid td.sol-user {
  color: #ee6723;
  font-weight: 800;
  background: #0a1324;
}
.sudoku-grid td.sol-given {
  color: #9fb3d1;
  font-weight: 800;
  background: #0a1324;
}

/* Pencil mode */

.sudoku-cell-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.pencil-notes {
  position: absolute;
  inset: 2px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font-size: 8px;
  line-height: 1;
  color: #7f8fb0;
  pointer-events: none;
}

.pencil-notes span {
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

input.cell[data-notes*="1"] ~ .pencil-notes span[data-n="1"],
input.cell[data-notes*="2"] ~ .pencil-notes span[data-n="2"],
input.cell[data-notes*="3"] ~ .pencil-notes span[data-n="3"],
input.cell[data-notes*="4"] ~ .pencil-notes span[data-n="4"],
input.cell[data-notes*="5"] ~ .pencil-notes span[data-n="5"],
input.cell[data-notes*="6"] ~ .pencil-notes span[data-n="6"],
input.cell[data-notes*="7"] ~ .pencil-notes span[data-n="7"],
input.cell[data-notes*="8"] ~ .pencil-notes span[data-n="8"],
input.cell[data-notes*="9"] ~ .pencil-notes span[data-n="9"] {
  opacity: 1;
}

/* Sudoku size modes */

.sudoku-wrap.puzzle-size-sm .sudoku-grid td {
  width: 26px;
  height: 26px;
}

.sudoku-wrap.puzzle-size-md .sudoku-grid td {
  width: 34px;
  height: 34px;
}

.sudoku-wrap.puzzle-size-lg .sudoku-grid td {
  width: 42px;
  height: 42px;
}

.sudoku-wrap.puzzle-size-sm input.cell {
  font-size: 14px;
}
.sudoku-wrap.puzzle-size-md input.cell {
  font-size: 16px;
}
.sudoku-wrap.puzzle-size-lg input.cell {
  font-size: 20px;
}

.sudoku-wrap.puzzle-size-sm .pencil-notes {
  font-size: 7px;
}
.sudoku-wrap.puzzle-size-md .pencil-notes {
  font-size: 8px;
}
.sudoku-wrap.puzzle-size-lg .pencil-notes {
  font-size: 9px;
}



/* --- Sudoku responsive spacing & sizing (scales bottom gap with cell size) --- */
.sudoku-wrap{
  /* defaults (MD) */
  --cell: 34px;
  --font: 16px;
  --note: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* set variables per size mode */
.sudoku-wrap.puzzle-size-sm { --cell: 26px; --font: 14px; --note: 7px; }
.sudoku-wrap.puzzle-size-md { --cell: 34px; --font: 16px; --note: 8px; }
.sudoku-wrap.puzzle-size-lg { --cell: 42px; --font: 20px; --note: 9px; }

/* the board itself should be in normal flow and push content below it */
.sudoku-wrap .sized-grid{
  display: block;
  /* the magic: bottom margin grows with board size to keep buttons clear */
  margin-bottom: clamp(10px, calc(var(--cell) * 1.4), 0px);
  /* ensure no rogue transform from global rules affects Sudoku */
  transform: none !important;
}

/* cells & text scale off the same variables */
.sudoku-wrap .sudoku-grid td{ width: var(--cell); height: var(--cell); }
.sudoku-wrap input.cell{ font-size: var(--font); }
.sudoku-wrap .sudoku-grid .given{ font-size: var(--font); }
.sudoku-wrap .pencil-notes{ font-size: var(--note); }






/* =========================================================
   KAKURO
   ========================================================= */

.kakuro {
  --cell: 48px;     /* base size, overridden by wrapper size classes below */
  --border: 2px;
  --diag: 2px;
  margin: 16px auto;
  display: block;
  border-collapse: collapse;
  transform-origin: center;
}

/* Size control driven by wrapper (so buttons move with grid) */
.kakuro-wrap.puzzle-size-sm .kakuro { --cell: 40px; }
.kakuro-wrap.puzzle-size-md .kakuro { --cell: 48px; }
.kakuro-wrap.puzzle-size-lg .kakuro { --cell: 62px; }

/* Important: for Kakuro we do NOT use transform scaling on sized-grid */
.kakuro-wrap .sized-grid {
  transform: none !important;
}

.kakuro td {
  width: var(--cell);
  height: var(--cell);
  border: var(--border) solid #3a4b77;
  position: relative;
  background: #0b152a;
  color: #e6eefc;
  text-align: center;
  overflow: hidden;
}

/* Kakuro clue (black) cells */
.kakuro .blk {
  position: relative;
  background: #050815;
  padding: 0;
  overflow: hidden;
}

/* Clue triangles (light blue tint) */
.kakuro .blk.hasR.hasC {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(139,211,255,0.14) 0),
    linear-gradient(45deg, rgba(139,211,255,0.14) 50%, transparent 0);
  background-repeat: no-repeat;
}

.kakuro .blk.hasR:not(.hasC) {
  background-image: linear-gradient(45deg, transparent 50%, rgba(139,211,255,0.14) 0);
  background-repeat: no-repeat;
}

.kakuro .blk.hasC:not(.hasR) {
  background-image: linear-gradient(45deg, rgba(139,211,255,0.14) 50%, transparent 0);
  background-repeat: no-repeat;
}

/* Diagonal separator */
.kakuro .blk::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      45deg,
      transparent calc(50% - var(--diag)),
      #3a4b77 50%,
      transparent calc(50% + var(--diag))
    );
  pointer-events: none;
  z-index: 1;
}

/* Sums: larger & neatly placed in triangle corners */
.kakuro .sumR,
.kakuro .sumC {
  position: absolute;
  z-index: 2;
  font-weight: 600;
  color: #9fb3d1;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}

/* Across sum (top-right triangle) */
.kakuro .sumR {
  top: 4px;
  right: 4px;
  font-size: 13px;
  text-align: right;
  /* Nudge inward so it's roughly equidistant from top, right, and diagonal */
  transform: translate(-18%, 18%);
}

/* Down sum (bottom-left triangle) */
.kakuro .sumC {
  bottom: 4px;
  left: 4px;
  font-size: 13px;
  text-align: left;
  /* Nudge inward so it's roughly equidistant from left, bottom, and diagonal */
  transform: translate(18%, -18%);
}


/* Scale sums with size */
.kakuro-wrap.puzzle-size-sm .sumR,
.kakuro-wrap.puzzle-size-sm .sumC {
  font-size: 11px;
}

.kakuro-wrap.puzzle-size-md .sumR,
.kakuro-wrap.puzzle-size-md .sumC {
  font-size: 13px;
}

.kakuro-wrap.puzzle-size-lg .sumR,
.kakuro-wrap.puzzle-size-lg .sumC {
  font-size: 15px;
}

/* Entry cells */
.kakuro input {
  width: 100%;
  height: 100%;
  background: #0a1324;
  color: #ee6723;
  border: none;
  text-align: center;
  font-weight: 800;
  font-size: calc(var(--cell) * 0.55);
  outline: none;
}

/* Pencil notes */
.kakuro .notes {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  grid-template-rows: repeat(3,1fr);
  pointer-events: none;
  color: #93b7ff;
  font-size: 14px;
  opacity: .95;
}

.kakuro .notes span {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Struck-out candidate (digit no longer possible in that run) */
.kakuro .notes span.note-struck {
  text-decoration: line-through;
  opacity: 0.45;
}

/* Ensure Kakuro action buttons clear tall grids cleanly when any old layout remains */
.kakuro + .flex {
  margin-top: 16px !important;
}
.kakuro-wrap.puzzle-size-lg .kakuro + .flex,
.kakuro.size-l + .flex {
  margin-top: 28px !important;
}

/* Kakuro toolbar buttons: match global puzzle button style */
.kakuro-wrap .puzzle-btn {
  background: #142245;
  color: #e6eefc;
  border-color: #20315e;
}

.kakuro-wrap .puzzle-btn.puzzle-btn-secondary {
  background: #0f1830;
  color: #8bd3ff;
}

.kakuro-wrap .puzzle-btn.active {
  border-color: #ee6723;
  color: #ee6723;
}


/* Wrong Kakuro entries: highlight like other puzzles */
.kakuro input.mistake {
  background: #3b1020;      /* deep red (previous error style vibe) */
  color: #ffb3a6;           /* softer contrast so it's clearly "wrong" */
}




/* =========================================================
   NONOGRAM
   ========================================================= */

/* (Optional legacy simple mode – safe to keep if anything still uses .nonogram) */
.nonogram {
  display: grid;
  gap: 2px;
  justify-content: center;
  margin: 12px auto;
}
.nonogram .cell {
  width: 24px;
  height: 24px;
  border: 1px solid #3a4b77;
  background: #0a1324;
  cursor: pointer;
}
.nonogram .cell.f {
  background: #1f3b63;
}

/* === Advanced aligned layout (current daily Nonogram) === */

.nonogram-block {
  margin: 0 auto 16px;
}

/* Outer container centers everything */
.nonogram-stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  margin: 0 auto;
}

/* Mobile */
@media (max-width: 600px) {
  .nonogram-stage {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nonogram-wrap {
    margin: 0 auto 8px;
  }
}



/* 2x2 grid:
   row 1: (empty) | top hints
   row 2: left hints | board
*/
.nonogram-wrap {
  --cell: 24px;
  display: grid;
  grid-template-columns: max-content max-content;
  grid-template-rows: max-content max-content;
  column-gap: 12px;   /* space between left hints & board */
  row-gap: 12px;      /* space between top hints & board */
  margin: 0 auto;
}

/* TOP HINTS: aligned with board columns (grid row 1, col 2) */
.nonogram-hints-top {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(var(--n-cols, 15), var(--cell));
  column-gap: 0;
  align-items: flex-end;
  justify-items: center;
}

.nonogram-hints-top .col-hints {
  width: var(--cell);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
}

/* LEFT HINTS: aligned with board rows (grid col 1, row 2) */
.nonogram-hints-left {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(var(--n-rows, 15), var(--cell));
  row-gap: 0;
  justify-items: flex-end;
  align-items: center;
}

.nonogram-hints-left .row-hints {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

/* Shared hint text styling */
.nonogram-hints-top .col-hints span,
.nonogram-hints-left .row-hints span {
  font-size: 12px;
  opacity: 0.85;
  padding: 1px 3px;
  border: 1px solid #20315e;
  border-radius: 6px;
  box-sizing: border-box;
}

/* BOARD: perfectly aligned in bottom-right (grid col 2, row 2) */
.nonogram-board {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(var(--n-cols, 15), var(--cell));
  grid-auto-rows: var(--cell);
  gap: 0;
  position: relative;
}

.nonogram-board .cell {
  width: var(--cell);
  height: var(--cell);
  background: #0a1324;
  border: 1px solid #20315e;
  cursor: pointer;
  box-sizing: border-box;
}

/* Light-blue guide lines every 5 cells */
.nonogram-board .cell[data-c="5"],
.nonogram-board .cell[data-c="10"],
.nonogram-board .cell[data-c="15"],
.nonogram-board .cell[data-c="20"] {
  border-left: 1px solid #8bd3ff;
}

.nonogram-board .cell[data-r="5"],
.nonogram-board .cell[data-r="10"],
.nonogram-board .cell[data-r="15"],
.nonogram-board .cell[data-r="20"] {
  border-top: 1px solid #8bd3ff;
}



/* Filled cell */
.nonogram-board .cell.f {
  background: #ee6723;
}

/* X mark (from X mode / Ctrl-click) */
/* X state: bold light-blue X */
.nonogram-board .cell.x {
  position: relative;
}

.nonogram-board .cell.x::before,
.nonogram-board .cell.x::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 2px;
  height: calc(100% - 8px);
  background: #8bd3ff;
  transform-origin: center;
  border-radius: 1px;
  opacity: 0.95;
  pointer-events: none;
}

.nonogram-board .cell.x::before {
  transform: translateX(-50%) rotate(45deg);
}

.nonogram-board .cell.x::after {
  transform: translateX(-50%) rotate(-45deg);
}


/* Error highlight (wrong filled cells) */
.nonogram-board .cell.err {
  position: relative;
  box-shadow: 0 0 0 2px rgba(255,77,120,.9);
  animation: nono-shake 140ms linear 0s 2;
}
.nonogram-board .cell.err::before,
.nonogram-board .cell.err::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: calc(100% - 8px);
  background: #fff;
  transform-origin: center;
  border-radius: 1px;
  opacity: .95;
}
.nonogram-board .cell.err::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.nonogram-board .cell.err::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}




@keyframes nono-shake {
  0% { transform: translateX(0); }
  25%{ transform: translateX(-2px); }
  50%{ transform: translateX(2px); }
  75%{ transform: translateX(-1px); }
 100%{ transform: translateX(0); }
}

/* Size classes: keep everything proportional */
.nonogram-block.puzzle-size-sm .nonogram-wrap { --cell: 18px; }
.nonogram-block.puzzle-size-md .nonogram-wrap { --cell: 24px; }
.nonogram-block.puzzle-size-lg .nonogram-wrap { --cell: 30px; }










/* =========================================================
   HERO SECTION (homepage hero image + overlay)
   ========================================================= */

.hero-wrap {
  position: relative;
  overflow: hidden;
  --parallax: 0px;
  padding-top: 40%;
  animation: heroNarrowD 1200ms ease-out 0s forwards;
}

.hero-wrap .hero-media {
  position: absolute;
  inset: 0;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: 50% calc(50% + var(--parallax));
  transform: scale(1.08);
  animation: heroZoomOut 1200ms ease-out 0s forwards;
  will-change: transform, background-position;
  z-index: 0;
}

.hero-wrap .hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--hero-overlay, rgba(0,0,0,.35));
  opacity: 0;
  animation: heroOverlayFade 800ms ease-out 0s forwards;
  z-index: 1;
}

.hero-wrap .hero-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 2;
}

.hero-wrap h1 {
  margin: 0 0 8px;
  font-size: 38px;
  opacity: 0;
  transform: translateY(8px);
  animation: heroTitleIn 500ms ease-out 0s forwards;
}

/* Mobile */
@media (max-width: 600px) {
  .hero-wrap h1 {
    font-size: 28px;
  }

  .hero-wrap p {
    font-size: 0.95rem;
    padding: 0 12px;
  }
}




.hero-wrap p {
  margin: 0;
  opacity: 0;
  transform: translateY(10px);
  animation: heroSubIn 500ms ease-out 50ms forwards;
}

.hero-ctas{
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.hero-btn{
  font-size: .9rem;
}

/* Make "Print" look like a secondary button */
.hero-btn-print{
  background: #fff;
  color: #142347;
  border-color: #fff;
}

.hero-btn-print:hover{
  background: #f3f4ff;
  color: #0b1320;
}



/* Responsive hero height anims */

@media (min-width:1024px) {
  .hero-wrap {
    padding-top: 40%;
    animation-name: heroNarrowD;
  }
  @keyframes heroNarrowD {
    from { padding-top:40%; }
    to   { padding-top:28%; }
  }
}

@media (min-width:600px) and (max-width:1023px) {
  .hero-wrap {
    padding-top:50%;
    animation-name: heroNarrowT;
  }
  @keyframes heroNarrowT {
    from { padding-top:50%; }
    to   { padding-top:36%; }
  }
}

@media (max-width:599px) {
  .hero-wrap {
    padding-top:60%;
    animation-name: heroNarrowM;
  }
  @keyframes heroNarrowM {
    from { padding-top:60%; }
    to   { padding-top:42%; }
  }
}

/* Hero shared keyframes */

@keyframes heroZoomOut {
  from { transform: scale(1.08); }
  to   { transform: scale(1.0); }
}

@keyframes heroOverlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes heroTitleIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}

@keyframes heroSubIn {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .hero-wrap { animation: none !important; }
  .hero-wrap .hero-media {
    transform: none !important;
    animation: none !important;
    background-position: 50% 50% !important;
  }
  .hero-wrap .hero-overlay {
    animation: none !important;
    opacity: 1 !important;
  }
  .hero-wrap h1,
  .hero-wrap p {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}






/* =========================================================
   WORDSEARCH — LAYOUT, PILLS, SIZING, STRIKES
   Scoped to: <section class="puzzle ..." data-wordsearch-root ...>
   ========================================================= */

/* "Find these words" label */
[data-wordsearch-root] .word-list-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #8bd3ff;
  opacity: 0.9;
  margin-top: 4px;
  width: 100%;
  text-align: center; /* centered as requested */
}

/* Top word pills:
   - responsive
   - max 4 columns on wide screens */
[data-wordsearch-root] .word-list {
  display: grid !important;
  gap: 6px 8px;
  margin: 8px auto 10px;
  padding: 0;
  width: 100%;
  max-width: 640px; /* tuned to align with puzzle & cap columns */
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  justify-content: center;
}





/* Pills */
[data-wordsearch-root] .word-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #10233d;
  border: 1px solid #264b7a;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8bd3ff;
  white-space: nowrap;
}

/* Found pills: orange + strike */
[data-wordsearch-root] .word-item.found {
  color: #ee6723;
  border-color: #ee6723;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #ee6723;
}

/* === Grid & cells ===
   PHP sets: data-cols, and inline --ws-cols / --ws-cell on .word-grid
   We use --ws-cell so Small/Default/Large resize WIDTH + HEIGHT.
*/

[data-wordsearch-root] .word-grid {
  display: grid;
  grid-template-columns: repeat(var(--ws-cols, 10), var(--ws-cell, 28px));
  gap: 0; /* no gaps -> continuous strikes */
  margin: 10px auto 4px;
  justify-content: center;
}

[data-wordsearch-root] .word-cell {
  position: relative;
  width: var(--ws-cell, 28px);
  height: var(--ws-cell, 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3a4b77;
  font-weight: 600;
  font-size: 14px;
  color: #e6eefc;
  user-select: none;
  cursor: pointer;
  background: #0a1324;
  z-index: 1; /* letters above strike */
}

/* While dragging / selecting: light blue background so path is visible */
[data-wordsearch-root] .word-cell.sel {
  background: #15264a;
}

/* Found letters: orange for clarity */
[data-wordsearch-root] .word-cell.found {
  color: #ee6723;
}



[data-wordsearch-root] .word-cell.sel::before,
[data-wordsearch-root] .word-cell.found::before {
  content: "";
  position: absolute;
  background: #ee6723;   /* orange strike */
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;            /* behind text */
}

/* Horizontal */
[data-wordsearch-root] .word-cell.found-h::before,
[data-wordsearch-root] .word-cell.sel.found-h::before {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
}

/* Vertical */
[data-wordsearch-root] .word-cell.found-v::before,
[data-wordsearch-root] .word-cell.sel.found-v::before {
  top: 0;
  bottom: 0;
  width: 1px;
  left: 50%;
  transform: translateX(-50%);
}

/* Diagonal TL -> BR */
[data-wordsearch-root] .word-cell.found-d1::before,
[data-wordsearch-root] .word-cell.sel.found-d1::before {
  width: 140%;
  height: 1px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Diagonal BL -> TR */
[data-wordsearch-root] .word-cell.found-d2::before,
[data-wordsearch-root] .word-cell.sel.found-d2::before {
  width: 140%;
  height: 1px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* === Size buttons: scale grid via --ws-cell so width + height change === */

[data-wordsearch-root] .sized-grid {
  transform: none !important; /* kill generic transform scaling */
}

/* Default */
[data-wordsearch-root].puzzle-size-md .word-grid {
  --ws-cell: 28px;
}

/* Small */
[data-wordsearch-root].puzzle-size-sm .word-grid {
  --ws-cell: 22px;
}

/* Large */
[data-wordsearch-root].puzzle-size-lg .word-grid {
  --ws-cell: 34px;
}


/* Mobile */
@media (max-width: 480px) {
  /* Slightly smaller cells and text on small phones */
  [data-wordsearch-root] .word-grid {
    --ws-cell: 24px;
  }

  [data-wordsearch-root] .word-cell {
    font-size: 12px;
  }

  /* Make pills a bit more compact */
  [data-wordsearch-root] .word-item {
    padding: 4px 8px;
    font-size: 9px;
    letter-spacing: 0.06em;
  }
}




/************************************
ALL ABOUT ADS SECTION
*************************************/
.ad-block {
  margin: 16px auto;
  text-align: center;
  background: #0b1628;
  border: 1px solid #233455;
  border-radius: 8px;
  padding: 4px;
}
.ad-block ins.adsbygoogle {
  display: block !important;
  margin: 0 auto;
}
.affiliate-puzzle-block {
  background: #0d1b33;
  border: 1px solid #1f3150;
  border-radius: 12px;
  padding: 16px;
  margin: 24px auto;
  text-align: center;
}
.affiliate-puzzle-block .aff-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Mobile */
@media (max-width: 600px) {
  .affiliate-puzzle-block .aff-card {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }
}



.affiliate-puzzle-block .aff-card {
  background: #112244;
  color: #8bd3ff;
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  width: 220px;
  transition: background 0.2s;
}
.affiliate-puzzle-block .aff-card:hover {
  background: #153060;
}
.affiliate-puzzle-block .aff-cta {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}



/* View Solution Button Global */
.view-solution-out { text-align:center; margin-top:8px; }
.view-solution-out .btn-link{
  display:inline-block; padding:6px 12px; border-radius:10px;
  border:1px solid #20315e; background:#0f1830; color:#8bd3ff; text-decoration:none;
}
.view-solution-out .btn-link:hover{ background:#182b4a; }


/* === Quick play notes === */
.note-game {
  margin-top: 12px;
  font-size: 0.9rem;
  opacity: 0.9;
  text-align: center;
  color: #9fb3d1;
}
.note-game em {
  color: #8bd3ff;
  font-style: normal;
  font-weight: 600;
}





.puzzle-noscript{
  padding:12px 14px;
  margin:10px 0;
  border:1px solid rgba(0,0,0,.12);
  border-radius:10px;
  background:rgba(0,0,0,.03);
}



/* Homepage puzzle card titles */
.info-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary, #fff);
  margin: 0 0 6px;
}





