:root {
  --stage: #FFF4E2;
  --stage-surface: #FFFDF9;
  --stage-border: #EDD9BE;
  --stage-ink: #231812;
  --stage-muted: #634B3B;

  --paper: #FFFBF5;
  --paper-alt: #F7ECDC;
  --card: #FFFFFF;
  --ink: #231812;
  --muted: #6A5547;
  --rule: #E6D5BE;

  --red: #CE3B1F;
  --red-deep: #992611;
  --blue: #0F766E;
  --forest: #1E6B42;
  --gold-1: #C27D0E;
  --gold-2: #FFD972;

  --shadow-sm: 0 2px 6px rgba(26, 20, 16, 0.08);
  --shadow-md: 0 12px 32px rgba(26, 20, 16, 0.13);
  --radius-card: 16px;
  --radius-tile: 12px;
  --radius-pill: 999px;

  --font-display: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ui: 'Onest', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-hand: 'Caveat', cursive;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

::selection {
  background: var(--blue);
  color: #FFFFFF;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: #D2B89A var(--paper);
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--red);
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 2px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.wrap-narrow {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: rgba(255, 251, 245, 0.94);
  backdrop-filter: blur(10px);
  color: var(--ink);
  border-bottom: 1px solid var(--stage-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 4px;
}

.brand-mark span {
  border-radius: 2px;
  background: #FFFBF5;
}

.brand-mark span:nth-child(2) {
  background: var(--red);
}

.brand-mark span:nth-child(3) {
  background: var(--gold-2);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  transition: color 140ms ease;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a[aria-current="page"] {
  color: var(--red);
  font-weight: 700;
}

.nav-boards-btn {
  border: 1.5px solid #DFB577;
  background: #FFF0D4;
  color: #5C3608;
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease;
}

.nav-boards-btn:hover {
  background: #FFE5BA;
}

.nav-boards-btn[hidden] {
  display: none;
}

@media (max-width: 680px) {
  .wrap, .wrap-narrow {
    padding: 0 14px;
  }
  .brand {
    font-size: 14.5px;
    gap: 6px;
  }
  .brand-mark {
    width: 22px;
    height: 22px;
    padding: 3px;
  }
  .nav-links {
    gap: 8px;
    font-size: 12.5px;
  }
  .nav-hide-sm {
    display: none;
  }
  .nav-boards-btn {
    padding: 4px 7px;
    font-size: 11.5px;
  }
}

@media (max-width: 460px) {
  .nav-hide-xs {
    display: none;
  }
}

/* Sunlit Warm Stationery Stage */
.stage-band {
  background-color: var(--stage);
  background-image:
    radial-gradient(ellipse 72% 62% at 12% 0%, rgba(255, 212, 152, 0.52) 0%, transparent 65%),
    radial-gradient(ellipse 64% 58% at 92% 10%, rgba(255, 204, 184, 0.42) 0%, transparent 62%),
    radial-gradient(rgba(168, 108, 56, 0.13) 1.15px, transparent 0);
  background-size: auto, auto, 24px 24px;
  color: var(--stage-ink);
  padding: 36px 0 42px;
}

.hero-paper {
  padding: 36px 0 42px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
  gap: 32px;
  align-items: start;
}

@media (max-width: 880px) {
  .stage-band {
    padding: 20px 0 28px;
  }
  .hero-paper {
    padding: 22px 0 28px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-title {
  font-size: clamp(2.05rem, 4.2vw, 3.25rem);
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--stage-ink);
}

.hero-lead {
  font-size: 16.5px;
  color: var(--stage-muted);
  max-width: 50ch;
  margin: 0 0 18px;
}

@media (max-width: 540px) {
  .hero-title {
    font-size: 1.95rem;
    margin-bottom: 8px;
  }
  .hero-lead {
    font-size: 14.5px;
    margin-bottom: 14px;
  }
}

/* Surfaces & Controls */
.sheet {
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid #2D1F17;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 20px;
}

.sheet-soft {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 20px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink);
}

.input, .select, .textarea {
  width: 100%;
  background: #FFFDF9;
  color: var(--ink);
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--red);
  background: var(--card);
  outline: none;
}

.textarea {
  min-height: 76px;
  resize: vertical;
}

.seg-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seg-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--rule);
  background: #FFF8EE;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.seg-btn[aria-pressed="true"], .seg-btn.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #FFFBF5;
}

