/* ==========================================================================
   UNITE Friend Challenge — "Dear Life" theme
   Warm paper cream base / hand-drawn ink lines / bold flat spot colors
   (deep green, mustard, tomato, pink) inspired by the design samples.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@700;900&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
  /* paper & ink */
  --cream: #faf5ea;
  --paper: #fffdf6;
  --ink: #201d17;
  --gray-text: #6f6a5c;

  /* spot colors */
  --green: #2f6b4f;
  --green-deep: #24523c;
  --yellow: #f0b53c;
  --tomato: #e8552f;
  --pink: #ef9ebc;
  --sage: #8fa98a;

  /* legacy variable names → remapped to the new palette so every page
     restyles without markup changes */
  --white: var(--paper);
  --gray-soft: #f1ead9;
  --gray-line: #e0d6bd;
  --navy: var(--green-deep);
  --orange: var(--tomato);
  --orange-soft: #f9dccd;
  --pink-soft: #fadfe9;
  --blue-soft: #dfe9dc;
  --green-soft: #d9e6d5;
  --purple-soft: #e6e2ef;
  --navy-soft: #dbe2da;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --shadow-card: 4px 4px 0 rgba(32, 29, 23, 0.9);
  --shadow-soft: 0 2px 10px rgba(32, 29, 23, 0.08);

  --font-sans: "Noto Sans JP", -apple-system, BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo",
    system-ui, sans-serif;
  --font-display: "Zen Maru Gothic", var(--font-sans);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 82px; /* space for bottom tab bar */
}

body.no-tabbar { padding-bottom: 0; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.005em;
  line-height: 1.4;
}

p { margin: 0; }

.container { max-width: 480px; margin: 0 auto; padding: 0 20px; }

/* marker-highlight on section headings (user pages only) */
body:not(.admin-body) main h2 {
  width: fit-content;
  background-image: linear-gradient(transparent 64%, rgba(240, 181, 60, 0.55) 64%, rgba(240, 181, 60, 0.55) 92%, transparent 92%);
  padding-right: 4px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 245, 234, 0.94);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 2px solid var(--ink);
}
.topbar-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
}
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--tomato);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.topbar-back { font-size: 0.9rem; color: var(--gray-text); padding: 4px 0; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  display: flex;
  justify-content: space-around;
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 2px 5px;
  font-size: 0.66rem;
  color: var(--gray-text);
  border-radius: var(--radius-sm);
  position: relative;
  transition: transform .15s ease;
}
.tabbar a:active { transform: scale(0.92); }
.tabbar a.active { color: var(--ink); font-weight: 700; }
.tabbar a.active::after {
  content: "";
  position: absolute;
  top: -2px; left: 22%; right: 22%;
  height: 4px;
  background: var(--tomato);
  border-radius: 0 0 4px 4px;
}
.tabbar svg { width: 21px; height: 21px; }

/* ---------- Buttons — sticker style ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .13s ease, box-shadow .13s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--ink); color: var(--cream); box-shadow: 3px 3px 0 rgba(32,29,23,0.35); }
.btn-accent { background: var(--tomato); color: #fff; }
.btn-outline { background: var(--paper); color: var(--ink); }
.btn-ghost { background: var(--gray-soft); color: var(--ink); box-shadow: none; border-width: 2px; }
.btn-ghost:hover { transform: none; box-shadow: none; background: #eadfc6; }
.btn-ghost:active { transform: scale(.98); }
.btn-sm { padding: 10px 16px; font-size: 0.85rem; width: auto; }
.btn-block-group { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Cards — paper stickers ---------- */
.card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }
.card-soft {
  background: var(--gray-soft);
  border: 2px solid var(--ink);
  box-shadow: none;
}
/* a hint of hand-placed tilt (user pages only) */
body:not(.admin-body) .card:nth-of-type(even) { transform: rotate(0.35deg); }
body:not(.admin-body) .card:nth-of-type(odd) { transform: rotate(-0.3deg); }

