:root {
  --bg:        #FFF8EE;
  --bg-2:      #FFEFD8;
  --paper:     #FFFFFF;
  --ink:       #1F1A2E;
  --ink-soft:  #5A5170;
  --line:      #ECE0CC;
  --line-soft: #F6ECDB;

  --c-red:     #FF4D5E;
  --c-orange:  #FF8A2B;
  --c-yellow:  #FFCC2E;
  --c-lime:    #B8E04A;
  --c-green:   #2CC07A;
  --c-teal:    #2BB8C7;
  --c-blue:    #3D7BFF;
  --c-indigo:  #6E55E8;
  --c-pink:    #FF6FB1;
  --c-magenta: #D63FB8;
  --c-brown:   #B5763A;
  --c-coral:   #FF7A66;

  --display: "Rubik", ui-sans-serif, system-ui, sans-serif;
  --body:    "Heebo", ui-sans-serif, system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(900px 600px at 90% -100px, #FFE0AA 0%, transparent 60%),
    radial-gradient(800px 500px at -100px 200px, #FFD6E5 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }

/* ── Top bar ── */
header.top {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.top-inner { display: flex; align-items: center; gap: 28px; padding: 14px 0; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 800;
  font-size: 24px; letter-spacing: -0.01em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--c-red)    0deg 60deg,
    var(--c-orange) 60deg 120deg,
    var(--c-yellow) 120deg 180deg,
    var(--c-green)  180deg 240deg,
    var(--c-blue)   240deg 300deg,
    var(--c-indigo) 300deg 360deg
  );
  border: 2px solid var(--ink);
}
nav.primary { display: flex; gap: 22px; font-weight: 700; font-size: 15px; }
nav.primary a { position: relative; padding: 4px 2px; }
nav.primary a::after {
  content: ""; position: absolute; right: 0; left: 0; bottom: -2px;
  height: 3px; background: var(--c-yellow); border-radius: 2px;
  transform: scaleX(0); transform-origin: right; transition: transform .15s;
}
nav.primary a:hover::after { transform: scaleX(1); }
.top-spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--ink); background: var(--paper);
  border-radius: 999px; padding: 7px 14px; width: 280px;
  transition: box-shadow .15s;
}
.search:focus-within { box-shadow: 4px 4px 0 var(--c-yellow); }
.search input {
  border: 0; outline: 0; background: transparent;
  font: inherit; flex: 1; color: var(--ink);
}
.search svg { color: var(--ink); flex: 0 0 auto; }

