html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0c0c14;
}

/* =============================================
   SCENE LAYOUT
   ============================================= */
.switch-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 3rem;
  user-select: none;
}

.scene-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 50% at 50% 50%,
    rgba(68,170,255,0.07) 0%,
    transparent 70%);
  transition: opacity 0.15s ease;
}

/* =============================================
   SWITCH WRAPPER
   ============================================= */
.switch-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 160px;
}

/* =============================================
   PCB / BASE
   ============================================= */
.pcb {
  position: relative;
  width: 200px;
  height: 28px;
  background: linear-gradient(180deg, #1a3a1a 0%, #0e2810 100%);
  border-radius: 6px;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.07);
  overflow: hidden;
}

.pcb-trace {
  position: absolute;
  height: 1px;
  background: rgba(255,220,80,0.25);
}
.pcb-trace--1 { top: 9px;  left: 20px; right: 20px; }
.pcb-trace--2 { top: 18px; left: 35px; right: 35px; }

.pcb-pin {
  position: absolute;
  bottom: 4px;
  width: 8px;
  height: 10px;
  background: #c8a84b;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.pcb-pin--l { left: 58px; }
.pcb-pin--r { right: 58px; }

/* =============================================
   HOUSING
   ============================================= */
.housing {
  position: relative;
  width: 120px;
  height: 80px;
  background: rgba(200,220,255,0.08);
  border: 1.5px solid rgba(200,220,255,0.22);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  backdrop-filter: blur(4px);
  overflow: hidden;
  /* housing sits above the PCB */
  margin-bottom: -2px;
}

/* Spring */
.spring {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 50px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 4px,
    rgba(200,200,200,0.18) 4px, rgba(200,200,200,0.18) 6px
  );
  border-radius: 2px;
  transition: height 0.08s ease, opacity 0.08s ease;
}

/* LED window (light diffuser) */
.led-window {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 14px;
  background: rgba(68,170,255,0.15);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(68,170,255,0.2);
  transition: background 0.1s ease, box-shadow 0.1s ease;
}

/* =============================================
   KEYCAP
   ============================================= */
.keycap {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 160px;
  height: 90px;
  background: linear-gradient(160deg, #48485e 0%, #2e2e42 60%, #1e1e2e 100%);
  border: none;
  border-radius: 10px 10px 6px 6px;
  cursor: pointer;
  outline: none;

  /* 3-D depth via layered box-shadow */
  box-shadow:
    /* keycap sides (the 3-D face visible at bottom) */
    0 10px 0 0 #1a1a28,
    0 13px 0 0 #111118,
    /* switch housing visible just below keycap */
    0 18px 0 0 rgba(200,220,255,0.10),
    0 20px 0 0 rgba(200,220,255,0.06),
    /* ambient drop shadow */
    0 22px 36px rgba(0,0,0,0.75),
    /* top highlight */
    inset 0 1px 0 rgba(255,255,255,0.13),
    inset 0 -1px 0 rgba(0,0,0,0.35);

  transition: transform 0.06s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.06s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* LED backlight glow on edges */
  text-shadow: none;
  color: #d0d0e0;
}

/* Pressed state */
.keycap.pressed {
  transform: translateY(9px);
  box-shadow:
    0 1px 0 0 #1a1a28,
    0 3px 0 0 #111118,
    /* housing still visible */
    0 7px 0 0 rgba(200,220,255,0.10),
    0 9px 0 0 rgba(200,220,255,0.06),
    /* compressed shadow */
    0 10px 14px rgba(0,0,0,0.9),
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 -1px 0 rgba(0,0,0,0.45),
    /* Backlit bleed around keycap edge */
    0 0 18px rgba(68,170,255,0.35);
}

.keycap:focus-visible {
  outline: 2px solid rgba(68,170,255,0.6);
  outline-offset: 4px;
}

/* Legend text */
.keycap-legend {
  font-size: 2rem;
  line-height: 1;
  transition: transform 0.06s ease;
}

.keycap-sub {
  font-family: 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(200,200,220,0.5);
  text-transform: uppercase;
}

/* =============================================
   LED & SPRING ACTIVE STATES
   ============================================= */
.housing.active .led-window {
  background: rgba(68,170,255,0.6);
  box-shadow: 0 0 20px rgba(68,170,255,0.8), 0 0 40px rgba(68,170,255,0.4);
}

.housing.active .spring {
  height: 20px;
  opacity: 0.8;
}

/* =============================================
   COUNTER
   ============================================= */
.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  opacity: 0.7;
}

.counter-value {
  font-family: 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: rgba(68,170,255,0.9);
  line-height: 1;
  transition: transform 0.1s ease;
}

.counter-value.bump {
  transform: scale(1.3);
}

.counter-label {
  font-family: 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}

/* =============================================
   HINT
   ============================================= */
.hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
}

.hint-text {
  display: inline-block;
  padding: 0.4rem 1.1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  font-family: 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  animation: hintFade 3.5s ease 1.5s forwards;
  opacity: 1;
}

@keyframes hintFade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Ripple effect on press */
@keyframes rippleOut {
  0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(3);   opacity: 0; }
}

.ripple {
  position: fixed;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(68,170,255,0.5);
  border-radius: 50%;
  pointer-events: none;
  animation: rippleOut 0.55s ease-out forwards;
  z-index: 5;
}
