/* Working private festival activities; preserve approved holiday palette and Graphik. */
.modal.is-festival { width: min(960px,100%); max-height: 94vh; }
.modal.is-festival .modal-scroll { max-height: 94vh; }
.festival, .festival-work, .festival-intro, .festival-heading { display: grid; gap: var(--space-md); min-width: 0; }
.festival-heading { padding-right: var(--space-xl); }
.festival-heading p, .festival-status, .festival-note { margin: 0; }
.festival-status { padding: var(--space-md); background: var(--holiday-cream); border-radius: var(--radius-md); font-size: var(--small-size); line-height: 1.5; }
.festival-note { font-size: var(--small-size); line-height: 1.5; }
.wish-counter { margin: 0; padding: var(--space-md); background: var(--holiday-cream); border-radius: var(--radius-md); font-size: var(--small-size); font-weight: 600; line-height: 1.5; text-align: center; }
.festival-field { display: grid; gap: var(--space-xs); min-width: 0; }
.festival-field input, .festival-field textarea, .festival-field select { width: 100%; min-width: 0; box-sizing: border-box; font-family: var(--font-family); color: var(--text); }
.festival-field textarea { resize: vertical; }
.festival button:focus-visible, .festival a:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.festival button { min-height: 44px; }
.festival button:disabled { cursor: default; }
.festival-download { display: grid; gap: var(--space-md); min-width: 0; }
.festival-download:empty { display: none; }
.festival-export-preview { max-width: min(100%,450px); max-height: 450px; object-fit: contain; border-radius: var(--radius-md); }
.table-catalog { display: grid; gap: var(--space-md); min-width: 0; }
.table-category { display: grid; gap: var(--space-sm); min-width: 0; }
.table-category-title { margin: 0; font-size: 1rem; line-height: 1.35; }
.table-inventory { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: var(--space-sm); }
.table-inventory-item { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--space-xs); padding: var(--space-sm); min-width: 0; border: 0; background: var(--holiday-ice); color: var(--text); border-radius: var(--radius-sm); font-size: 12px; touch-action: none; user-select: none; }
.table-inventory-item img { width: 100%; height: 64px; object-fit: contain; pointer-events: none; }
.table-inventory-item span { overflow-wrap: anywhere; }
.table-board { position: relative; width: 100%; aspect-ratio: 1672 / 941; background: var(--holiday-cream); border-radius: var(--radius-md); overflow: hidden; }
.table-scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.table-drag-ghost { position: absolute; z-index: 4; transform: translate(-50%,-50%); object-fit: contain; opacity: .8; pointer-events: none; }
.table-drag-ghost[hidden] { display: none; }
.table-piece { position: absolute; transform: translate(-50%,-50%); width: 18%; height: 15%; min-height: 0 !important; border: 0; padding: 0; background: transparent; color: var(--text); border-radius: var(--radius-sm); touch-action: none; user-select: none; cursor: grab; }
/* The generic .btn:hover transform must not replace absolute-position centering. */
.festival .table-piece, .festival .table-piece:hover, .festival .table-piece-remove, .festival .table-piece-remove:hover { transform: translate(-50%,-50%); transition: none; }
.table-piece::after { content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%,-50%); }
.table-piece:active { cursor: grabbing; }
.table-piece-remove { position: absolute; z-index: 5; transform: translate(-50%,-50%); display: grid; place-items: center; width: 26px; height: 26px; min-height: 0; padding: 0; border: 2px solid var(--primary); border-radius: 50%; background: #fff; color: var(--primary); font: inherit; font-size: 19px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.festival .table-piece-remove { min-height: 0; }
.table-piece-remove::after { content: ''; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%,-50%); }
.table-piece-remove[hidden] { display: none; }
.table-piece-remove:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.table-piece[aria-pressed="true"] { outline: 2px solid var(--primary); outline-offset: 2px; }
.table-board.is-pointer-away .table-piece[aria-pressed="true"] { outline: none; }
.table-board.is-pointer-away .table-piece-remove:not(:focus-visible) { visibility: hidden; pointer-events: none; }
.table-board.is-pointer-away .table-piece[aria-pressed="true"]:focus-visible { outline: 2px solid var(--primary); }
.table-piece img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.fortune-cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: var(--space-md); }
.fortune-card { aspect-ratio: 964 / 1632; min-height: 0 !important; padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--primary); perspective: 1000px; }
.fortune-card:disabled { opacity: 1; }
.fortune-card-inner { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.fortune-card-inner.is-revealed { transform: rotateY(180deg); }
.fortune-card-inner.is-flipping { animation: fortune-flip .65s ease-in-out both; }
.fortune-card-side { position: absolute; inset: 0; display: block; border-radius: var(--radius-lg); background-color: var(--primary); background-size: 100% 100%; background-position: center; backface-visibility: hidden; }
.fortune-card-face { transform: rotateY(180deg); }
@keyframes fortune-flip { from { transform: rotateY(0deg); } to { transform: rotateY(180deg); } }
@media (prefers-reduced-motion: reduce) { .fortune-card-inner.is-flipping { animation: none; } }
.fortune-art { display: block; width: min(340px, 92%); margin: 0 auto; border-radius: var(--radius-lg); }
.fortune-result { margin: 0; padding: var(--space-xl); background: var(--holiday-pink); border-radius: var(--radius-lg); font-size: var(--h3-size); line-height: 1.4; }
.fortune-result.is-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Approved hand-lettered certificates; the name uses a Cyrillic handwriting font. */
@font-face { font-family: Neucha; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/neucha-cyrillic.woff2') format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: Neucha; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/neucha-latin.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
.certificate-preview { position: relative; width: min(100%, 440px); justify-self: center; aspect-ratio: 1122 / 1402; border-radius: var(--radius-md); background: #fbf8ef; overflow: hidden; min-width: 0; }
.certificate-art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.certificate-art-text { position: absolute; left: 9.8%; top: 39.59%; width: 80.22%; height: 23.9%; }
.certificate-preview [hidden] { display: none; }
.certificate-name { position: absolute; left: 18%; top: 30.3%; width: 64%; height: 6.1%; display: flex; align-items: end; justify-content: center; white-space: nowrap; color: #222; line-height: 1; font-family: Neucha, Graphik, sans-serif; }
.certificate-legacy { position: absolute; inset: 38% 15%; margin: 0; text-align: center; font: 600 18px/1.4 Graphik, sans-serif; }
.wish-gallery { min-width: 0; display: grid; gap: var(--space-sm); }
.wish-cards { display: flex; gap: var(--space-sm); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 4px 4px 8px; scrollbar-width: thin; scrollbar-color: var(--primary) transparent; }
.wish-cards:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.wish-navigation { display: flex; justify-content: flex-end; gap: var(--space-sm); }
.wish-navigation[hidden] { display: none; }
.wish-navigation button { min-width: 44px; padding: 0 12px; font-size: 22px; }
.wish-cards > .wish-card { flex: 0 0 clamp(280px, 40%, 320px); scroll-snap-align: start; }
.wish-card { position: relative; container-type: inline-size; display: block; width: 100%; min-width: 0; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--radius-md); --wish-art: url('/art/wish-cards.webp'); background-color: var(--holiday-cream); background-image: var(--wish-art); background-size: 100% 100%; background-position: center; background-repeat: no-repeat; color: #000; font: inherit; line-height: 1.15; text-align: center; cursor: pointer; overflow-wrap: anywhere; }
/* Safe area inside the illustrated sheet, leaving room for its slanted edges and the hand. */
.wish-card-text { position: absolute; left: 34%; top: 52%; width: 51%; height: 25%; box-sizing: border-box; padding-top: 3%; font-family: Neucha, Graphik, sans-serif; font-weight: 400; font-size: clamp(14px, 4.8cqw, 19px); }
span.wish-card-text { display: grid; place-items: center; overflow-y: auto; }
.wish-card:nth-child(2n) { background-color: var(--holiday-ice); }
.wish-card:nth-child(3n) { background-color: var(--holiday-pink); }
.wish-card[aria-pressed="true"], .wish-custom.is-selected { outline: 3px solid var(--primary); outline-offset: -3px; }
.wish-custom-input { min-width: 0; min-height: 0; padding: 3% 4px 2px; border: 0; border-radius: 0; background: transparent; color: #000; font-family: Neucha, Graphik, sans-serif; font-weight: 400; line-height: inherit; text-align: center; resize: none; overflow-y: auto; }
.wish-custom-input::placeholder { color: #444; opacity: 1; }
.wish-custom-input:focus-visible { outline: 2px solid #3d3bff; outline-offset: 2px; }
/* The aligned clean art shows only through the advancing paper-shaped cutout.
   Both the cutout and the flat ember front are clipped away from the hand. */
@property --wish-burn-progress { syntax: '<length>'; inherits: true; initial-value: 0px; }
.wish-card { overflow: hidden; }
.wish-card.is-burning { background-image: url('/art/wish-burn-background.webp'), var(--wish-art); }
.wish-burn {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: var(--wish-art) center / 100% 100% no-repeat;
  mask-image: linear-gradient(black, black), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath fill='black' d='M0 0H100V50L96 49.4 92 50.8 88 49.7 84 51 80 49 76 50 72 48.8 68 51.1 64 50 60 51 56 49.2 52 50.6 48 49 44 50.4 40 49.8 36 51 32 48.9 28 50.5 24 49.5 20 51 16 49.3 12 50.6 8 49 4 50.4 0 50Z'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpolygon fill='white' points='31,38.8 59.5,42.8 59.4,40 60,40 62.7,44.4 63.8,43.9 64.8,45 65.6,44.8 67.2,48.3 71.1,49.4 71.1,46.6 72.2,47.5 74,48 74.8,47.2 75.8,49.8 77.1,49.8 77.4,51.7 79.8,52.2 81.9,52.2 84.6,51.9 85.9,52.2 87.2,50.2 88,49.3 88.9,50 90.1,48 90.8,48.5 91.8,47.6 92.6,49.1 93.8,48.2 94,48.2 94.1,53.4 87.3,85.4 80.4,78.9 77,77 74.8,76.8 73.4,77.3 72.8,78.3 73.1,79.8 74.2,81.5 75.6,83.4 76.5,85.6 75.7,86.1 67,85.9 56,83.9 45,80.9 35,78.7 24.8,76'/%3E%3C/svg%3E");
  mask-size: 100% 100%; mask-repeat: no-repeat;
  mask-position: 0 0, 0 calc(var(--wish-burn-progress) - 50cqw), 0 0;
  mask-composite: subtract, intersect;
  animation: wish-paper-burn 2.1s linear forwards;
}
/* A jagged, two-colour front travels with the cutout, never beyond the sheet. */
.wish-card.is-burning::after {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  animation: wish-paper-burn 2.1s linear forwards;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath fill='%23f26a1b' d='M0 50L4 47 8 48 12 46.5 16 48 20 47 24 48 28 46.5 32 48 36 47 40 48 44 46.5 48 48 52 47 56 48 60 46.5 64 48 68 47 72 48 76 46.5 80 48 84 47 88 48 92 46.5 96 48 100 47V50L96 49.4 92 50.8 88 49.7 84 51 80 49 76 50 72 48.8 68 51.1 64 50 60 51 56 49.2 52 50.6 48 49 44 50.4 40 49.8 36 51 32 48.9 28 50.5 24 49.5 20 51 16 49.3 12 50.6 8 49 4 50.4 0 50Z'/%3E%3Cpath fill='%23ffd34e' d='M0 49L4 48 8 49 12 48 16 49 20 48 24 49 28 48 32 49 36 48 40 49 44 48 48 49 52 48 56 49 60 48 64 49 68 48 72 49 76 48 80 49 84 48 88 49 92 48 96 49 100 48V50L96 49.4 92 50.8 88 49.7 84 51 80 49 76 50 72 48.8 68 51.1 64 50 60 51 56 49.2 52 50.6 48 49 44 50.4 40 49.8 36 51 32 48.9 28 50.5 24 49.5 20 51 16 49.3 12 50.6 8 49 4 50.4 0 50Z'/%3E%3C/svg%3E");
  background-size: 100% 100%; background-repeat: no-repeat;
  background-position: 0 calc(var(--wish-burn-progress) - 50cqw);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpolygon fill='white' points='31,38.8 59.5,42.8 59.4,40 60,40 62.7,44.4 63.8,43.9 64.8,45 65.6,44.8 67.2,48.3 71.1,49.4 71.1,46.6 72.2,47.5 74,48 74.8,47.2 75.8,49.8 77.1,49.8 77.4,51.7 79.8,52.2 81.9,52.2 84.6,51.9 85.9,52.2 87.2,50.2 88,49.3 88.9,50 90.1,48 90.8,48.5 91.8,47.6 92.6,49.1 93.8,48.2 94,48.2 94.1,53.4 87.3,85.4 80.4,78.9 77,77 74.8,76.8 73.4,77.3 72.8,78.3 73.1,79.8 74.2,81.5 75.6,83.4 76.5,85.6 75.7,86.1 67,85.9 56,83.9 45,80.9 35,78.7 24.8,76'/%3E%3C/svg%3E");
  mask-size: 100% 100%; mask-repeat: no-repeat;
}
.is-burning .wish-card-text { z-index: 2; animation: wish-text-burn 2.1s linear forwards; }
@keyframes wish-paper-burn { from { --wish-burn-progress: 35cqw; } to { --wish-burn-progress: 90cqw; } }
@keyframes wish-text-burn { 0%, 28% { opacity: 1; } 48%, 100% { opacity: 0; } }
.wish-complete { margin: 0; background: var(--holiday-ice); padding: var(--space-xl); border-radius: var(--radius-lg); font-size: var(--body-size); line-height: 1.6; white-space: pre-line; }
@media (max-width: 600px) {
  .table-board { position: sticky; top: 0; z-index: 3; }
  .table-inventory { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .table-inventory-item img { height: 48px; }
  .fortune-cards { gap: var(--space-sm); grid-template-columns: repeat(2,minmax(0,1fr)); }
  .festival-work .actions { display: grid; }
  .festival-work .btn { white-space: normal; }
}
@media (max-width: 600px) { .wish-cards > .wish-card { flex-basis: 280px; } }
@media (prefers-reduced-motion: reduce) { .festival * { scroll-behavior: auto; transition: none; } }
