*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Roboto, Arial, Helvetica, sans-serif;
  background: linear-gradient(160deg, #f5f7fa 0%, #e8ecf1 100%);
  color: #222;
}

.app {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.app.has-power-dock {
  padding-left: 200px;
}

.hidden {
  display: none !important;
}

/* —— Gate screen —— */
.gate {
  text-align: center;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 0 48px;
}

.start-panel {
  margin: 10px auto 18px;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.start-panel.hidden {
  display: none !important;
}

.start-panel-text {
  margin: 0 0 10px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #3c4043;
}

.start-panel-btn {
  border: none;
  border-radius: 4px;
  background: #1a73e8;
  color: #fff;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.start-panel-btn:hover {
  background: #1558b0;
}

.section-power .section-tag {
  font-family: Roboto, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a73e8;
}

.verification-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flow-node.hidden,
#flow-node-captcha.hidden {
  display: none !important;
}

.section-chat:not(.hidden) {
  width: 100%;
  justify-content: center;
}

.flow-node.is-powered .g-recaptcha,
.flow-node.is-powered.level-panel {
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.25), 0 0 18px rgba(100, 200, 255, 0.2);
}

.flow-node.is-powered.level-wheel.rustic-panel {
  box-shadow:
    0 0 0 2px rgba(201, 162, 101, 0.45),
    0 0 22px rgba(255, 200, 100, 0.25),
    0 6px 20px rgba(30, 18, 8, 0.45);
}

.system-power-panel {
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  top: 50%;
  z-index: 50;
  width: 168px;
  margin: 0;
  padding: 14px 12px;
  background: #f9f9f9;
  border: 1px solid #d3d3d3;
  border-radius: 3px;
  box-shadow:
    0 0 4px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.06);
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-12px) scale(0.96);
  transition:
    opacity 0.45s ease,
    transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.system-power-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0) scale(1);
}

.system-power-track {
  height: 16px;
  background: #e8e0c8;
  border: 1px solid #c9b87a;
}

.system-power-fill {
  background: #f4c430;
  box-shadow: inset 0 1px 0 rgba(255, 248, 200, 0.6);
  transition: width 0.15s linear;
  animation: power-pulse 1.4s ease-in-out infinite;
}

.system-power-track.is-full .system-power-fill {
  background: #ffd54f;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 200, 0.8),
    0 0 12px rgba(255, 213, 79, 0.65);
  animation: power-pulse-full 1s ease-in-out infinite;
}

@keyframes power-pulse {
  0%,
  100% {
    filter: brightness(1);
    box-shadow: inset 0 1px 0 rgba(255, 248, 200, 0.5);
  }
  50% {
    filter: brightness(1.15);
    box-shadow:
      inset 0 1px 0 rgba(255, 248, 220, 0.9),
      0 0 8px rgba(255, 200, 50, 0.5);
  }
}

@keyframes power-pulse-full {
  0%,
  100% {
    filter: brightness(1.05);
  }
  50% {
    filter: brightness(1.25);
  }
}

.system-power-panel .progress-header {
  flex-wrap: wrap;
  gap: 4px;
}

.system-power-panel .progress-label {
  font-size: 0.72rem;
  line-height: 1.2;
}

.system-power-panel .progress-percent {
  font-size: 0.85rem;
}

.system-power-rate {
  margin: 8px 0 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: #5f6368;
}

@media (max-width: 720px) {
  .app.has-power-dock {
    padding-left: 24px;
  }

  .system-power-panel {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    width: 152px;
    transform: translateX(-12px) scale(0.96);
  }

  .system-power-panel.is-visible {
    transform: translateX(0) scale(1);
  }
}

/* —— Power pipes —— */
.power-pipe {
  position: relative;
  width: 36px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0 auto;
  transition:
    max-height 0.75s cubic-bezier(0.2, 0.9, 0.3, 1),
    opacity 0.35s ease,
    margin 0.5s ease;
}

.power-pipe.is-live {
  max-height: 88px;
  opacity: 1;
  margin: 4px auto;
}

