/* ==========================================================================
 * 深夜怪谈档案馆 · 统一门户样式 (portal.css)
 * 零外链 / 零外部字体 / 桌面端与移动端自适应
 * ========================================================================== */

:root {
  --bg-deep: #090b0e;
  --bg-base: #0e1116;
  --bg-surface: #141920;
  --bg-card: #171d25;
  --bg-card-hover: #1d242e;
  --bg-elevated: #202834;

  --border-subtle: rgba(217, 184, 124, 0.14);
  --border-strong: rgba(217, 184, 124, 0.34);
  --border-teal: rgba(78, 201, 176, 0.34);

  --text-primary: #eae4d7;
  --text-secondary: #b2aba0;
  --text-muted: #7d7870;

  --accent-brass: #d9b87c;
  --accent-brass-dim: rgba(217, 184, 124, 0.16);
  --accent-teal: #4ec9b0;
  --accent-teal-dim: rgba(78, 201, 176, 0.14);
  --accent-amber: #e29d5b;

  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.45);
  --container-max: 1240px;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  background:
    radial-gradient(circle at 18% 0%, rgba(78, 201, 176, 0.06), transparent 40%),
    radial-gradient(circle at 82% 12%, rgba(217, 184, 124, 0.07), transparent 44%),
    var(--bg-deep);
  color: var(--text-primary);
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

.ambient-scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  opacity: 0.22;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.26) 3px
  );
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 768px) {
  .container {
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 54px;
  background: rgba(11, 13, 17, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: rgba(217, 184, 124, 0.1);
  color: var(--accent-brass);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

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

.brand-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-code {
  display: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

@media (min-width: 640px) {
  .brand-title {
    font-size: 16px;
  }
  .brand-code {
    display: block;
  }
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-full {
  display: none;
}

.nav-short {
  display: inline;
}

@media (min-width: 640px) {
  .nav-full {
    display: inline;
  }
  .nav-short {
    display: none;
  }
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-pill:hover,
.nav-pill:focus-visible {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  outline: none;
}

.nav-pill-accent {
  color: var(--accent-brass);
  border-color: var(--border-subtle);
  background: rgba(217, 184, 124, 0.08);
}

.nav-pill-accent:hover,
.nav-pill-accent:focus-visible {
  color: #fff6e5;
  background: rgba(217, 184, 124, 0.18);
  border-color: var(--border-strong);
}

@media (min-width: 640px) {
  .topbar-nav {
    gap: 10px;
  }
  .nav-pill {
    padding: 0 12px;
    font-size: 13px;
  }
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 430px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

@media (min-width: 768px) {
  .hero {
    min-height: 470px;
  }
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  filter: saturate(0.86) brightness(0.76);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 11, 14, 0.94) 0%, rgba(9, 11, 14, 0.78) 54%, rgba(9, 11, 14, 0.62) 100%),
    linear-gradient(180deg, rgba(9, 11, 14, 0.35) 0%, rgba(9, 11, 14, 0.96) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-top: 40px;
  padding-bottom: 42px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-teal);
  background: rgba(12, 20, 22, 0.78);
  color: var(--accent-teal);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 8px var(--accent-teal);
}

.hero-title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  color: #f6efe2;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.hero-subtitle {
  margin: 0 0 12px;
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 500;
  color: var(--accent-brass);
  letter-spacing: 0.03em;
}

.hero-desc {
  margin: 0 0 22px;
  max-width: 620px;
  font-size: 14px;
  color: var(--text-secondary);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 660px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }
}

.stat-chip {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(18, 23, 30, 0.84);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(6px);
  min-width: 0;
}

.stat-chip-highlight {
  border-color: var(--border-teal);
  background: rgba(15, 29, 30, 0.84);
}

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-chip-highlight .stat-value {
  color: var(--accent-teal);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent-brass);
  color: #16130d;
  border-color: var(--accent-brass);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #e7cb95;
  outline: none;
}

.btn-secondary {
  background: rgba(23, 29, 37, 0.86);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(35, 44, 56, 0.94);
  outline: none;
}

/* Sections */
.section {
  padding: 40px 0 46px;
}

.section-alt {
  background: linear-gradient(180deg, rgba(20, 25, 32, 0.55) 0%, rgba(9, 11, 14, 0.92) 100%);
  border-top: 1px solid var(--border-subtle);
}

@media (min-width: 768px) {
  .section {
    padding: 54px 0 60px;
  }
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .section-head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.section-kicker {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent-teal);
}

.section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f4ede0;
}

.section-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

@media (min-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
  }
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  min-width: 0;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.game-cover-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0c0f14;
  border-bottom: 1px solid var(--border-subtle);
}

