:root {
  --cocoa: #2b1a12;
  --cocoa-2: #3d2619;
  --cream: #f6eedf;
  --paper: #fbf6ec;
  --sand: #eadcc4;
  --ochre: #c8902e;
  --ochre-dark: #9a6a17;
  --terra: #b4532a;
  --forest: #3e5a3a;
  --ink: #2b1a12;
  --muted: #6e5848;
  --line: #e0d0b6;
  --font-display: 'Zodiak', 'Georgia', serif;
  --font-body: 'General Sans', 'Inter', system-ui, sans-serif;
  --r: 16px;
  --tab-h: 68px;
  --shadow: 0 1px 2px rgba(43,26,18,.06), 0 8px 24px rgba(43,26,18,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cocoa);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--terra); }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; border-radius: 6px; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--paper);
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,.35);
}
@media (min-width: 700px) {
  body { background: var(--cocoa) repeating-linear-gradient(90deg, transparent 0 46px, rgba(200,144,46,.08) 46px 48px, transparent 48px 60px, rgba(180,83,42,.07) 60px 62px); }
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--cocoa); color: var(--cream);
}
.brand { background: none; border: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--cream); padding: 4px 0; letter-spacing: .01em; }
.brand span { color: var(--ochre); }
.help-btn {
  background: var(--terra); color: #fff; border: 0; border-radius: 999px;
  padding: 8px 14px; font-weight: 600; font-size: 14px;
}

main { padding: 0 0 calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); outline: none; }

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--cream); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  background: none; border: 0; padding: 8px 0 10px; min-height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 500; color: var(--muted);
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--terra); }
.tabbar button[aria-current="page"] svg { stroke-width: 2.2; }

/* Layout pieces */
.pad { padding: 20px 18px; }
.stack > * + * { margin-top: 14px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--terra); margin: 0; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.h-display { font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: -.01em; }
.h-section { font-size: 20px; font-weight: 600; }
.h-card { font-size: 18px; font-weight: 600; }
.lead { font-size: 17px; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 22px; min-height: 48px;
  font-weight: 600; font-size: 16px; background: var(--cocoa); color: var(--cream);
  text-decoration: none; transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--terra); color: #fff; }
.btn.gold { background: var(--ochre); color: var(--cocoa); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.linkbtn { background: none; border: 0; color: var(--terra); font-weight: 600; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card.cream { background: var(--cream); box-shadow: none; }
.card.dark { background: var(--cocoa); color: var(--cream); border-color: var(--cocoa); }
.card.dark .muted { color: #cdb9a1; }

/* Welcome */
.welcome { background: var(--cocoa); color: var(--cream); min-height: 100dvh; display: flex; flex-direction: column; }
.welcome .art { aspect-ratio: 3/2; background: center/cover no-repeat; position: relative; }
.welcome .art::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(to bottom, transparent, var(--cocoa)); }
.welcome .copy { padding: 8px 22px 32px; }
.welcome h1 { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1.05; }
.welcome h1 span { color: var(--ochre); }
.welcome p { color: #e6d6c0; }
.stripe { height: 8px; background: linear-gradient(90deg, var(--ochre) 0 33%, var(--terra) 33% 66%, var(--forest) 66%); }

/* Choice tiles */
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-height: 56px;
}
.choice strong { font-size: 16px; }
.choice span { font-size: 14px; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--terra); background: #fdf1ea; box-shadow: inset 0 0 0 1px var(--terra); }

label.field { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], textarea, select {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 12px 14px; font-size: 16px; line-height: 1.45;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--ochre); outline: none; box-shadow: 0 0 0 3px rgba(200,144,46,.25); }

/* Home */
.greet { background: var(--cocoa); color: var(--cream); padding: 6px 18px 22px; }
.greet .h-display { color: var(--cream); }
.greet p { color: #e6d6c0; margin: 6px 0 0; }
.today {
  display: grid; grid-template-columns: 112px 1fr; gap: 0; overflow: hidden; padding: 0;
  margin: -6px 18px 0; position: relative; z-index: 2;
}
.today .pic { background: center/cover no-repeat; min-height: 150px; }
.today .body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick button {
  background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 78px;
}
.quick strong { font-size: 15px; }
.quick span { font-size: 13px; color: var(--muted); }

.mod-list { display: grid; gap: 12px; }
.mod {
  display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; text-align: left; width: 100%;
}
.mod .thumb { width: 84px; height: 96px; border-radius: 10px; background: center/cover no-repeat; }
.mod .meta { font-size: 13px; color: var(--muted); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sand); color: var(--cocoa); }
.badge.done { background: var(--forest); color: #fff; }
.soon { opacity: .6; }

/* Session */
.session-hero { position: relative; aspect-ratio: 16/10; background: center 25%/cover no-repeat; }
.session-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(43,26,18,.92), rgba(43,26,18,.1) 65%); }
.session-hero .t { position: absolute; left: 18px; right: 18px; bottom: 16px; z-index: 1; color: var(--cream); }
.session-hero .t .eyebrow { color: var(--ochre); }
.steps { display: flex; gap: 6px; padding: 14px 18px 0; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--sand); }
.steps i.on { background: var(--terra); }
.step-label { padding: 10px 18px 0; display: flex; justify-content: space-between; align-items: baseline; }
.session-nav { display: flex; gap: 10px; padding: 8px 18px 0; }
.session-nav .btn { flex: 1; }