.more-opts {
  margin-bottom: 14px;
  border: 1px dashed #D8BF9E;
  border-radius: 10px;
  padding: 8px 12px;
  background: #FFF9F0;
}

.more-opts summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.more-opts summary::-webkit-details-marker {
  display: none;
}

.more-opts summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 15px;
}

.more-opts[open] summary::after {
  content: '−';
}

.more-opts-body {
  padding-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  border: 1.5px solid var(--ink);
  padding: 11px 16px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 110ms ease, background-color 120ms ease, box-shadow 110ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--red);
  color: #FFFFFF;
  border-color: var(--red-deep);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 0 var(--red-deep), 0 6px 14px rgba(26, 20, 16, 0.16);
}

.btn-primary:hover:not(:disabled) {
  background: #BC3117;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 0 var(--red-deep);
}

.btn-ink {
  background: var(--ink);
  color: #FFFFFF;
}

.btn-blue {
  background: var(--blue);
  color: #FFFFFF;
  border-color: #0B5650;
}

.btn-gold {
  background: linear-gradient(135deg, #F7E19C 0%, #DFAF3E 100%);
  color: #291E05;
  border-color: #8F670D;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-wide {
  width: 100%;
}

.form-sub-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--paper);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.bingo-pill {
  background: var(--red);
  color: #FFFFFF;
  border-color: var(--red-deep);
  font-weight: 700;
}

.board-size-pill {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--rule);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Welcome back strip */
.saved-boards {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}

.saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.saved-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* Bingo Board Canvas & Themes */
.board-frame {
  border-radius: 20px;
  padding: 18px;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-md);
  transition: background-color 180ms ease;
}

.board-frame[data-theme="riso"] {
  background: #FFFFFF;
  color: #231812;
  --tile-bg: #FFFBF4;
  --tile-ink: #231812;
  --tile-muted: #6A5547;
  --tile-border: #2D1F17;
  --center-bg: #CE3B1F;
  --center-ink: #FFFFFF;
}

.board-frame[data-theme="midnight"] {
  background: #221D2A;
  color: #FDF7EE;
  border-color: #4D415E;
  --tile-bg: #2D2638;
  --tile-ink: #FDF7EE;
  --tile-muted: #D4C7DC;
  --tile-border: #594B6E;
  --center-bg: #DF4B2E;
  --center-ink: #FFFFFF;
}

.board-frame[data-theme="matcha"] {
  background: #F1F7EC;
  color: #1A2E20;
  border-color: #1E6B42;
  --tile-bg: #FFFDF9;
  --tile-ink: #1A2E20;
  --tile-muted: #466651;
  --tile-border: #1E6B42;
  --center-bg: #1E6B42;
  --center-ink: #FFFFFF;
}

.board-frame[data-theme="gilded"] {
  background: linear-gradient(150deg, #FFF9E8 0%, #F4DF9F 55%, #FFFDF7 100%);
  color: #291E05;
  border-color: #8F670D;
  --tile-bg: #FFFDF8;
  --tile-ink: #291E05;
  --tile-muted: #5B4006;
  --tile-border: #B8861B;
  --center-bg: #291E05;
  --center-ink: #F7E19C;
}

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.board-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  font-weight: 800;
  line-height: 1.05;
}

.board-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin-top: 3px;
  opacity: 0.82;
}

.bingo-grid-wrap {
  position: relative;
}

.bingo-grid {
  display: grid;
  gap: 10px;
}

