/* Coloring Moss web · one stylesheet, no framework */
:root {
  --paper: #fbfaf5;
  --card: #ffffff;
  --ink: #1f2a24;
  --muted: #5d685f;
  --line: #dfe3da;
  --moss: #4f6b3a;
  --moss-dark: #3b5229;
  --moss-soft: #e9efe1;
  --russet: #b4532a;
  --gold-soft: #f7efd9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 36, .06), 0 4px 14px rgba(31, 42, 36, .06);
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--moss-dark); text-underline-offset: 2px; }
a:hover { color: var(--russet); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: rgba(251, 250, 245, .96); position: sticky; top: 0; z-index: 5; backdrop-filter: saturate(1.2) blur(6px); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--moss-soft); color: var(--moss-dark); }

/* breadcrumbs */
.crumbs { font-size: .88rem; color: var(--muted); margin: 18px 0 6px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: #9aa39b; }
.crumbs a { color: var(--muted); }

/* hero */
.hero { padding: 18px 0 8px; }
.hero .lede { font-size: 1.1rem; color: #36423a; max-width: 60ch; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; background: var(--moss-soft); color: var(--moss-dark); }
.badge.alt { background: var(--gold-soft); color: #7a5418; }
.get { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 8px 0 26px; max-width: 760px; }
.get h2 { font-size: 1.05rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.get ul { margin: 0; padding-left: 1.2em; }
.get li { margin: 2px 0; }

/* jump links */
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.jump a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--card); font-size: .92rem; }

/* cards */
.section { margin: 10px 0 34px; scroll-margin-top: 80px; }
.section > p { max-width: 70ch; color: #36423a; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; scroll-margin-top: 80px; }
.card:target { outline: 3px solid var(--russet); outline-offset: 2px; }
.card-media { position: relative; display: block; background: #fff; aspect-ratio: 4 / 5; border-bottom: 1px solid var(--line); cursor: zoom-in; }
.card-media img.main { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.card-media.pixel img.main { image-rendering: pixelated; padding: 22px; }
.card-media .inset { position: absolute; right: 8px; bottom: 8px; width: 34%; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); padding: 3px; }
.card-media .inset.pixel { image-rendering: pixelated; }
.card-media .open-hint { position: absolute; left: 8px; top: 8px; font-size: .75rem; font-weight: 700; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); }
.card-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: .82rem; }
.meta li { background: #f2f4ef; border-radius: 6px; padding: 2px 8px; color: #3d4a40; }
.meta li.level-easy { background: #e3f0d8; color: #2f5a1c; }
.meta li.level-medium { background: #f6ecd2; color: #6d4c12; }
.meta li.level-hard, .meta li.level-detailed { background: #f6dfd6; color: #7a2f17; }
.blurb { font-size: .94rem; color: #3d4a40; margin: 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--moss); background: #fff; color: var(--moss-dark); font: 600 .92rem/1.2 var(--sans); text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--moss-soft); color: var(--moss-dark); }
.btn:focus-visible, .card-media:focus-visible, a:focus-visible { outline: 3px solid var(--russet); outline-offset: 2px; }
.btn.primary { background: var(--moss); color: #fff; grid-column: 1 / -1; }
.btn.primary:hover { background: var(--moss-dark); color: #fff; }
.btn small { font-weight: 500; opacity: .8; }
.answer { font-size: .86rem; color: var(--muted); margin: 0; }
.answer a { font-weight: 600; }
.twin { margin: 0; font-size: .86rem; }
.twin a { font-weight: 600; }

/* tips + related */
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 0 0 30px; }
.tip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tip h3 { font-size: 1rem; font-family: var(--sans); }
.tip p { margin: 0; color: #3d4a40; font-size: .95rem; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; margin-bottom: 36px; }

/* collection tiles (home + index) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 18px; margin-bottom: 30px; }
.tile { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tile:hover { border-color: var(--moss); color: var(--ink); }
.tile-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.tile-thumbs img { background: #fff; aspect-ratio: 1; object-fit: contain; padding: 8px; width: 100%; height: 100%; }
.tile-thumbs img.pixel { image-rendering: pixelated; padding: 14px; }
.tile-body { padding: 12px 14px 14px; }
.tile-body h3 { margin-bottom: 4px; }
.tile-body p { margin: 0; color: var(--muted); font-size: .92rem; }

/* home */
.entries { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; margin: 18px 0 34px; }
.entry { display: grid; grid-template-columns: 1fr 1fr; gap: 0; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.entry:hover { border-color: var(--moss); color: var(--ink); }
.entry-text { padding: 18px; display: flex; flex-direction: column; justify-content: center; }
.entry-text h2 { margin-bottom: 6px; }
.entry-text p { margin: 0 0 10px; color: #3d4a40; font-size: .95rem; }
.entry-text .go { font-weight: 700; color: var(--moss-dark); }
.entry-img { background: #fff; border-left: 1px solid var(--line); display: grid; place-items: center; padding: 10px; }
.entry-img img { max-height: 200px; object-fit: contain; }
.entry-img img.pixel { image-rendering: pixelated; }
.formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; margin-bottom: 34px; }
.format { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.format h3 { font-family: var(--sans); font-size: 1rem; }
.format p { margin: 0; font-size: .95rem; color: #3d4a40; }
.season { background: var(--gold-soft); border-radius: 18px; padding: 18px 18px 4px; margin-bottom: 34px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 26px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.site-footer h2 { font-size: .95rem; font-family: var(--sans); color: var(--ink); margin-bottom: 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 3px 0; }

/* preview dialog */
dialog.preview { max-width: 96vw; overflow: auto; border: 0; border-radius: 16px; padding: 0; width: min(760px, 96vw); max-height: 94vh; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.preview::backdrop { background: rgba(20, 28, 22, .55); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.preview-head h2 { font-size: 1.1rem; margin: 0; }
.preview-close { min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: 1.3rem; cursor: pointer; }
.preview-body { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.preview-actions .actions { margin-top: 0; }
.preview-body img { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.preview-tabs { display: flex; gap: 8px; }
.preview-tabs[hidden] { display: none; }
.preview-tabs button { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; }
.preview-tabs button[aria-pressed="true"] { background: var(--moss); color: #fff; border-color: var(--moss); }

/* event debug panel (only with ?cmdebug=1) */
#cm-debug { position: fixed; right: 10px; bottom: 10px; width: min(420px, 94vw); max-height: 40vh; overflow: auto; background: #111; color: #b8f5a8; font: 12px/1.4 ui-monospace, Consolas, monospace; padding: 10px; border-radius: 10px; z-index: 50; white-space: pre-wrap; }

/* print: only the requested sheet */
#print-root { display: none; }
@media print {
  @page { margin: 0; }
  html, body { background: #fff !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
  #print-root img { display: block; width: 100%; height: auto; max-height: 100vh; object-fit: contain; margin: 0 auto; page-break-inside: avoid; break-inside: avoid; }
  body:not(.printing) .site-header, body:not(.printing) .site-footer, body:not(.printing) .actions, body:not(.printing) dialog { display: none !important; }
}
@media (max-width: 520px) {
  .entry { grid-template-columns: 1fr; }
  .entry-img { border-left: 0; border-top: 1px solid var(--line); }
  .site-header .wrap { padding: 6px 0; }
}
