/* The pages to read and to print (/nonogram/size/..., /nonogram/print/..., src/pages/pages.ts), in
   the how-to page's cross-stitch look: cloth, navy thread, a wooden hoop round a board. On paper a
   page of sheets (body.sheets) prints only its sheets, one to a page of A4. */
:root { --bg: #f6f1e8; --ink: #2a2620; --muted: #7a7064; --accent: #2f4a78; --accent-text: #2f4a78; --red: #c44646; --cloth: #f7f0e2; --line: rgb(120 96 64 / 0.3); --surface-2: #f1ebdf; --shadow: 0 1px 2px rgb(60 40 20 / 0.06), 0 6px 18px rgb(60 40 20 / 0.08); }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg) repeating-linear-gradient(90deg, rgb(255 255 255 / 0.14) 0 2px, transparent 2px 6px); font: 500 16px/1.8 "Lounge Sans", "Noto Sans JP", system-ui, sans-serif; }
main { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; }
a { color: var(--accent-text); }
:lang(ja) { word-break: auto-phrase; }
h1, h2, h3, summary, figcaption { text-wrap: balance; }
p, li, td, th { text-wrap: pretty; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: inherit; }
h1, h2, h3 { font-family: "Lounge Round", "M PLUS Rounded 1c", sans-serif; font-weight: 900; line-height: 1.4; }
h1 { font-size: clamp(25px, 5vw, 34px); margin: 10px 0 8px; }
h1 small { display: block; margin-top: 2px; font-size: 0.62em; color: #5a5046; }
.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 16px 0 0; font: 900 15px "Lounge Round", sans-serif; color: var(--muted); }
.lead { margin: 0 0 16px; color: #5a5046; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
section { margin-top: 26px; padding: 20px 22px 18px; border-radius: 20px; background: #fffaf2; box-shadow: var(--shadow); }
section > h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 21px; }
section > h2 .n { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 18px; }
@media (max-width: 600px) { section { padding: 18px 16px 16px; } }

/* The ways on: a navy button, and a cream one beside it. */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.actions.center { justify-content: center; margin-top: 30px; }
.actions a, .actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; text-decoration: none; font: 900 16px "Lounge Round", sans-serif; box-shadow: 0 3px 0 #1f3357; cursor: pointer; }
.actions .alt { background: #fffaf2; color: var(--accent-text); box-shadow: inset 0 0 0 2px rgb(47 74 120 / 0.35), 0 3px 0 rgb(47 74 120 / 0.25); }


/* A level: five rising bars, so many lit, as in the game. */
.lv { --lv: #2a2620; display: inline-flex; align-items: flex-end; gap: 1.5px; height: 12px; vertical-align: -1px; }
.lv i { width: 4px; border-radius: 1.5px; background: var(--lv); }
.lv i:nth-child(1) { height: 28%; }
.lv i:nth-child(2) { height: 46%; }
.lv i:nth-child(3) { height: 64%; }
.lv i:nth-child(4) { height: 82%; }
.lv i:nth-child(5) { height: 100%; }
.lv i.off { background: rgb(42 38 32 / 0.14); }
.lv.l1, .lv.l2 { --lv: #3d9b43; }
.lv.l3 { --lv: #2b8ad2; }
.lv.l4, .lv.l5 { --lv: #c44646; }

.steps { display: grid; gap: 10px; margin: 0 0 12px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 12px 14px 12px 54px; border-radius: 14px; border: 2px dashed rgb(196 70 70 / 0.25); }
.steps li::before { content: "STEP " counter(step); position: absolute; left: 10px; top: 14px; width: 38px; font: 900 10px/1.2 "Lounge Round", sans-serif; color: var(--red); text-align: center; }
.links { margin: 6px 0 0; padding-left: 1.2em; }
.links li { margin: 4px 0; }
.more { margin: 8px 0 0; font-weight: 700; }

/* A board: cloth in a wooden hoop on the screen. */
.ng-board { display: block; width: 100%; height: auto; }
.g-num text { font: 800 5.6px "Lounge Round", "M PLUS Rounded 1c", sans-serif; fill: #5a4630; text-anchor: middle; }
.g-band { fill: rgb(120 96 64 / 0.07); }
.g-cloth { fill: var(--cloth); }
.g-line { fill: none; stroke: rgb(120 96 64 / 0.3); stroke-width: 0.35; }
.g-five { fill: none; stroke: rgb(196 70 70 / 0.62); stroke-width: 0.6; stroke-dasharray: 1.6 1.1; }
.g-edge { fill: none; stroke: rgb(90 70 48 / 0.6); stroke-width: 0.7; }
.sample { max-width: 460px; margin: 14px auto 18px; padding: 14px 16px 14px 10px; border-radius: 22px; background: var(--cloth); box-shadow: 0 0 0 7px #c99a62, 0 0 0 9px #a87b46, 0 10px 26px rgb(90 70 48 / 0.3); }
.sample + .actions { justify-content: center; }

.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.numbers a { display: grid; place-items: center; height: 44px; border-radius: 10px; background: var(--surface-2); color: var(--ink); text-decoration: none; font: 900 16px "Lounge Round", sans-serif; }
.numbers a:hover { background: var(--accent); color: #fff; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 0; font-weight: 800; }

/* A sheet: white paper on the screen; on paper, a page of A4. Of many sheets of a kind, the
   screen shows the first as a sample; the answers stay off the screen, printed only. */
.sheet { display: flex; flex-direction: column; max-width: 640px; margin: 12px auto 16px; padding: 22px 22px 16px; border-radius: 6px; background: #fff; box-shadow: var(--shadow); }
.sheet .g-cloth { fill: #fff; }
.sheet .g-band { fill: #f3f1ed; }
.sheet .g-five { stroke: #2a2620; stroke-width: 0.55; stroke-dasharray: none; }
.sheet .g-edge { stroke: #2a2620; stroke-width: 0.9; }
.sheet .g-line { stroke: #9a948a; stroke-width: 0.3; }
.sheet-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin: 0 0 14px; font-size: 13px; }
.sheet-title b { font: 900 16px "Lounge Round", sans-serif; }
.sheet-title .site { color: var(--muted); font-size: 10px; }
.rule { margin: 14px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.one { display: grid; place-items: center; }
.one .ng-board { max-height: 78vh; }
.many { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 16px 18px; }
.many figure { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.many figcaption { font: 900 13px "Lounge Round", sans-serif; color: var(--muted); }
.kind > .sheet ~ .sheet, .kind[data-kind="answers"], .print-only { display: none; }
.answer { max-width: 640px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; background: #fffaf2; box-shadow: var(--shadow); }
.answer summary { cursor: pointer; font: 900 16px "Lounge Round", sans-serif; color: var(--accent-text); }
.answer .one { margin-top: 12px; }
.answer .muted { margin: 8px 0 0; text-align: center; font-weight: 800; }

#faq details { border-bottom: 1px solid #ece4d6; padding: 10px 2px; }
#faq summary { cursor: pointer; font-weight: 800; list-style: none; }
#faq summary::before { content: "Q. "; color: var(--red); font-family: "Lounge Round", sans-serif; font-weight: 900; }
#faq details p { margin: 8px 0 0; padding-left: 1.8em; }
.foot { margin-top: 26px; text-align: center; font-size: 13px; color: var(--muted); }
.foot a { display: inline-block; color: inherit; margin: 0 6px; }
.ad-slot { max-width: 728px; margin: 28px auto 0; }

/* ---- the dress the Lounge's other pages to read wear (mines' and nanpure's level pages, the print
   pages): coloured title tiles, numbered tiles before each section, numbers scattered down the
   sides, and a colour for the page - its size's own - on the nonogram's cloth and navy thread. */
:root { --c-coral: #ff8a5c; --c-yellow: #f5b83d; --c-blue: #4aaef0; --c-green: #6cc46e; --c-purple: #a68af2; --c-ink: #2f4a78; --surface: #fffaf2; --round: "Lounge Round", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", system-ui, sans-serif; --lv: var(--c-ink); }
.t-coral, .c-coral { --lv: var(--c-coral); }
.t-yellow, .c-yellow { --lv: var(--c-yellow); }
.t-green, .c-green { --lv: var(--c-green); }
.t-blue, .c-blue { --lv: var(--c-blue); }
.t-purple, .c-purple { --lv: var(--c-purple); }
.t-ink, .c-ink { --lv: var(--c-ink); }
.dressed { position: relative; overflow-x: clip; background: radial-gradient(circle at 12% 0, color-mix(in srgb, var(--lv) 16%, transparent), transparent 420px), radial-gradient(circle at 92% 18%, color-mix(in srgb, var(--c-yellow) 12%, transparent), transparent 380px), var(--bg) repeating-linear-gradient(90deg, rgb(255 255 255 / 0.14) 0 2px, transparent 2px 6px); }
.deco { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.deco i { position: absolute; display: grid; place-items: center; width: var(--s); height: var(--s); border-radius: calc(var(--s) * 0.22); background: color-mix(in srgb, var(--lv) 38%, var(--bg)); color: #fff; font: 900 calc(var(--s) * 0.56) / 1 var(--round); font-style: normal; transform: rotate(var(--r)); opacity: 0.85; }
.deco i.o { background: none; border: 2px dashed color-mix(in srgb, var(--lv) 55%, var(--bg)); color: color-mix(in srgb, var(--lv) 70%, var(--bg)); }
@media (max-width: 1180px) { .deco i { opacity: 0.35; } }
@media (max-width: 760px) { .deco { display: none; } }

.tiles { display: inline-flex; gap: 6px; margin: 10px 0 0; }
.tiles b { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--lv); color: #fff; font: 900 26px / 1 var(--round); box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.13), 0 6px 14px rgb(22 28 45 / 0.08); animation: tile-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(var(--k) * 60ms + 60ms); }
.tiles b.two { letter-spacing: -0.06em; }
@keyframes tile-in { from { transform: translateY(-20px) scale(0.6) rotate(-8deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tiles b { animation: none; } }
@media (max-width: 520px) { .tiles b { width: 40px; height: 40px; font-size: 22px; } }
.tiles.long { gap: 5px; }
.tiles.long b { width: 38px; height: 38px; border-radius: 9px; font-size: 21px; }
.tiles.long b.two { font-size: 18px; }
@media (max-width: 520px) { .tiles.long { gap: 4px; } .tiles.long b { width: 34px; height: 34px; font-size: 19px; } .tiles.long b.two { font-size: 16px; } }

.tile-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 21px; }
.tile-head b { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--lv); color: #fff; font-size: 18px; box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.13); transform: rotate(-6deg); }
.dressed section { border-radius: 22px; background: var(--surface); }
.dressed section p a, .dressed section li a { color: var(--accent-text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; padding: 0; list-style: none; }
.chips a, .chips b { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px; background: var(--surface); color: var(--ink) !important; font-size: 14px; font-weight: 700; text-decoration: none; box-shadow: 0 1px 4px rgb(0 0 0 / 0.08); }
section .chips a { background: var(--bg); }
.chips a:hover { color: var(--lv) !important; }
.chips b { background: var(--lv); color: #fff !important; }

.cta { display: inline-block; margin: 8px 0; padding: 12px 22px; border-radius: 999px; background: var(--lv); color: #fff; font: 800 16px / 1.5 "Lounge Sans", "Noto Sans JP", sans-serif; text-decoration: none; text-wrap: balance; box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.12); }
.c-green .cta { background: #4fae52; }
.cta:hover { filter: brightness(1.05); }
.pill { display: inline-block; padding: 10px 18px; border-radius: 999px; background: var(--surface); color: var(--ink) !important; font-weight: 800; text-decoration: none; box-shadow: 0 1px 4px rgb(0 0 0 / 0.08), 0 6px 14px rgb(60 40 20 / 0.06); }

/* A size's own page: the size at a glance beside its first puzzle, set down a little askew. */
.level-page main { max-width: 1000px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 28px 40px; align-items: center; margin: 14px 0 8px; }
.head h1 small, .hero h1 small { display: block; margin-top: 4px; color: var(--muted); font-size: 16px; }
.dressed h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.3; }
.hero .lead { color: var(--ink); opacity: 0.8; }
.who { margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--lv) 12%, var(--surface)); font-size: 14px; }
.who b { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 999px; background: var(--lv); color: #fff; font-size: 12px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.facts li { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / 0.06); border-left: 5px solid var(--lv); }
.facts small { color: var(--muted); font-size: 12px; font-weight: 700; }
.facts b { font-size: 16px; line-height: 1.5; }
.hero-fig { padding: 20px 22px; border-radius: 22px; background: var(--surface); box-shadow: 0 18px 40px rgb(22 28 45 / 0.12); transform: rotate(1.6deg); transition: transform 0.3s; }
.hero-fig:hover { transform: rotate(0); }
.hero-fig-title { margin: 0 0 12px; font: 900 17px / 1.5 var(--round); }
.hero-fig .sample { margin: 12px auto 18px; }
.hero-fig-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; margin: 0; font-weight: 700; font-size: 14px; }
.hero-fig-links .pill { background: var(--lv); color: #fff !important; }
.compare { width: 100%; margin-top: 12px; border-collapse: separate; border-spacing: 0 6px; font-size: 15px; }
.compare thead th { padding: 0 12px; color: var(--muted); font-size: 12px; text-align: left; }
.compare tbody th, .compare tbody td { padding: 10px 12px; background: var(--bg); text-align: left; vertical-align: middle; white-space: nowrap; }
.compare tbody th { border-left: 5px solid var(--lv); border-radius: 12px 0 0 12px; }
.compare tbody td:last-child { border-radius: 0 12px 12px 0; }
.compare th a, .compare th b { color: var(--ink) !important; font-size: 16px; }
.compare small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.compare tr.here th, .compare tr.here td { background: color-mix(in srgb, var(--lv) 18%, var(--surface)); }
.dressed section.others { padding: 0; background: none; box-shadow: none; }
.others h2 { margin: 30px 0 10px; font-size: 21px; }
.level-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 8px 0 4px; }
.level-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 1px 4px rgb(0 0 0 / 0.06); border-top: 5px solid var(--lv); transition: transform 0.2s; }
section .level-card { background: var(--bg); }
.level-card:hover { transform: translateY(-3px); }
.level-card > b { font: 900 17px / 1.5 var(--round); }
.level-card > span:not(.tiles):not(.peek) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.level-card small { margin-top: auto; color: color-mix(in srgb, var(--lv) 75%, #000); font-weight: 700; }
.level-card .tiles { margin: 0; }
.level-card .tiles b { width: 30px; height: 30px; border-radius: 7px; font-size: 16px; animation: none; }
.level-card .tiles b.two { font-size: 13px; }
.level-card .peek .ng-board { max-width: 150px; padding: 6px; border-radius: 10px; background: #fff; }
/* The steps of the way in to printing: numbered circles, in the tiles' colours. */
.numbered { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: n; }
.numbered li { counter-increment: n; position: relative; padding-left: 42px; }
.numbered li::before { content: counter(n); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--c-coral); color: #fff; font: 900 16px / 1 var(--round); transform: rotate(-6deg); }
.numbered li:nth-child(2)::before { background: var(--c-yellow); }
.numbered li:nth-child(3)::before { background: var(--c-green); }
/* Questions: a + to open, a − to close. */
.dressed #faq summary { list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.dressed #faq summary::-webkit-details-marker { display: none; }
.dressed #faq summary::before { content: none; }
.dressed #faq summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); color: var(--lv); font-weight: 900; }
.dressed #faq details[open] summary::after { content: "−"; }
.dressed #faq details p { padding-left: 0; }
@media (max-width: 820px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-fig { transform: none; }
}
@media (max-width: 520px) {
  .compare { font-size: 14px; }
  .compare thead th { padding: 0 6px; }
  .compare tbody th, .compare tbody td { padding: 9px 6px; }
  .compare tbody td { white-space: normal; }
}

.dressed .actions a:not(.alt), .dressed .actions button:not(.alt) { background: var(--lv); box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.12); }
.c-green .actions a:not(.alt), .c-green .actions button:not(.alt) { background: #4fae52; }

@media print {
  .ad-slot, .deco, .tiles, .tile-head b { display: none !important; }
  .dressed { background: #fff; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  section { box-shadow: none; break-inside: avoid; }
  /* A page of sheets: the sheets alone, the kind chosen (print.js), one sheet to a page. */
  @page { size: A4; margin: 10mm; }
  .sheets main > :not(section):not(.sheet), .sheets section > :not(.kind) { display: none !important; }
  .sheets section { margin: 0; padding: 0; border-radius: 0; background: none; }
  .sheets .sheet { display: none; width: 190mm; height: 270mm; max-width: none; margin: 0; padding: 0; border-radius: 0; box-shadow: none; break-before: page; break-inside: avoid; overflow: hidden; }
  .sheets .kind { display: none !important; }
  body.sheets:not([data-print]) .kind[data-kind="work"], body[data-print="work"] .kind[data-kind="work"], body[data-print="answers"] .kind[data-kind="answers"] { display: block !important; }
  .sheets section:not(:has(.kind)) { display: none !important; }
  body.sheets:not([data-print]) .sheet:is([data-for~="one"], [data-for~="work"]),
  body[data-print="one"] .sheet[data-for~="one"],
  body[data-print="problem"] .sheet[data-for~="problem"],
  body[data-print="work"] .sheet[data-for~="work"],
  body[data-print="answers"] .sheet[data-for~="answers"] { display: flex !important; }
  /* One puzzle: the grid as large as fits with the note right under it, both on the sheet. */
  .sheets .one { flex: 0 1 auto; min-height: 0; }
  .sheets .one .ng-board { width: 100%; height: auto; max-height: 232mm; }
  .sheets .many { flex: 1; min-height: 0; }
  .sheets .rule { flex: none; margin-top: 5mm; break-before: avoid; }
  .sheets .many { grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); gap: 6mm; }
  .sheets .many figure { min-height: 0; }
  .sheets .many .ng-board { flex: 1; min-height: 0; height: 100%; }
  .sheet-title b { font-size: 15pt; }
  .g-num text { fill: #000; }
  .g-band { fill: #f1f1f1; }
  .g-line { stroke: #8a8a8a; stroke-width: 0.3; }
  .g-five { stroke: #000; stroke-width: 0.55; stroke-dasharray: none; }
  .g-edge { stroke: #000; stroke-width: 0.9; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* カラーロジック's sample: the coloured numbers on their tiles, the board to solve and its answer side by side. */
.cl-sample { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.cl-board { border-collapse: collapse; font: 800 12px/1 var(--round, sans-serif); }
.cl-board td { width: 22px; height: 22px; border: 1px solid rgb(120 96 64 / 0.25); background: var(--cloth-lit, #f7f0e2); }
.cl-board th { padding: 1px; text-align: center; vertical-align: bottom; }
.cl-board th.rc { text-align: right; white-space: nowrap; }
.cl-board span { display: inline-block; min-width: 16px; margin: 1px; padding: 2px 3px; border-radius: 4px; color: #fff; text-shadow: 0 1px 1px rgb(0 0 0 / 0.45); }

/* The Lounge's rail (the hub's site-frame.css): on a wide screen the pages to read stand right of it, in
   its column, as wide as it leaves them; on a phone and on paper they are as they were. */
@media (min-width: 960px) {
  .lounge-cols > main.lounge-body { max-width: none; margin: 0; padding: 24px 0 60px; }
  /* a size's first puzzle a little narrower beside its words, so the words keep their room */
  .lounge-cols .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 28px 32px; }
}
@media print {
  .lounge-rail, .lounge-dates { display: none !important; }
  .lounge-cols { display: block !important; max-width: none !important; padding: 0 !important; }
}
