:root {
  color-scheme: dark;
  --bg: #07090b;
  --ink: #f7f3e8;
  --muted: #b6b2a7;
  --glass: rgba(7, 9, 11, 0.62);
  --glass-strong: rgba(7, 9, 11, 0.76);
  --line: rgba(255, 255, 255, 0.22);
  --line-soft: rgba(255, 255, 255, 0.12);
  --accent: #e6b35f;
  --accent-strong: #f2d07e;
  --night: #7fb7e6;
  --shadow: rgba(0, 0, 0, 0.4);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

button,
input,
a {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  text-decoration: none;
}

.project-back {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  padding: 8px 14px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  font-weight: 600;
  opacity: 1;
  transition: opacity 0.6s ease, background 120ms ease;
}

.project-back.is-dimmed {
  opacity: 0.08;
}

.project-back:hover,
.project-back:focus-visible {
  opacity: 1;
}

.project-back:hover {
  background: #181818;
}

.player-shell {
  width: 100vw;
  height: 100vh;
  min-height: 360px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    #07090b;
}

.video-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

.clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateZ(0);
  transition: opacity 75ms linear, visibility 75ms linear;
}

.clip.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.center-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(7, 9, 11, 0.52);
  color: var(--ink);
  box-shadow: 0 24px 70px var(--shadow);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
}

.center-play:hover,
.icon-button:hover,
.donate-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.center-play:focus-visible,
.icon-button:focus-visible,
.donate-button:focus-visible,
.timeline:focus-visible,
.volume-slider:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.center-play.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
}

.button-icon,
.center-icon {
  display: block;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.center-icon {
  width: 32px;
  height: 32px;
  margin-left: 3px;
  fill: currentColor;
  stroke: none;
}

.icon-play {
  width: 19px;
  height: 19px;
  margin-left: 2px;
  fill: currentColor;
  stroke: none;
}

.icon-pause,
.is-playing .icon-play {
  display: none;
}

.is-playing .icon-pause {
  display: block;
}

.controls {
  position: absolute;
  left: clamp(12px, 3vw, 30px);
  right: clamp(12px, 3vw, 30px);
  bottom: clamp(12px, 3vw, 28px);
  z-index: 4;
  display: grid;
  grid-template-columns: 44px minmax(120px, 1fr) minmax(50px, auto) 54px minmax(118px, 150px) 44px;
  gap: 9px;
  align-items: center;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04)),
    var(--glass-strong);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(22px) saturate(135%);
}

.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  color: var(--ink);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.22);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 24px rgba(0, 0, 0, 0.3);
}

.switch-button {
  color: var(--accent-strong);
}

body[data-mode="night"] .switch-button {
  color: var(--night);
}

.switch-button .button-icon {
  width: 23px;
  height: 23px;
}

.key-hint {
  position: absolute;
  right: 1px;
  bottom: 0;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.center-play:disabled,
.icon-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.icon-button:active,
.center-play:active {
  transform: scale(0.96);
}

.center-play:active {
  transform: translate(-50%, -50%) scale(0.94);
}

.timeline-wrap {
  min-width: 0;
  display: grid;
  align-items: center;
}

.timeline {
  width: 100%;
  height: 22px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.timeline,
.volume-slider {
  accent-color: var(--accent-strong);
}

.timeline::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent) 0 var(--progress, 0%), rgba(255, 255, 255, 0.22) var(--progress, 0%) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.36);
}

.timeline::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent) 0 var(--progress, 0%), rgba(255, 255, 255, 0.22) var(--progress, 0%) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.36);
}

.timeline::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.14),
    0 4px 12px rgba(0, 0, 0, 0.38);
}

.timeline::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.14),
    0 4px 12px rgba(0, 0, 0, 0.38);
}

.time-readout {
  min-width: 50px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.volume-control {
  display: grid;
  grid-template-columns: 38px minmax(68px, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  height: 44px;
  padding: 0 10px 0 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.volume-button {
  width: 38px;
  height: 38px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.volume-button:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.icon-volume-muted,
.is-muted .icon-volume {
  display: none;
}

.is-muted .icon-volume-muted {
  display: block;
}

.volume-slider {
  width: 100%;
  min-width: 0;
  height: 22px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent-strong) 0 var(--volume, 100%), rgba(255, 255, 255, 0.22) var(--volume, 100%) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.34);
}

.volume-slider::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent-strong) 0 var(--volume, 100%), rgba(255, 255, 255, 0.22) var(--volume, 100%) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.34);
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.13),
    0 3px 9px rgba(0, 0, 0, 0.34);
}

.volume-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.13),
    0 3px 9px rgba(0, 0, 0, 0.34);
}

.icon-fullscreen {
  width: 22px;
  height: 22px;
}

.donate-button {
  position: absolute;
  top: clamp(14px, 3vw, 30px);
  right: clamp(14px, 3vw, 30px);
  z-index: 4;
  display: inline-grid;
  grid-template-columns: 18px auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(242, 208, 126, 0.38);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(242, 208, 126, 0.24), rgba(230, 179, 95, 0.12)),
    rgba(7, 9, 11, 0.68);
  color: var(--ink);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px) saturate(130%);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.donate-button:hover {
  border-color: rgba(242, 208, 126, 0.72);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.42),
    0 0 0 4px rgba(242, 208, 126, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.donate-button:active {
  transform: scale(0.97);
}

.donate-button .button-icon {
  width: 17px;
  height: 17px;
  fill: var(--accent-strong);
  stroke: var(--accent-strong);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 620px) {
  .donate-button {
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.82rem;
  }

  .controls {
    grid-template-columns: 44px minmax(88px, 1fr) 46px 52px minmax(86px, 116px) 44px;
    gap: 6px;
    padding: 7px;
  }

  .volume-control {
    grid-template-columns: 34px minmax(44px, 1fr);
    gap: 2px;
    padding-right: 7px;
  }

  .volume-button {
    width: 34px;
    height: 34px;
  }

  .time-readout {
    min-width: 46px;
    font-size: 0.78rem;
  }
}

@media (max-width: 460px) {
  .controls {
    grid-template-columns: 42px minmax(76px, 1fr) 42px 52px 42px;
  }

  .time-readout {
    display: none;
  }

  .volume-control {
    grid-template-columns: 42px;
    padding: 0;
    background: transparent;
    border-color: transparent;
  }

  .volume-slider {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .clip,
  .mode-badge span,
  .center-play,
  .icon-button {
    transition: none;
  }
}
