/* Tenfold Posts. One column, thumb-sized controls, two tabs.
   Light is the default; dark follows the phone unless the person picks one. */
:root {
  --bg: #F5F2EA; --surface: #FFFFFF; --surface-2: #EEE9DD; --ink: #13201A; --muted: #5E6A62;
  --line: #E1DBCC; --accent: #136B35; --accent-ink: #FFFFFF; --accent-soft: #DCEEDF;
  --rec: #C8342E; --rec-ink: #FFFFFF; --rec-soft: #F8E0DC; --warn: #7F520C; --warn-soft: #F5E8C8;
  --shadow: 0 1px 2px rgba(19,32,26,.05), 0 6px 18px rgba(19,32,26,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 16px; --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1612; --surface: #17211B; --surface-2: #1F2B24; --ink: #EAE6D9; --muted: #9DAAA1;
    --line: #2A3830; --accent: #5BD38A; --accent-ink: #08170E; --accent-soft: #173826;
    --rec: #E5534B; --rec-ink: #FFFFFF; --rec-soft: #3B1B19; --warn: #E8BC62; --warn-soft: #3A2E14;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1612; --surface: #17211B; --surface-2: #1F2B24; --ink: #EAE6D9; --muted: #9DAAA1;
  --line: #2A3830; --accent: #5BD38A; --accent-ink: #08170E; --accent-soft: #173826;
  --rec: #E5534B; --rec-ink: #FFFFFF; --rec-soft: #3B1B19; --warn: #E8BC62; --warn-soft: #3A2E14;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
/* Hidden means hidden, even on boxes that set their own display (banners, sections). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none; min-height: 100dvh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); }

.wrap { max-width: 600px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.page { padding-block: 8px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 20px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: env(safe-area-inset-top); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.site-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px; border: 0; background: none; font-weight: 700; font-size: 17px; min-width: 0; }
.site-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.18) inset; }
.chev { color: var(--muted); font-weight: 400; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.back { border: 0; background: none; color: var(--accent); font-weight: 600; min-height: 40px; padding: 0; display: inline-flex; align-items: center; gap: 4px; }

/* Bottom tabs: two of them */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs .wrap { display: flex; }
.tab { flex: 1; border: 0; background: none; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }

/* Text */
.hello { font-size: 26px; font-weight: 750; }
.sub { color: var(--muted); font-size: 15px; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; }
button.card:active { transform: scale(.99); }
.card h3 { font-size: 17px; font-weight: 650; }
.card .why { color: var(--muted); font-size: 14px; }
.card .meta, .meta { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pill.go { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.rec { background: var(--rec-soft); color: var(--rec); }

/* The main button */
.hero-btn { display: flex; align-items: center; gap: 16px; width: 100%; border: 0; border-radius: 20px; padding: 18px; background: var(--accent); color: var(--accent-ink); text-align: left; box-shadow: var(--shadow); }
.hero-btn:active { transform: scale(.985); }
.hero-btn .mic { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.hero-btn .mic svg { width: 26px; height: 26px; }
.hero-btn b { display: block; font-size: 19px; font-family: var(--display); }
.hero-btn small { display: block; font-size: 14px; opacity: .88; margin-top: 2px; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 650; padding: 8px 0; min-height: var(--tap); text-align: left; }

/* Banners */
.banner { border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.banner.rec { background: var(--rec-soft); }
.banner.warn { background: var(--warn-soft); }
.banner b { font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Buttons */
.btn { min-height: var(--tap); padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--rec); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 20px; height: 20px; }

/* Answer screen */
.prompts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: q; }
.prompts li { counter-increment: q; display: grid; grid-template-columns: 26px 1fr; gap: 8px; font-size: 16px; }
.prompts li::before { content: counter(q); width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.recorder { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 16px; }
.rec-btn { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--rec); color: var(--rec-ink); display: grid; place-items: center; position: relative; }
.rec-btn::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--rec-soft); }
.rec-btn .shape { width: 34px; height: 34px; border-radius: 50%; background: currentColor; transition: border-radius .18s, width .18s, height .18s; }
.rec-btn.on .shape { width: 30px; height: 30px; border-radius: 7px; }
@media (prefers-reduced-motion: no-preference) {
  .rec-btn.on::after { animation: ring 1.6s ease-out infinite; }
  @keyframes ring { 0% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1.18); opacity: 0; } }
}
.timer { font-family: var(--display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rec-state { font-size: 15px; color: var(--muted); text-align: center; max-width: 34ch; }
.levels { display: flex; gap: 4px; align-items: center; height: 22px; }
.levels i { width: 5px; border-radius: 3px; background: var(--rec); height: 4px; transition: height .08s; }
.parts { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.part { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 6px 6px 6px 12px; font-size: 14px; }
.part span { flex: 1; font-variant-numeric: tabular-nums; }
.mini { width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--surface); display: grid; place-items: center; }
.mini svg { width: 18px; height: 18px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; color: var(--muted); text-align: center; padding: 4px; word-break: break-word; }
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 1; z-index: 1; }
textarea { width: 100%; min-height: 110px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; font-size: 16px; resize: vertical; }
.sticky-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--bg); border-top: 1px solid var(--line); padding-block: 10px calc(10px + env(safe-area-inset-bottom)); }
.sticky-foot .wrap { display: flex; gap: 10px; }
.sticky-foot .btn { flex: 1; min-height: 52px; font-size: 16px; padding: 0 12px; white-space: nowrap; }

