/* ═══════════════════════════════════════════════════════════════
   Companion Workbook — Interactive Web/Mobile Edition
   Phone-first long-scroll, optimized for WebView embed
   Matches survival-guide-web.css design system
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Poppins:wght@300;400;500;600;700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

/* ── Brand tokens ── */
:root {
  --sage-dark:  #2F3A2C;
  --sage:       #4A5A45;
  --sage-mid:   #7C8C75;
  --sage-light: #A8B5A0;
  --cream:      #F6F1E6;
  --cream-dark: #EDE5D3;
  --gold:       #B8935A;
  --gold-light: #D4B88A;
  --ivory:      #FBF8F1;
  --white:      #FFFFFF;
  --ink:        #2F3A2C;
  --ink-2:      #5A6A55;

  --ff-display: 'Playfair Display', Georgia, serif;
  --ff-body:    'Poppins', system-ui, sans-serif;
  --ff-prose:   'Lora', Georgia, serif;

  --radius:     12px;
  --radius-sm:  8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ── Progress bar ── */
.progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cream-dark);
  z-index: 1000;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.15s ease-out;
}

/* ── Sticky header ── */
.top-header {
  position: sticky;
  top: 3px;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(251, 248, 241, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(124, 140, 117, 0.15);
}
.top-header .mark img { height: 28px; width: auto; }
.title-block { text-align: center; }
.eyebrow-mini {
  display: block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--sage-mid);
}
.title-mini {
  display: block;
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--sage-dark);
}

/* ── Hero ── */
.hero {
  background: linear-gradient(170deg, var(--sage-dark) 0%, var(--sage) 100%);
  padding: 72px 24px 48px;
  text-align: center;
  color: var(--cream);
}
.hero .brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold-light);
}
.hero .rule {
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
}
.hero h1 {
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}
.hero h1 em { font-style: italic; color: var(--gold-light); }
.hero .lede {
  font-family: var(--ff-prose);
  font-size: 15px;
  line-height: 1.7;
  color: rgba(246, 241, 230, 0.85);
  max-width: 420px;
  margin: 0 auto 20px;
}
.hero .meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--sage-light);
}
.hero .meta .dot {
  width: 4px; height: 4px;
  background: var(--gold);
  border-radius: 50%;
  align-self: center;
}

/* ── TOC ── */
.toc-fab {
  position: fixed;
  bottom: 24px; right: 16px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--sage-dark);
  color: var(--cream);
  font-size: 20px;
  border: none;
  cursor: pointer;
  z-index: 800;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.toc-drawer {
  position: fixed;
  top: 0; right: -300px; bottom: 0;
  width: 280px;
  background: var(--ivory);
  z-index: 950;
  transition: right 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  overflow-y: auto;
  padding: 20px;
}
.toc-drawer.open { right: 0; }
.toc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.toc-label {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--sage-dark);
}
.toc-close {
  width: 32px; height: 32px;
  background: none; border: none;
  font-size: 18px;
  color: var(--sage-mid);
  cursor: pointer;
}
.toc-list {
  list-style: none;
  padding: 0;
}
.toc-list li { margin-bottom: 4px; }
.toc-list a {
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--sage-dark);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.toc-list a:active { background: var(--cream-dark); }

/* ── Sections ── */
.section {
  padding: 40px 20px;
  border-bottom: 1px solid var(--cream-dark);
}
.section-inner {
  max-width: 540px;
  margin: 0 auto;
}

/* ── Eyebrow / Week badge ── */
.eyebrow {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 8px;
}
.week-badge {
  display: inline-block;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--white);
  background: var(--sage);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

/* ── Headings ── */
h2 {
  font-family: var(--ff-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--sage-dark);
  line-height: 1.2;
  margin-bottom: 8px;
}
h2 em { font-style: italic; color: var(--sage-mid); }
h3 {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--sage-dark);
  margin: 28px 0 12px;
}
.rule-gold {
  width: 40px;
  height: 3px;
  background: var(--gold);
  border: none;
  margin-bottom: 20px;
  border-radius: 2px;
}

