:root {
  --grass: #4caf2f;
  --grass-2: #6bc94a;
  --moss: #7ed957;
  --wood: #d08a45;
  --bark: #8a5428;
  --sand: #f2d98a;
  --parchment: #fff8e6;
  --paper: #fffdf8;
  --ink: #2c2116;
  --gold: #ffc107;
  --danger: #e85d3a;
  --sky: #6ec8f5;
  --sky-soft: #d8f1ff;
  --flower: #ff8fb3;
  --water: #3aa0e8;
  --shadow: 4px 4px 0 #3a6e24;
  --font-display: "Chakra Petch", sans-serif;
  --font-body: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    linear-gradient(180deg, #7ec8f5 0%, #b8e6fb 42%, #c8ef86 100%);
  color: var(--ink);
  font-family: var(--font-body);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.frame {
  max-width: 980px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, var(--grass-2) 0 10px, transparent 10px),
    repeating-linear-gradient(90deg, #f3dc9a 0 8px, #fff1c4 8px 16px),
    var(--parchment);
  min-height: 100vh;
  border-left: 8px solid var(--wood);
  border-right: 8px solid var(--wood);
}

.mast {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.75rem;
  background:
    linear-gradient(180deg, var(--grass-2), var(--grass));
  color: #fffef5;
  border-bottom: 8px solid var(--wood);
  box-shadow: inset 0 -6px 0 var(--gold);
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  background:
    linear-gradient(90deg, var(--grass-2) 50%, var(--flower) 50%) 0 0 / 42px 21px no-repeat,
    linear-gradient(90deg, var(--wood) 50%, var(--gold) 50%) 0 21px / 42px 21px no-repeat;
  border: 3px solid #fffef5;
  box-shadow: 3px 3px 0 var(--bark);
}

.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.02em;
}

.brand em {
  display: block;
  font-style: normal;
  opacity: 0.92;
  font-size: 0.92rem;
}

nav {
  display: flex;
  gap: 0.5rem;
}

nav a {
  color: #fffef5;
  text-decoration: none;
  font-family: var(--font-display);
  padding: 0.35rem 0.7rem;
  border: 3px solid transparent;
}

nav a:hover {
  border-color: #fffef5;
  background: var(--gold);
  color: var(--ink);
}

nav a.nav-special {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--ink);
}

nav a.nav-special:hover {
  border-color: #fffef5;
  background: #fffef5;
}

main {
  margin: 0.85rem 0.95rem 1.15rem;
  padding: 1.45rem 1.5rem 0.7rem;
  background: var(--paper);
  border: 4px solid var(--bark);
  box-shadow: var(--shadow);
}

.hero-band { margin-bottom: 1.75rem; }
.hero-band.compact { margin-bottom: 1.2rem; }

.kicker {
  font-family: var(--font-display);
  color: var(--water);
  text-transform: lowercase;
  margin: 0 0 0.4rem;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.6rem;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }

.lede {
  font-size: 1.15rem;
  max-width: 42rem;
}

.lede a, .prose a {
  color: var(--water);
  font-weight: 600;
}

.lede a:hover, .prose a:hover {
  color: var(--grass);
}

.meta, .hint { color: #6b4e2e; }

.badge {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-display);
  padding: 0.2rem 0.55rem;
  border: 3px solid var(--bark);
  margin-bottom: 0.6rem;
}

.feature-card, .activity, .materials, .step, .comments {
  background: var(--paper);
  border: 4px solid var(--bark);
  box-shadow: var(--shadow);
}

.feature-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.2rem 1.3rem;
  margin-bottom: 2rem;
  background:
    linear-gradient(90deg, var(--gold) 0 8px, transparent 8px),
    linear-gradient(180deg, #fff6c8, var(--paper) 28%);
}
.feature-card a { color: var(--ink); }
.feature-media { display: block; }
.feature-copy { min-width: 0; }
.feature-thumb, .listing-thumb {
  display: block;
  width: 100%;
  object-fit: cover;
  background: var(--bark);
  border: 3px solid var(--gold);
  box-shadow: 3px 3px 0 var(--bark);
}
.feature-thumb {
  aspect-ratio: 16 / 10;
  height: 100%;
  max-height: 10.5rem;
}
.feature-thumb.pixel, .listing-thumb.pixel { image-rendering: pixelated; }

.special-card {
  display: block;
  margin-bottom: 2rem;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
  border: 4px solid var(--bark);
  box-shadow: var(--shadow);
  background:
    linear-gradient(90deg, var(--gold) 0 8px, transparent 8px),
    linear-gradient(180deg, #fff6c8, var(--paper) 40%);
}

.special-card:hover {
  background:
    linear-gradient(90deg, var(--gold) 0 8px, transparent 8px),
    linear-gradient(180deg, var(--gold), var(--paper) 48%);
}

.special-card .badge { margin-bottom: 0.45rem; }

.special-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.special-card span:last-child {
  display: block;
  color: #5a4028;
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 1.5rem;
}

.post-list, .activity ul, .archive { list-style: none; padding: 0; margin: 0; }

.post-list li { margin: 0 0 1rem; }
.post-list a, .archive a {
  display: grid;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.7rem 0.8rem;
  border: 3px solid transparent;
  background: var(--paper);
}
.post-list a {
  grid-template-columns: 7rem 1fr;
  align-items: start;
}
.post-list .listing-thumb {
  width: 7rem;
  height: 5.2rem;
}
.post-list .listing-copy {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}
.post-list a:hover, .archive a:hover {
  border-color: var(--grass);
  background: #eaf8d4;
}

.post-list em, .activity em, .archive .when em {
  color: var(--wood);
  font-style: normal;
  font-size: 0.92rem;
}

.activity {
  padding: 1rem;
  background:
    linear-gradient(180deg, var(--sky-soft), var(--paper) 36%);
}
.activity li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 2px dashed var(--sand);
}
.activity li:last-child { border: 0; }

