:root {
  --bg: #f4f5f0;
  --surface: #ffffff;
  --surface-alt: #eaece5;
  --text: #141c18;
  --muted: #435249;
  --primary: #0d684b;
  --primary-hover: #094d37;
  --primary-soft: #e3f1ec;
  --accent: #9a3412;
  --accent-soft: #fef3c7;
  --border: #cfd6d0;
  --stage-bg: #111916;
  --stage-ink: #edf2ef;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 28, 24, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 28, 24, 0.08);
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  max-width: 100%;
}

body.chromeless-body {
  background-color: var(--stage-bg);
  color: var(--stage-ink);
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 150ms ease;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.2;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 36px;
  font-weight: 700;
}

h2 {
  font-size: 28px;
  font-weight: 700;
  margin-top: 40px;
}

h3 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 28px;
}

p {
  margin: 0 0 16px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  background-color: var(--primary);
  color: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

.brand-link:hover {
  color: var(--primary);
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background-color: var(--primary);
  color: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-item {
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background-color 150ms ease, color 150ms ease;
}

.nav-item:hover {
  background-color: var(--primary-soft);
  color: var(--primary-hover);
}

.menu-toggle {
  display: none;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Reserved Ad Slots (Silent when empty) */
.gfs-ad-slot {
  max-width: 1120px;
  margin: 16px auto;
  padding: 0 20px;
  text-align: center;
}

.gfs-ad-slot:empty {
  display: none;
  margin: 0;
  padding: 0;
}

/* Main & Hero Player */
.site-main {
  padding: 24px 0 64px;
}

.hero-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background-color: var(--primary-soft);
  color: var(--primary-hover);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.hero-header h1 {
  margin-bottom: 4px;
}

.hero-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 65ch;
}

.spec-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.spec-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background-color: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
}

.player-shell {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 460px;
  background-color: var(--stage-bg);
  color: var(--stage-ink);
  overflow: hidden;
}

.player-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.player-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
}

.player-cover-card {
  position: relative;
  z-index: 2;
  max-width: 480px;
  width: 100%;
  background-color: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.cover-stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background-color: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.cover-headline {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 18px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 28px;
  background-color: var(--primary);
  color: var(--surface);
  border: 0;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: var(--surface);
  transform: translateY(-1px);
}

.cover-subnote {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.player-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  background-color: var(--stage-bg);
  color: var(--stage-ink);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.player-stage[data-gf-state="loading"] .player-loading {
  display: flex;
}

.reel-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--muted);
  border-top-color: var(--primary-soft);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background-color: var(--surface-alt);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.player-actions-left,
.player-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.btn-chip:hover {
  border-color: var(--primary);
  background-color: var(--primary-soft);
  color: var(--primary-hover);
}

.btn-chip[aria-pressed="true"],
.btn-chip[data-gf-liked] {
  background-color: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
}

.share-feedback {
  font-size: 13px;
  color: var(--primary-hover);
  font-weight: 600;
}

.ios-install-tip {
  margin: 0;
  padding: 12px 16px;
  background-color: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

/* Mode Strip & Hub Links */
.dossier-hub {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 32px 0 48px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, transform 150ms ease;
}

.hub-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  color: var(--text);
}

.hub-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.hub-card strong {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 6px;
  display: block;
}

.hub-card span.hub-desc {
  font-size: 14px;
  color: var(--muted);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Prose Article */
.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
  max-width: 100%;
}

.content-layout > *,
.hero-block,
.player-shell,
.side-rail {
  min-width: 0;
  max-width: 100%;
}

.dossier-prose {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
}

.dossier-prose code {
  overflow-wrap: anywhere;
}

.dossier-prose p,
.dossier-prose li {
  max-width: 70ch;
  font-size: 16px;
}

.dossier-prose ul,
.dossier-prose ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.dossier-prose li {
  margin-bottom: 8px;
}

.dossier-prose img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 24px 0;
}

.dossier-prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

.dossier-prose th,
.dossier-prose td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.dossier-prose th {
  background-color: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
}

.dossier-prose blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  background-color: var(--primary-soft);
  color: var(--primary-hover);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Sidebar Rail */
.side-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rail-box {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.rail-box h2,
.rail-box h3 {
  font-size: 18px;
  margin: 0 0 12px;
}

.rail-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-links a {
  font-size: 14px;
  font-weight: 600;
}

.tier-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tier-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background-color: var(--bg);
  border-radius: 6px;
  font-size: 13px;
}

.tier-row strong {
  font-family: var(--font-mono);
  color: var(--primary-hover);
}

/* Server-Rendered Archive / Spoiler Ledger */
.ledger-section {
  margin-top: 32px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}

.ledger-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background-color: var(--bg);
  overflow: hidden;
}

.ledger-item summary {
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ledger-item summary:hover {
  background-color: var(--primary-soft);
}

.ledger-body {
  padding: 16px 18px;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
}

/* FAQ Section */
.faq-section {
  margin-top: 40px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}

.faq-section h2 {
  margin-top: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq-item:last-child {
  border-bottom: 0;
}

.faq-item summary {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 70ch;
}

/* Comments Section */
.comments-section {
  margin-top: 40px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}

.comments-section h2 {
  margin-top: 0;
}

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

.form-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}

.reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--primary-soft);
  color: var(--primary-hover);
  border-radius: 6px;
  font-size: 14px;
}

.comment-list[data-gf-empty] .empty-comments {
  display: block;
}

.empty-comments {
  display: none;
  color: var(--muted);
  font-size: 14px;
  padding: 16px;
  background-color: var(--bg);
  border-radius: var(--radius);
}

.comment-card {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.comment-card[data-gf-owner] {
  background-color: var(--primary-soft);
  padding: 16px;
  border-radius: var(--radius);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 6px;
}

.owner-pill {
  font-size: 12px;
  font-weight: 700;
  background-color: var(--primary);
  color: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Footer */
.site-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col h3 {
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col a {
  font-size: 14px;
}

.footer-note {
  color: var(--muted);
  font-size: 14px;
  max-width: 48ch;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

/* Responsive Mobile Breakpoints */
@media (max-width: 900px) {
  .content-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .dossier-hub {
    grid-template-columns: minmax(0, 1fr);
  }
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 28px;
  }
  h2 {
    font-size: 22px;
  }
  .container {
    padding: 0 16px;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
  }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 12px;
  }
  .site-nav.is-open {
    display: flex;
  }
  .header-inner {
    flex-wrap: wrap;
    padding: 10px 0;
  }
  .player-stage {
    aspect-ratio: auto;
    min-height: 520px;
  }
  .player-cover-card {
    padding: 20px 16px;
  }
  .btn-primary {
    width: 100%;
  }
  .dossier-prose,
  .faq-section,
  .comments-section,
  .ledger-section {
    padding: 20px 16px;
  }
  .dossier-prose table {
    display: block;
    overflow-x: auto;
  }
}