/* ---------- Section ---------- */
.section { padding-top: 30px; padding-bottom: 30px; }
.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tomato);
  margin-bottom: 8px;
}
.hero-title { font-size: 1.85rem; line-height: 1.4; }
.hero-sub { margin-top: 12px; color: var(--gray-text); font-size: 0.97rem; }
.muted { color: var(--gray-text); }
.small { font-size: 0.82rem; }
.center { text-align: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.87rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.field .hint { font-size: 0.78rem; color: var(--gray-text); margin-top: 6px; }
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  box-shadow: 3px 3px 0 var(--yellow);
}
.field textarea { resize: none; min-height: 70px; }

.radio-pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill span {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform .12s ease;
}
.radio-pill span:active { transform: scale(0.95); }
.radio-pill input:checked + span {
  background: var(--ink); color: var(--cream);
  box-shadow: 2px 2px 0 var(--yellow);
}

/* ---------- Quiz ---------- */
.quiz-progress {
  height: 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 22px;
}
.quiz-progress-bar {
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--tomato) 0 8px, #f0764f 8px 16px);
  border-radius: 999px;
  transition: width .35s cubic-bezier(.6,1.6,.4,1);
}
.quiz-q-num { font-size: 0.8rem; color: var(--gray-text); font-weight: 700; margin-bottom: 8px; }
.quiz-q-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 20px;
  line-height: 1.55;
}
.quiz-option {
  display: block;
  padding: 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(32,29,23,0.85);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.quiz-option:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(32,29,23,0.85); }
.quiz-option:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(32,29,23,0.85); }
.quiz-option.selected { background: var(--yellow); }
.quiz-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px; height: 27px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 900;
  margin-right: 10px;
}
.quiz-option.selected .quiz-option-letter { background: var(--ink); color: var(--cream); }

/* ---------- Progress bar (challenge) ---------- */
.progress-track {
  height: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--green) 0 8px, #3d7f61 8px 16px);
  border-radius: 999px;
  transition: width .5s cubic-bezier(.6,1.4,.4,1);
}

/* ---------- Checklist ---------- */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 2px dashed var(--gray-line);
  font-size: 0.9rem;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.checklist-item input[type="checkbox"]:checked {
  background: var(--green);
  transform: rotate(-4deg);
}
.checklist-item input[type="checkbox"]:checked::after {
  content: "✓";
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
}
.checklist-item.done span { color: var(--gray-text); text-decoration: line-through; }

/* ---------- Badges / tags ---------- */
.tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--gray-soft);
}
.tag-outline { background: var(--paper); }

/* ---------- Week accordion ---------- */
.week-card { padding: 0; overflow: hidden; }
.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
}
.week-head-left { display: flex; align-items: center; gap: 12px; }
.week-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--gray-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 900; font-size: 0.85rem;
  flex-shrink: 0;
}
.week-card.complete .week-num { background: var(--green); color: #fff; }
.week-title { font-family: var(--font-display); font-weight: 900; font-size: 0.95rem; }
.week-sub { font-size: 0.78rem; color: var(--gray-text); }
.week-chevron { transition: transform .2s ease; color: var(--gray-text); }
.week-card.open .week-chevron { transform: rotate(180deg); }
.week-body { display: none; padding: 0 20px 20px; border-top: 2px dashed var(--gray-line); }
.week-card.open .week-body { display: block; padding-top: 16px; }

/* ---------- Result page ---------- */
.result-hero { text-align: center; padding: 36px 0 20px; }
.result-char-wrap {
  width: 172px; height: 172px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  box-shadow: 5px 5px 0 rgba(32,29,23,0.85);
  display: flex; align-items: center; justify-content: center;
  animation: fx-bob 3.2s ease-in-out infinite;
}
@keyframes fx-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1.2deg); }
}
.result-type-name {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
}
.result-type-jp { font-size: 1.05rem; color: var(--gray-text); margin-top: 4px; }
.result-catch {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.7;
}
.strength-list, .caution-list { margin: 0; padding: 0; list-style: none; }
.strength-list li, .caution-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.strength-list li::before {
  content: "";
  position: absolute; left: 0; top: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--tomato);
  border: 1.5px solid var(--ink);
}
.caution-list li::before {
  content: "";
  position: absolute; left: 0; top: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--sage);
  border: 1.5px solid var(--ink);
}
.verse-box {
  background: var(--green-deep);
  color: var(--cream);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.verse-box::before {
  content: "”";
  position: absolute;
  top: -14px; left: 10px;
  font-family: Georgia, serif;
  font-size: 5rem;
  color: rgba(250, 245, 234, 0.14);
}
.verse-text { font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.9; }
.verse-ref { margin-top: 10px; font-size: 0.8rem; color: rgba(250,245,234,0.65); }

/* ---------- Character illustration frame ---------- */
.char-frame {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
}

/* ---------- Type chip ---------- */
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
}
.type-chip .dot { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.type-chip .dot svg { width: 11px; height: 11px; }

/* ---------- Resource card ---------- */
.resource-card .r-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 900; }
.resource-card .r-target { margin-top: 10px; }
.resource-caution {
  margin-top: 12px;
  background: var(--orange-soft);
  border: 1.5px dashed var(--tomato);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.8rem;
  color: #8c3415;
}
.resource-link {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  padding: 9px 18px;
  background: var(--tomato);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .13s ease, box-shadow .13s ease;
}
.resource-link:active { transform: scale(.97); }