/* ── Body text ── */
p {
  font-family: var(--ff-prose);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.hint {
  font-size: 13px;
  color: var(--ink-2);
  font-style: italic;
  margin-bottom: 10px;
}

/* ── Inline quote ── */
.inline-quote {
  font-family: var(--ff-prose);
  font-style: italic;
  font-size: 15px;
  color: var(--sage);
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  margin: 16px 0 20px;
  background: rgba(184, 147, 90, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.6;
}

/* ── Pullquote ── */
.pullquote {
  font-family: var(--ff-display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--sage-dark);
  text-align: center;
  padding: 24px 16px;
  margin: 24px 0;
  border-top: 1px solid var(--cream-dark);
  border-bottom: 1px solid var(--cream-dark);
}

/* ── How-to grid ── */
.how-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
.how-card {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.how-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.how-card h4 {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--sage-dark);
  margin-bottom: 6px;
}
.how-card p { font-size: 13px; margin-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════
   INTERACTIVE ELEMENTS
   ═══════════════════════════════════════════════════════════════ */

/* ── Prompt groups (label + textarea/input) ── */
.prompt-group {
  margin-bottom: 20px;
}
.prompt-label {
  display: block;
  font-family: var(--ff-prose);
  font-weight: 600;
  font-size: 14px;
  color: var(--sage-dark);
  margin-bottom: 8px;
  line-height: 1.4;
}

/* ── Textarea ── */
.wb-textarea {
  display: block;
  width: 100%;
  font-family: var(--ff-prose);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.wb-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.15);
}
.wb-textarea::placeholder {
  color: var(--sage-light);
  font-style: italic;
}

/* ── Text input ── */
.wb-input {
  display: block;
  width: 100%;
  font-family: var(--ff-prose);
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--cream-dark);
  border-bottom: 2px solid var(--sage-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.wb-input:focus {
  outline: none;
  border-color: var(--gold);
  border-bottom-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 147, 90, 0.15);
}
.wb-input::placeholder { color: var(--sage-light); }

/* ── Commitment card ── */
.commitment-card {
  background: var(--white);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-top: 24px;
}
.commitment-card h4 {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--sage-dark);
  margin-bottom: 12px;
}
.commitment-card p {
  font-family: var(--ff-prose);
  font-style: italic;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
  margin-bottom: 20px;
}
.sign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.sign-field { display: flex; flex-direction: column; }
.sign-input {
  border: none !important;
  border-bottom: 2px solid var(--sage-mid) !important;
  border-radius: 0 !important;
  padding: 8px 4px !important;
  background: transparent !important;
  font-size: 15px !important;
}
.sign-input:focus { border-bottom-color: var(--gold) !important; box-shadow: none !important; }
.sign-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--sage-mid);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Checklists ── */
.wb-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px dashed var(--cream-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.check-item:active { background: rgba(184, 147, 90, 0.06); }
.check-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.check-item .check-box {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 2px solid var(--sage-mid);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  margin-top: 1px;
}
.check-item .check-box::after {
  content: '';
  display: none;
  width: 6px; height: 11px;
  border: solid var(--white);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.check-item input:checked ~ .check-box {
  background: var(--gold);
  border-color: var(--gold);
}
.check-item input:checked ~ .check-box::after { display: block; }
.check-item.checked span:last-child {
  color: var(--sage-mid);
  text-decoration: line-through;
  text-decoration-color: var(--sage-light);
}
.check-item span:last-child {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  transition: color 0.2s;
}

/* ── Tables ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
}
.wb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
}
.wb-table thead th {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sage);
  background: var(--cream);
  padding: 10px 8px;
  text-align: left;
  border-bottom: 2px solid var(--cream-dark);
}
.wb-table tbody td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--cream-dark);
  vertical-align: middle;
}
.wb-table .row-label {
  font-weight: 500;
  color: var(--sage-dark);
  white-space: nowrap;
  font-size: 13px;
  padding-right: 8px;
}
.wb-table .total-row td {
  border-top: 2px solid var(--sage-mid);
  font-weight: 600;
  color: var(--sage-dark);
}
.col-check { width: 52px; text-align: center; }
.col-cost { width: 80px; }
.col-sm { width: 70px; }
.col-day { width: 100px; }

/* Table cell inputs */
.cell-input {
  width: 100%;
  font-family: var(--ff-prose);
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--cream-dark);
  padding: 6px 4px;
  -webkit-appearance: none;
}
.cell-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
}
.cell-input::placeholder { color: var(--sage-light); font-size: 13px; }
.cell-cost { text-align: right; }

/* Table checkboxes */
.wb-table input[type="checkbox"],
.col-check input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Metric labels in snapshot table */
.metric-label {
  font-weight: 500;
  color: var(--sage-dark);
  font-size: 13px;
  line-height: 1.4;
}
.day30 { background: rgba(184, 147, 90, 0.08); }