.pipe-flange {
  width: 44px;
  height: 8px;
  margin-left: -4px;
  background: linear-gradient(180deg, #8a8a8a, #5a5a5a);
  border: 2px solid #444;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.pipe-shaft {
  position: relative;
  width: 28px;
  height: 56px;
  margin: 0 auto;
}

.pipe-metal {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, #4a4a4a 0%, #7a7a7a 35%, #9a9a9a 50%, #7a7a7a 65%, #4a4a4a 100%);
  border: 2px solid #3a3a3a;
  box-shadow:
    inset 2px 0 4px rgba(0, 0, 0, 0.35),
    inset -2px 0 4px rgba(255, 255, 255, 0.08);
}

.pipe-electricity {
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  opacity: 0;
  overflow: hidden;
  background: #1a2a3a;
  transition: opacity 0.4s ease 0.35s;
}

.power-pipe.is-charged .pipe-electricity {
  opacity: 1;
}

.pipe-electricity::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 140%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(80, 180, 255, 0.2) 20%,
    rgba(120, 220, 255, 0.95) 42%,
    #fff9c4 50%,
    rgba(120, 220, 255, 0.95) 58%,
    rgba(80, 180, 255, 0.2) 80%,
    transparent 100%
  );
  animation: electricity-flow 0.55s linear infinite;
  filter: drop-shadow(0 0 6px rgba(100, 200, 255, 0.9));
}

.pipe-electricity-2::before {
  animation-duration: 0.38s;
  animation-delay: 0.12s;
  opacity: 0.85;
}

.power-pipe.is-charged .pipe-flange {
  box-shadow:
    0 0 8px rgba(100, 200, 255, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.25);
}

.power-pipe.is-charged .pipe-flange-bottom {
  animation: flange-pulse 1.2s ease-in-out infinite;
}

@keyframes electricity-flow {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(60%);
  }
}

@keyframes flange-pulse {
  0%,
  100% {
    box-shadow: 0 0 6px rgba(100, 200, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 14px rgba(150, 230, 255, 0.85);
  }
}

.gate-title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 500;
}

.gate-sub {
  margin: 0 0 28px;
  color: #5f6368;
  font-size: 0.95rem;
}

/* —— reCAPTCHA widget (v2 checkbox style) —— */
.g-recaptcha {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 304px;
  min-height: 74px;
  padding: 0 12px 0 10px;
  background: #f9f9f9;
  border: 1px solid #d3d3d3;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
  user-select: none;
}