/* ── Buttons ── */
.btn {
  font-family: var(--body); font-weight: 800; font-size: 14px;
  border: 2px solid var(--ink); background: var(--c-yellow); color: var(--ink);
  padding: 9px 18px; border-radius: 999px;
  transition: transform .08s ease, box-shadow .08s ease;
  box-shadow: 3px 3px 0 var(--ink);
}
.btn:hover  { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(1px,1px);   box-shadow: 1px 1px 0 var(--ink); }
.btn.pink  { background: var(--c-pink);  color: #fff; }
.btn.blue  { background: var(--c-blue);  color: #fff; }
.btn.green { background: var(--c-green); color: #fff; }

/* ── Hero ── */
.hero {
  padding: 64px 0 36px;
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 48px; align-items: end;
}
.hero h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(46px,6vw,86px); line-height: 1;
  letter-spacing: -0.025em; margin: 0 0 20px; text-wrap: balance;
}
.hero h1 .word { display: inline-block; padding: 0 .12em; border-radius: 8px; }
.hero h1 .w1 { background: var(--c-yellow); }
.hero h1 .w2 { background: var(--c-pink); color: #fff; }
.hero h1 .w3 { background: var(--c-teal); color: #fff; }
.hero p { font-size: 18px; color: var(--ink-soft); max-width: 52ch; margin: 0 0 28px; text-wrap: pretty; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats {
  margin-top: 36px; display: flex; gap: 36px;
  border-top: 2px solid var(--ink); padding-top: 20px;
}
.stat .n { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: -0.02em; line-height: 1; }
.stat:nth-child(1) .n { color: var(--c-red); }
.stat:nth-child(2) .n { color: var(--c-blue); }
.stat:nth-child(3) .n { color: var(--c-green); }
.stat:nth-child(4) .n { color: var(--c-magenta); }
.stat .l { font-size: 13px; color: var(--ink-soft); margin-top: 4px; font-weight: 500; }

/* hero collage */
.collage {
  position: relative; aspect-ratio: 5/4;
  border: 2px solid var(--ink); background: var(--paper);
  border-radius: 8px; box-shadow: 8px 8px 0 var(--ink); overflow: hidden;
}
.collage::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 16px, var(--bg-2) 16px 17px);
}
.collage .card {
  position: absolute; background: white;
  border: 2.5px solid var(--ink); border-radius: 6px;
  box-shadow: 4px 4px 0 var(--ink);
  display: flex; flex-direction: column;
  padding: 7px 7px 0 7px;
}
.collage .card .ph {
  flex: 1; overflow: hidden;
  border: 2px solid var(--ink); border-radius: 2px;
  display: flex;
}
.collage .card .ph img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.collage .card .label {
  font-family: var(--display); font-weight: 700; font-size: 11px;
  padding: 5px 4px 6px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.collage .c1 { right: 6%;  top: 10%;    width: 44%; height: 48%; transform: rotate(-4deg); }
.collage .c1 .ph { background: var(--c-orange); }
.collage .c1 .label { color: var(--c-orange); }
.collage .c2 { left: 8%;  top: 6%;     width: 38%; height: 42%; transform: rotate(3deg); }
.collage .c2 .ph { background: var(--c-pink); }
.collage .c2 .label { color: var(--c-magenta); }
.collage .c3 { right: 28%; bottom: 8%; width: 46%; height: 44%; transform: rotate(-1.5deg); }
.collage .c3 .ph { background: var(--c-teal); }
.collage .c3 .label { color: var(--c-teal); }

/* ── Section heads ── */
section { padding: 64px 0; border-top: 2px solid var(--ink); position: relative; }
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px; margin-bottom: 28px;
}
.eyebrow {
  font-family: var(--display); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px;
  color: var(--c-magenta); margin-bottom: 8px; display: inline-block;
  background: #fff; border: 2px solid var(--ink); padding: 3px 10px; border-radius: 999px;
}
.section-head h2 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(32px,3.4vw,46px); letter-spacing: -0.025em; line-height: 1.05; margin: 0;
}
.section-head h2 em { font-style: normal; background: var(--c-lime); padding: 0 .15em; border-radius: 6px; }
.section-head .meta { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.section-head .meta a { color: var(--ink); border-bottom: 2px solid var(--c-blue); padding-bottom: 1px; font-weight: 700; }

/* ── Filter chips ── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.chip {
  font-family: var(--body); font-weight: 700; font-size: 14px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 8px 16px; border-radius: 999px; transition: all .12s;
  box-shadow: 2px 2px 0 var(--ink); cursor: pointer;
}
.chip:hover  { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.chip.active { background: var(--ink); color: var(--paper); }
.chip .count { opacity: 0.7; margin-right: 6px; font-weight: 500; }
.chip[data-c="red"]    { background: var(--c-red);    color: #fff; }
.chip[data-c="orange"] { background: var(--c-orange); color: #fff; }
.chip[data-c="yellow"] { background: var(--c-yellow); }
.chip[data-c="green"]  { background: var(--c-green);  color: #fff; }
.chip[data-c="teal"]   { background: var(--c-teal);   color: #fff; }
.chip[data-c="blue"]   { background: var(--c-blue);   color: #fff; }
.chip[data-c="indigo"] { background: var(--c-indigo); color: #fff; }
.chip[data-c="pink"]   { background: var(--c-pink);   color: #fff; }

/* ── Category grid ── */
.cat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.cat {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 10px;
  overflow: hidden; transition: transform .12s, box-shadow .12s;
  display: flex; flex-direction: column; box-shadow: 4px 4px 0 var(--ink);
}
.cat:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--ink); }
.cat .thumb {
  aspect-ratio: 4/3; border-bottom: 2px solid var(--ink);
  position: relative; background: var(--cat-bg, var(--c-yellow));
  display: grid; place-items: center; overflow: hidden;
}
.cat .thumb::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(var(--angle,25deg), transparent 0 14px, rgba(255,255,255,0.18) 14px 15px);
}
.coloring-img,
.mini-coloring,
.page-thumb img,
.collage .card .ph img,
#print-img {
  filter: grayscale(100%) contrast(1.15);
}

