* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --depth: 5vmin;
  --on: 0;
  --size: 25vmin;
  --bg: hsl(calc(200 - (var(--on) * 160)), calc((20 + (var(--on) * 50)) * 1%), calc((20 + (var(--on) * 60)) * 1%));
  --cord: hsl(0, 0%, calc((60 - (var(--on) * 50)) * 1%));
  --stroke: hsl(0, 0%, calc((60 - (var(--on) * 50)) * 1%));
  --shine: hsla(0, 0%, 100%, calc(0.75 - (var(--on) * 0.5)));
  --cap: hsl(0, 0%, calc((40 + (var(--on) * 30)) * 1%));
  --filament: hsl(45, calc(var(--on) * 80%), calc((25 + (var(--on) * 75)) * 1%));
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
}

/* Fan Styles */
.fan-container {
  position: fixed;
  left: 50px;
  bottom: 50px;
  transform: scale(1.5);
  z-index: 2000;
}

.fan {
  height: 350px;
  width: 350px;
  position: relative;
}

.fan label {
  display: block;
  height: 20px;
  width: 20px;
  background-color: black;
  position: absolute;
  top: 120px;
  left: calc(50% - 10px);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  animation-play-state: paused;
  opacity: 1;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.fan label:after {
  content: "";
  position: absolute;
  height: 70px;
  width: 70px;
  background-color: #005fe4;
  border: 10px solid #00317e;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.fan label span {
  display: block;
  height: 120px;
  width: 70px;
  background-color: #fdbf00;
  border-radius: 55% 45% 100% 0% / 39% 28% 72% 61%;
  position: absolute;
  z-index: -1;
}

.fan label span:nth-child(1) {
  bottom: 10px;
  left: 10px;
}

.fan label span:nth-child(2) {
  transform: rotate(-120deg);
  left: -95px;
  top: -50px;
}

.fan label span:nth-child(3) {
  transform: rotate(-240deg);
  right: -60px;
  top: 10px;
}

.fan .base {
  height: 160px;
  width: 20px;
  background-color: #00317e;
  position: absolute;
  left: calc(50% - 10px);
  top: 140px;
  z-index: -1;
}

.fan .base:after {
  content: "";
  position: absolute;
  height: 35px;
  width: 150px;
  background-color: #fdbf00;
  left: -65px;
  top: 160px;
  border-radius: 20px 20px 0 0;
}

.fan input[type="checkbox"] {
  position: absolute;
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  width: 20px;
  background-color: #c30010;
  bottom: 50px;
  left: 165px;
  outline: none;
  cursor: pointer;
  border-radius: 5px 5px 0 0;
  z-index: 10;
}

.fan input[type="checkbox"]:checked {
  height: 8px;
}

.fan input[type="checkbox"]:checked + label {
  animation-play-state: running;
}

/* Temperature Display Box */
.temperature-box {
  position: fixed;
  top: 20px;
  right: 280px;
  background: linear-gradient(145deg, 
              hsl(210, calc((20 + (var(--on) * 30)) * 1%), calc((20 + (var(--on) * 25)) * 1%)),
              hsl(210, calc((30 + (var(--on) * 40)) * 1%), calc((10 + (var(--on) * 20)) * 1%)));
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5),
              inset 0 2px 4px rgba(255, 255, 255, 0.1);
  z-index: 1000;
  border: 2px solid hsl(210, calc((30 + (var(--on) * 20)) * 1%), calc((30 + (var(--on) * 30)) * 1%));
  transition: all 0.5s ease;
}

/* Humidity Display Box */
.humidity-box {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(145deg, 
              hsl(210, calc((20 + (var(--on) * 30)) * 1%), calc((20 + (var(--on) * 25)) * 1%)),
              hsl(210, calc((30 + (var(--on) * 40)) * 1%), calc((10 + (var(--on) * 20)) * 1%)));
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5),
              inset 0 2px 4px rgba(255, 255, 255, 0.1);
  z-index: 1000;
  border: 2px solid hsl(210, calc((30 + (var(--on) * 20)) * 1%), calc((30 + (var(--on) * 30)) * 1%));
  transition: all 0.5s ease;
}

