.switchboard-dice-shell {
  position: relative;
  min-height: clamp(460px, 62vw, 720px);
  margin-top: 18px;
  border: 1px solid rgba(247, 216, 92, 0.38);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 68%, rgba(247, 216, 92, 0.12), transparent 30%),
    linear-gradient(180deg, #11100b 0%, #080908 56%, #15100b 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 42px rgba(247, 216, 92, 0.08);
}

.switchboard-dice-shell[hidden] {
  display: none;
}

.switchboard-dice {
  position: absolute;
  inset: 0;
  user-select: none;
}

.switchboard-dice-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.switchboard-dice::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 245, 197, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 245, 197, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mix-blend-mode: screen;
  opacity: 0.5;
}

.switchboard-dice-hud {
  position: absolute;
  inset: 16px 18px auto;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: start;
  color: #fff5c5;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

.switchboard-dice-title {
  color: #f7d85c;
}

.switchboard-dice-branch,
.switchboard-dice-status {
  color: rgba(243, 240, 232, 0.76);
  text-align: right;
}

.switchboard-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: clamp(8px, 1.6vw, 16px);
  width: min(92%, 780px);
  min-height: 190px;
  padding: clamp(14px, 2vw, 22px);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 245, 197, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(47, 42, 30, 0.82), rgba(17, 18, 15, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 245, 197, 0.04) 0 1px, transparent 1px 18px);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.55), 0 24px 52px rgba(0, 0, 0, 0.34);
}

.switchboard-toggle {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 12px;
  min-height: 142px;
  padding: 12px 8px 10px;
  border-color: rgba(255, 245, 197, 0.18);
  border-radius: 6px;
  background: rgba(8, 9, 8, 0.7);
  color: rgba(243, 240, 232, 0.72);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.switchboard-toggle:hover,
.switchboard-toggle:focus-visible {
  border-color: var(--switch-color);
}

.switchboard-toggle.is-on {
  color: #fff8d8;
  border-color: color-mix(in srgb, var(--switch-color), white 18%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--switch-color), transparent 70%), 0 0 24px color-mix(in srgb, var(--switch-color), transparent 74%);
}

.switchboard-lever {
  position: relative;
  width: 28px;
  height: 94px;
  border: 1px solid rgba(255, 245, 197, 0.22);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 245, 197, 0.18), rgba(0, 0, 0, 0.42));
}

.switchboard-lever::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 56px;
  width: 42px;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 245, 197, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.86), transparent 14%),
    linear-gradient(180deg, #6d6751, #221d14);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.34);
  transition: top 180ms cubic-bezier(0.2, 0.72, 0.18, 1), background 180ms ease, box-shadow 180ms ease;
}

.switchboard-toggle.is-on .switchboard-lever::before {
  top: -4px;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.95), transparent 14%),
    linear-gradient(180deg, color-mix(in srgb, var(--switch-color), white 20%), #1c1b13);
  box-shadow: 0 0 24px color-mix(in srgb, var(--switch-color), transparent 32%);
}

.switchboard-dice-face {
  position: absolute;
  left: 50%;
  bottom: clamp(46px, 8vw, 82px);
  z-index: 4;
  display: grid;
  place-items: center;
  width: clamp(72px, 12vw, 112px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 245, 197, 0.62);
  border-radius: 14px;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.34), transparent 18%),
    linear-gradient(145deg, #f7d85c, #6e5221 58%, #18120b);
  color: #171009;
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 0 34px rgba(247, 216, 92, 0.22), inset 0 0 22px rgba(255, 255, 255, 0.18);
}

.switchboard-caption {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 4vw, 34px);
  z-index: 4;
  width: min(92%, 820px);
  transform: translateX(-50%);
  color: rgba(255, 248, 216, 0.92);
  font-size: clamp(1.1rem, 4.8vw, 3.4rem);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 0 22px rgba(247, 216, 92, 0.22);
  pointer-events: none;
}

.switchboard-dice-shell[data-switch-count="0"] {
  filter: saturate(0.58) brightness(0.82);
}

.switchboard-dice-shell[data-switch-branch="six"] {
  border-color: rgba(255, 95, 69, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 95, 69, 0.16), 0 0 54px rgba(255, 95, 69, 0.12);
}

@media (max-width: 760px) {
  .switchboard-dice-shell {
    min-height: 560px;
  }

  .switchboard-dice-hud {
    inset: 14px;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .switchboard-dice-branch,
  .switchboard-dice-status {
    text-align: left;
  }

  .switchboard-panel {
    top: 46%;
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    gap: 6px;
    padding: 10px;
  }

  .switchboard-toggle {
    min-height: 128px;
    padding-inline: 4px;
    font-size: 0.58rem;
  }

  .switchboard-lever {
    height: 82px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .switchboard-lever::before {
    transition: none;
  }
}