.cat .thumb .coloring-img {
  position: relative; z-index: 1;
  width: 56%; aspect-ratio: 1; object-fit: contain;
  background: white; border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink); display: block; padding: 6px;
}
.cat.featured .thumb .coloring-img { width: 52%; }
.cat .thumb .corner {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--display); font-weight: 700; font-size: 12px;
  color: var(--ink); background: var(--paper);
  padding: 3px 10px; border: 2px solid var(--ink); border-radius: 999px;
}
.cat .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--paper); }
.cat .body h3 { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.015em; margin: 0; }
.cat .body p  { margin: 0; font-size: 14px; color: var(--ink-soft); }
.cat .body .foot {
  margin-top: 10px; display: flex; justify-content: space-between; align-items: center;
  font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--ink);
}
.cat .body .foot .tag {
  background: var(--cat-bg, var(--c-yellow)); color: var(--ink);
  border: 1.5px solid var(--ink); padding: 2px 8px; border-radius: 999px;
}
.cat .body .foot .arrow { transition: transform .15s; font-size: 16px; }
.cat:hover .body .foot .arrow { transform: translateX(-3px); }
.cat.featured { grid-column: span 2; grid-row: span 2; }
.cat.featured .thumb { aspect-ratio: 5/4; }
.cat.featured .body h3 { font-size: 32px; }
.cat.featured .body p  { font-size: 15px; max-width: 44ch; }

/* ── Popular strip ── */
.pop-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 14px; }
.sheet {
  background: var(--paper); border: 2px solid var(--ink);
  aspect-ratio: 8.5/11; position: relative; border-radius: 4px;
  overflow: hidden; transition: transform .15s, box-shadow .15s;
  box-shadow: 3px 3px 0 var(--ink);
}
.sheet:hover { transform: translate(-2px,-2px) rotate(-0.5deg); box-shadow: 6px 6px 0 var(--ink); }
.sheet .pad {
  position: absolute; inset: 16px;
  border: 1.5px dashed var(--ink); display: grid; place-items: center;
  background: var(--sheet-bg, var(--c-yellow));
}
.sheet .pad img.mini-coloring {
  width: 70%; border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink); background: white; display: block; padding: 4px;
}
.sheet .tag {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  font-family: var(--display); font-weight: 800; font-size: 11px;
  background: var(--ink); color: var(--paper); padding: 3px 9px; border-radius: 999px;
}
.sheet .tag.hot  { background: var(--c-red); }
.sheet .tag.new  { background: var(--c-green); }
.sheet .tag.kids { background: var(--c-blue); }
.sheet .caption {
  position: absolute; bottom: 0; right: 0; left: 0;
  font-family: var(--display); font-weight: 700; font-size: 12px;
  color: #fff; background: rgba(0,0,0,.72);
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; gap: 6px;
  opacity: 0; transition: opacity .18s;
  z-index: 2;
}
.sheet:hover .caption { opacity: 1; }