.temp-label {
  text-align: center;
  color: hsl(200, calc((20 + (var(--on) * 60)) * 1%), calc((80 + (var(--on) * 20)) * 1%));
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 15px;
  text-shadow: 0 0 10px hsla(calc(200 - (var(--on) * 160)), calc((50 + (var(--on) * 30)) * 1%), 50%, 0.5);
  transition: all 0.5s ease;
}

.led-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: hsl(220, calc((30 + (var(--on) * 20)) * 1%), calc((5 + (var(--on) * 15)) * 1%));
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.8);
  transition: all 0.5s ease;
}

.digit {
  position: relative;
  width: 40px;
  height: 60px;
  display: inline-block;
}

.segment {
  position: absolute;
  background: hsl(0, 0%, calc((10 + (var(--on) * 5)) * 1%));
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.segment.active {
  background: hsl(calc(0 + (var(--on) * 30)), calc((80 + (var(--on) * 20)) * 1%), calc((50 + (var(--on) * 10)) * 1%));
  box-shadow: 0 0 10px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.8),
              0 0 20px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.6),
              inset 0 0 5px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.5);
}

/* Segment positions for 7-segment display */
.segment.a {
  top: 0;
  left: 8px;
  width: 24px;
  height: 4px;
  clip-path: polygon(15% 0%, 85% 0%, 100% 50%, 85% 100%, 15% 100%, 0% 50%);
}

.segment.b {
  top: 4px;
  right: 4px;
  width: 4px;
  height: 24px;
  clip-path: polygon(50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%, 0% 15%);
}

.segment.c {
  bottom: 4px;
  right: 4px;
  width: 4px;
  height: 24px;
  clip-path: polygon(50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%, 0% 15%);
}

.segment.d {
  bottom: 0;
  left: 8px;
  width: 24px;
  height: 4px;
  clip-path: polygon(15% 0%, 85% 0%, 100% 50%, 85% 100%, 15% 100%, 0% 50%);
}

.segment.e {
  bottom: 4px;
  left: 4px;
  width: 4px;
  height: 24px;
  clip-path: polygon(50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%, 0% 15%);
}

.segment.f {
  top: 4px;
  left: 4px;
  width: 4px;
  height: 24px;
  clip-path: polygon(50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%, 0% 15%);
}

.segment.g {
  top: 28px;
  left: 8px;
  width: 24px;
  height: 4px;
  clip-path: polygon(15% 0%, 85% 0%, 100% 50%, 85% 100%, 15% 100%, 0% 50%);
}

.degree-symbol {
  color: hsl(calc(0 + (var(--on) * 30)), calc((80 + (var(--on) * 20)) * 1%), calc((50 + (var(--on) * 10)) * 1%));
  font-size: 24px;
  font-weight: 700;
  font-family: 'Courier New', 'Consolas', monospace;
  margin-left: 5px;
  text-shadow: 0 0 10px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.8),
              0 0 20px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.6);
  transition: all 0.5s ease;
}

.celsius-symbol {
  color: hsl(calc(0 + (var(--on) * 30)), calc((80 + (var(--on) * 20)) * 1%), calc((50 + (var(--on) * 10)) * 1%));
  font-size: 32px;
  font-weight: 700;
  font-family: 'Courier New', 'Consolas', monospace;
  margin-left: 2px;
  text-shadow: 0 0 10px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.8),
              0 0 20px hsla(calc(0 + (var(--on) * 30)), 100%, 50%, 0.6);
  transition: all 0.5s ease;
  letter-spacing: -2px;
}

.toggle label {
  position: absolute;
  opacity: 0.5;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 2;
}

input {
  height: 0;
  width: 0;
  position: fixed;
  left: 100%;
  transform: scale(0);
}

.toggle {
  height: var(--size);
  width: var(--size);
  transform: translate(-50%, -100%);
  z-index: 2;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -100%, calc(var(--depth) * 3));
}

.toggle-scene {
  overflow: visible !important;
  width: 100%;
  position: absolute;
}

.toggle-scene__arm {
  display: none;
}