.more {
  font-family: var(--font-display);
  color: var(--grass);
}

.more:hover { color: var(--water); }

.archive li { margin-bottom: 0.6rem; }
.archive a {
  grid-template-columns: 8.5rem 6.5rem 1fr;
  align-items: start;
}
.archive .listing-thumb {
  width: 6.5rem;
  height: 4.8rem;
}
.archive .when { font-family: var(--font-display); }
.excerpt { display: block; color: #5a4028; }
.tags { display: block; color: var(--water); font-size: 0.9rem; }

.post-body { max-width: 44rem; }

.hero-figure, .figure {
  margin: 1.1rem 0;
  background: var(--bark);
  border: 4px solid var(--gold);
  box-shadow: var(--shadow);
}

.hero-figure img, .figure img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  cursor: zoom-in;
}

.hero-figure figcaption, .figure figcaption {
  margin: 0;
  padding: 0.45rem 0.7rem;
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.youtube-figure {
  margin: 1.1rem 0;
  background: var(--bark);
  border: 4px solid var(--gold);
  box-shadow: var(--shadow);
}
.youtube-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.youtube-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.materials {
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  background:
    linear-gradient(180deg, #eaf8d4, var(--paper) 40%);
}

.materials ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.4rem 1rem;
  list-style: square;
}

.steps { display: grid; gap: 1rem; margin: 1.4rem 0; }
.step { padding: 1rem 1.1rem; }

.callout {
  border: 4px solid var(--bark);
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}
.callout-tip { background: #d4f5a8; }
.callout-warn { background: #ffd0b5; }
.callout p { margin: 0.3rem 0; }

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-inner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.image-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  image-rendering: pixelated;
}

body.lightbox-open {
  overflow: hidden;
}

.comments { padding: 1.2rem; margin: 2rem 0 1rem; }

.comment-form { display: grid; gap: 0.7rem; }
.comment-form label { display: grid; gap: 0.3rem; font-family: var(--font-display); }

input, textarea, button {
  font: inherit;
  border: 3px solid var(--bark);
  background: #fffef9;
  color: var(--ink);
}

input, textarea { padding: 0.5rem 0.6rem; width: 100%; }

button {
  font-family: var(--font-display);
  background: var(--grass);
  color: #fffef5;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  width: max-content;
  box-shadow: 3px 3px 0 var(--bark);
}

button:hover {
  background: var(--gold);
  color: var(--ink);
}

.comment-status {
  margin: 0;
  padding: 0.5rem 0.6rem;
  background: #d4f5a8;
  border: 3px solid var(--bark);
}

.colophon {
  padding: 1.2rem 1.75rem 2rem;
  color: #6b4e2e;
  border-top: 6px solid var(--grass);
  background: linear-gradient(180deg, #eaf8d4, var(--parchment));
}

.prose { max-width: 42rem; font-size: 1.08rem; }

.guess-score {
  font-family: var(--font-display);
  margin: 0 0 0.85rem;
}

.guess-stage {
  display: flex;
  justify-content: center;
  margin-bottom: 0.9rem;
  position: relative;
  z-index: 1;
}

.guess-stage #guess-canvas {
  display: block;
  width: min(320px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  flex-shrink: 0;
  border: 4px solid var(--bark);
  box-shadow: var(--shadow);
  background: var(--sky);
  image-rendering: pixelated;
  touch-action: manipulation;
}

.guess-stage #guess-canvas.is-win {
  box-shadow: var(--shadow), 0 0 0 3px var(--gold);
}

.guess-fireworks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  z-index: 1000;
  image-rendering: pixelated;
  opacity: 0;
  visibility: hidden;
  transform: translateZ(0);
}

.guess-fireworks.is-on {
  opacity: 1;
  visibility: visible;
}

.guess-feedback {
  min-height: 1.6em;
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
}

.guess-feedback.is-ok { color: var(--grass); }
.guess-feedback.is-no { color: var(--danger); }

.guess-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 0 0 0.8rem;
}

.guess-form[hidden],
.guess-choices[hidden] {
  display: none;
}

.guess-form input {
  flex: 1;
  min-width: 12rem;
  min-height: 44px;
  font-size: 16px;
}

.guess-form button,
.guess-actions button,
.guess-choices button {
  min-height: 44px;
  touch-action: manipulation;
}

.guess-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0 0 0.8rem;
}

.guess-choices button {
  width: 100%;
  box-sizing: border-box;
}

.guess-choices button.is-right {
  background: var(--gold);
  color: var(--ink);
}

.guess-choices button.is-wrong {
  opacity: 0.55;
}

.guess-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
}

@media (min-width: 761px) {
  .guess-choices {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .mast, .split, .archive a, .gallery-grid, .feature-card, .post-list a {
    display: block;
  }
  .feature-thumb, .post-list .listing-thumb, .archive .listing-thumb {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 16 / 10;
    margin-bottom: 0.6rem;
  }
  nav { flex-wrap: wrap; }
  .frame { border-width: 0; }
  main {
    margin: 0.65rem 0.55rem 0.85rem;
    padding: 1.1rem 0.95rem 0.45rem;
  }
}