/* ── Confidence rating ── */
.confidence-list {
  margin-bottom: 24px;
}
.conf-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--cream-dark);
}
.conf-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--sage-dark);
  margin-bottom: 8px;
}
.rating {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.dot-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--sage-light);
  background: var(--white);
  color: var(--sage-mid);
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.dot-btn:active { transform: scale(0.9); }
.dot-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
}
.conf-notes {
  font-size: 13px !important;
  border: none !important;
  border-bottom: 1px dashed var(--cream-dark) !important;
  padding: 6px 0 !important;
}

/* ── Scorecards ── */
.scorecard {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
}
.scorecard thead th {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--white);
  background: var(--sage-dark);
  padding: 8px 4px;
  text-align: center;
  min-width: 32px;
}
.scorecard tbody td {
  padding: 4px 2px;
  border: 1px solid var(--cream-dark);
  text-align: center;
  vertical-align: middle;
}
.scorecard .row-label {
  font-weight: 600;
  color: var(--sage-dark);
  text-align: left;
  padding-left: 8px;
  white-space: nowrap;
  background: var(--cream);
}
.scorecard .col-total,
.scorecard .col-sub {
  background: var(--cream);
  font-weight: 700;
  color: var(--sage-dark);
  min-width: 42px;
}
.scorecard .col-sub { background: rgba(184, 147, 90, 0.1); }
.auto-total { font-weight: 700; color: var(--gold); }

.score-input {
  width: 100%;
  max-width: 36px;
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  background: transparent;
  border: none;
  padding: 6px 2px;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}
.score-input:focus {
  outline: none;
  background: rgba(184, 147, 90, 0.1);
  border-radius: 4px;
}
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 18-hole scorecard adjustments */
.scorecard-18 thead th { font-size: 10px; padding: 6px 2px; min-width: 26px; }
.scorecard-18 .score-input { max-width: 28px; font-size: 13px; }

/* ── Round meta grid ── */
.round-title {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 2px solid var(--cream-dark);
}
.round-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.rm-field { display: flex; flex-direction: column; }
.rm-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sage-mid);
  margin-bottom: 4px;
}

/* ── CTA section ── */
.cta-section {
  background: linear-gradient(170deg, var(--sage-dark) 0%, var(--sage) 100%);
  color: var(--cream);
  border-bottom: none;
}
.cta-section .brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold-light);
}
.cta-section .rule {
  display: inline-block;
  width: 32px; height: 1px;
  background: var(--gold);
  opacity: 0.5;
}
.cta-section h2 {
  color: var(--cream);
  text-align: center;
  font-size: 28px;
  margin-bottom: 16px;
}
.cta-section h2 em { color: var(--gold-light); }
.cta-section .lede {
  font-family: var(--ff-prose);
  font-size: 15px;
  line-height: 1.7;
  color: rgba(246, 241, 230, 0.85);
  text-align: center;
  max-width: 440px;
  margin: 0 auto 28px;
}

.cta-card {
  display: flex;
  gap: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.cta-mark img { width: 44px; height: auto; }
.cta-card .eyebrow { color: var(--gold-light); margin-bottom: 4px; }
.cta-card h3 {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 8px;
}
.cta-card p {
  font-size: 13px;
  color: rgba(246, 241, 230, 0.8);
  margin-bottom: 0;
}

.cta-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.feat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--cream);
}
.check-icon {
  color: var(--gold);
  font-weight: 700;
  font-size: 16px;
}

.cta-social {
  text-align: center;
  font-size: 14px;
  color: rgba(246, 241, 230, 0.8);
  line-height: 1.6;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}
.cta-social strong { color: var(--cream); }

.signoff {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.signoff em {
  font-family: var(--ff-prose);
  font-size: 15px;
  color: rgba(246, 241, 230, 0.85);
  line-height: 1.7;
  display: block;
  margin-bottom: 20px;
}
.signoff-name {
  font-size: 14px;
  color: var(--cream);
  line-height: 1.6;
}
.signoff-name strong {
  font-size: 16px;
  letter-spacing: 1px;
}
.signoff-title {
  font-size: 10px;
  color: rgba(246, 241, 230, 0.5);
  letter-spacing: 1.5px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (700px+)
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 700px) {
  .section { padding: 56px 32px; }
  .hero { padding: 88px 32px 56px; }
  .hero h1 { font-size: 40px; }
  h2 { font-size: 30px; }
  .how-grid { grid-template-columns: 1fr 1fr 1fr; }
  .wb-textarea { font-size: 16px; }
  .scorecard thead th { min-width: 38px; }
  .scorecard-18 thead th { min-width: 30px; }
}