/* Resource icon badge */
.resource-card .r-head { display: flex; align-items: center; gap: 12px; }
.r-icon {
  width: 52px;
  height: 52px;
  flex: none;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 rgba(32, 29, 23, 0.9);
}
.r-icon img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.r-icon .r-initial {
  display: none;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--ink);
}
.r-icon.fallback img { display: none; }
.r-icon.fallback .r-initial { display: block; }
.r-icon-emoji { font-size: 1.6rem; }
.resource-card .r-titles { min-width: 0; }
.resource-card .r-sub { font-size: 0.7rem; color: var(--gray-text); margin-top: 2px; }

/* ---------- Notice / privacy box ---------- */
.notice-box {
  background: var(--gray-soft);
  border: 2px dashed var(--ink);
  border-radius: var(--radius-md);
  padding: 18px;
  font-size: 0.85rem;
}
.notice-box ul { margin: 8px 0 0; padding-left: 18px; }
.notice-box li { margin-bottom: 6px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-text); }

/* ---------- Squiggle divider & floating deco ---------- */
.squiggle { display: block; margin: 6px auto; width: 90px; color: var(--ink); }
.deco-float { position: absolute; pointer-events: none; }
.fx-floaty { animation: fx-floaty 4.5s ease-in-out infinite; }
.fx-floaty2 { animation: fx-floaty 5.6s ease-in-out .8s infinite; }
@keyframes fx-floaty {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-9px) rotate(4deg); }
}

/* hero image block */
.hero-img-wrap { position: relative; margin: 18px 20px 0; }
.hero-img-wrap img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 2.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(32,29,23,0.9);
  display: block;
}

/* ---------- Scroll reveal (added by fx.js) ---------- */
.fx-hidden { opacity: 0; transform: translateY(16px); }
.fx-in { opacity: 1; transform: none; transition: opacity .55s ease, transform .55s cubic-bezier(.5,1.4,.4,1); }
@media (prefers-reduced-motion: reduce) {
  .fx-hidden { opacity: 1; transform: none; }
  .result-char-wrap, .fx-floaty, .fx-floaty2 { animation: none; }
}

/* ---------- Confetti (spawned by fx.js) ---------- */
.fx-confetti {
  position: fixed;
  width: 10px; height: 14px;
  z-index: 90;
  pointer-events: none;
  border-radius: 2px;
}