.recaptcha-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.recaptcha-checkbox-anchor {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.recaptcha-checkbox-anchor:disabled {
  cursor: default;
}

.recaptcha-checkbox-anchor:not(:disabled):hover .recaptcha-checkbox-border {
  border-color: #b2b2b2;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.recaptcha-checkbox-border {
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid #c1c1c1;
  border-radius: 2px;
  background: #fff;
  transition:
    background 0.25s ease,
    border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.recaptcha-checkbox-borderAnimation {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(66, 133, 244, 0.15), transparent);
  animation: recaptcha-shimmer 1.2s ease-in-out infinite;
}

.g-recaptcha.is-checking .recaptcha-checkbox-borderAnimation {
  display: block;
}

.g-recaptcha.is-checked .recaptcha-checkbox-border {
  background: #f9fff9;
  border-color: #00a040;
}

.g-recaptcha.is-checked .recaptcha-checkbox-anchor {
  cursor: default;
}

/* Spinner (multi-color swirl) */
.recaptcha-checkbox-spinner {
  position: absolute;
  inset: 2px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.g-recaptcha.is-checking .recaptcha-checkbox-spinner {
  display: flex;
}

.recaptcha-spinner-svg {
  width: 22px;
  height: 22px;
  animation: recaptcha-spin 1.1s linear infinite;
}

.recaptcha-spinner-arc {
  stroke-linecap: round;
  stroke-dasharray: 28 100;
  transform-origin: 25px 25px;
}

.arc-blue {
  stroke: #4285f4;
  animation: recaptcha-arc-pulse 1.1s ease-in-out infinite;
}

.arc-red {
  stroke: #ea4335;
  transform: rotate(90deg);
  animation: recaptcha-arc-pulse 1.1s ease-in-out 0.15s infinite;
}

.arc-yellow {
  stroke: #fbbc04;
  transform: rotate(180deg);
  animation: recaptcha-arc-pulse 1.1s ease-in-out 0.3s infinite;
}

.arc-green {
  stroke: #34a853;
  transform: rotate(270deg);
  animation: recaptcha-arc-pulse 1.1s ease-in-out 0.45s infinite;
}

@keyframes recaptcha-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes recaptcha-arc-pulse {
  0%,
  100% {
    stroke-dasharray: 8 100;
    opacity: 0.5;
  }
  50% {
    stroke-dasharray: 32 100;
    opacity: 1;
  }
}

@keyframes recaptcha-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Checkmark */
.recaptcha-checkbox-checkmark {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.g-recaptcha.is-checked .recaptcha-checkbox-checkmark {
  display: flex;
  animation: recaptcha-check-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
}

.recaptcha-checkbox-checkmark svg {
  width: 20px;
  height: 20px;
}

.recaptcha-checkbox-checkmark path {
  fill: #00a040;
}

@keyframes recaptcha-check-pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.recaptcha-checkbox-label {
  font-size: 14px;
  line-height: 1.4;
  color: #000;
  cursor: pointer;
  white-space: nowrap;
}

.g-recaptcha.is-checking .recaptcha-checkbox-label,
.g-recaptcha.is-checked .recaptcha-checkbox-label {
  cursor: default;
}

/* Branding */
.recaptcha-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  padding-left: 8px;
}

.recaptcha-logo svg {
  display: block;
}

.recaptcha-terms {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2px;
  font-size: 8px;
  color: #555;
  line-height: 1.2;
}

.recaptcha-terms-links a {
  color: #555;
  text-decoration: none;
}

.recaptcha-terms-links a:hover {
  text-decoration: underline;
}

/* —— Level panels (shared theme) —— */
.levels-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 0;
  width: 100%;
}

.level-panel {
  width: 304px;
  padding: 16px;
  background: #f9f9f9;
  border: 1px solid #d3d3d3;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.45s ease,
    transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.level-pump {
  transform: translateX(-120%);
}

.level-pump.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.level-pump.is-done {
  opacity: 1;
  pointer-events: none;
}

.level-pump.is-done .pump-btn {
  opacity: 0.5;
}

.level-pump.is-done::after {
  content: "✓ Complete";
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #00a040;
}

.level-badge {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1a73e8;
}

.level-hint {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: #5f6368;
}

.progress-panel {
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: #333;
}

.progress-percent {
  font-weight: 700;
  color: #1a73e8;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 14px;
  background: #e8e8e8;
  border: 1px solid #d3d3d3;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(
    90deg,
    #4285f4 0%,
    #ea4335 33%,
    #fbbc04 66%,
    #34a853 100%
  );
  transition: width 0.12s ease-out;
}

.pump-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px 10px;
  border: 2px solid #c1c1c1;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.08s ease;
}

.pump-btn:hover:not(:disabled) {
  border-color: #b2b2b2;
  background: #fafafa;
}

.pump-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.pump-btn.is-pumping .pump-handle {
  transform: translateY(14px);
}

.pump-btn.is-pumping .pump-rod {
  height: 8px;
}

.pump-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
  height: 52px;
}

.pump-base {
  position: absolute;
  bottom: 0;
  width: 44px;
  height: 10px;
  background: #e0e0e0;
  border: 2px solid #c1c1c1;
  border-radius: 2px;
}

.pump-rod {
  position: absolute;
  bottom: 10px;
  width: 6px;
  height: 22px;
  background: #9e9e9e;
  border-radius: 2px;
  transition: height 0.1s ease;
}

.pump-handle {
  position: absolute;
  top: 0;
  width: 28px;
  height: 14px;
  background: #4285f4;
  border: 2px solid #1a73e8;
  border-radius: 3px;
  transition: transform 0.1s ease;
}

.pump-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1a73e8;
}

/* —— Level 4: rustic momentum spinner —— */
.level-wheel {
  transform: translateX(120%);
}

.level-wheel.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* —— Level 5 & 6: horror / retro —— */
.level-generator,
.level-power {
  transform: translateX(120%);
  width: 320px;
}

