/* Theme toggle and menu controls extracted from styles.css. */
.theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.9),
      rgba(243, 247, 255, 0.82)
    ),
    var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 10px 20px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  user-select: none;
}
.theme-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-toggle-track {
  position: relative;
  width: 68px;
  height: 34px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: linear-gradient(
      180deg,
      rgba(244, 248, 255, 0.98),
      rgba(228, 238, 255, 0.9)
    ),
    var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.28);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.theme-toggle-icon {
  position: absolute;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  transition:
    color 0.2s ease,
    opacity 0.18s ease,
    transform 0.22s ease;
}
.theme-toggle-icon-sun {
  left: 11px;
  color: #f59e0b;
}
.theme-toggle-icon-moon {
  right: 11px;
  color: rgba(71, 85, 105, 0.88);
}
.theme-toggle-input:not(:checked)
  + .theme-toggle-track
  .theme-toggle-icon-moon {
  color: rgba(30, 41, 59, 0.96);
  opacity: 1;
}
.theme-toggle-input:not(:checked) + .theme-toggle-track .theme-toggle-icon-sun {
  opacity: 0;
  transform: translateY(-50%) scale(0.8);
}
.theme-toggle-input:checked + .theme-toggle-track .theme-toggle-icon-moon {
  opacity: 0;
  transform: translateY(-50%) scale(0.8);
}
.theme-toggle-input:checked + .theme-toggle-track .theme-toggle-icon-sun {
  opacity: 1;
}
.theme-toggle-thumb {
  position: absolute;
  z-index: 2;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    transform 0.22s ease,
    background-color 0.22s ease;
}
.theme-toggle:hover .theme-toggle-track {
  box-shadow: 0 12px 24px rgba(8, 15, 30, 0.1);
}
.theme-toggle-input:focus-visible + .theme-toggle-track {
  outline: 2px solid rgba(10, 132, 255, 0.34);
  outline-offset: 2px;
}
.theme-toggle-input:checked + .theme-toggle-track {
  background: linear-gradient(
      180deg,
      rgba(22, 28, 39, 0.94),
      rgba(13, 18, 30, 0.9)
    ),
    var(--surface);
  border-color: rgba(148, 163, 184, 0.34);
  box-shadow: 0 0 0 1px rgba(122, 92, 255, 0.14) inset;
}
.theme-toggle-input:checked + .theme-toggle-track .theme-toggle-thumb {
  transform: translateX(34px);
  background: #e8efff;
}
.theme-toggle-input:checked + .theme-toggle-track .theme-toggle-icon-sun {
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.18);
}
.theme-toggle-input:checked + .theme-toggle-track .theme-toggle-icon-moon {
  color: rgba(139, 184, 255, 0.52);
}

.theme-menu {
  position: relative;
  flex: 0 0 auto;
}
.theme-menu summary {
  list-style: none;
}
.theme-menu summary::-webkit-details-marker {
  display: none;
}
.theme-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.theme-menu[open] .theme-menu-trigger {
  color: var(--ink);
  border-color: var(--line-strong);
}
.theme-menu-caret {
  font-size: 10px;
  line-height: 1;
  transition: transform 0.2s ease;
}
.theme-menu[open] .theme-menu-caret {
  transform: rotate(180deg);
}
.theme-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 90;
}
.theme-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(10, 132, 255, 0.14);
  border-radius: 18px;
  padding: 12px 14px;
  background: linear-gradient(
    180deg,
    rgba(247, 250, 255, 0.98),
    rgba(238, 244, 255, 0.94)
  );
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
[data-theme='dark'] .theme-menu-trigger,
[data-theme='dark'] .theme-menu-panel,
[data-theme='dark'] .theme-menu-item {
  background: linear-gradient(
      180deg,
      rgba(15, 20, 32, 0.95),
      rgba(10, 15, 25, 0.92)
    ),
    radial-gradient(
      circle at top right,
      rgba(10, 132, 255, 0.12),
      transparent 38%
    );
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}
[data-theme='dark'] .theme-menu-item-copy small,
[data-theme='dark'] .theme-menu-item-copy strong {
  color: var(--ink);
}
[data-theme='dark'] .theme-menu-state {
  background: rgba(78, 165, 255, 0.16);
  color: #d8e9ff;
}
[data-theme='dark'] .theme-toggle {
  background: linear-gradient(
      180deg,
      rgba(18, 25, 38, 0.9),
      rgba(12, 18, 30, 0.86)
    ),
    var(--surface);
  border-color: rgba(148, 196, 255, 0.2);
}
[data-theme='dark'] .theme-toggle-track {
  background: linear-gradient(
      180deg,
      rgba(18, 24, 38, 0.94),
      rgba(12, 18, 30, 0.9)
    ),
    var(--surface);
  border-color: rgba(148, 196, 255, 0.24);
}
[data-theme='dark'] .theme-toggle-input:checked + .theme-toggle-track {
  background: linear-gradient(
      180deg,
      rgba(8, 16, 31, 0.98),
      rgba(8, 13, 23, 0.94)
    ),
    var(--surface);
  border-color: rgba(148, 196, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(122, 92, 255, 0.22) inset;
}
[data-theme='dark'] .theme-toggle-thumb {
  background: #eaf3ff;
}
[data-theme='dark'] .theme-toggle-icon-sun {
  color: rgba(250, 204, 21, 0.9);
}
[data-theme='dark'] .theme-toggle-icon-moon {
  color: rgba(148, 196, 255, 0.78);
}
[data-theme='dark']
  .theme-toggle-input:checked
  + .theme-toggle-track
  .theme-toggle-icon-sun {
  color: rgba(255, 255, 255, 0.98);
}
.theme-menu-item-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.theme-menu-item-copy strong {
  font-size: 13px;
  letter-spacing: -0.02em;
}
.theme-menu-item-copy small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.3;
}
.theme-menu-state {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.12);
  color: #0a56b8;
  font-size: 11px;
  font-weight: 800;
}
@media (max-width: 880px) {
  .theme-menu-panel {
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 24px));
  }
}

@media (max-width: 900px) {
  .theme-toggle-track {
    width: 62px;
    height: 32px;
  }
  .theme-toggle-thumb {
    width: 24px;
    height: 24px;
  }
  .theme-toggle-input:checked + .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(30px);
  }
}

@media (max-width: 640px) {
  .theme-toggle-track {
    width: 58px;
    height: 30px;
  }
  .theme-toggle-thumb {
    width: 22px;
    height: 22px;
  }
  .theme-toggle-input:checked + .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(28px);
  }
}

@media (max-width: 390px) {
  .theme-toggle-track {
    width: 54px;
    height: 28px;
  }
  .theme-toggle-thumb {
    width: 20px;
    height: 20px;
  }
  .theme-toggle-input:checked + .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(26px);
  }
}

@media (max-width: 720px) {
  .theme-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 5px;
  }

  .theme-toggle-track {
    width: 66px;
    height: 32px;
  }

  .theme-toggle-thumb {
    width: 24px;
    height: 24px;
    top: 3px;
    left: 3px;
  }

  .theme-toggle-input:checked + .theme-toggle-track .theme-toggle-thumb {
    transform: translateX(32px);
  }

  .theme-toggle-icon {
    font-size: 13px;
  }

  .theme-toggle-icon-sun {
    left: 10px;
  }

  .theme-toggle-icon-moon {
    right: 10px;
  }
}