/* Posts */
.post-row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.date { text-align: center; border-radius: 12px; background: var(--surface-2); padding: 6px 0; line-height: 1.1; }
.date b { display: block; font-size: 18px; font-family: var(--display); font-variant-numeric: tabular-nums; }
.date small { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.preview { width: 100%; height: 62dvh; border: 1px solid var(--line); border-radius: var(--r); background: #fff; display: block; }
.preview-full { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.preview-full .bar { display: flex; justify-content: space-between; align-items: center; padding: 8px max(16px, env(safe-area-inset-left)); }
.preview-full iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.fact { display: flex; gap: 12px; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: 10px 0; border-top: 1px solid var(--line); min-height: var(--tap); }
.fact:first-of-type { border-top: 0; }
.box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: var(--accent-ink); }
.fact[aria-pressed="true"] .box { background: var(--accent); border-color: var(--accent); }
.box svg { width: 16px; height: 16px; opacity: 0; }
.fact[aria-pressed="true"] .box svg { opacity: 1; }

/* This month against the plan: one mark per post */
.plan h3 { font-variant-numeric: tabular-nums; }
.meter { display: flex; gap: 6px; }
.meter i { flex: 1; max-width: 56px; height: 8px; border-radius: 4px; background: var(--surface-2); }
.meter i.on { background: var(--accent); }

/* Login */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding-block: 32px; }
.mark { width: 64px; height: 64px; border-radius: 16px; }
.code { width: 100%; min-height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 22px; letter-spacing: .14em; text-transform: uppercase; font-variant-numeric: tabular-nums; text-align: center; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.err { color: var(--rec); font-size: 15px; }

/* Sheets */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-width: 600px; margin: 0 auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 14px; max-height: 85dvh; overflow: auto; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 14px; font-weight: 600; text-align: left; }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: none; font-weight: 600; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

#toast { pointer-events: none; position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; max-width: min(340px, calc(100% - 32px)); text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; border: 1px dashed var(--line); border-radius: var(--r); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: sp .8s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }

/* Added with the Tenfold Posts name: the page behind a sheet stays put, a plain text field,
   the how-it-works steps, and no grey callout box when a button is held. */
html.locked, html.locked body { overflow: hidden; }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-ink); }
button, a.btn, .card { -webkit-touch-callout: none; }
.field { width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; }
.steps.big { gap: 10px; font-size: 16px; padding-left: 22px; }
.steps.big b { font-weight: 700; }
.guide h2 { font-size: 19px; }
.sheet h2 { font-size: 20px; }
.card:not(button) { cursor: default; }
@media (hover: hover) {
  .btn:hover:not(:disabled), .choice:hover, button.card:hover { border-color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } button.card:active, .hero-btn:active { transform: none; } }

/* Where a post is: four steps in a row */
.track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.track li { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.25; }
.track i { height: 6px; border-radius: 3px; background: var(--surface-2); }
.track .done i { background: var(--accent); }
.track .now i { background: var(--warn); }
.track .done, .track .now { color: var(--ink); }
