:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: rgba(18, 22, 31, 0.82);
  --panel-strong: rgba(24, 29, 42, 0.96);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f7f8fb;
  --muted: #9da8bb;
  --primary: #7c5cff;
  --primary-2: #18d3ff;
  --success: #40d98d;
  --danger: #ff5977;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 14%, rgba(124, 92, 255, 0.28), transparent 34%),
    radial-gradient(circle at 84% 22%, rgba(24, 211, 255, 0.2), transparent 30%),
    linear-gradient(135deg, #070910 0%, #111522 55%, #090b10 100%);
  color: var(--text);
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
video:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 3px;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  max-width: 720px;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
  gap: 28px;
  align-items: center;
}

.phone-frame {
  position: relative;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    #0d1017;
  box-shadow: var(--shadow);
}

.phone-frame::before {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 82px;
  height: 5px;
  content: "";
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  transform: translateX(-50%);
  z-index: 2;
}

.video-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    #020305;
}

.video-player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  color: var(--text);
  background:
    radial-gradient(circle at center, rgba(124, 92, 255, 0.22), transparent 42%),
    rgba(2, 3, 5, 0.88);
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.empty-state.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.empty-state small {
  max-width: 250px;
  color: var(--muted);
  line-height: 1.5;
}

.loader {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--primary-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.control-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 8px rgba(157, 168, 187, 0.08);
}

.status-dot.is-ok {
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(64, 217, 141, 0.12);
}

.status-dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 0 8px rgba(255, 89, 119, 0.12);
}

.label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.status-card strong {
  font-size: 18px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.media-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.primary-btn,
.save-btn,
.control-btn,
.ghost-btn {
  min-height: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    border-color 0.15s ease;
}

.icon-btn .button-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.action-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 16px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(15, 18, 27, 0.92);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.36);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  backdrop-filter: blur(14px);
}

.action-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.button-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 520px) {
  .action-toast {
    bottom: 16px;
    font-size: 13px;
  }
}

.play-toggle:not(.is-playing) .icon-pause,
.play-toggle.is-playing .icon-play,
.mute-toggle:not(.is-muted) .icon-muted,
.mute-toggle.is-muted .icon-volume {
  display: none;
}

.primary-btn {
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.save-btn {
  color: #06130d;
  font-weight: 800;
  background: linear-gradient(135deg, #43e795, #15c7a9);
}

.ghost-btn {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.primary-btn:hover,
.save-btn:hover,
.control-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.26);
}

.primary-btn:disabled,
.save-btn:disabled,
.control-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 560px);
    padding: 28px 0;
  }

  .player-layout {
    grid-template-columns: 1fr;
  }

  .phone-frame {
    width: min(100%, 390px);
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: 100%;
    padding: 12px;
  }

  .hero {
    margin-bottom: 12px;
    padding: 0 4px;
  }

  h1 {
    font-size: 22px;
    letter-spacing: -0.02em;
  }

  .player-layout {
    gap: 12px;
  }

  .phone-frame {
    width: min(100%, 410px);
    padding: 8px;
    border-radius: 24px;
  }

  .phone-frame::before {
    top: 7px;
    width: 62px;
    height: 4px;
  }

  .video-wrap {
    border-radius: 18px;
  }

  .control-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .status-card {
    padding: 13px;
    border-radius: 15px;
  }

  .status-card strong {
    font-size: 15px;
  }

  .button-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  .media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .primary-btn,
  .save-btn,
  .control-btn,
  .ghost-btn {
    min-height: 46px;
    border-radius: 12px;
    font-size: 14px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