/* ── Holidays ── */
.hol-strip { display: grid; grid-template-columns: repeat(8,1fr); gap: 12px; }
.hol {
  border: 2px solid var(--ink); padding: 18px 10px 14px; border-radius: 10px;
  text-align: center; transition: all .12s; box-shadow: 3px 3px 0 var(--ink);
  background: var(--hol-bg, var(--paper)); color: var(--hol-fg, var(--ink));
}
.hol:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.hol .month {
  font-family: var(--display); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink);
  padding: 2px 8px; border-radius: 999px; display: inline-block; margin-bottom: 10px;
}
.hol .name { font-family: var(--display); font-weight: 800; font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; }
.hol .num  { margin-top: 8px; font-family: var(--display); font-weight: 600; font-size: 12px; opacity: 0.85; }

/* ── Ages / difficulty ── */
.age-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.age {
  border: 2px solid var(--ink); background: var(--paper); border-radius: 12px;
  padding: 22px 22px 26px; box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s; position: relative; overflow: hidden;
}
.age::before {
  content: ""; position: absolute; top: -30px; left: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--age-c, var(--c-yellow)); opacity: 0.85;
}
.age:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--ink); }
.age .level { display: flex; gap: 5px; margin-bottom: 16px; position: relative; }
.age .level i {
  width: 14px; height: 14px; border: 2px solid var(--ink);
  border-radius: 50%; background: var(--paper);
}
.age .level i.on { background: var(--age-c, var(--c-red)); }
.age h4 { font-family: var(--display); font-size: 24px; font-weight: 900; margin: 0 0 6px; letter-spacing: -0.02em; position: relative; }
.age .range {
  font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--ink);
  background: var(--age-c, var(--c-yellow)); border: 1.5px solid var(--ink);
  padding: 2px 10px; border-radius: 999px; display: inline-block; margin-bottom: 10px; position: relative;
}
.age p { margin: 0; color: var(--ink-soft); font-size: 14px; position: relative; }

/* ── How it works ── */
.how { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.step {
  border: 2px solid var(--ink); border-radius: 12px; padding: 22px;
  background: var(--paper); box-shadow: 4px 4px 0 var(--ink);
}
.step:nth-child(1) { background: var(--c-yellow); }
.step:nth-child(2) { background: var(--c-pink); color: #fff; }
.step:nth-child(3) { background: var(--c-teal); color: #fff; }
.step:nth-child(2) .n,
.step:nth-child(3) .n { color: #fff; opacity: 0.85; }
.step .n { font-family: var(--display); font-weight: 900; font-size: 36px; letter-spacing: -0.02em; margin-bottom: 10px; line-height: 1; }
.step h4  { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; margin: 0 0 8px; }
.step p   { margin: 0; font-size: 14.5px; max-width: 36ch; opacity: 0.95; }

/* ── Footer ── */
footer {
  border-top: 2px solid var(--ink); background: var(--ink);
  color: #FFF8EE; padding: 56px 0 36px; margin-top: 40px;
}
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 36px; }
footer .brand { color: #FFF8EE; }
.foot-grid h5 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: 12px; letter-spacing: 0.08em; color: var(--c-yellow); margin: 0 0 14px;
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.foot-grid a  { font-size: 14px; color: #FFF8EE; opacity: 0.85; }
.foot-grid a:hover { color: var(--c-yellow); opacity: 1; }
.foot-grid p  { font-size: 14px; opacity: 0.8; margin: 0 0 14px; max-width: 32ch; }
.foot-bot {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255,248,238,.2);
  display: flex; justify-content: space-between;
  font-family: var(--display); font-weight: 600; font-size: 12px; opacity: 0.7;
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .hero            { grid-template-columns: 1fr; gap: 32px; }
  .cat-grid        { grid-template-columns: repeat(2,1fr); }
  .cat.featured    { grid-column: span 2; grid-row: auto; }
  .pop-grid        { grid-template-columns: repeat(3,1fr); }
  .hol-strip       { grid-template-columns: repeat(4,1fr); }
  .age-grid        { grid-template-columns: repeat(2,1fr); }
  .how             { grid-template-columns: 1fr; }
  .foot-grid       { grid-template-columns: 1fr 1fr; }
  nav.primary      { display: none; }
  .search          { width: 200px; }
}
@media (max-width: 560px) {
  /* Search: wrap to second row, full width */
  .top-inner       { flex-wrap: wrap; gap: 10px; padding-bottom: 10px; }
  .top-spacer      { display: none; }
  .search          { display: flex; width: 100%; order: 99; border-radius: 10px; }

  .cat-grid        { grid-template-columns: repeat(2,1fr); gap: 12px; }
  .cat.featured    { grid-column: auto; }
  .pop-grid        { grid-template-columns: repeat(2,1fr); }
  .hol-strip       { grid-template-columns: repeat(2,1fr); }
  .age-grid        { grid-template-columns: repeat(2,1fr); }

  /* Category view: edge-to-edge on mobile */
  #category-view .wrap { padding: 0 10px; }
  .view-inner      { padding: 20px 0 60px; }
  .view-title      { font-size: 2rem; }
}

/* ── Category view overlay ── */
body.view-open { overflow: hidden; }

#category-view {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg); overflow-y: auto;
  animation: slideUp .22s ease;
}
#category-view.hidden { display: none; }

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

.view-inner { padding: 40px 0 80px; }

.view-back {
  margin-bottom: 32px;
  font-size: 15px;
}

.view-header { margin-bottom: 40px; border-bottom: 2px solid var(--ink); padding-bottom: 32px; }
.view-header .eyebrow { display: inline-block; margin-bottom: 12px; }

.view-title {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(38px, 5vw, 64px); letter-spacing: -0.025em;
  line-height: 1; margin: 0 0 12px;
}

.view-desc { font-size: 18px; color: var(--ink-soft); margin: 0 0 16px; max-width: 56ch; }

.view-meta {
  display: inline-block;
  font-family: var(--display); font-weight: 700; font-size: 13px;
  background: var(--cat-accent, var(--c-yellow));
  border: 2px solid var(--ink); padding: 4px 14px; border-radius: 999px;
}

/* ── Pages grid ── */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
}

.page-card {
  background: var(--paper); border: 2px solid var(--ink);
  border-radius: 10px; overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
  cursor: pointer; display: flex; flex-direction: column;
}
.page-card:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--ink); }

