/* ==========================================================
   DM-only content visibility
   ========================================================== */

.dm-only {
  display: none; /* default: player-safe */
}

body.dm-mode .dm-only {
  display: block; /* DM mode: reveal */
}

/* ==========================================================
   DM Switch – Arcane Seal Toggle
   Markup expected:
   <label class="dm-switch">
     <input class="dm-switch__input" type="checkbox" />
     <span class="dm-switch__slider"></span>
     <span class="dm-switch__label">DM</span>
   </label>
   ========================================================== */

/* Container */
.dm-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.35rem;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

/* Hide native checkbox but keep it focusable */
.dm-switch__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Slider track (carved metal slot) */
.dm-switch__slider {
  position: relative;
  width: 46px;
  height: 24px;
  border-radius: 999px;

  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.12), transparent 45%),
    linear-gradient(90deg, rgba(95, 75, 45, 0.95), rgba(45, 32, 20, 0.95));

  border: 1px solid rgba(0, 0, 0, 0.6);

  box-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);

  transition: background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

/* Wax seal knob */
.dm-switch__slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;

  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 45%),
    radial-gradient(circle at 50% 60%, rgba(0, 0, 0, 0.28), transparent 55%),
    linear-gradient(145deg, #7b1f1f, #4b0f12);

  border: 1px solid rgba(0, 0, 0, 0.45);

  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.10),
    inset 0 -2px 3px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.55);

  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

/* Engraved rune */
.dm-switch__slider::after {
  content: "✶"; /* swap rune if desired */
  position: absolute;
  top: 50%;
  left: 12px; /* aligns with knob when OFF */
  transform: translate(-50%, -50%);
  font-size: 12px;
  line-height: 1;
  pointer-events: none;

  color: rgba(250, 235, 200, 0.75);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);

  transition: left 180ms ease, color 180ms ease, text-shadow 180ms ease;
}

/* Label */
.dm-switch__label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: rgba(242, 230, 210, 0.92);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);

  transition: color 200ms ease, text-shadow 200ms ease;
}

/* ==========================================================
   States
   ========================================================== */

/* Hover */
.dm-switch:hover .dm-switch__slider {
  box-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.45);
}

/* Focus ring */
.dm-switch__input:focus-visible + .dm-switch__slider {
  outline: 2px solid rgba(255, 210, 120, 0.45);
  outline-offset: 3px;
}

/* Checked: move knob + rune */
.dm-switch__input:checked + .dm-switch__slider::before {
  transform: translateX(22px);
  filter: saturate(1.1);

  box-shadow:
    0 0 8px rgba(255, 200, 120, 0.25),
    0 0 16px rgba(255, 160, 90, 0.18),
    inset 0 1px 2px rgba(255, 255, 255, 0.10),
    inset 0 -2px 3px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.55);
}

.dm-switch__input:checked + .dm-switch__slider::after {
  left: 34px; /* aligns with knob when ON */
  color: rgba(255, 235, 190, 0.95);
  text-shadow:
    0 0 6px rgba(255, 200, 120, 0.25),
    0 1px 0 rgba(0, 0, 0, 0.55);
}

/* Checked: track slightly "awakened" */
.dm-switch__input:checked + .dm-switch__slider {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.12), transparent 45%),
    linear-gradient(90deg, rgba(75, 55, 30, 0.95), rgba(35, 25, 15, 0.95));

  border-color: rgba(0, 0, 0, 0.65);

  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.60),
    inset 0 0 0 1px rgba(255, 210, 120, 0.10),
    0 0 10px rgba(255, 180, 90, 0.18);
}

/* Checked: label glows + pulses */
.dm-switch__input:checked ~ .dm-switch__label {
  color: #ffe9b8;
  text-shadow:
    0 0 4px rgba(255, 210, 120, 0.4),
    0 0 10px rgba(255, 180, 90, 0.25),
    0 1px 0 rgba(0, 0, 0, 0.6);

  animation: dmGlowPulse 3.5s ease-in-out infinite;
}

@keyframes dmGlowPulse {
  0% {
    text-shadow:
      0 0 4px rgba(255, 210, 120, 0.35),
      0 0 10px rgba(255, 180, 90, 0.20),
      0 1px 0 rgba(0, 0, 0, 0.6);
  }
  50% {
    text-shadow:
      0 0 6px rgba(255, 230, 150, 0.55),
      0 0 14px rgba(255, 200, 120, 0.35),
      0 1px 0 rgba(0, 0, 0, 0.6);
  }
  100% {
    text-shadow:
      0 0 4px rgba(255, 210, 120, 0.35),
      0 0 10px rgba(255, 180, 90, 0.20),
      0 1px 0 rgba(0, 0, 0, 0.6);
  }
}