.game-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}

.game-card[data-game-id="game1"] .game-cover {
  object-position: center 22%;
}

.game-card:hover .game-cover {
  transform: scale(1.03);
}

.game-cover-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 11, 14, 0.48) 0%, transparent 45%, rgba(14, 17, 22, 0.85) 100%);
  pointer-events: none;
}

.game-badges-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.vol-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(11, 14, 18, 0.86);
  border: 1px solid var(--border-strong);
  color: var(--accent-brass);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.ending-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(11, 14, 18, 0.88);
  color: var(--text-secondary);
}

.ending-badge.is-progress {
  border-color: var(--border-teal);
  background: rgba(14, 34, 34, 0.9);
  color: var(--accent-teal);
}

.ending-badge.is-complete {
  border-color: var(--accent-brass);
  background: rgba(44, 34, 16, 0.92);
  color: #f6d99c;
}

.game-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.game-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--accent-teal);
}

.game-playtime {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.game-title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  color: #f5efe3;
}

.game-desc {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  flex: 1 1 auto;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.card-btn-play {
  flex: 1 1 140px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-brass);
  color: #16130c;
  font-size: 13.5px;
  font-weight: 700;
  transition: background 0.16s ease;
}

.card-btn-play:hover,
.card-btn-play:focus-visible {
  background: #ebd09e;
  outline: none;
}

.card-btn-dl {
  flex: 1 1 150px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.card-btn-dl:hover,
.card-btn-dl:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  color: var(--text-primary);
  outline: none;
}

/* Teaser Card (Game 5 slot) */
.game-card.is-teaser {
  opacity: 0.82;
  background: linear-gradient(135deg, rgba(20, 24, 31, 0.92), rgba(15, 18, 24, 0.96));
  border-style: dashed;
  border-color: rgba(217, 184, 124, 0.24);
}

.game-card.is-teaser:hover {
  transform: none;
  border-color: rgba(217, 184, 124, 0.34);
}

@media (min-width: 768px) {
  .game-card.is-teaser.is-span-wide {
    grid-column: 1 / -1;
    flex-direction: row;
  }
  .game-card.is-teaser.is-span-wide .teaser-visual {
    width: 320px;
    flex-shrink: 0;
    border-bottom: 0;
    border-right: 1px solid var(--border-subtle);
  }
}

.teaser-visual {
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(217, 184, 124, 0.04) 0px,
      rgba(217, 184, 124, 0.04) 10px,
      transparent 10px,
      transparent 20px
    ),
    #10141a;
  border-bottom: 1px solid var(--border-subtle);
}

.teaser-stamp {
  padding: 4px 12px;
  border: 1.5px solid rgba(217, 184, 124, 0.45);
  border-radius: 4px;
  color: var(--accent-brass);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  transform: rotate(-3deg);
}

.teaser-substamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.card-btn-disabled {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 13px;
  cursor: default;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(23, 29, 37, 0.72);
  color: var(--text-secondary);
  font-size: 12.5px;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-btn.is-active {
  background: var(--accent-brass-dim);
  border-color: var(--accent-brass);
  color: var(--accent-brass);
  font-weight: 600;
}

/* Novels Grid */
.novels-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .novels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 1080px) {
  .novels-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

.novel-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  min-width: 0;
}

.novel-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.novel-cover-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0d1015;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

.novel-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.novel-card:hover .novel-cover {
  transform: scale(1.03);
}

.novel-cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--accent-brass);
  background: radial-gradient(circle at center, rgba(217, 184, 124, 0.14), #0e1116);
}

.novel-bookmark {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(12, 24, 24, 0.9);
  border: 1px solid var(--border-teal);
  color: var(--accent-teal);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.novel-body {
  padding: 15px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.novel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.novel-tag {
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 11px;
}

.novel-title {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  color: #f4ede0;
}

.novel-subtitle {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--accent-brass);
  line-height: 1.45;
}

.novel-blurb {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
}

.novel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.novel-stats {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.novel-read-cta {
  font-weight: 600;
  color: var(--accent-brass);
  white-space: nowrap;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-subtle);
  background: #080a0d;
  padding: 26px 0 32px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-brand {
  margin: 0 0 3px;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--text-primary);
}

.footer-meta {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-link {
  font-size: 13px;
  color: var(--accent-brass);
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}