/* ---------- Admin (kept business-like, warm paper tone) ---------- */
.admin-body { padding-bottom: 40px; max-width: none; background: var(--cream); }
.admin-shell { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.admin-header { border-bottom: 2px solid var(--ink); background: var(--green-deep); color: var(--cream); }
.admin-header-inner {
  max-width: 1080px; margin: 0 auto; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.admin-nav { display: flex; gap: 16px; font-size: 0.85rem; }
.admin-nav a { opacity: 0.75; }
.admin-nav a.active { opacity: 1; font-weight: 700; border-bottom: 2px solid var(--yellow); padding-bottom: 2px; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 16px;
}
.stat-num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 900; }
.stat-label { font-size: 0.78rem; color: var(--gray-text); margin-top: 2px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.78rem; }
.bar-row .bar-label { width: 84px; flex-shrink: 0; color: var(--gray-text); }
.bar-row .bar-track { flex: 1; height: 9px; background: var(--gray-soft); border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar-row .bar-fill { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.bar-row .bar-num { width: 30px; text-align: right; flex-shrink: 0; font-weight: 700; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-bar select, .filter-bar input {
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--paper);
}

.table-wrap { overflow-x: auto; border: 2px solid var(--ink); border-radius: var(--radius-md); background: var(--paper); }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; white-space: nowrap; }
table.admin-table th, table.admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-line); }
table.admin-table th { background: var(--gray-soft); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-text); }
table.admin-table tr:last-child td { border-bottom: none; }

.privacy-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem; color: var(--gray-text);
  background: var(--gray-soft);
  border: 1.5px dashed var(--ink);
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.group-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 14px; }
.group-member-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--gray-line); font-size: 0.82rem; }
.group-member-row:last-child { border-bottom: none; }
.group-member-row select { font-size: 0.75rem; padding: 4px 6px; border-radius: 6px; border: 1.5px solid var(--ink); background: var(--paper); }

