.mini-main { padding-bottom: 40px; background: var(--color-canvas); }
.mini-page-header { color: var(--color-ink); background: transparent; }
.mini-header-inner { width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 16px 0 0; }
.mini-page-header h1 { margin: 3px 0 2px; color: var(--color-brand-strong); font-size: clamp(2rem, 5vw, 2.6rem); line-height: 1.05; }
.mini-page-header p { margin: 0; color: var(--color-muted); line-height: 1.4; }
.back-link { display: inline-block; margin-bottom: 7px; color: var(--color-brand); font-size: .9rem; font-weight: 700; text-underline-offset: 3px; }
.prototype-label { margin-top: 0 !important; color: var(--color-brand) !important; font-size: .76rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.gummy-header { background: transparent; }

.mini-collection { width: min(980px, calc(100% - 28px)); margin: 18px auto 0; display: grid; gap: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mini-puzzle-choice { overflow: hidden; background: #fff; border: 1px solid #dfd3bf; border-radius: 18px; box-shadow: var(--shadow-card); }
.mini-puzzle-choice > img { display: block; width: 100%; height: 220px; object-fit: contain; object-position: center; background: #eef7f8; }
.mini-choice-copy { padding: 18px 20px 22px; }
.mini-choice-copy h2 { margin: 8px 0 6px; color: #294f6e; font-size: 1.35rem; }
.mini-choice-copy p { margin: 0 0 16px; color: #5f554b; line-height: 1.5; }
.mini-choice-copy a { display: inline-block; padding: 10px 14px; color: #fff; background: #287a78; border-radius: 9px; font-weight: 900; text-decoration: none; }
.mini-choice-copy a:hover { background: #1e6462; }
.mini-difficulty { display: inline-block; padding: 4px 9px; color: #584515; background: #fff1bf; border-radius: 999px; font-size: .78rem; font-weight: 900; }

.puzzle-card { width: min(880px, calc(100% - 28px)); margin: 22px auto 0; overflow: hidden; background: #fff; border: 1px solid #dfd3bf; border-radius: 18px; box-shadow: var(--shadow-card); }
.puzzle-art { display: block; background: #dff3ff; }
.puzzle-art img { width: 100%; height: auto; display: block; aspect-ratio: 3 / 2; object-fit: cover; }
.puzzle-art .print-art { display: none; }
.story-section, .clues-section, .grid-section { padding: 20px 24px 0; }
.grid-section { padding-bottom: 24px; }
.story-section h2, .clues-section h2, .grid-section h2 { margin: 0 0 8px; color: #294f6e; font-size: 1.35rem; }
.story-section p { margin: 0; font-size: 1.04rem; line-height: 1.55; }
.clues-section ol { margin: 0; padding-left: 1.6rem; }
.clues-section li { margin: 0 0 8px; padding-left: 3px; line-height: 1.45; }
.grid-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.grid-heading p { margin: 0; color: #665849; font-size: .92rem; }
.grid-key { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; font-size: .84rem; font-weight: 800; white-space: nowrap; }
.grid-key span { padding: 5px 8px; background: #fff7dc; border-radius: 999px; }
.key-no { color: #bf352e; }.key-match { color: #1e7b4d; }
.logic-grid-wrap { max-width: 620px; margin: 14px auto 0; }
.logic-grid { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.logic-grid th { padding: 7px 3px; color: #294f6e; background: #e8f5ff; border-radius: 8px; font-size: clamp(.75rem, 2.6vw, .95rem); overflow-wrap: anywhere; }
.logic-grid th:first-child { width: 24%; background: #fff1bf; }
.logic-grid tbody th { text-align: left; padding-left: 10px; background: #fff1bf; }
.grid-cell { min-height: 58px; width: 100%; display: grid; place-items: center; padding: 0; color: #796d61; background: #fff; border: 2px solid #cbbda9; border-radius: 9px; font-size: 1.7rem; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.grid-cell:hover { background: #fffaf0; }
.grid-cell.no { color: #bf352e; background: #fff0ed; border-color: #e4a59f; }
.grid-cell.match { color: #176f45; background: #e7f8ed; border-color: #67ae82; }
.grid-cell.auto-no { color: #bf352e; background: #fff8f5; }
.grid-cell:focus-visible, .puzzle-actions button:focus-visible, .celebration button:focus-visible { outline: 3px solid #122f4b; outline-offset: 2px; }
.status { min-height: 1.5em; margin: 12px 0 0; color: #665849; text-align: center; font-weight: 700; }
.status.success { color: #176f45; }.status.failure { color: #aa2e27; animation: wobble .35s ease-in-out; }
.puzzle-actions { margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.puzzle-actions button, .celebration button { min-height: 48px; padding: 9px 12px; color: #294050; background: #fff; border: 2px solid #cbbda9; border-radius: 10px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.puzzle-actions button:hover, .celebration button:hover { background: #fff1bf; }
.puzzle-actions button:disabled { cursor: default; opacity: .45; }
.puzzle-actions .primary { color: #fff; background: #287a78; border-color: #287a78; }
.puzzle-actions .primary:hover { background: #1e6462; }
.print-site-marker { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.celebration[hidden] { display: none; }
.celebration { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: #102b3da8; }
.celebration-card { position: relative; z-index: 2; width: min(420px, 100%); padding: 30px; text-align: center; background: #fffdf8; border: 4px solid #f3bd3d; border-radius: 20px; box-shadow: 0 18px 60px #0006; }
.celebration-kicker { margin: 0; color: #287a78; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.celebration-card h2 { margin: 8px 0; font-size: 2rem; }
.confetti-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-layer i { position: absolute; top: -20px; left: var(--left); width: 10px; height: 15px; background: var(--color); animation: confetti-fall 3s linear var(--delay) forwards; }
@keyframes confetti-fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); } }
@keyframes wobble { 25% { transform: translateX(-7px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }

@media (max-width: 620px) {
    .mini-main { padding-bottom: 20px; }
    .mini-header-inner { width: calc(100% - 24px); padding: 12px 0 8px; }
    .mini-page-header h1 { font-size: 1.8rem; white-space: nowrap; }
    .puzzle-card { width: calc(100% - 12px); margin-top: 8px; border-radius: 12px; }
    .story-section, .clues-section, .grid-section { padding: 16px 12px 0; }
    .grid-section { padding-bottom: 16px; }
    .grid-heading { align-items: start; flex-direction: column; gap: 8px; }
    .grid-key { justify-content: start; }
    .logic-grid { border-spacing: 2px; }
    .logic-grid th:first-child { width: 23%; }
    .logic-grid tbody th { padding-left: 5px; }
    .grid-cell { min-height: 52px; border-radius: 7px; }
    .puzzle-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mini-collection { width: calc(100% - 12px); margin-top: 10px; grid-template-columns: 1fr; gap: 14px; }
    .mini-puzzle-choice { border-radius: 12px; }
    .mini-puzzle-choice > img { height: 170px; }
}
@media (max-width: 350px) {
    .story-section, .clues-section, .grid-section { padding-inline: 8px; }
    .logic-grid th { font-size: .7rem; }
    .grid-cell { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .confetti-layer i, .status.failure { animation: none; } }

@media print {
    @page { size: letter portrait; margin: .35in; }
    html, body { width: auto !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; background: #fff; color: #000; }
    body.site-frame { display: block !important; height: auto !important; min-height: 0 !important; grid-template: none !important; overflow: visible !important; }
    .skip-link, #site-header, #site-footer, .mini-page-header, .puzzle-actions, .grid-key, .status, .celebration, .visually-hidden { display: none !important; }
    main.site-main.mini-main { display: block !important; height: auto !important; min-height: 0 !important; max-height: none !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
    .puzzle-card { width: 100%; height: auto !important; min-height: 0 !important; margin: 0; display: block !important; border: 0; border-radius: 0; box-shadow: none; break-inside: avoid-page; page-break-inside: avoid; break-after: avoid-page; page-break-after: avoid; }
    .puzzle-card::before { content: attr(data-print-title); display: block; margin: 0 0 .08in; font-size: 20pt; font-weight: 800; text-align: center; }
    .puzzle-art { width: 100%; background: #fff; text-align: center; }
    .puzzle-art .color-art { display: none; }
    .puzzle-art .print-art { display: block; width: 6.6in; max-width: 100%; max-height: 4.4in; height: auto; margin: 0 auto; object-fit: contain; }
    body[data-puzzle="fruit-gummy-grab-bags"] .puzzle-art .print-art { width: 5.8in; max-height: 3.87in; }
    body[data-puzzle="fruit-gummy-grab-bags"] .story-section,
    body[data-puzzle="fruit-gummy-grab-bags"] .clues-section,
    body[data-puzzle="fruit-gummy-grab-bags"] .grid-section { padding-top: .05in; }
    body[data-puzzle="fruit-gummy-grab-bags"] .logic-grid-wrap { margin-top: .03in; }
    body[data-puzzle="fruit-gummy-grab-bags"] .grid-cell { min-height: .34in; }
    .story-section, .clues-section, .grid-section { padding: .09in 0 0; }
    .story-section h2, .clues-section h2 { display: none; }
    .story-section p, .clues-section li { font-size: 9.5pt; line-height: 1.25; }
    .clues-section ol { margin: 0; }
    .clues-section li { margin-bottom: 2px; }
    .grid-heading h2 { margin: 0; color: #000; font-size: 12pt; text-align: center; }
    .grid-heading p { display: none; }
    .logic-grid-wrap { max-width: 5.4in; margin-top: .06in; }
    .logic-grid { border-spacing: 0; border-collapse: collapse; }
    .logic-grid th { padding: 4px; color: #000; background: #fff; border: 1.5px solid #000; border-radius: 0; font-size: 8.5pt; }
    .logic-grid th:first-child { width: 23%; background: #fff; }
    .grid-cell { min-height: .38in; border: 1px solid #000; border-radius: 0; color: transparent !important; background: #fff !important; font-size: 0; }
    .print-site-marker { display: block; margin: .08in 0 0; font-size: 8pt; font-weight: 700; text-align: center; break-after: avoid-page; page-break-after: avoid; }
}