.level-generator.is-visible,
.level-power.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.horror-panel {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 0, 0, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, #0d0808 0%, #1a0a0a 45%, #0a0505 100%);
  border: 2px solid #4a1515;
  color: #c9a0a0;
  box-shadow:
    0 0 24px rgba(120, 0, 0, 0.35),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.horror-badge {
  font-family: Creepster, Rye, serif;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: #ff4444 !important;
  text-shadow: 0 0 12px rgba(255, 40, 40, 0.6);
  text-transform: none;
}

.level-4-hint,
.level-generator .level-4-hint,
.level-5-hint {
  color: #8a6060;
  font-style: italic;
}

.horror-generator {
  position: relative;
  display: block;
  width: 100%;
  text-align: center;
  padding: 16px 12px;
  margin-top: 8px;
  border: 1px solid #3a1010;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  font: inherit;
  color: inherit;
  cursor: default;
}

.horror-generator:disabled {
  opacity: 1;
  cursor: default;
}

.horror-generator.is-repair-ready {
  cursor: pointer;
  border-color: #8b2020;
  box-shadow: 0 0 16px rgba(255, 40, 40, 0.35);
  animation: repair-pulse 1.5s ease-in-out infinite;
}

.horror-generator.is-repair-ready:hover {
  border-color: #cc3333;
}

@keyframes repair-pulse {
  50% {
    box-shadow: 0 0 22px rgba(255, 60, 60, 0.55);
  }
}

.horror-flicker {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 30, 30, 0.12) 0%, transparent 65%);
  animation: horror-flicker 3.5s ease-in-out infinite;
  pointer-events: none;
}

.level-generator.is-generator-dead .horror-flicker {
  animation: horror-flicker-dead 1.2s ease-in-out infinite;
  background: radial-gradient(circle at 50% 40%, rgba(80, 0, 0, 0.2) 0%, transparent 70%);
}

@keyframes horror-flicker {
  0%,
  100% {
    opacity: 0.5;
  }
  40% {
    opacity: 1;
  }
  42% {
    opacity: 0.3;
  }
  55% {
    opacity: 0.85;
  }
}

@keyframes horror-flicker-dead {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.4;
  }
}

.generator-visual {
  position: relative;
  width: 110px;
  height: 80px;
  margin: 0 auto 12px;
  z-index: 1;
}

.generator-visual.is-running .gen-coil {
  animation: gen-spin 1.2s linear infinite;
}

.generator-visual.is-running .gen-pulse {
  animation: gen-heartbeat 1.8s ease-in-out infinite;
}

.generator-visual.is-broken .gen-coil {
  animation: none;
  opacity: 0.2;
  filter: grayscale(0.8);
}

.generator-visual.is-broken .gen-pulse {
  display: none;
}

.generator-visual.is-broken .gen-core {
  background: #1a0505;
  border-color: #330000;
  box-shadow: 0 0 8px rgba(80, 0, 0, 0.8);
}

.gen-coil {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  border: 4px solid #3a1010;
  border-radius: 50%;
  border-top-color: #cc2222;
  box-shadow: 0 0 14px rgba(200, 30, 30, 0.5);
}

.gen-coil.coil-2 {
  width: 40px;
  height: 40px;
  margin-left: -20px;
  top: 16px;
  border-width: 3px;
  animation-direction: reverse;
  border-top-color: #ff5555;
}

.gen-core {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 40px;
  height: 20px;
  margin-left: -20px;
  background: #2a0808;
  border: 2px solid #8b1a1a;
  border-radius: 2px;
  box-shadow:
    0 0 16px rgba(200, 40, 40, 0.55),
    inset 0 0 8px rgba(255, 80, 80, 0.2);
}

.gen-pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  border-radius: 50%;
  border: 1px solid rgba(255, 50, 50, 0.25);
  pointer-events: none;
}

@keyframes gen-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes gen-heartbeat {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.7;
  }
}

.generator-status {
  margin: 0;
  font-family: Creepster, serif;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  z-index: 1;
  position: relative;
}

.generator-status.is-online {
  color: #ff5555;
  text-shadow: 0 0 10px rgba(255, 60, 60, 0.7);
  animation: status-pulse 2s ease-in-out infinite;
}

.generator-status.is-broken {
  color: #662222;
  text-shadow: none;
  animation: none;
}

@keyframes status-pulse {
  50% {
    opacity: 0.75;
  }
}