.page-thumb {
  aspect-ratio: 1; position: relative;
  background: var(--cat-bg, var(--c-yellow));
  display: grid; place-items: center;
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
}
.page-thumb::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(25deg, transparent 0 14px, rgba(255,255,255,.18) 14px 15px);
}
.page-thumb img {
  width: 70%; max-height: 90%; object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
  background: transparent;
  border-radius: 4px;
  position: relative; z-index: 1;
}
/* shimmer skeleton while image loads */
.page-thumb::after {
  content: "";
  position: absolute; inset: 15%;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,.55) 25%, rgba(255,255,255,.85) 50%, rgba(255,255,255,.55) 75%);
  background-size: 200% 100%;
  animation: thumb-shimmer 1.4s infinite;
  z-index: 0;
  pointer-events: none;
}
.page-thumb.loaded::after { display: none; }
@keyframes thumb-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.page-tag {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-family: var(--display); font-weight: 800; font-size: 11px;
  padding: 3px 9px; border-radius: 999px; color: #fff;
}
.page-tag.tag-hot  { background: var(--c-red); }
.page-tag.tag-new  { background: var(--c-green); }
.page-tag.tag-kids { background: var(--c-blue); }

.page-meta {
  padding: 10px 14px 6px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; background: var(--paper); position: relative; z-index: 2;
}
.page-name {
  font-family: var(--display); font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.page-diff {
  font-family: var(--display); font-weight: 700; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--ink);
  white-space: nowrap;
}
.diff-easy   { background: var(--c-lime); }
.diff-medium { background: var(--c-yellow); }
.diff-hard   { background: var(--c-orange); color: #fff; }
.diff-adult  { background: var(--c-indigo); color: #fff; }

.page-counts {
  padding: 4px 14px 8px;
  display: flex; gap: 8px;
  background: var(--paper); position: relative; z-index: 2;
}
.cnt-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
  border: 1.5px solid #111; box-shadow: 1px 1px 0 #111;
}
.print-cnt { background: var(--c-yellow); color: #111; }
.view-cnt  { background: #f0f0f0;        color: #444; }

.pop-legend { display: flex; gap: 8px; margin-top: 8px; }

.nav-popular {
  background: var(--c-yellow); color: #111 !important;
  border: 2px solid #111; border-radius: 20px;
  padding: 4px 14px; font-weight: 700;
  box-shadow: 2px 2px 0 #111;
}

.page-actions {
  display: flex; gap: 8px;
  padding: 8px 14px 14px;
  background: var(--paper); position: relative; z-index: 2;
}
.print-btn, .pdf-btn {
  flex: 1; margin: 0;
  font-size: 13px; padding: 8px 10px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.25);
}
.print-btn {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.print-btn:hover { background: #2d2640; box-shadow: 4px 4px 0 rgba(0,0,0,.25); }
.pdf-btn {
  background: var(--c-blue); color: #fff; border-color: var(--c-blue);
}
.pdf-btn:hover { background: #2462e0; box-shadow: 4px 4px 0 rgba(0,0,0,.25); }
.btn-pdf-do {
  background: var(--c-blue) !important; color: #fff !important;
  font-size: 15px !important; padding: 11px 24px !important;
}

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 80px 20px;
  border: 2px dashed var(--line); border-radius: 16px;
  margin: 40px 0;
}
.empty-icon { font-size: 64px; margin-bottom: 20px; }
.empty-state h3 { font-family: var(--display); font-size: 28px; font-weight: 900; margin: 0 0 12px; }
.empty-state p  { color: var(--ink-soft); font-size: 16px; margin: 0; }

/* ── Print preview modal ── */
body.print-preview-open { overflow: hidden; }

#print-preview {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(31,26,46,.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#print-preview.hidden { display: none; }

.print-modal {
  background: white; border: 3px solid var(--ink);
  border-radius: 12px; box-shadow: 8px 8px 0 var(--ink);
  width: min(600px, 100%);
  display: flex; flex-direction: column;
  overflow: hidden; max-height: 90vh;
}

.print-modal-header {
  padding: 16px 20px;
  border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--c-yellow);
}
.print-modal-header h3 {
  font-family: var(--display); font-weight: 800;
  font-size: 18px; margin: 0; letter-spacing: -0.01em;
}
.modal-close {
  background: none; border: 2px solid var(--ink); border-radius: 50%;
  width: 32px; height: 32px; font-size: 16px; line-height: 1;
  cursor: pointer; transition: background .1s;
}
.modal-close:hover { background: var(--ink); color: white; }

.print-modal-body {
  flex: 1; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 30px; background: #f5f5f5;
}
#print-img {
  max-width: 100%; max-height: 60vh;
  border: 2px solid var(--line); background: white;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
}

.print-modal-footer {
  padding: 16px 20px;
  border-top: 2px solid var(--ink);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
#print-name {
  font-family: var(--display); font-weight: 700; font-size: 14px;
  color: var(--ink-soft);
}
.btn-print-do {
  background: var(--c-green) !important; color: #fff !important;
  font-size: 15px !important; padding: 11px 24px !important;
}

/* ── @media print ── */
@media print {
  /* hide everything */
  header, main, footer, #category-view, .print-modal-header, .print-modal-footer { display: none !important; }

  /* show only the print overlay image */
  body { background: white !important; margin: 0 !important; }
  #print-preview { position: fixed !important; inset: 0 !important; background: white !important; display: flex !important; padding: 0 !important; }
  .print-modal { border: none !important; box-shadow: none !important; border-radius: 0 !important; width: 100% !important; max-height: none !important; }
  .print-modal-body { padding: 0 !important; background: white !important; }
  #print-img { max-width: 100vw !important; max-height: 100vh !important; width: 100% !important; height: 100% !important; object-fit: contain !important; }
}

/* ── Responsive additions ── */
@media (max-width: 560px) {
  .pages-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
