:root {
  color-scheme: dark;
  --bg: #101112;
  --surface: #18191b;
  --surface-strong: #232326;
  --text: #f6f0e8;
  --muted: #aaa39a;
  --line: rgba(246, 240, 232, 0.14);
  --line-strong: rgba(246, 240, 232, 0.28);
  --accent: #ff405f;
  --cyan: #2ad4c5;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Inter", Arial, sans-serif;
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

.app {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 18, 0.94);
}

.brand {
  min-width: 0;
}

.brand span {
  display: block;
  color: var(--cyan);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}

.brand h1 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-button,
.text-button,
.hotspot {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 28px;
  line-height: 1;
}

.text-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.icon-button:hover,
.text-button:hover,
.hotspot:hover {
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

.icon-button:focus-visible,
.text-button:focus-visible,
.hotspot:focus-visible,
.thumb-button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.counter {
  min-width: 74px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
}

.counter strong {
  color: var(--text);
  font-size: 16px;
}

.viewer {
  min-height: 0;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 24px 24px;
}

.thumbs {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 2px 4px 2px 2px;
}

.thumb-button {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
  cursor: pointer;
}

.thumb-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0.72;
  transition: opacity 160ms ease, transform 160ms ease;
}

.thumb-button::after {
  content: attr(data-index);
  position: absolute;
  left: 7px;
  top: 6px;
  min-width: 25px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.66);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.thumb-button:hover img,
.thumb-button[aria-current="true"] img {
  opacity: 1;
}

.thumb-button[aria-current="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 64, 95, 0.22);
}

.stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 13px;
}

.slide-shell {
  width: min(100%, calc((100svh - 146px) * 1.7777778));
  max-width: 1680px;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
}

.slide-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  opacity: 1;
  transition: opacity 180ms ease;
}

.slide-image.is-loading {
  opacity: 0.28;
}

.hotspot {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 58px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.42);
  font-size: 34px;
  line-height: 1;
  opacity: 0;
}

.slide-shell:hover .hotspot,
.hotspot:focus-visible {
  opacity: 1;
}

.hotspot-prev {
  left: 12px;
}

.hotspot-next {
  right: 12px;
}

.slide-title {
  width: min(100%, 1680px);
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    padding: 14px 14px 12px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .toolbar {
    gap: 6px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    font-size: 25px;
  }

  .counter {
    min-width: 62px;
    height: 38px;
  }

  .text-button {
    min-height: 38px;
    padding: 0 11px;
    font-size: 13px;
  }

  .viewer {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 12px 14px;
  }

  .thumbs {
    order: 2;
    flex-direction: row;
    min-height: 78px;
    padding: 2px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .thumb-button {
    flex: 0 0 128px;
  }

  .stage {
    order: 1;
    gap: 10px;
  }

  .slide-shell {
    width: 100%;
  }

  .hotspot {
    opacity: 1;
    width: 38px;
    height: 50px;
    font-size: 29px;
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar {
    justify-content: space-between;
  }

  .text-button {
    flex: 1 1 auto;
  }
}