.generator-uptime {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #6a4545;
  z-index: 1;
  position: relative;
}

.horror-wire-task {
  margin-top: 14px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(40, 0, 0, 0.5) 0%, rgba(10, 0, 0, 0.8) 100%);
  border: 2px solid #5a1010;
  border-radius: 4px;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(120, 0, 0, 0.25);
  animation: wire-task-shudder 4s ease-in-out infinite;
}

@keyframes wire-task-shudder {
  0%,
  96%,
  100% {
    transform: translateX(0);
  }
  97% {
    transform: translateX(-2px);
  }
  98% {
    transform: translateX(2px);
  }
}

.wire-task-title {
  margin: 0 0 4px;
  font-family: Creepster, serif;
  font-weight: 400;
  font-size: 1.1rem;
  color: #ff3333;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

.wire-task-hint {
  margin: 0 0 12px;
  font-size: 0.75rem;
  color: #7a5050;
  font-style: italic;
}

.wire-board-wrap {
  position: relative;
  min-height: 180px;
  margin-bottom: 4px;
}

.wire-board-wrap.is-dragging-wire {
  cursor: crosshair;
}

.wire-lines-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.wire-line-cursor {
  opacity: 0.92;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.35));
}

.wire-line-fixed {
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

.wire-board {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 180px;
  pointer-events: none;
}

.wire-column {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 10px;
  pointer-events: auto;
}

.wire-port {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid #1a0505;
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.6),
    0 0 10px rgba(0, 0, 0, 0.8);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.wire-port:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.6),
    0 0 14px rgba(255, 40, 40, 0.45);
}

.wire-port.is-dragging {
  transform: scale(1.12);
  box-shadow:
    0 0 0 2px #ffaaaa,
    0 0 18px rgba(255, 60, 60, 0.9);
}

.wire-port.is-connected {
  opacity: 0.35;
  cursor: default;
  filter: brightness(0.6);
}

.wire-port.wire-red {
  background: #6b0f0f;
  box-shadow: inset 0 0 8px #ff2222, 0 0 8px rgba(255, 0, 0, 0.35);
}

.wire-port.wire-blue {
  background: #0f1448;
  box-shadow: inset 0 0 8px #4466ff, 0 0 8px rgba(80, 100, 255, 0.35);
}

.wire-port.wire-yellow {
  background: #4a3a08;
  box-shadow: inset 0 0 8px #cc9900, 0 0 8px rgba(200, 150, 0, 0.35);
}

.wire-port.wire-pink {
  background: #4a0838;
  box-shadow: inset 0 0 8px #ff44aa, 0 0 8px rgba(255, 50, 150, 0.35);
}

.wire-progress {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #8a5555;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Level 5 — Windows 95 retro */
.retro-panel {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #808080 #808080 #dfdfdf;
  color: #000;
  box-shadow: 2px 2px 0 #404040;
}

.retro-badge {
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #000080 !important;
  text-shadow: none;
  text-transform: none;
}

.level-5-hint {
  color: #222;
  font-style: normal;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 0.8rem;
}

.retro-power-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 18px 0 10px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  margin-top: 10px;
  overflow: visible;
}

.power-float-particle {
  position: absolute;
  z-index: 20;
  margin: 0;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #006000;
  text-shadow: 0 1px 0 #b8ffb8;
  pointer-events: none;
  white-space: nowrap;
  transform: translateX(-50%);
  animation: power-float-up 0.85s ease-out forwards;
}

@keyframes power-float-up {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translateX(calc(-50% + var(--drift, 0px))) translateY(-8px) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translateX(calc(-50% + var(--drift, 0px))) translateY(-52px) scale(1.1);
  }
}

.win95-power-btn {
  min-width: 140px;
  min-height: 52px;
  padding: 10px 28px;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #000;
  cursor: pointer;
  background: #00a000;
  border: 2px solid;
  border-color: #5cd65c #006000 #006000 #5cd65c;
  box-shadow: 1px 1px 0 #003000;
}

.win95-power-btn:hover {
  background: #00b000;
}

.win95-power-btn:active,
.win95-power-btn.is-pressed {
  border-color: #006000 #5cd65c #5cd65c #006000;
  padding: 11px 27px 9px 29px;
  background: #008000;
}