.toggle-scene__cord {
  stroke: var(--cord);
  cursor: move;
}

.toggle-scene__cord:nth-of-type(1) {
  display: none;
}

.toggle-scene__cord:nth-of-type(2),
.toggle-scene__cord:nth-of-type(3),
.toggle-scene__cord:nth-of-type(4),
.toggle-scene__cord:nth-of-type(5) {
  display: none;
}

.toggle-scene__cord-end {
  stroke: var(--cord);
  fill: var(--cord);
}

.toggle-scene__dummy-cord {
  stroke-width: 6;
  stroke: var(--cord);
}

.bulb__filament {
  stroke: var(--filament);
}

.bulb__shine {
  stroke: var(--shine);
}

.bulb__flash {
  stroke: #f5e0a3;
  display: none;
}

.bulb__bulb {
  stroke: var(--stroke);
  fill: hsla(calc(180 - (95 * var(--on))), 80%, 80%, calc(0.1 + (0.4 * var(--on))));
}

.bulb__cap {
  fill: var(--cap);
}

.bulb__cap-shine {
  fill: var(--shine);
}

.bulb__cap-outline {
  stroke: var(--stroke);
}

.bear {
  display: none;
}

.bear__fur {
  fill: #784421;
}

.bear__pad {
  fill: #deaa87;
}

.doorway {
  position: absolute;
  top: 50%;
  height: calc(var(--size) * 2.5);
  width: calc(var(--size) * 1.1);
  transform: translate(0, calc(var(--size) * -0.75 + 50px));
  left: calc(50% + (var(--size) * 0.5));
  -webkit-clip-path: inset(0 0 0 -200%);
  clip-path: inset(0 0 0 -200%);
  z-index: 2000;
}

.doorway__opening {
  height: 100%;
  width: 100%;
  position: absolute;
  background: #1a1a1a;
  transform: translate3d(0, 0, calc(var(--depth) * -1));
}

.bear {
  position: absolute;
  top: 10%;
  width: var(--size);
}

.door {
  --panel: hsl(30, 20%, calc(12% + (var(--on) * 40%)));
  height: 100%;
  position: absolute;
  width: 100%;
  transform-origin: 100% 50%;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
}

.door__panel {
  width: 30%;
  height: 35%;
  position: absolute;
  border: 1vmin var(--panel) solid;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translate(var(--x), var(--y));
}

.door__panel:nth-of-type(1) {
  --x: -70%;
  --y: -70%;
}

.door__panel:nth-of-type(2) {
  --x: 70%;
  --y: -70%;
}

.door__panel:nth-of-type(3) {
  --x: -70%;
  --y: 70%;
}

.door__panel:nth-of-type(4) {
  --x: 70%;
  --y: 70%;
}

.door__handle {
  height: 4vmin;
  width: 4vmin;
  position: absolute;
  left: 10%;
  top: 50%;
  transform: translate3d(0, -50%, 1vmin);
}

.door__handle > div {
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: hsl(45, 70%, calc((var(--lightness, 20%)) + (var(--on) * 40%)));
}

.door__handle > div:nth-of-type(1) {
  --lightness: 25%;
}

.door__handle > div:nth-of-type(2) {
  --lightness: 30%;
  transform: translate3d(0, 0, calc(var(--depth) * 1));
}

.door__side {
  position: absolute;
}

.door__side:nth-of-type(1) {
  --lightness: 20%;
  height: 100%;
  width: 100%;
  transform: translate3d(0, 0, 0);
  z-index: 3;
  background-color: hsl(30, 20%, calc((var(--lightness, 20%)) + (var(--on) * 40%)));
}

.door__side:nth-of-type(2) {
  --lightness: 10%;
  height: 100%;
  width: 100%;
  transform: translate3d(0, 0, calc(var(--depth) * -1));
}

.door__side {
  background-color: hsl(30, 20%, calc((var(--lightness, 20%)) + (var(--on) * 40%)));
}

/* Responsive fix for doorway position on large screens */
@media (min-height: 900px) {
  .doorway {
    top: auto;
    bottom: 50px;
    transform: none;
  }
}