@media (min-width: 860px) {
  body:not(.admin-body) { display: flex; justify-content: center; background: #efe7d3; }
  body:not(.admin-body) > .app-shell { background: var(--cream); min-height: 100vh; width: 480px; box-shadow: var(--shadow-soft); }
}

/* ==========================================================================
   Rebrand layer — one accent color per page, editorial motion (2026)
   ========================================================================== */

/* ---------- per-page accent (set via <body data-accent="...">) ---------- */
body {
  --accent: var(--yellow);
  --accent-deep: #8a610d;
  --accent-marker: rgba(240, 181, 60, 0.55);
  --accent-soft: #f8ecc9;
}
body[data-accent="green"] { --accent: var(--green); --accent-deep: var(--green-deep); --accent-marker: rgba(47,107,79,.28); --accent-soft: #dbe7d8; }
body[data-accent="tomato"] { --accent: var(--tomato); --accent-deep: #a33517; --accent-marker: rgba(232,85,47,.30); --accent-soft: #f8dcd0; }
body[data-accent="pink"] { --accent: var(--pink); --accent-deep: #a84a71; --accent-marker: rgba(239,158,188,.5); --accent-soft: #fadfe9; }
body[data-accent="sage"] { --accent: var(--sage); --accent-deep: #4c614a; --accent-marker: rgba(143,169,138,.45); --accent-soft: #e2e9df; }

body:not(.admin-body) main h2 {
  background-image: linear-gradient(transparent 64%, var(--accent-marker) 64%, var(--accent-marker) 92%, transparent 92%);
}
.eyebrow { color: var(--accent-deep); }
.brand-dot { background: var(--accent); }
.tabbar a.active::after { background: var(--accent); }
.quiz-option.selected { background: var(--accent-soft); }
.quiz-option.selected .quiz-option-letter { background: var(--accent); border-color: var(--ink); color: var(--ink); }

/* ---------- page-to-page morph (View Transitions API, MPA) ---------- */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: fx-vt-out .16s ease both; }
  ::view-transition-new(root) { animation: fx-vt-in .3s cubic-bezier(.3,1.25,.4,1) both; }
}
@keyframes fx-vt-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes fx-vt-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- marquee band ---------- */
.marquee {
  overflow: hidden;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  user-select: none;
}
.marquee-track {
  display: flex;
  gap: 34px;
  width: max-content;
  padding: 9px 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  white-space: nowrap;
  animation: fx-marquee 22s linear infinite;
}
.marquee-track span { display: inline-flex; align-items: center; gap: 34px; }
.marquee-track .mq-dot { color: var(--accent-deep); }
@keyframes fx-marquee { to { transform: translateX(-50%); } }

/* ---------- rotating sticker badge ---------- */
.spin-badge {
  position: absolute;
  width: 92px; height: 92px;
  animation: fx-spin 16s linear infinite;
  filter: drop-shadow(2px 2px 0 rgba(32,29,23,.7));
}
@keyframes fx-spin { to { transform: rotate(360deg); } }

/* ---------- hero scene: characters on a color band ---------- */
.hero2 { position: relative; padding-top: 26px; text-align: center; }
.hero2 .hero-sub { margin-left: auto; margin-right: auto; }
.hero-scene { margin-top: 6px; }
.hero-scene svg { width: 100%; height: auto; display: block; }

/* hand-drawing line animation */
@media (prefers-reduced-motion: no-preference) {
  .hero-scene .draw {
    stroke-dasharray: 620;
    stroke-dashoffset: 620;
    animation: fx-draw 1.4s cubic-bezier(.5,0,.3,1) forwards;
  }
  .hero-scene .fill-in { opacity: 0; animation: fx-fadein .55s ease forwards; }
}
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
@keyframes fx-fadein { to { opacity: 1; } }

/* tilted poster (the tufted logo) */
.poster-card {
  transform: rotate(-1.6deg);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 6px 6px 0 rgba(32,29,23,.9);
  overflow: hidden;
  transition: transform .5s cubic-bezier(.3,1.6,.4,1);
}
.poster-card:hover { transform: rotate(0.4deg) scale(1.015); }
.poster-card img { display: block; width: 100%; }

/* ---------- scroll-driven parallax (2026: pure CSS scroll timeline) ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .fx-parallax {
      animation: fx-par linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }
  }
}
@keyframes fx-par {
  from { transform: translateY(22px) rotate(-2deg); }
  to { transform: translateY(-22px) rotate(3deg); }
}
.hero-scene { position: relative; }
.hero-scene svg.spin-badge { width: 92px; height: 92px; }

/* ---------- window wall (from the poster reference) ---------- */
.window-wall {
  background: var(--green-deep);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 18px 26px;
}
.window-wall h2, .window-wall .ww-title {
  background-image: none !important;
  color: var(--cream);
  font-size: 1.15rem;
}
.ww-eyebrow {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--yellow);
  margin-bottom: 6px;
}
.ww-sub { margin-top: 8px; font-size: 0.8rem; color: rgba(250,245,234,0.75); }
.window-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
  margin-top: 18px;
}
.window {
  display: block;
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 64px 64px 10px 10px;
  padding: 7px;
  margin-bottom: 8px; /* room for the sill */
  box-shadow: 3px 4px 0 rgba(15, 32, 24, 0.55);
  transition: transform .3s cubic-bezier(.3,1.6,.4,1);
}
.window:hover { transform: translateY(-4px) rotate(-0.6deg); }
.window::after { /* sill */
  content: "";
  position: absolute;
  left: -9px; right: -9px; bottom: -10px;
  height: 9px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 3px;
}
.window-pane {
  background: #f8dbe7;
  border: 2px solid var(--ink);
  border-radius: 56px 56px 6px 6px;
  padding: 14px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 128px;
}
.window-pane svg { width: 72%; height: auto; }
.window-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.78rem;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 1px 11px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.window-sub { font-size: 0.64rem; font-weight: 700; color: #a84a71; }
.window { display: flex; flex-direction: column; }
.window-pane { flex: 1; justify-content: flex-end; }
@media (prefers-reduced-motion: no-preference) {
  .char-pop {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: fx-pop .8s cubic-bezier(.3,1.6,.4,1) both;
  }
}
@keyframes fx-pop { from { opacity: 0; transform: translateY(14px) scale(.85); } }