.bingo-grid[data-size="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bingo-grid[data-size="4"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bingo-lines-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.bingo-strike-line {
  stroke: rgba(206, 59, 31, 0.80);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 160;
  stroke-dashoffset: 0;
  animation: bingo-draw 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bingo-draw {
  from { stroke-dashoffset: 160; }
  to { stroke-dashoffset: 0; }
}

@media (max-width: 540px) {
  .board-frame {
    padding: 12px;
  }
  .bingo-grid {
    gap: 7px;
  }
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1.12;
  border-radius: var(--radius-tile);
  border: 1.5px solid var(--tile-border);
  background: var(--tile-bg);
  color: var(--tile-ink);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform 130ms cubic-bezier(0.22, 1, 0.36, 1), border-color 130ms ease;
}

.tile:hover {
  transform: translateY(-2px);
}

.tile.is-empty {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tile.is-center {
  background: var(--center-bg);
  color: var(--center-ink);
  border-color: var(--center-bg);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: default;
}

.tile.is-center:hover {
  transform: none;
}

.center-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  margin-bottom: 5px;
}

.center-title {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.15;
}

.tile.is-bingo-win:not(.is-center) {
  box-shadow: inset 0 0 0 2px var(--red);
}

.tile.is-gold {
  background: linear-gradient(135deg, #FFF7DA 0%, #F7E19C 52%, #FFFDF5 100%);
  color: #291E05;
  border: 2px solid #B8861B;
  box-shadow: 0 4px 12px rgba(14, 18, 28, 0.12);
}

.board-frame[data-theme="midnight"] .tile.is-gold {
  background: linear-gradient(135deg, #272216 0%, #3A301A 55%, #231E13 100%);
  color: #F7E19C;
  border-color: #D4A537;
}

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  min-height: 22px;
  width: 100%;
}

.tile-doodle-canvas {
  width: 100%;
  height: 40px;
  display: block;
  flex-shrink: 0;
}

.tile-sticker {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-block;
}

.tile-vibe {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid;
  line-height: 1.3;
  flex-shrink: 0;
}

.tile-stamp {
  display: inline-block;
  border: 1.5px solid var(--red);
  color: var(--red);
  background: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.3;
  flex-shrink: 0;
  animation: stamp-slam 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes stamp-slam {
  from {
    opacity: 0;
    transform: scale(1.35);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tile-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.22;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tile-text.has-doodle {
  -webkit-line-clamp: 3;
}

.bingo-grid[data-size="4"] .tile-text {
  font-size: 10.5px;
  -webkit-line-clamp: 3;
}

.tile-author {
  font-family: var(--font-hand);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--tile-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile.is-gold .tile-author {
  color: #5B4006;
}

.board-frame[data-theme="midnight"] .tile.is-gold .tile-author {
  color: #E7C96B;
}

@media (max-width: 540px) {
  .tile {
    padding: 6px;
    aspect-ratio: 1 / 1.18;
  }
  .tile-top {
    min-height: 19px;
  }
  .tile-doodle-canvas {
    height: 28px;
  }
  .tile-sticker {
    width: 20px;
    height: 20px;
  }
  .tile-stamp, .tile-vibe {
    font-size: 8px;
    padding: 1px 4px;
  }
  .tile-text {
    font-size: 10.5px;
    line-height: 1.16;
    -webkit-line-clamp: 4;
  }
  .tile-text.has-doodle {
    -webkit-line-clamp: 2;
  }
  .tile-author {
    font-size: 13px;
  }
}

.tile-empty-plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-grid;
  place-items: center;
  margin-bottom: 4px;
  font-weight: 700;
}

.tile-empty-label {
  font-size: 12px;
  font-weight: 600;
}

.tile-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
}

.board-frame[data-theme="midnight"] .tile-lock-badge {
  color: #FFD972;
}

/* Progress Meter & Board Layout */
.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .board-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.tile-meter {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.tile-meter[data-size="4"] {
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
}

.meter-cell {
  height: 10px;
  border-radius: 4px;
  background: var(--paper-alt);
  border: 1px solid var(--rule);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.meter-cell.is-lit {
  background: var(--ink);
  border-color: var(--ink);
}

.meter-cell.is-stamped {
  background: var(--red);
  border-color: var(--red-deep);
}

.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.code-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px dashed var(--ink);
  border-radius: 10px;
}

.welcome-banner {
  background: #FFF0DB;
  border: 1px solid #EBC08A;
  color: #5C3409;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.icebreaker-banner {
  background: #FFF5D1;
  border: 1.5px solid #D4931E;
  color: #4A3004;
  border-radius: 12px;
  padding: 11px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.prompt-pills {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.prompt-pill {
  width: 100%;
  text-align: left;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.prompt-pill:hover {
  border-color: var(--ink);
  background: #FFFFFF;
}

.preview-banner {
  background: #FFF5D1;
  color: #4A3004;
  border: 1.5px solid #D4931E;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.phrase-box {
  background: var(--paper);
  border: 1px dashed var(--rule);
  border-radius: 10px;
  padding: 10px 12px;
}

.phrase-code {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

/* Circle & Highlight Cards */
.card-highlight {
  background: #FFF9EC;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-card);
  padding: 18px;
}

.circle-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
  transition: border-color 120ms ease;
}

.circle-row:hover {
  border-color: var(--ink);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 24, 18, 0.50);
  backdrop-filter: blur(3px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: 100%;
  max-width: 500px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 24px 56px rgba(26, 20, 16, 0.24);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.preset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip-btn {
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.active {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

/* Stamp Picker inside Inspector */
.stamp-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stamp-choice {
  border: 1.5px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

.stamp-choice small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.stamp-choice.active {
  border-color: var(--st-color);
  background: var(--st-bg);
  color: var(--st-color);
}

.stamp-choice.active small {
  color: var(--st-color);
}

/* Doodle Canvas */
.doodle-wrap {
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: #FFFFFF;
  overflow: hidden;
}

.doodle-canvas {
  width: 100%;
  height: 126px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.doodle-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
}

.pen-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pen-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.pen-swatch.active {
  border-color: var(--ink);
  transform: scale(1.12);
}

.brush-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brush-btn {
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.brush-btn.active {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 460px) {
  .sticker-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
}

.sticker-btn {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  cursor: pointer;
}

.sticker-btn.active {
  border: 2px solid var(--ink);
  background: #FFF7DA;
}

.sticker-btn.deluxe {
  border-color: var(--gold-1);
}

/* Visual How-It-Works & Below Fold Sections */
.section {
  padding: 44px 0;
  border-top: 1px solid var(--rule);
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  font-weight: 800;
  margin-bottom: 18px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.how-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 780px) {
  .how-grid,
  .how-grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

.step-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-visual {
  background: linear-gradient(145deg, #FFF0D6 0%, #FFE5D1 100%);
  border: 1px solid #EED3B3;
  color: var(--ink);
  border-radius: 12px;
  padding: 14px;
  min-height: 112px;
  display: grid;
  place-items: center;
}

.mini-grid-viz {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  gap: 5px;
}

.mini-grid-viz span {
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px dashed #C79F74;
}

.mini-grid-viz span.center {
  background: var(--red);
  border: none;
}

.mini-grid-viz span.filled {
  background: #FFFFFF;
  border: 1.5px solid var(--ink);
}

.mini-tile-viz {
  background: #FFFFFF;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
  border-radius: 10px;
  padding: 8px 10px;
  width: 100%;
  max-width: 210px;
  display: grid;
  gap: 4px;
}

.mini-story-viz {
  width: 96px;
  border-radius: 10px;
  background: #FFFFFF;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 8px;
  text-align: center;
  display: grid;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
}

.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* Ideas Grid */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 820px) {
  .ideas-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .ideas-grid {
    grid-template-columns: 1fr;
  }
}

.idea-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 120ms ease;
}

.idea-card:hover {
  border-color: var(--ink);
}

.idea-card.is-wildcard {
  grid-column: 1 / -1;
  background: #FFFDF5;
  border-color: var(--gold-1);
}

.idea-copy-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.idea-card.is-copied .idea-copy-tag {
  color: var(--forest);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper);
  padding: 28px 0 42px;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Poster Preview & Toast */
.poster-preview-img {
  width: 100%;
  max-height: 40dvh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: block;
}

.poster-preview-img[hidden] {
  display: none;
}

.poster-loading {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  border: 1px dashed var(--rule);
  background: var(--paper);
  display: grid;
  place-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.poster-loading[hidden] {
  display: none;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 120;
  box-shadow: var(--shadow-md);
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast[hidden] {
  display: none;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 110;
}

.small-note {
  font-size: 13px;
  color: var(--muted);
}

.error-text {
  color: var(--red);
  font-size: 13.5px;
  font-weight: 600;
  margin: 0 0 10px;
}

.error-text:empty {
  display: none;
}

@media print {
  @page {
    size: portrait;
    margin: 12mm;
  }
  body {
    background: #FFFFFF !important;
    color: #231812 !important;
  }
  .site-header,
  .site-footer,
  #side-panel,
  .modal-backdrop,
  .toast,
  .confetti-canvas {
    display: none !important;
  }
  .stage-band {
    background: #FFFFFF !important;
    padding: 0 !important;
  }
  .board-layout {
    display: block !important;
  }
  .board-frame {
    box-shadow: none !important;
    border-width: 2px !important;
    max-width: 100% !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
