:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #151b2d;
  --muted: #6b7280;
  --line: #dde3ee;
  --red: #b7222b;
  --red-deep: #7d121a;
  --gold: #bc842a;
  --shadow: 0 18px 42px rgba(19, 28, 48, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(145deg, rgba(183, 34, 43, 0.08), transparent 420px),
    linear-gradient(315deg, rgba(188, 132, 42, 0.13), transparent 480px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 13px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(221, 227, 238, 0.92);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: max-content;
}

.brand-logo {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
}

.site-nav {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  flex: 0 0 auto;
  border-radius: 8px;
  color: #384153;
  font-size: 14px;
  padding: 9px 11px;
}

.site-nav a:hover,
.site-nav a.is-active {
  background: rgba(183, 34, 43, 0.08);
  color: var(--red-deep);
}

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

.chapters,
.preview {
  margin-bottom: 34px;
}

.chapters h2,
.section-title h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.chapter-grid a {
  display: block;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
  box-shadow: 0 8px 22px rgba(19, 28, 48, 0.07);
}

.chapter-grid span,
.section-title span {
  display: block;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.chapter-grid strong {
  display: block;
  margin-top: 8px;
  color: #30384a;
  font-size: 14px;
  line-height: 1.45;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.preview-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-padding-left: 2px;
}

.preview-thumb,
.quick-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 4px;
}

.preview-thumb {
  flex: 0 0 160px;
}

.preview-thumb img,
.quick-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
}

.preview-thumb.is-active,
.quick-thumb.is-active {
  border-color: var(--red);
  background: rgba(183, 34, 43, 0.07);
}

.deck {
  display: grid;
  gap: 30px;
}

.slide-card {
  scroll-margin-top: 92px;
}

.slide-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.slide-card h2 {
  margin: 0;
  font-size: clamp(21px, 2.4vw, 30px);
  line-height: 1.3;
}

.slide-card .open-modal {
  min-height: 38px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  padding: 0 16px;
  box-shadow: 0 8px 20px rgba(183, 34, 43, 0.2);
}

.slide-frame {
  margin: 0;
  border-radius: 8px;
  background: #101522;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.slide-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.site-footer {
  width: min(1180px, calc(100% - 34px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 24px 0 42px;
  text-align: center;
}

.quick-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: 254px;
  max-width: calc(100vw - 36px);
  border: 1px solid rgba(221, 227, 238, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 16px 42px rgba(19, 28, 48, 0.16);
  padding: 12px;
  backdrop-filter: blur(16px);
}

.quick-panel h3 {
  margin: 0;
  font-size: 15px;
}

.quick-panel p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.quick-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  max-height: 164px;
  overflow: auto;
}

.quick-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.quick-controls button {
  flex: 1;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--red-deep);
  cursor: pointer;
  font-weight: 800;
}

.modal {
  width: min(96vw, 1480px);
  border: 0;
  border-radius: 8px;
  background: #0d111b;
  padding: 16px;
}

.modal::backdrop {
  background: rgba(7, 10, 18, 0.82);
}

.modal img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  cursor: pointer;
  font-size: 24px;
}

@media (max-width: 1120px) {
  .chapter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .quick-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand,
  .site-nav {
    width: 100%;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 22px;
  }

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

  .preview-thumb {
    flex-basis: 132px;
  }

  .slide-card header {
    align-items: flex-start;
    flex-direction: column;
  }

  .slide-card .open-modal {
    width: 100%;
  }
}