.level-wheel.rustic-panel {
  width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 235, 200, 0.08) 0%, transparent 40%),
    repeating-linear-gradient(
      92deg,
      #5c4033 0px,
      #6b4e3a 3px,
      #4a3426 6px,
      #5c4033 9px
    );
  border: 4px double #c9a227;
  border-radius: 6px;
  box-shadow:
    0 6px 20px rgba(30, 18, 8, 0.45),
    inset 0 1px 0 rgba(255, 220, 160, 0.25);
  color: #f4e8d0;
}

.level-wheel .rustic-badge {
  font-family: Rye, Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: #f0d9a8;
  text-shadow: 1px 1px 0 #2a1810;
}

.level-wheel .rustic-hint {
  color: #d4c4a8;
  font-style: italic;
}

.level-wheel .progress-label,
.level-wheel .progress-percent,
.level-wheel .progress-header {
  color: #f0e2c8;
}

.level-wheel .rustic-progress .progress-track {
  background: #2a1810;
  border: 2px solid #8b6914;
  border-radius: 4px;
  height: 16px;
}

.level-wheel .rustic-progress .progress-fill {
  background: linear-gradient(90deg, #8b4513 0%, #c9a227 50%, #daa520 100%);
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, 0.4);
}

.spinner-hud {
  text-align: center;
  margin-bottom: 14px;
}

.level-wheel .rustic-gauge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 20px 8px;
  background: radial-gradient(circle at 50% 30%, #fff8e7 0%, #e8d4b0 70%, #c4a574 100%);
  border: 3px solid #5c4033;
  border-radius: 8px;
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.5),
    0 3px 0 #3e2723,
    0 5px 12px rgba(0, 0, 0, 0.35);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.level-wheel .rustic-gauge.is-in-zone {
  border-color: #2e7d32;
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.5),
    0 0 16px rgba(76, 175, 80, 0.5),
    0 3px 0 #1b5e20;
}

.level-wheel .rustic-gauge.is-too-slow {
  border-color: #b8860b;
}

.level-wheel .rustic-gauge.is-too-fast {
  border-color: #8b2500;
}

.level-wheel .mph-value {
  font-family: Rye, Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: #3e2723;
  line-height: 1;
}

.level-wheel .rustic-gauge.is-in-zone .mph-value {
  color: #1b5e20;
}

.level-wheel .rustic-gauge.is-too-fast .mph-value {
  color: #8b2500;
}

.level-wheel .mph-unit {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #5c4033;
  letter-spacing: 0.08em;
}

.level-wheel .mph-target {
  margin: 10px 0 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.82rem;
  color: #e8d4b0;
}

.spinner-progress {
  margin-bottom: 16px;
}

.spinner-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 6px;
  touch-action: none;
  user-select: none;
}

.spinner-zone-ring {
  position: absolute;
  width: 204px;
  height: 204px;
  border-radius: 50%;
  border: 3px dashed #8b6914;
  opacity: 0.45;
  transition:
    opacity 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
  pointer-events: none;
}

.spinner-zone-ring.is-active {
  opacity: 1;
  border-color: #c9e265;
  border-style: solid;
  box-shadow: 0 0 22px rgba(201, 226, 101, 0.45);
  animation: zone-ring-pulse 1.4s ease-in-out infinite;
}

@keyframes zone-ring-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

.spinner-wheel {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a67c52 0%, #6b4423 55%, #4a2f18 100%);
  border: 6px solid #8b7355;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.5),
    inset 0 3px 10px rgba(255, 220, 170, 0.2),
    inset 0 -4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  touch-action: none;
  z-index: 1;
}

.spinner-wheel.is-grabbing {
  border-color: #c9a227;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.45),
    inset 0 3px 10px rgba(255, 220, 170, 0.15);
}

.spinner-wheel.is-spinning-fast {
  border-color: #8b2500;
}

.spinner-wheel-face {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: conic-gradient(
    from -22deg,
    #7a5230 0deg 45deg,
    #5c3d24 45deg 90deg,
    #8b5a2b 90deg 135deg,
    #4a3018 135deg 180deg,
    #6b4423 180deg 225deg,
    #5c3d24 225deg 270deg,
    #8b5a2b 270deg 315deg,
    #7a5230 315deg 360deg
  );
  box-shadow:
    inset 0 0 0 3px rgba(201, 162, 101, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.35);
  will-change: transform;
}