.story { border-left: 4px solid var(--ochre); padding: 12px 14px; background: var(--cream); border-radius: 0 12px 12px 0; }
.story h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.sources { font-size: 12px; color: var(--muted); }
.sources a { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 14px;
  font-size: 15px; text-align: left; min-height: 44px; line-height: 1.3;
}
.chip[aria-pressed="true"] { background: var(--cocoa); color: var(--cream); border-color: var(--cocoa); }
.affirm-note { background: #eef3ea; border: 1px solid #cfdcc8; color: var(--forest); padding: 12px 14px; border-radius: 12px; font-size: 15px; }

/* Breathing */
.breathe { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 10px 0; }
.orb-wrap { width: 230px; height: 230px; display: grid; place-items: center; position: relative; }
.orb {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e9b75a, var(--ochre) 55%, var(--terra));
  box-shadow: 0 0 0 10px rgba(200,144,46,.15), 0 0 0 22px rgba(200,144,46,.08);
  transition: transform 4s ease-in-out;
}
.orb.big { transform: scale(1.9); }
.orb-label { position: absolute; font-weight: 600; color: var(--cocoa); font-size: 18px; text-align: center; }
.orb-count { font-size: 14px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .orb { transition: none; } }

/* Scenario */
.versions { display: grid; gap: 10px; }
.version { border-radius: 14px; padding: 14px; }
.version.spiral { background: #f7e6df; border: 1px solid #e8c5b6; }
.version.grounded { background: #e7efe3; border: 1px solid #c6d6bf; }
.version strong { display: block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }

.ladder { display: grid; gap: 8px; }
.rung { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rung b { display: block; }
.rung span { font-size: 14px; color: var(--muted); }
.rung[aria-pressed="true"] { border-color: var(--forest); background: #eef3ea; }

.done-card { text-align: center; padding: 28px 20px; }
.affirmation-big { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.25; color: var(--cocoa); }

/* Journal */
.entry { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.entry h3 { font-size: 16px; font-weight: 600; }
.entry dl { margin: 8px 0 0; }
.entry dt { font-size: 13px; color: var(--muted); margin-top: 8px; }
.entry dd { margin: 2px 0 0; white-space: pre-wrap; }
.entry .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .h-card { color: var(--ink); margin-bottom: 6px; }

/* Studio */
.canvas-wrap { background: var(--sand); border-radius: var(--r); padding: 12px; }
.canvas-wrap canvas { width: 100%; height: auto; border-radius: 10px; display: block; background: #fff; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--terra); }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 4px; font-size: 13px; font-weight: 500; min-height: 44px; }
.seg button[aria-pressed="true"] { border-color: var(--terra); background: #fdf1ea; }

/* Lists */
.list { display: grid; gap: 10px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-height: 56px; }
.list-item small { display: block; color: var(--muted); font-size: 13px; }
.toggle { width: 50px; height: 30px; border-radius: 999px; background: var(--sand); position: relative; border: 0; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle[aria-checked="true"] { background: var(--forest); }
.toggle[aria-checked="true"]::after { left: 23px; }

.facil { background: #fff7e6; border: 1px dashed var(--ochre); border-radius: 14px; padding: 14px 16px; }
.facil ol { margin: 6px 0 0; padding-left: 20px; }

/* Overlay sheet */
.overlay { position: fixed; inset: 0; background: rgba(20,12,8,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.overlay[hidden] { display: none; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto; }
.sheet .close { float: right; background: var(--sand); border: 0; border-radius: 999px; width: 40px; height: 40px; font-size: 20px; line-height: 1; }
.help-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.help-line .btn { padding: 10px 16px; min-height: 44px; font-size: 15px; }

.install { display: flex; gap: 12px; align-items: center; }
.install p { margin: 0; font-size: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); background: var(--cocoa); color: var(--cream); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }

.fade-in { animation: fade .28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

[hidden] { display: none !important; }
.welcome .install p { color: var(--ink); }
.welcome .install p.muted { color: var(--muted, #6b5a4c); }
.welcome .install .linkbtn { color: var(--terra); }
