:root {
  color-scheme: dark;
  --air: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #081018;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.scene {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background: #081018;
}

.scene-plate {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
  user-select: none;
}

.scene-plate-state {
  opacity: 0;
  transition:
    opacity 720ms ease,
    filter 720ms ease;
}

.scene[data-scene-state="warmth"] .scene-plate[data-state-plate="warmth"],
.scene[data-scene-state="whiteout"] .scene-plate[data-state-plate="whiteout"] {
  opacity: 1;
}

.scene::before,
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene::before {
  z-index: 2;
  background:
    radial-gradient(circle at 55% 43%, rgba(255, 190, 93, 0.16), transparent 13rem),
    radial-gradient(ellipse at 50% 72%, transparent 0 21rem, rgba(1, 5, 10, 0.52) 43rem),
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 34%, transparent 66%, rgba(0, 0, 0, 0.34));
  mix-blend-mode: screen;
  opacity: 0.72;
  transition: opacity 620ms ease, background 620ms ease;
}

.scene::after {
  z-index: 5;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 6px),
    radial-gradient(circle at 50% 49%, transparent 34%, rgba(0, 0, 0, 0.48));
  mix-blend-mode: soft-light;
  opacity: 0.42;
  transition: opacity 620ms ease, background 620ms ease;
}

.scene[data-scene-state="warmth"]::before {
  background:
    radial-gradient(circle at 55% 45%, rgba(255, 177, 60, 0.64), transparent 12rem),
    radial-gradient(ellipse at 52% 59%, rgba(255, 139, 31, 0.3), transparent 20rem),
    radial-gradient(ellipse at 50% 74%, transparent 0 24rem, rgba(1, 5, 9, 0.46) 45rem),
    linear-gradient(90deg, rgba(0, 0, 0, 0.24), transparent 33%, transparent 68%, rgba(0, 0, 0, 0.26));
  opacity: 0.96;
}

.scene[data-scene-state="warmth"]::after {
  background:
    radial-gradient(ellipse at 53% 53%, rgba(255, 183, 84, 0.22), transparent 23rem),
    radial-gradient(circle at 50% 49%, transparent 34%, rgba(0, 0, 0, 0.32));
  opacity: 0.62;
}

.scene[data-scene-state="whiteout"]::before {
  background:
    linear-gradient(135deg, rgba(239, 248, 255, 0.32), rgba(148, 184, 209, 0.2) 42%, rgba(6, 17, 26, 0.24)),
    radial-gradient(ellipse at 50% 76%, rgba(234, 245, 255, 0.18), transparent 22rem),
    linear-gradient(90deg, rgba(210, 231, 245, 0.18), transparent 31%, transparent 69%, rgba(207, 229, 243, 0.22));
  mix-blend-mode: screen;
  opacity: 0.82;
}

.scene[data-scene-state="whiteout"]::after {
  background:
    repeating-linear-gradient(112deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 8px),
    radial-gradient(circle at 50% 50%, transparent 20%, rgba(5, 15, 24, 0.22));
  opacity: 0.72;
}

.snow-canvas {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

.cottage-hit {
  position: absolute;
  z-index: 7;
  left: 33%;
  top: 39%;
  width: 39%;
  height: 17%;
  min-width: 150px;
  min-height: 108px;
  border: 0;
  border-radius: 44% 48% 38% 40%;
  padding: 0;
  cursor: pointer;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.cottage-hit:focus-visible {
  outline: 2px solid rgba(255, 225, 150, 0.86);
  outline-offset: 6px;
  box-shadow: 0 0 0 10px rgba(255, 174, 73, 0.16);
}

.controls {
  position: absolute;
  z-index: 10;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(338px, calc(100vw - 28px));
  color: rgba(241, 248, 250, 0.92);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.42);
}

.control-tabs,
.control-panel {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.control-tab,
.mini-button {
  min-height: 42px;
  border: 1px solid rgba(226, 242, 248, 0.3);
  border-radius: 999px;
  color: rgba(241, 248, 250, 0.92);
  background: rgba(5, 12, 18, 0.38);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 18px 38px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition:
    transform 160ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.control-tab {
  min-width: 78px;
  padding: 0 17px;
  font-size: 12px;
}

.mini-button {
  min-width: 70px;
  padding: 0 13px;
  font-size: 11px;
}

.control-tab:active,
.mini-button:active {
  transform: translateY(1px) scale(0.98);
}

.control-tab[aria-expanded="true"],
.mini-button[aria-pressed="true"] {
  color: rgba(7, 14, 18, 0.96);
  border-color: rgba(245, 252, 255, 0.78);
  background: rgba(232, 246, 252, 0.86);
}

.scene[data-scene-state="warmth"] .control-tab[aria-expanded="true"],
.scene[data-scene-state="warmth"] .mini-button[aria-pressed="true"] {
  background: rgba(255, 203, 123, 0.9);
  border-color: rgba(255, 226, 161, 0.86);
}

.scene[data-scene-state="whiteout"] .control-tab[aria-expanded="true"],
.scene[data-scene-state="whiteout"] .mini-button[aria-pressed="true"] {
  background: rgba(232, 246, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.88);
}

.control-panel {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition:
    max-height 220ms ease,
    margin-top 220ms ease,
    opacity 180ms ease,
    transform 220ms ease;
}

.control-panel.is-open {
  max-height: 52px;
  margin-top: 8px;
  opacity: 1;
  transform: translateY(0);
}

.scene-status {
  display: block;
  margin: 9px 4px 0 auto;
  max-width: 270px;
  color: rgba(223, 239, 244, 0.86);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

@media (min-width: 760px) {
  .scene-plate {
    object-position: center 44%;
  }

  .controls {
    right: clamp(34px, 5vw, 72px);
    bottom: clamp(34px, 5vh, 62px);
  }

}

@media (max-width: 420px) {
  .controls {
    width: min(316px, calc(100vw - 24px));
  }

  .control-tabs,
  .control-panel {
    gap: 6px;
  }

  .control-tab {
    min-width: 72px;
    padding: 0 14px;
  }

  .mini-button {
    min-width: 64px;
    padding: 0 11px;
  }

  .scene-status {
    max-width: 245px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
