.art-sprite {
  display: inline-block;
  flex: none;
  width: var(--art-size, 3rem);
  aspect-ratio: 1;
  background-repeat: no-repeat;
  background-position: var(--art-x, 0%) var(--art-y, 0%);
}
.memory-art, .cave-art { background-size: 300% 200%; }
.memory-art { background-image: url('assets/leikir/minnisspjold.webp'); }
.cave-art { background-image: url('assets/leikir/hellir-hlutir.webp'); }
.flight-art {
  background-image: url('assets/leikir/kustferd-spjald.webp');
  background-size: 200% 200%;
}
.art-tree, .art-sack, .art-music, .art-ladle { --art-x: 50%; }
.art-cookie, .art-logs, .art-cup, .art-chest, .art-house, .art-stocking { --art-x: 100%; }
.art-heart, .art-music, .art-cup, .art-stool, .art-ladle, .art-chest, .art-cloud, .art-stocking { --art-y: 100%; }

.tile-icon { overflow: hidden; }
.tile-icon .art-sprite { --art-size: 84%; }
.tile-icon .art-thumb { width: 100%; height: 100%; object-fit: cover; }
.feature-icon .art-sprite { --art-size: clamp(52px, 8vw, 100px); }
.feature-icon:has(.art-sprite) { width: auto; flex-basis: auto; }
.card-art { height: clamp(132px, 14vw, 196px); overflow: hidden; }
.card-art .art-sprite { --art-size: clamp(110px, 12vw, 172px); }
.card-art .art-thumb { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.recipe-banner { align-items: center; }
.recipe-banner .art-sprite { --art-size: 78px; }
.memory-tile { background: #253a50; }
.memory-tile .art-sprite { --art-size: 88%; }
.memory-tile:not(.revealed,.matched) .art-sprite { --art-size: 68%; }
.memory-tile.revealed { background: #e2eef5; }
.memory-tile.matched { background: #fff0ce; }
.memory-tile.matched:disabled { opacity: 1; }
.world-map .land { fill: #abc3a5; stroke: #6c8790; stroke-width: .9; }

.cg-flight-grid { background: #b9d1e4; border-color: #789ab6; }
.cg-flight-cell { background: #f0f6ff; }
.cg-flight-cell.cloud { background: #c7dbee; }
.cg-flight-cell > .flight-art { --art-size: 92%; }
.cg-flight-cell > .art-stocking { position: absolute; left: 0; bottom: 0; z-index: 1; --art-size: 43%; }
.cg-flight-cell small { z-index: 2; }
.cg-broom {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  place-self: stretch;
  filter: none;
}
.cg-broom .flight-art { --art-size: 98%; }
.cg-broom[data-facing="2"] .flight-art { transform: scaleX(-1); }
.cg-broom b { position: absolute; right: 1px; bottom: 2px; margin: 0; }
.cg-flight-cell.house.player .art-house { opacity: .48; }
.cg-flight-cell.house.player .cg-broom { inset: -13% 5% 13% -5%; }
.cg-flight-cell.house.player .cg-broom b { inset: 11% auto auto 6%; }

.cg-rhyme-layout, .cg-welcome {
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: clamp(18px, 3vw, 38px);
}
.cg-rhyme-scene {
  width: 100%;
  height: auto;
  display: block;
  border: 2px solid #384a5c;
  border-radius: 15px;
  box-shadow: 0 4px 0 #d2dde6;
}
.cg-welcome .cg-rhyme-scene { animation: welcome-in .45s ease-out; }
@keyframes welcome-in { from { opacity: 0; } to { opacity: 1; } }

.cg-cave-frame {
  background: #758b9d;
  border-color: #495f72;
  box-shadow: inset 0 9px 0 #667e92;
}
.cg-cave-cell.rock:disabled { background: #34495e; border-color: #34495e; }
.cg-cave-cell .cave-art { --art-size: 90%; }
.cg-piece-name .cave-art { --art-size: 36px; }
.cg-cave-cell .cg-rock-art {
  width: 74%;
  aspect-ratio: 1.2;
  background: linear-gradient(142deg, #aab9c2 0 39%, #788d9e 40% 67%, #516677 68%);
  clip-path: polygon(18% 33%, 39% 4%, 70% 12%, 94% 52%, 92% 79%, 68% 95%, 20% 88%, 4% 62%);
}
.print-preview .coloring-art {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 310px;
  object-fit: contain;
  margin: 12px auto;
}

@media (max-width: 650px) {
  .cg-rhyme-layout, .cg-welcome { grid-template-columns: minmax(0,1fr); }
  .cg-rhyme-scene { max-width: 480px; margin-inline: auto; }
  .cg-broom b { font-size: clamp(14px, 4vw, 22px); padding: 1px 3px; }
  .cg-piece-name .cave-art { --art-size: 29px; }
}
@media (prefers-reduced-motion: reduce) {
  .cg-welcome .cg-rhyme-scene { animation: none; }
}
@media print {
  .recipe-banner .art-sprite { display: none; }
  .print-sheet .coloring-art { display: block; width: auto; height: auto; max-width: 165mm; max-height: 201mm; margin: 4mm auto; }
}

/* A text-free coloring sheet with the complete bare tree visible. */
.print-preview:has(.coloring-sheet){max-height:none;overflow:visible}
.print-preview .coloring-sheet .coloring-art{width:auto;height:auto;max-width:100%;max-height:min(48vh,400px);margin:0 auto;object-fit:contain}
@media print{
 .print-sheet.coloring-sheet{display:flex;align-items:center;justify-content:center;width:180mm;height:260mm}
 .print-sheet.coloring-sheet .coloring-art{width:auto;height:auto;max-width:180mm;max-height:260mm;margin:0 auto}
}

/* Text-free star templates; instructions stay above the preview. */
.print-instructions{font-size:14px;color:var(--muted);margin:0 0 22px}
.print-preview:has(.star-sheet){max-height:none;overflow:visible}
.print-preview .star-template{display:block;width:auto;height:auto;max-width:100%;max-height:min(48vh,400px);margin:0 auto}
@media print{
 .print-sheet.star-sheet{display:flex;align-items:center;justify-content:center;width:180mm;height:260mm}
 .print-sheet.star-sheet .star-template{width:auto;height:auto;max-width:180mm;max-height:255mm;margin:0 auto}
}

/* The word-search sheets contain only the grid and target words. */
.word-list{list-style:none;padding:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-width:480px;margin:18px auto 0;text-align:center;font-weight:600}
.print-preview .wordsearch-sheet+.wordsearch-sheet{margin-top:32px}
.print-preview .wordsearch-sheet .word-grid{table-layout:fixed;width:100%;max-width:480px;margin:0 auto;font-size:clamp(11px,2.2vw,20px)}
.print-preview .wordsearch-sheet .word-grid td{width:8.333%;height:clamp(20px,4vw,38px)}
.print-preview .word-list{font-size:clamp(10px,2vw,14px)}
.print-preview .answer-cell{background:#ddd;font-weight:bold}
@media print{
 .print-sheet.wordsearch-sheet{padding-top:22mm}
 .print-sheet.wordsearch-sheet .word-grid{table-layout:fixed;width:156mm;margin:0 auto 12mm;font:21pt monospace}
 .print-sheet.wordsearch-sheet .word-grid td{width:13mm;height:13mm}
 .print-sheet.wordsearch-sheet .word-list{width:156mm;max-width:100%;margin:0 auto;gap:5mm 0;font:600 16pt var(--font)}
}
/* Coloring-card choices and a text-free folded card. */
.greeting-choices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:22px 0}
.greeting-choices button{border:1px solid var(--line);border-radius:6px;background:#fff;padding:8px;color:var(--ink);min-width:0}
.greeting-choices button[aria-pressed=true]{border:2px solid var(--red);padding:7px;background:var(--ice)}
.greeting-choices img{width:100%;height:auto;aspect-ratio:2/3;object-fit:contain;background:#fff}
.greeting-choices span{display:block;margin-top:8px;font-size:12px}
.print-preview:has(.greeting-sheet){max-height:none;overflow:visible;padding:12px}
.greeting-sheet{width:100%;aspect-ratio:297/210;background:white}
.greeting-flat{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;height:100%}
.greeting-back,.greeting-front{min-width:0;min-height:0}
.greeting-front{display:flex;align-items:center;justify-content:center;border-inline-start:1px dashed #aaa;padding:3%}
.greeting-front img{width:100%;height:100%;min-height:0;object-fit:contain}
@media(max-width:560px){.greeting-choices{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* Spacious interview and world-travel worksheets. */
.print-preview:has(.designed-sheet){padding:16px;max-height:480px}
.designed-sheet{background:#fff;color:#222;padding:18px 10px;line-height:1.5}
.designed-sheet+.designed-sheet{margin-top:32px;border-top:1px dashed #aaa;padding-top:28px}
.ws-kicker{font-size:10px;color:#666;margin-bottom:8px}
.ws-title{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:14px}
.ws-title h1{font-size:27px;letter-spacing:-.5px}
.ws-title svg{width:32px;height:32px;flex:none}
.ws-header p{margin-bottom:24px}
.ws-fields{display:grid;gap:15px;margin:0 0 30px;font-size:12px}
.ws-fields>div{display:flex;gap:12px;align-items:end}
.ws-field-line{flex:1;min-width:30px;border-bottom:1px solid #aaa;min-height:20px}
.ws-blocks{display:grid;gap:30px}
.ws-block-title{display:flex;gap:12px;align-items:center;margin-bottom:9px}
.ws-block-title svg{width:25px;height:25px;flex:none}
.print-preview .ws-block h2{font:600 16px/1.4 var(--font);letter-spacing:0;margin:0}
.ws-block p{font-size:13px;margin-bottom:12px}
.ws-answer-lines{display:grid;gap:0}
.ws-answer-lines>span{display:block;border-bottom:1px solid #bcbcbc;min-height:30px}
.ws-country-fields{display:grid;gap:12px;font-size:12px;margin-top:15px}
.ws-country-fields>div{display:grid;grid-template-columns:minmax(95px,.7fr) minmax(0,1.5fr);align-items:start;gap:10px}
.ws-country-fields .ws-answer-lines>span{min-height:27px}
.ws-drawing{height:var(--drawing-height);border:1px solid #aaa;border-radius:6px;margin-top:15px}
.ws-footer{display:flex;justify-content:space-between;font-size:10px;color:#666;margin-top:30px}
@page greeting-card{size:A4 landscape;margin:10mm}
@media print{
 .print-sheet.greeting-sheet{page:greeting-card;width:277mm;height:190mm;aspect-ratio:auto;padding:0;margin:0;break-inside:avoid}
 .print-sheet.greeting-sheet .greeting-front{padding:4mm}
 .print-sheet.designed-sheet{position:relative;box-sizing:border-box;width:176mm;min-height:263mm;padding:0 0 12mm;margin:0 auto;line-height:1.4}
 .print-sheet.designed-sheet+.designed-sheet{border:0;padding-top:0}
 .designed-sheet .ws-kicker{font-size:9pt;margin-bottom:3mm}
 .designed-sheet .ws-title{margin-bottom:4mm}
 .designed-sheet .ws-title h1{font-size:25pt;margin:0;letter-spacing:0}
 .designed-sheet .ws-title svg{width:9mm;height:9mm;margin:0;max-height:none}
 .designed-sheet .ws-header p{font:11pt/1.4 var(--font);margin-bottom:8mm}
 .designed-sheet .ws-fields{gap:3mm;margin-bottom:8mm;font-size:10pt}
 .designed-sheet .ws-field-line{min-height:6mm}
 .designed-sheet .ws-blocks{gap:7mm}
 .designed-sheet .ws-block{break-inside:avoid}
 .designed-sheet .ws-block-title{gap:3mm;margin-bottom:2mm}
 .designed-sheet .ws-block-title svg{width:7mm;height:7mm;margin:0;max-height:none}
 .designed-sheet .ws-block h2{font:600 13pt/1.4 var(--font);letter-spacing:0;margin:0}
 .designed-sheet .ws-block p{font:11pt/1.4 var(--font);margin-bottom:3mm}
 .designed-sheet .ws-answer-lines>span{min-height:8mm}
 .designed-sheet .ws-country-fields{gap:3mm;margin-top:4mm;font-size:10pt}
 .designed-sheet .ws-country-fields>div{grid-template-columns:38mm minmax(0,1fr);gap:3mm}
 .designed-sheet .ws-country-fields .ws-answer-lines>span{min-height:8mm}
 .designed-sheet .ws-drawing{margin-top:3mm}
 .designed-sheet .ws-footer{position:absolute;bottom:0;inset-inline:0;margin:0;font-size:8pt}
}

.ws-drawing.ws-drawing-open{border:0;border-radius:0}

/* One illustration for each song, preserving the full scene. */
.song-layout>*{min-width:0}
.song-illustration{max-width:720px;margin:24px 0 28px}
.song-illustration img{display:block;width:100%;height:auto;aspect-ratio:3/2;border-radius:7px}
.song-illustration figcaption{font-size:11px;line-height:1.5;color:var(--muted);margin-top:7px}
@media print{.song-illustration{max-width:70mm;margin:4mm 0;break-inside:avoid}.song-illustration figcaption{font-size:8pt}}

@media print{
 body:has(.song-layout) .page-head,body:has(.song-layout) .intro-note,.song-layout+.task{display:none!important}
 .song-layout{display:block}
 .song-illustration{float:right;width:60mm;margin:0 0 4mm 5mm}
 .song-content .verses{display:block;margin-top:5mm}
 .song-content .verse{font-size:12pt;line-height:1.45;margin-bottom:6mm;break-inside:avoid}
 .song-content>.rights{clear:both}
 .song-content>.rights,.song-content>.source{font-size:8pt;line-height:1.4;margin-top:3mm}
}

/* Final PDF artwork is shared by preview and download. */
.greeting-pdf-preview{display:block;width:100%;height:auto;object-fit:contain;background:#fff}
@media print{.greeting-pdf-preview{width:100%;height:auto}}
