/* --- 鸣潮式「主线回顾」框架：暗色、磁带、章节、幕 --- */
:root {
  --bg-deep: #06090c;
  --bg-panel: #0c1218;
  --text: #e6edf3;
  --text-muted: #8a9aaa;
  --accent: #5ee0d6;
  --accent-dim: rgba(94, 224, 214, 0.35);
  --accent-glow: rgba(94, 224, 214, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --font-sans: "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, monospace;
  --radius: 12px;
  --header-h: 56px;
  --maxw: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-deep);
}

/* 胶片噪点 */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* 顶栏 */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.5rem 1.25rem;
  background: linear-gradient(to bottom, rgba(6, 9, 12, 0.95), rgba(6, 9, 12, 0.65), transparent);
  border-bottom: 1px solid transparent;
}

.site-header--editor {
  position: relative;
  background: rgba(6, 9, 12, 0.92);
  border-bottom: 1px solid var(--border);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-actions__link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.header-actions__link:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.brand__mark {
  color: var(--accent);
  font-size: 1.1rem;
}

.brand__name {
  font-size: 0.95rem;
}

.nav-chapters {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.nav-chapters__link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.nav-chapters__link:hover {
  color: var(--text);
}

.nav-chapters__link.is-active {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

.main {
  padding-top: var(--header-h);
}

/* Hero：宽画幅 */
.hero {
  position: relative;
  min-height: min(92vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 4rem;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 20%, rgba(94, 224, 214, 0.08), transparent 55%),
    linear-gradient(180deg, #0a1018 0%, #06090c 100%);
}

.hero__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, #06090c 85%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  text-align: center;
  max-width: 42rem;
}

.hero__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin: 0 0 1rem;
}

.hero__title {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.hero__title-accent {
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-dim);
}

.hero__lead {
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.hero__cta {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.65rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: var(--bg-deep);
  background: var(--accent);
  border-radius: 999px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.hero__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-dim);
}

.hero__scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: var(--text-muted);
}

.hero__scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scaleY(0.85);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* 磁带区 */
.tape-shell {
  padding: 3rem 1.25rem 4rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.tape-shell__grid {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .tape-shell__grid {
    grid-template-columns: 1fr;
  }
}

.cassette {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.cassette__switch {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
}

.cassette__arrow {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(6, 9, 12, 0.7);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.cassette__arrow:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: rgba(94, 224, 214, 0.08);
}

.cassette__arrow:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cassette__body {
  background: linear-gradient(145deg, #1a222c 0%, #121820 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cassette__holes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.25rem 1.25rem;
}

.cassette__reel {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3544, #0e141c);
  border: 2px solid #2a3544;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
  animation: reel 8s linear infinite;
}

.cassette__reel--r {
  animation-direction: reverse;
  animation-duration: 9s;
}

@keyframes reel {
  to {
    transform: rotate(360deg);
  }
}

.cassette__label {
  text-align: center;
  padding: 0.75rem;
  background: rgba(94, 224, 214, 0.06);
  border: 1px dashed var(--accent-dim);
  border-radius: 8px;
}

.cassette__label--btn {
  width: 100%;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.cassette__label--btn:hover:not(:disabled) {
  background: rgba(94, 224, 214, 0.12);
}

.cassette__label--btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cassette__label-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.cassette__label-sub {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.tape-shell__heading {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.tape-shell__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tape-shell__desc code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent);
  background: rgba(94, 224, 214, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.tape-event-list-wrap {
  margin-top: 1rem;
}

.tape-event-list__label {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.tape-event-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tape-event-link {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.7rem;
  width: fit-content;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px dashed transparent;
  transition: color 0.2s, border-color 0.2s;
}

.tape-event-link:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.tape-event-link__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.tape-event-link__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tape-event-list__empty {
  margin: 0;
  width: 100%;
  border: 1px dashed var(--accent-dim);
  border-radius: 10px;
  background: rgba(94, 224, 214, 0.08);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 章节 */
.chapter {
  position: relative;
  padding: 4rem 1.25rem 5rem;
  overflow: hidden;
}

.chapter__backdrop {
  position: absolute;
  inset: 0;
  background: var(--chapter-bg, #0c1218);
  z-index: 0;
}

.chapter__backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(94, 224, 214, 0.06), transparent 60%);
  pointer-events: none;
}

.chapter__inner {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
}

.chapter__head {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.chapter__index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.chapter__title {
  margin: 0.5rem 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
}

.chapter__synopsis {
  margin: 0;
  max-width: 36rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 幕 */
.beats {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.beat {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

.beat__bar {
  background: linear-gradient(to bottom, var(--accent), var(--accent-dim));
  border-radius: 4px;
  box-shadow: 0 0 20px var(--accent-dim);
}

.beat__body {
  background: rgba(12, 18, 24, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(8px);
}

.beat__date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.beat__title {
  margin: 0.35rem 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.beat__text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.beat__text code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--accent);
}

.beat__figure {
  margin: 1rem 0 0;
}

.beat__placeholder {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a2530, #0e151c);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 滚动显现 */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  padding: 2.5rem 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* 上篇 / 下篇 */
.half {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.half:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.half__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.half__synopsis {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 40rem;
}

.half__empty {
  margin: 0;
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.beat__text--multiline {
  white-space: pre-wrap;
}

.beat__gallery {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.beat__img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.empty-state {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.25rem;
  text-align: center;
}

.empty-state__text {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.empty-state__hint {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  opacity: 0.85;
}

/* 登录页 */
.page-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse 80% 60% at 50% 20%, rgba(94, 224, 214, 0.06), transparent 55%),
    linear-gradient(180deg, #0a1018 0%, #06090c 100%);
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}

.auth-back:hover {
  color: var(--accent);
}

.auth-card {
  padding: 2rem;
  background: rgba(12, 18, 24, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.auth-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.auth-lead,
.auth-note {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-ok {
  margin: 0 0 1rem;
  color: var(--accent);
}

.auth-form .field {
  display: block;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.field--full {
  grid-column: 1 / -1;
}

.field__label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field__input {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(6, 9, 12, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.field__select {
  min-width: 10rem;
}

textarea.field__input {
  resize: vertical;
  min-height: 4rem;
}

.field-error {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #f08080;
  display: none;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn--ghost:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.btn--danger:hover {
  color: #f08080;
  border-color: rgba(240, 128, 128, 0.4);
}

.btn--block {
  width: 100%;
}

.btn--small {
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
}

.btn--lg {
  padding: 0.75rem 2rem;
  font-size: 0.85rem;
}

/* 编辑页 */
.page-editor {
  min-height: 100vh;
  background: var(--bg-deep);
}

.editor-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel {
  padding: 1.5rem;
  background: rgba(12, 18, 24, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.panel__hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .panel__grid {
    grid-template-columns: 1fr;
  }
}

.panel__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel__head .panel__title {
  margin: 0;
}

.half-switch {
  margin: 1rem 0;
  padding: 0;
  border: none;
}

.half-switch__legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  margin-right: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.radio-pill input {
  margin-right: 0.4rem;
  accent-color: var(--accent);
}

.radio-pill span {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.radio-pill input:checked + span {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

.beats-editor {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.beat-editor {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(6, 9, 12, 0.4);
}

.beat-editor__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.beat-editor__label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.beat-editor__row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 560px) {
  .beat-editor__row {
    grid-template-columns: 1fr;
  }
}

.beat-editor__gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.beat-editor__thumb {
  position: relative;
  margin: 0;
  width: 120px;
  height: 80px;
}

.beat-editor__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.beat-editor__rm {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
}

.beat-editor__file input[type="file"] {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.editor-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.save-status {
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.3s;
}

.save-status.is-on {
  opacity: 1;
}

/* 减少动画：尊重系统设置 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .cassette__reel {
    animation: none;
  }
  .hero__scroll-line {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
