:root {
  color-scheme: dark;
  font: 1rem/1.55 system-ui, sans-serif;
  color: #fffaea;
  background: #10251e;
  --gold: #f4ce81;
  --cherry: #ff7882;
  --line: #ffffff28;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 78% 12%, #712c3f77, transparent 37%),
    radial-gradient(ellipse at 15% 28%, #33806975, transparent 46%),
    linear-gradient(160deg, #17392f, #102720 72%);
}
.brand-initial { color: var(--cherry); }
.eyebrow, footer { color: var(--gold); }
main { flex: 1; width: min(100% - 2rem, 56rem); margin: 0 auto; padding: 2rem 0 3rem; }
footer { padding: 1.15rem clamp(1rem, 5vw, 4rem); border-top: 1px solid var(--line); font-size: .9rem; }
h1, h2 { font-family: Georgia, serif; line-height: 1.04; margin: 0 0 1rem; }
h1 { font-size: clamp(2.6rem, 9vw, 5.6rem); letter-spacing: -.05em; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template: "heading gift" auto "action gift" 1fr / minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  padding: clamp(2rem, 5vw, 4rem);
  margin-bottom: 1.35rem;
  border: 1px solid #f4ce815c;
  border-radius: clamp(1.2rem, 5vw, 2.8rem);
  background:
    radial-gradient(ellipse at 76% 50%, #e8ad5629, transparent 37%),
    linear-gradient(110deg, #0d221df5, #102720d1 58%, #302326d9);
  box-shadow: inset 0 0 0 1px #f4ce8121, 0 1.75rem 3.5rem #080c0966;
}
body:has(.hero)::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #081a1350, #081a135f 50%, #0e2019de), url('/winter-forest.jpg') center / cover no-repeat;
}
body:has(.hero) { background: #10251e; isolation: isolate; }
body:has(.hero) footer { background: #0e211bd9; }
.hero-heading { grid-area: heading; }
.hero-action { grid-area: action; align-self: start; }
.gift-scene { grid-area: gift; }
.hero h1 {
  font-size: clamp(2.8rem, 7.6vw, 5.7rem);
  margin-bottom: 0;
  color: #fff6df;
  text-shadow: 0 .075em .34em #13241cb3;
}
.hero-action > p { max-width: 32rem; }
#draw { max-width: 22rem; }
#draw input { background: #0c211adb; }
#draw button { width: 100%; background: linear-gradient(110deg, #ffe2a6, #ebbd67); box-shadow: 0 .35rem 1rem #070e0b42; }
.eyebrow { font-weight: 750; text-transform: uppercase; letter-spacing: .22em; font-size: .88rem; }
.gift { position: relative; width: 9rem; height: 7rem; margin: 3.75rem auto 1.8rem; filter: drop-shadow(0 1.1rem 1.2rem #0005); }
.gift i, .gift b { position: absolute; background: linear-gradient(90deg, transparent 42%, var(--gold) 42% 58%, transparent 58%), linear-gradient(130deg, #c44a49, #8b2538); }
.gift i { inset: 1.1rem .25rem 0; border-radius: .3rem .3rem .75rem .75rem; }
.gift b { inset: 0 0 auto; height: 1.6rem; border-radius: .35rem; box-shadow: 0 .25rem .4rem #0003; transition: transform .75s cubic-bezier(.2,.8,.2,1); }
.gift b::before, .gift b::after { content: ''; position: absolute; width: 1.9rem; height: 1rem; border: .22rem solid var(--gold); border-radius: 65% 80% 10%; bottom: 1.45rem; right: 50%; transform: rotate(12deg); }
.gift b::after { right: auto; left: 50%; transform: scaleX(-1) rotate(12deg); }
.gift-scene.handover {
  --portrait-size: clamp(5.5rem, 28vw, 9.5rem);
  --scene-inset: .35rem;
  --portrait-center: calc(var(--scene-inset) + var(--portrait-size) / 2);
  position: relative;
  width: min(100%, 32rem);
  height: calc(var(--portrait-size) + 9.5rem);
  margin: 2rem auto 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: .5rem var(--scene-inset);
}
.scene-portrait {
  display: grid;
  place-items: center;
  width: var(--portrait-size);
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: #234136;
}
.scene-portrait[hidden] { display: none; }
.scene-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.handover .gift {
  position: absolute;
  left: calc(100% - var(--portrait-center));
  bottom: .25rem;
  width: 9rem;
  margin: 0;
  z-index: 1;
  scale: .68;
  translate: -50% 0;
  transform-origin: bottom center;
  animation: gift-delivery 1.15s ease-in-out both;
}
.handover .gift b { animation: gift-opens .45s 1.05s both; }
@keyframes gift-delivery {
  0% { left: var(--portrait-center); transform: rotate(-10deg); }
  45% { transform: translateY(-2.5rem) rotate(8deg); }
  100% { left: calc(100% - var(--portrait-center)); transform: translateY(0); }
}
@keyframes gift-opens {
  to { transform: translate(-1rem, -2.35rem) rotate(-17deg); }
}
.gift-cat {
  position: absolute;
  width: clamp(5rem, 38%, 9rem);
  aspect-ratio: 3 / 2;
  background: url('/gift-cat-poses.png') 100% 100% / 200% 200% no-repeat;
  left: calc(50% - clamp(3.75rem, 32%, 7.5rem));
  bottom: .1rem;
  z-index: 2;
  pointer-events: none;
}
.cat-handover .gift-cat {
  transform-origin: 32% 100%;
  animation: cat-pounce 2.85s both, cat-poses 2.85s step-end both;
}
.cat-handover .gift {
  left: 50%;
  scale: .92;
  animation: none;
}
.cat-handover .gift b { animation: cat-lid-pop .63s 2.08s both; }
.cat-handover .gift::after {
  content: '✦  ✧  ✦';
  position: absolute;
  left: 50%;
  top: 0;
  color: #ffde8a;
  font-size: 1.8rem;
  white-space: nowrap;
  text-shadow: 0 0 .6rem #ffae49;
  pointer-events: none;
  animation: cat-sparkles .65s 2.04s both;
}
@keyframes cat-pounce {
  0%, 20% { opacity: 0; transform: translateX(-3.25rem) scale(.75); }
  30% { opacity: 1; transform: translate(-2.5rem, -1.2rem) rotate(-11deg); }
  39% { transform: translateX(-1.9rem) scale(1.12, .83); }
  48% { transform: translate(-1.6rem, -1.35rem) rotate(-12deg); }
  57% { transform: translateX(-.85rem) scale(1.1, .84); }
  66% { transform: translateX(-.85rem) scale(.86, .8) rotate(-7deg); }
  72% { transform: translate(.85rem, -.4rem) scale(1.13, .97) rotate(-13deg); }
  83% { transform: translate(-.5rem, -.75rem) rotate(8deg); }
  92% { transform: translateX(-.25rem) scale(1.08, .9); }
  100% { opacity: 1; transform: translateX(-.25rem); }
}
@keyframes cat-poses {
  0%, 45% { background-position: 0 0; }
  33%, 57% { background-position: 100% 0; }
  70% { background-position: 0 100%; }
  77%, 100% { background-position: 100% 100%; }
}
@keyframes cat-lid-pop {
  0% { transform: translate(0, 0); }
  45% { transform: translate(1.1rem, -3.2rem) rotate(28deg); }
  100% { transform: translate(1.45rem, -1.65rem) rotate(18deg); }
}
@keyframes cat-sparkles {
  0% { opacity: 0; transform: translate(-50%, -.4rem) scale(.35); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -3.3rem) scale(1.4); }
}
.animation-preview { text-align: center; }
.card a { color: var(--gold); }
#result:empty { display: none; }
#result.draw-result {
  margin: .25rem 0 0;
  font: 700 clamp(1.55rem, 5vw, 2.4rem)/1.12 Georgia, serif;
  color: #fff6df;
}
.draw-result strong {
  display: block;
  margin-top: .24em;
  color: var(--gold);
  font-size: clamp(2.15rem, 8vw, 3.75rem);
  overflow-wrap: anywhere;
}
#calendar-actions { margin-top: 1.2rem; }
#calendar-actions p { margin: 0 0 .55rem; font-size: .92rem; color: var(--gold); }
.calendar-links { display: flex; flex-wrap: wrap; gap: .55rem; }
.calendar-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .45rem .8rem;
  border: 1px solid #f4ce8190;
  border-radius: .55rem;
  color: #fff3d3;
  font-weight: 650;
  text-decoration: none;
}
.calendar-links a:hover { background: #f4ce8126; }
.card, .notice { border: 1px solid var(--line); border-radius: 1.1rem; padding: clamp(1rem, 4vw, 2rem); background: #112d25; margin: 1.3rem 0; }
.notice { padding: .8rem 1rem; color: var(--gold); }
.names, .checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .6rem 1rem; margin-bottom: 1rem; }
fieldset { border: 1px solid var(--line); border-radius: .6rem; min-width: 0; margin: 0 0 1rem; }
article { margin-block: 1.1rem; padding-top: .6rem; border-top: 1px solid var(--line); }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: .6rem; padding: .65rem 1rem; color: #16271d; background: var(--gold); font-weight: 760; }
button:hover { background: #ffe4a8; }
button:disabled { opacity: .6; cursor: default; }
input:not([type=checkbox]), select { display: block; width: 100%; margin: .25rem 0 .65rem; padding: .62rem; border: 1px solid #ffffff55; border-radius: .5rem; color: inherit; background: #0c211a; }
.checks { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
input[type=checkbox] { accent-color: var(--gold); width: 1.1rem; height: 1.1rem; vertical-align: middle; }
:focus-visible { outline: 3px solid #fff3bc; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .gift b { transition: none; }
  .handover .gift, .handover .gift b, .cat-handover .gift-cat, .cat-handover .gift::after { animation: none; }
  .cat-handover .gift::after { content: none; }
  .handover .gift b { transform: translate(-1rem, -2.35rem) rotate(-17deg); }
}

.participation, .game-rules {
  margin: 0 auto 1.35rem;
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid #f4ce814f;
  border-radius: 1.4rem;
  background: linear-gradient(145deg, #17382ff2, #132822f5);
  box-shadow: 0 1.1rem 2rem #080c0938;
}
.game-rules h2 { font-size: clamp(1.45rem, 3.2vw, 2rem); }
.game-rules ul { margin: 0; padding-inline-start: 1.15rem; }
.game-rules li + li { margin-top: .5rem; }
.game-rules li::marker { color: var(--gold); }
.participation-heading { text-align: center; }
.participation-heading h2 { margin-bottom: .35rem; }
.participation-heading p { margin: 0; color: var(--gold); }
.portraits {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(.55rem, 2vw, 1.25rem);
  padding: 0;
  margin: 1.35rem 0 0;
  list-style: none;
  text-align: center;
}
.portrait {
  display: grid;
  place-items: center;
  width: min(100%, 6.5rem);
  aspect-ratio: 1;
  margin: 0 auto .5rem;
  overflow: hidden;
  border: 3px solid #ff7379;
  border-radius: 50%;
  background: #234136;
  box-shadow: 0 0 0 3px #ff737926;
}
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portrait-status { display: block; font-size: .88rem; color: #ffafb2; }
.avatar-caption {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: -.95rem auto .3rem;
  padding: .18rem .5rem;
  border: 1px solid #f4ce81a0;
  border-radius: .45rem;
  background: #472734;
  color: #fff3d3;
  font-size: .88rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.participated .portrait { border-color: #64e3a9; box-shadow: 0 0 0 3px #64e3a926; }
.participated .portrait-status { color: #88edbd; }
@media (max-width: 39rem) {
  main { padding-top: 1rem; }
  .hero { grid-template: "heading" "gift" "action" / minmax(0, 1fr); gap: .75rem; text-align: center; padding: 1.6rem 1.15rem; }
  #draw { margin-inline: auto; }
  .calendar-links { justify-content: center; }
  .gift { margin-top: 2.75rem; margin-bottom: 1.25rem; }
  .portraits { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 1rem; }
}
