:root {
  color-scheme: light;
  --thumb: #e5e7e0;
  --video-bg: #dedfd9;
  --backdrop: #191c1752;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171916;
  --ink: #f1f0ea;
  --muted: #b2b6ab;
  --rule: #42463d;
  --thumb: #262824;
  --video-bg: #10120f;
  --backdrop: #06070499;
}
.index-item img { background: var(--thumb); }
.stage video { background: var(--video-bg); }
dialog::backdrop { background: var(--backdrop); }
.header-actions, .panel-actions {
  display: flex;
  align-items: center;
  gap: 26px;
  justify-self: end;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  min-height: 44px;
  border-radius: 99px;
}
.theme-track {
  position: relative;
  display: block;
  width: 80px;
  height: 40px;
  border: 2px solid #dfe2e7;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 3px 8px #0000000c;
  transition: background-color 350ms ease, border-color 350ms ease;
}
.theme-toggle svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .theme-sun, .theme-toggle .theme-moon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 6px;
  margin: 0;
  transition: opacity 250ms ease, transform 400ms ease;
}
.theme-sun { left: 7px; color: #ffb747; opacity: 1; transform: rotate(0deg) scale(1); }
.theme-moon { right: 7px; color: #fff; opacity: 0; transform: rotate(-25deg) scale(.6); }
.theme-toggle .theme-knob {
  position: absolute;
  display: block;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  margin: 0;
  border: 3px solid #ffb747;
  border-radius: 50%;
  background: #ffedcf;
  transform: translateX(40px);
  transition: transform 420ms cubic-bezier(.22,1,.36,1), background-color 350ms ease, border-color 350ms ease;
}
[data-theme="dark"] .theme-track { background: #35404e; border-color: #4b5564; }
[data-theme="dark"] .theme-knob { transform: translateX(0); background: #485363; border-color: #fff; }
[data-theme="dark"] .theme-sun { opacity: 0; transform: rotate(90deg) scale(.6); }
[data-theme="dark"] .theme-moon { opacity: 1; transform: rotate(0deg) scale(1); }
@media (max-width: 900px) {
  .header-actions, .panel-actions { gap: 16px; }
  .header .wordmark { font-size: 30px; }
  .header nav { gap: 18px; }
  .header nav button { font-size: 18px; }
}
@media (max-width: 650px) {
  .header { height: 118px; grid-template-columns: 1fr auto; align-content: center; }
  .header-actions { grid-row: 1; grid-column: 2; gap: 12px; }
  .header nav { grid-row: 2; grid-column: 1 / 3; justify-content: center; margin-top: 8px; }
  .panel-actions { gap: 10px; }
}
@media (max-width: 360px) {
  .header .wordmark { font-size: 27px; }
  .header-actions { gap: 8px; }
  .header .info-link { font-size: 16px; gap: 4px; }
  .header .info-link .diagonal-arrow { width: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-track, .theme-knob, .theme-sun, .theme-moon { transition: none !important; }
}