.spinner-spoke {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 46%;
  margin-left: -3px;
  margin-top: -46%;
  background: linear-gradient(180deg, #d4af37 0%, #8b6914 100%);
  border-radius: 2px;
  box-shadow: 1px 0 2px rgba(0, 0, 0, 0.4);
  transform-origin: 50% 100%;
}

.spinner-spoke:nth-child(1) {
  transform: rotate(0deg);
}

.spinner-spoke:nth-child(2) {
  transform: rotate(90deg);
}

.spinner-spoke:nth-child(3) {
  transform: rotate(180deg);
}

.spinner-spoke:nth-child(4) {
  transform: rotate(270deg);
}

.spinner-grab {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: 0;
  margin-left: -16px;
  padding: 0;
  background: radial-gradient(circle at 35% 30%, #f0d060 0%, #b8860b 55%, #8b6914 100%);
  border: 3px solid #5c4033;
  border-radius: 50%;
  box-shadow:
    0 3px 0 #3e2723,
    0 5px 8px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  z-index: 6;
}

.spinner-grab.is-grabbing {
  cursor: grabbing;
  transform: scale(1.08);
  box-shadow:
    0 2px 0 #3e2723,
    0 0 12px rgba(255, 200, 80, 0.65);
}

.spinner-wheel::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  background: radial-gradient(circle at 40% 35%, #e8c878 0%, #8b6914 70%, #5c4033 100%);
  border: 3px solid #3e2723;
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 1px 2px rgba(255, 240, 200, 0.6);
}

.level-wheel .rustic-status {
  margin: 14px 0 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.88rem;
  font-style: italic;
  color: #f0e2c8;
  min-height: 1.2em;
  text-shadow: 1px 1px 0 #2a1810;
}

/* —— Win screen —— */
.win-screen {
  position: relative;
  text-align: center;
  max-width: 420px;
  padding: 40px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  animation: win-enter 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.1) forwards;
  overflow: hidden;
}

.win-level {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1a73e8;
}

.win-title {
  margin: 0 0 6px;
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: #00a040;
  animation: win-title-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.15s both;
}

.win-tagline {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 500;
  color: #333;
}

.win-message {
  margin: 0 0 28px;
  font-size: 0.95rem;
  color: #5f6368;
}

.win-replay {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 28px;
  border: none;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.win-replay:hover {
  background: #1557b0;
}

.win-replay:active {
  transform: scale(0.98);
}

.win-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, #4285f4 2px, transparent 2px),
    radial-gradient(circle, #ea4335 2px, transparent 2px),
    radial-gradient(circle, #fbbc04 2px, transparent 2px),
    radial-gradient(circle, #34a853 2px, transparent 2px);
  background-size: 80px 80px, 100px 100px, 90px 90px, 110px 110px;
  background-position: 10% 20%, 80% 30%, 50% 70%, 20% 80%;
  opacity: 0.35;
  animation: confetti-drift 4s linear infinite;
}

@keyframes win-enter {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes win-title-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes confetti-drift {
  to {
    background-position: 15% 25%, 75% 35%, 55% 65%, 25% 75%;
  }
}

/* —— Level picker (] key) —— */
.level-picker {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.level-picker.hidden {
  display: none !important;
}

.level-picker-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.level-picker-panel {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 20px 18px 16px;
  background: #fff;
  border: 2px solid #1a1a1a;
  border-radius: 12px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
  animation: level-picker-in 0.2s ease-out;
}

@keyframes level-picker-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.level-picker-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
}

.level-picker-hint {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: #5f6368;
  text-align: center;
}

.level-picker-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 4px;
}

.level-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.level-picker-btn {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  color: #1a1a1a;
  background: #f8f9fa;
  border: 2px solid #dadce0;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    transform 0.08s ease;
}

.level-picker-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.level-picker-btn:active {
  transform: scale(0.98);
}

.level-picker-btn[aria-current="true"] {
  background: #e8f0fe;
  border-color: #1a73e8;
  font-weight: 700;
}
