:root {
  --night-top: #060b1d;
  --night-bottom: #101b3f;
  --sky-off-top: #2a4590;
  --sky-off-bottom: #1d3373;
  --sky-on-top: #3d63c4;
  --sky-on-bottom: #2a4a9e;
  --snow: #f3f7ff;
  --snow-shade: #cfdcf2;
  --glow: rgba(255, 214, 120, .6);
  --note-bg: #fff6dc;
  --note-ink: #4a3a10;
  --gap: clamp(24px, 5vmin, 56px);
}

#donald { --rim: #e5343e; --rim-dark: #8f1520; }
#snowman { --rim: #34a853; --rim-dark: #17602d; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: linear-gradient(var(--night-top), var(--night-bottom));
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Two layers of slow falling snow behind everything. */
.snow, .snow::after {
  position: fixed;
  inset: -200px 0 0;
  pointer-events: none;
  background-image:
    radial-gradient(2.5px 2.5px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 90px 120px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 150px 60px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 60px 170px, #fff 50%, transparent 51%);
  background-size: 200px 200px;
  opacity: .5;
  animation: snowfall 14s linear infinite;
}
.snow::after {
  content: "";
  background-size: 130px 130px;
  opacity: .35;
  animation-duration: 22s;
}
@keyframes snowfall { to { transform: translateY(200px); } }

/* Two tiles, centred, with clear night sky between and around them. */
.yard {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  justify-items: center;
  align-items: center;
  gap: var(--gap);
  padding: max(var(--gap), env(safe-area-inset-top)) var(--gap)
           calc(max(var(--gap), env(safe-area-inset-bottom)) + 12px);
}
@media (orientation: landscape) {
  .yard {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: repeat(2, minmax(0, 560px));
    justify-content: center;
  }
}

/* A chunky physical button: coloured rim, raised bottom edge, presses down. */
.inflatable {
  position: relative;
  display: block;
  height: 100%;
  max-height: 640px;
  width: auto;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 7px solid var(--rim);
  border-radius: 40px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(var(--sky-off-top), var(--sky-off-bottom));
  box-shadow: 0 12px 0 var(--rim-dark), 0 22px 40px rgba(0, 0, 0, .55);
  transition: transform .1s ease, box-shadow .1s ease, filter .4s ease;
}
.inflatable:active {
  transform: translateY(8px);
  box-shadow: 0 4px 0 var(--rim-dark), 0 10px 20px rgba(0, 0, 0, .5);
}
.inflatable:focus-visible { outline: 4px solid #ffd678; outline-offset: 6px; }

/* Lit: the sky brightens and the rim glows warm. */
.sky-on {
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--sky-on-top), var(--sky-on-bottom));
  opacity: 0;
  transition: opacity .9s ease;
}
.inflatable[aria-pressed="true"] .sky-on { opacity: 1; }
.inflatable[aria-pressed="true"] {
  box-shadow: 0 12px 0 var(--rim-dark), 0 0 36px 4px var(--glow), 0 22px 40px rgba(0, 0, 0, .55);
}
.inflatable[aria-pressed="true"]:active {
  box-shadow: 0 4px 0 var(--rim-dark), 0 0 30px 2px var(--glow), 0 10px 20px rgba(0, 0, 0, .5);
}

/* Warm light behind a lit inflatable, like the bulbs inside the real ones. */
.glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(55% 50% at 50% 52%, var(--glow), transparent 72%);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.inflatable[aria-pressed="true"] .glow { opacity: 1; }

/* Snow drift in front, so a deflated figure sinks into it. */
.ground {
  position: absolute;
  z-index: 1;
  left: -20%;
  right: -20%;
  bottom: -18%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(120% 100% at 50% 0%, var(--snow) 55%, var(--snow-shade));
}

.sway {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 4%;
  bottom: 10.5%;
  transform-origin: 50% 100%;
}
.figure {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
}
.figure svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .3));
  transition: filter 1s ease;
}

/* Resting poses, never distorted. app.js animates between them. */
.figure { transform: translateY(13%) rotate(-12deg) scale(.74, .74); }
.inflatable[aria-pressed="true"] .figure { transform: translateY(0%) rotate(0deg) scale(1, 1); }
.inflatable[aria-pressed="false"] .figure svg {
  filter: brightness(.82) saturate(.8) drop-shadow(0 4px 6px rgba(0, 0, 0, .3));
}

.inflatable[aria-pressed="true"] .eyes-shut,
.inflatable[aria-pressed="false"] .eyes-open { display: none; }

.inflatable[aria-pressed="true"] .sway { animation: sway 3.4s ease-in-out infinite; }
@keyframes sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* "Not this time" wiggle when a tap could not reach the plug. */
.inflatable.nope { animation: nope .45s ease; }
@keyframes nope {
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(3px); }
}

body.offline .inflatable { filter: grayscale(.35) brightness(.9); }
body.offline .yard { padding-top: max(88px, env(safe-area-inset-top)); }

.note {
  position: fixed;
  z-index: 2;
  left: 50%;
  top: max(20px, env(safe-area-inset-top));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--note-bg);
  color: var(--note-ink);
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

@media (prefers-reduced-motion: reduce) {
  .snow, .snow::after, .inflatable[aria-pressed="true"] .sway { animation: none; }
}
