* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 20px 30px;
  background-color: #111;
  position: relative;
  z-index: 2;
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
}

main {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 2;
}

.light-page {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 74px - 61px);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.light-stage {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 74px - 61px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

/* OFF時の全体暗幕 */
.stage-dim {
  position: fixed;
  inset: 0;
  background: rgba(120, 120, 120, 0.18);
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* ON時は暗幕を消す */
.light-stage.on .stage-dim {
  opacity: 0;
}

/* 光 */
.page-light {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
  z-index: 0;
  background:
    radial-gradient(
      circle at 50% 36%,
      rgba(255, 228, 120, 0.36) 0%,
      rgba(255, 206, 70, 0.24) 14%,
      rgba(255, 180, 30, 0.14) 28%,
      rgba(255, 155, 0, 0.08) 42%,
      rgba(255, 140, 0, 0.03) 58%,
      rgba(0, 0, 0, 0) 82%
    );
}

.glow {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.glow-outer {
  width: 900px;
  height: 900px;
  background: radial-gradient(
    circle,
    rgba(255, 215, 70, 0.26) 0%,
    rgba(255, 190, 0, 0.12) 30%,
    rgba(0, 0, 0, 0) 72%
  );
  filter: blur(50px);
  opacity: 0;
}

.glow-inner {
  width: 380px;
  height: 380px;
  background: radial-gradient(
    circle,
    rgba(255, 244, 180, 0.70) 0%,
    rgba(255, 223, 110, 0.28) 48%,
    rgba(0, 0, 0, 0) 76%
  );
  filter: blur(18px);
  opacity: 0;
}

/* 電球 */
.bulb-wrap {
  position: relative;
  z-index: 2;
  margin-bottom: 36px;
}

.bulb {
  position: relative;
  width: 180px;
  height: 280px;
}

.bulb-top {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: #343447;
  border: 4px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.04);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease;
}

.filament {
  position: absolute;
  top: 108px;
  width: 4px;
  height: 58px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  transition: background 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
  z-index: 2;
}

.filament-left {
  left: 83px;
  transform: rotate(28deg);
}

.filament-right {
  left: 94px;
  transform: rotate(-28deg);
}

.base {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: background 0.35s ease;
}

.base-1 {
  top: 160px;
  width: 64px;
  height: 58px;
  border-radius: 0 0 12px 12px;
  background: #696969;
}

.base-2 {
  top: 214px;
  width: 54px;
  height: 18px;
  border-radius: 8px;
  background: #585858;
}

.base-3 {
  top: 228px;
  width: 48px;
  height: 18px;
  border-radius: 8px;
  background: #484848;
}

/* 割れ表現 */
.crack {
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  opacity: 0;
  z-index: 3;
  transition: opacity 0.2s ease;
}

.crack-1 {
  width: 3px;
  height: 70px;
  top: 28px;
  left: 92px;
  transform: rotate(28deg);
  border-radius: 2px;
}

.crack-2 {
  width: 3px;
  height: 58px;
  top: 52px;
  left: 78px;
  transform: rotate(-18deg);
  border-radius: 2px;
}

/* ON */
.light-stage.on .page-light,
.light-stage.on .glow-outer,
.light-stage.on .glow-inner {
  opacity: 1;
}

.light-stage.on .bulb-top {
  background: radial-gradient(
    circle at 42% 35%,
    #fff2a8 0%,
    #ffe46b 35%,
    #ffd741 65%,
    #efbd1b 100%
  );
  border-color: rgba(255, 234, 157, 0.95);
  box-shadow:
    inset 0 0 24px rgba(255, 248, 196, 0.45),
    0 0 30px rgba(255, 213, 63, 0.82),
    0 0 90px rgba(255, 188, 0, 0.28);
}

.light-stage.on .filament {
  background: rgba(255, 251, 226, 0.95);
  box-shadow: 0 0 10px rgba(255, 245, 200, 0.9);
}

.light-stage.on .base-1 {
  background: #d39a12;
}

.light-stage.on .base-2 {
  background: #b57e09;
}

.light-stage.on .base-3 {
  background: #986507;
}

/* 壊れ */
.bulb.broken .bulb-top {
  background: #2c2d3a !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.03) !important;
}

.bulb.broken .filament {
  background: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

.bulb.broken .filament-left {
  transform: rotate(12deg) translateY(8px);
}

.bulb.broken .filament-right {
  transform: rotate(-42deg) translateY(14px);
}

.bulb.broken .crack {
  opacity: 1;
}

/* 横向き物理スイッチ */
.wall-switch-wrap {
  position: relative;
  z-index: 2;
}

.switch-plate {
  width: 170px;
  height: 110px;
  background: linear-gradient(180deg, #e7e5db 0%, #d7d3c7 100%);
  border-radius: 14px;
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.5),
    0 10px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
}

.physical-switch {
  position: relative;
  width: 96px;
  height: 62px;
  border: none;
  background: linear-gradient(180deg, #f4f0e4 0%, #ddd7ca 100%);
  border-radius: 8px;
  cursor: pointer;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.65),
    inset 0 -4px 6px rgba(0, 0, 0, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.physical-switch .switch-inner {
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f9f7ef 0%, #ddd8cb 100%);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.7);
}

/* OFF: 左下が押されてる感じ */
.physical-switch.left {
  transform: perspective(140px) rotateY(16deg);
}

/* ON: 右下が押されてる感じ */
.physical-switch.right {
  transform: perspective(140px) rotateY(-16deg);
}

.light-message {
  position: relative;
  z-index: 2;
  margin-top: 18px;
  min-height: 22px;
  font-size: 0.95rem;
  color: #c9c9c9;
}

footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  background-color: rgba(17, 17, 17, 0.72);
  color: #ccc;
  backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  .light-page,
  .light-stage {
    min-height: calc(100vh - 70px - 58px);
  }

  .glow-outer {
    width: 640px;
    height: 640px;
  }

  .glow-inner {
    width: 280px;
    height: 280px;
  }

  .bulb {
    width: 150px;
    height: 240px;
  }

  .bulb-top {
    width: 150px;
    height: 150px;
  }

  .filament {
    top: 92px;
    height: 50px;
  }

  .filament-left {
    left: 69px;
  }

  .filament-right {
    left: 80px;
  }

  .base-1 {
    top: 135px;
    width: 54px;
    height: 52px;
  }

  .base-2 {
    top: 184px;
    width: 46px;
    height: 15px;
  }

  .base-3 {
    top: 197px;
    width: 40px;
    height: 15px;
  }

  .switch-plate {
    width: 148px;
    height: 96px;
  }

  .physical-switch {
    width: 86px;
    height: 56px;
  }
}