:root {
  --bg: #06090f;
  --panel: rgba(13, 19, 28, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --ink: #eef3fa;
  --muted: #93a1b5;
  --accent: #4c8dff;
  --accent-2: #8fd0ff;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui,
    -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 700px at 50% -12%, rgba(70, 120, 255, 0.20), transparent 62%),
    radial-gradient(900px 520px at 88% 112%, rgba(0, 176, 255, 0.10), transparent 60%),
    radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--bg);
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- top progress ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 60;
  background: rgba(255, 255, 255, 0.05);
}

.progress span {
  display: block;
  height: 100%;
  width: 11.11%;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(90, 160, 255, 0.75);
  transition: width 0.42s var(--ease);
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(14px, 3vw, 30px);
  background: linear-gradient(180deg, rgba(6, 9, 15, 0.92), rgba(6, 9, 15, 0.55) 70%, transparent);
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(140deg, #3d7bf5, #7cc4ff);
  box-shadow: 0 6px 18px -6px rgba(76, 141, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-text strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12.5px;
  color: #c2cddd;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.tool:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line);
}

.tool:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* play/pause icon swap */
#btnPlay .ic-pause {
  display: none;
}

#btnPlay[aria-pressed="true"] {
  color: #bfe0ff;
  background: rgba(76, 141, 255, 0.16);
  border-color: rgba(76, 141, 255, 0.42);
}

#btnPlay[aria-pressed="true"] .ic-play {
  display: none;
}

#btnPlay[aria-pressed="true"] .ic-pause {
  display: block;
  fill: currentColor;
  stroke: none;
}

.ic-pause rect {
  fill: currentColor;
  stroke: none;
}

#btnFull .ic-collapse {
  display: none;
}

body.is-fullscreen #btnFull .ic-expand {
  display: none;
}

body.is-fullscreen #btnFull .ic-collapse {
  display: block;
}

/* ---------- stage ---------- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 78px clamp(12px, 3vw, 32px) 104px;
}

.frame {
  position: relative;
  width: min(100%, calc((100svh - 186px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  isolation: isolate;
  box-shadow:
    0 40px 110px -34px rgba(0, 0, 0, 0.95),
    0 10px 30px -18px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 90px -30px rgba(76, 141, 255, 0.35);
}

.slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  opacity: 0;
  transition: opacity 0.28s var(--ease);
  user-select: none;
  -webkit-user-drag: none;
}

.slide-img.is-active {
  opacity: 1;
}

.skeleton {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(110deg, #eef2f7 8%, #f8fafc 18%, #eef2f7 33%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.skeleton.is-done {
  opacity: 0;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

/* edge arrows */
.edge {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #1b2431;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s;
}

.edge svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.edge-prev {
  left: 14px;
  transform: translateX(-6px);
}

.edge-next {
  right: 14px;
  transform: translateX(6px);
}

.frame:hover .edge,
.edge:focus-visible {
  opacity: 1;
  transform: translateX(0);
}

.edge:hover {
  background: #fff;
}

.edge[disabled] {
  opacity: 0;
  pointer-events: none;
}

/* ---------- dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 45;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(140%);
}

.dock-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #cbd6e4;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.dock-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.dock-btn:active {
  transform: scale(0.93);
}

.dock-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.dock-btn[disabled] {
  opacity: 0.3;
  pointer-events: none;
}

.counter {
  margin: 0 4px;
  min-width: 66px;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.counter #cur {
  color: var(--ink);
  font-weight: 600;
}

.counter .sep {
  margin: 0 4px;
  opacity: 0.5;
}

.dock-sep {
  width: 1px;
  height: 20px;
  margin: 0 8px;
  background: var(--line);
}

.dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  transition: width 0.28s var(--ease), background 0.2s;
}

.dot:hover {
  background: rgba(255, 255, 255, 0.45);
}

.dot.is-active {
  width: 18px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- hint ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 46;
  transform: translate(-50%, 8px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: #b9c6d8;
  background: rgba(10, 15, 22, 0.82);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
  white-space: nowrap;
}

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

.hint-touch {
  display: none;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px;
  color: #dbe6f5;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

/* ---------- overview overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  background: rgba(4, 7, 12, 0.90);
  backdrop-filter: blur(14px) saturate(120%);
  animation: fadeIn 0.22s ease;
}

.overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

.overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px clamp(18px, 4vw, 44px) 14px;
}

.overlay-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.overlay-head p {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.overlay-close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #cfdaea;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  transition: background 0.2s, transform 0.2s;
}

.overlay-close:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: rotate(90deg);
}

.overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px clamp(18px, 4vw, 44px) 40px;
  overscroll-behavior: contain;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #11161f;
  border: 1px solid var(--line);
  text-align: left;
  transition: transform 0.24s var(--ease), border-color 0.24s, box-shadow 0.24s;
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #fff;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.9);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card.is-current {
  border-color: rgba(76, 141, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(76, 141, 255, 0.55), 0 22px 44px -22px rgba(76, 141, 255, 0.55);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px 11px;
}

.card-num {
  flex: none;
  min-width: 22px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}

.card-title {
  font-size: 12.5px;
  color: #c9d5e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card.is-current .card-title {
  color: #eaf2ff;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .tool-label {
    display: none;
  }

  .tool {
    padding: 0 9px;
  }

  .brand-text strong {
    font-size: 12.5px;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 56px;
    padding: 0 12px;
  }

  .brand-text span {
    display: none;
  }

  .mark {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .stage {
    padding: 66px 10px 96px;
  }

  .frame {
    width: 100%;
  }

  .dock {
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 5px 7px;
  }

  .dock-sep,
  .dots {
    display: none;
  }

  .hint {
    bottom: 74px;
    font-size: 11px;
    padding: 8px 11px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
}

@media (hover: none) {
  .edge {
    display: none;
  }

  .hint-kb {
    display: none;
  }

  .hint-touch {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
