:root {
  --bg: #f7f1e8;
  --card: #fffaf2;
  --text: #2b2118;
  --muted: #6b5b4b;
  --primary: #c2562f;
  --primary-dark: #9e4220;
  --accent: #e0a03a;
  --border: #dfd3c2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .08);
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-head: "Fraunces", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0 0 12px;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: 36px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }

p {
  margin: 0 0 16px;
  max-width: 70ch;
}

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

a {
  color: var(--primary);
  text-underline-offset: 3px;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header & Navigation */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

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

.gf-site-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
}

.site-wordmark {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
}

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

.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 4px;
}

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

.site-main {
  padding: 24px 0 64px;
}

/* Footer */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--muted);
  font-size: 14px;
}

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

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

.footer-brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.footer-copy {
  color: var(--muted);
}

.footer-link {
  color: var(--primary);
  font-weight: 600;
}

.footer-note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #efe5d6;
  border-color: var(--muted);
}

.btn-play {
  padding: 12px 24px;
  font-size: 18px;
  box-shadow: var(--shadow-md);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

/* Hero & Player Stage */
.hero-stage {
  padding: 24px;
  margin-bottom: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  background-image:
    linear-gradient(to right, rgba(107, 91, 75, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(107, 91, 75, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  box-shadow: var(--shadow-sm);
}

.hero-head {
  margin-bottom: 16px;
}

.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.player-deck {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  gap: 16px;
  align-items: stretch;
}

.player-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #2b2118;
  box-shadow: var(--shadow-md);
}

.player-frame iframe,
.player-cover,
.player-loading {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-cover-action {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 33, 24, 0.32);
}

.btn-exit-fs {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 250, 242, 0.4);
  border-radius: var(--radius);
  background: rgba(43, 33, 24, 0.88);
  color: #fffaf2;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-exit-fs:hover {
  background: var(--primary);
  border-color: var(--primary);
}

[data-gf-fs="1"] {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
}


/* Loader */
.player-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: var(--text);
  color: var(--card);
  z-index: 10;
}

.sonar-loader {
  position: relative;
  width: 64px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sonar-track {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 250, 242, 0.25);
}

.sonar-ping {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: sonar-expand 2s ease-out infinite;
}

.sonar-ping-delayed {
  animation-delay: 1s;
}

.sonar-marker {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 86, 47, 0.35);
  animation: sonar-rise 2.4s ease-in-out infinite;
}

.loading-label {
  margin: 0;
  font-size: 14px;
  color: var(--card);
  text-align: center;
}

@keyframes sonar-expand {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

@keyframes sonar-rise {
  0% { transform: translateY(0); }
  100% { transform: translateY(-70px); }
}

/* Player Actions */
.player-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

[data-gf-like][data-gf-liked],
[data-gf-like][aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-gf-like][data-gf-liked]:hover,
[data-gf-like][aria-pressed="true"]:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.share-msg {
  font-size: 14px;
  color: var(--muted);
}

/* Depth Gauge */
.depth-gauge {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.gauge-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.gauge-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.gauge-scale {
  font-size: 12px;
  color: var(--muted);
}

.gauge-ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.gauge-ticks::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 64px;
  width: 1px;
  background: var(--border);
}

.gauge-tick {
  display: grid;
  grid-template-columns: 58px 14px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.25;
}

.gauge-depth {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.gauge-mark {
  display: block;
  width: 10px;
  height: 2px;
  background: var(--muted);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.gauge-tier {
  font-size: 12px;
  color: var(--text);
}

.gauge-tier-top .gauge-mark {
  background: var(--accent);
  height: 3px;
}

.gauge-tier-top .gauge-depth,
.gauge-tier-top .gauge-tier {
  color: var(--primary-dark);
  font-weight: 700;
}

.gauge-tier-bottom .gauge-mark {
  background: var(--primary);
  height: 3px;
}

.gauge-tier-bottom .gauge-depth,
.gauge-tier-bottom .gauge-tier {
  color: var(--text);
  font-weight: 700;
}

/* Prose & Markdown Content */
.home-body,
.faq-section,
.comments-section {
  margin-top: 56px;
}

.prose-content h2 {
  font-size: 28px;
  margin: 48px 0 16px;
}

.prose-content h2:first-child {
  margin-top: 0;
}

.prose-content h3 {
  font-size: 22px;
  margin: 32px 0 12px;
}

.prose-content p,
.prose-content li {
  max-width: 70ch;
}

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

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

.prose-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}

.prose-content th,
.prose-content td {
  padding: 10px 12px;
  border: 1px solid var(--text);
  text-align: left;
  vertical-align: top;
}

.prose-content th {
  background: var(--card);
  font-weight: 700;
}

.prose-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 24px 0;
}

/* FAQ */
.faq-section h2 {
  margin-bottom: 16px;
}

.faq-list {
  border-top: 1px solid var(--border);
}

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

.faq-item summary {
  cursor: pointer;
  padding: 16px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 20px;
  line-height: 1;
  color: var(--primary);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-a {
  padding: 0 16px 16px;
  color: var(--muted);
}

.faq-a p:last-child {
  margin-bottom: 0;
}

/* Comments */
.comments-head {
  margin-bottom: 20px;
}

.comments-invite {
  margin: 0;
  color: var(--muted);
}

.comment-form {
  padding: 20px;
  margin-bottom: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.reply-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
}

.comment-form[data-gf-replying] .reply-banner {
  display: flex;
}

.form-row {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.label-opt {
  font-weight: 400;
  color: var(--muted);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

.form-textarea {
  resize: vertical;
  min-height: 96px;
}

.form-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.comment-msg {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.comments-empty-note {
  display: none;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 15px;
}

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

.comment-item {
  padding: 16px;
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

[data-gf-owner] {
  border-left: 4px solid var(--accent);
}

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

.comment-author {
  color: var(--text);
  font-weight: 700;
}

.owner-badge {
  display: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

[data-gf-owner] > .comment-meta .owner-badge {
  display: inline-block;
}

.comment-time {
  font-size: 13px;
  color: var(--muted);
}

.comment-body {
  margin: 0 0 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-foot {
  display: flex;
  align-items: center;
}

.comment-replies {
  margin-top: 12px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.comment-replies:empty {
  display: none;
}

/* Legal Page */
.legal-page {
  margin-top: 16px;
}

.legal-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.legal-header h1 {
  margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
  h1 {
    font-size: 32px;
  }

  .hero-stage {
    padding: 16px;
  }

  .player-deck {
    grid-template-columns: 1fr;
  }

  .player-frame {
    aspect-ratio: 3 / 4;
  }

  .btn {
    width: 100%;
  }

  .depth-gauge {
    padding: 8px 12px;
  }

  .gauge-header {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 6px;
    margin-bottom: 6px;
  }

  .gauge-ticks {
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }

  .gauge-ticks::before {
    top: auto;
    bottom: 6px;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
  }

  .gauge-tick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .gauge-mark {
    width: 2px;
    height: 8px;
  }

  .gauge-tier {
    display: none;
  }

  .prose-content table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 8px 16px;
    padding-top: 12px;
    padding-bottom: 8px;
  }

  .site-wordmark {
    white-space: nowrap;
    font-size: 18px;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 16px;
  }

  .site-nav a {
    white-space: nowrap;
    font-size: 14px;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .footer-top {
    flex-wrap: wrap;
  }
}
