/* Intangible Money — design tokens and styles */

:root,
[data-theme="paper"] {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --text: #14171A;
  --body: #2B3035;
  --muted: #5E646B;
  --line: #E3E1DA;
  --accent: #0B5D4B;
  --accent-soft: #DCEBE4;
  --on-accent: #FFFFFF;
  --decor: 0.09;
  --shadow: 0 10px 30px rgba(20, 23, 26, 0.10);
  --scrim: rgba(20, 23, 26, 0.45);
  color-scheme: light;
}
[data-theme="ink"] {
  --bg: #0E1113;
  --surface: #171B1F;
  --text: #ECEAE4;
  --body: #D4D2CC;
  --muted: #9AA1A8;
  --line: #262B30;
  --accent: #5CC8A0;
  --accent-soft: #16312A;
  --on-accent: #0B1512;
  --decor: 0.08;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
[data-theme="atlantic"] {
  --bg: #EEF2F6;
  --surface: #FFFFFF;
  --text: #0F1D2E;
  --body: #26364A;
  --muted: #51606F;
  --line: #D6DEE7;
  --accent: #1F5FBF;
  --accent-soft: #DDE8F7;
  --on-accent: #FFFFFF;
  --decor: 0.09;
  --shadow: 0 10px 30px rgba(15, 29, 46, 0.10);
  --scrim: rgba(15, 29, 46, 0.45);
  color-scheme: light;
}
[data-theme="claret"] {
  --bg: #150E11;
  --surface: #1F161A;
  --text: #F2E9EA;
  --body: #DCD0D2;
  --muted: #A8999D;
  --line: #33262B;
  --accent: #E8798A;
  --accent-soft: #3A1D24;
  --on-accent: #1A0B0F;
  --decor: 0.09;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.serif { font-family: 'Newsreader', Georgia, 'Times New Roman', serif; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Background character */
.decor {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
  stroke: var(--accent); opacity: var(--decor);
}

#app { position: relative; z-index: 1; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.page { max-width: 640px; margin: 0 auto; padding: 0 20px; }
.page.wide { max-width: 1080px; }
.view-enter { animation: fade-in .22s ease both; }
/* Opacity only: a transform here would stop fixed elements (reading pill, Add button) from sticking to the screen. */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px 24px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 48px; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
body.no-tabs .tabbar { display: none; }
body:has(.fab) #app { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
body.no-tabs #app { padding-bottom: 40px; }

/* ---------- Brand header ---------- */
.brandbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 0; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.brand-name { font-family: 'Newsreader', Georgia, serif; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; display: block; }
.brand-tag { font-size: 11px; color: var(--muted); letter-spacing: 0.02em; display: block; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 99px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  text-decoration: none; padding: 0;
}
.icon-btn.plain { border: 0; background: transparent; }
.icon-btn svg, .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.greeting { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 0 16px; will-change: opacity; }
.greeting h1 { margin: 0; font-family: 'Newsreader', Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.2; }
.greeting .date { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 18px 20px; position: relative; overflow: hidden;
}
.card + .card, .stack > * + * { margin-top: 14px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.eyebrow.accent { color: var(--accent); }
.card-link { display: block; text-decoration: none; color: inherit; }
.section-title { font-family: 'Newsreader', Georgia, serif; font-size: 22px; font-weight: 600; margin: 30px 0 12px; letter-spacing: -0.01em; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 99px; border: 0;
  background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.block { width: 100%; min-height: 54px; font-size: 16px; }
.btn.danger { background: transparent; color: #C0392B; border: 1px solid var(--line); }
[data-theme="ink"] .btn.danger, [data-theme="claret"] .btn.danger { color: #FF8A80; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link { font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; display: inline-flex; padding: 8px 0; background: none; border: 0; }

/* Reminder card */
.reminder { background: var(--accent-soft); border-radius: 18px; padding: 14px 16px; }
.reminder + .reminder { margin-top: 10px; }
.reminder .top { display: flex; gap: 12px; align-items: center; }
.reminder .badge { width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px; background: var(--surface); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.reminder .title { font-size: 15px; font-weight: 600; }
.reminder .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

/* Feature (case study) */
.feature { padding: 20px; }
.feature .rings { position: absolute; right: -24px; bottom: -14px; width: 210px; height: 150px; pointer-events: none; opacity: .14; stroke: var(--accent); fill: none; }
.feature .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.feature .badge { width: 56px; height: 56px; flex-shrink: 0; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.feature .badge svg { width: 30px; height: 30px; stroke-width: 1.8; }
.feature h2 { position: relative; margin: -10px 0 10px; padding-right: 66px; font-family: 'Newsreader', Georgia, serif; font-size: 27px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; }
.feature p { position: relative; margin: 0 0 16px; font-size: 15px; color: var(--muted); }
.feature .cover { margin: -20px -20px 18px; height: 190px; background: var(--accent-soft) center / cover no-repeat; }
.feature.has-cover h2 { margin-top: 10px; padding-right: 0; }

/* Term */
.term-word { font-family: 'Newsreader', Georgia, serif; font-size: 27px; font-weight: 500; font-style: italic; margin: 6px 0 4px; letter-spacing: -0.01em; }

/* Money tile + bars */
.big-num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.huge-num { font-size: 38px; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.bar { height: 9px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; margin: 12px 0; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s ease; }
.bar.over > i { background: #D9534F; }
.chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: #FCEBD5; color: #8A4B08; }
.chip.over { background: #F9DEDC; color: #9B2C24; }
[data-theme="ink"] .chip.warn, [data-theme="claret"] .chip.warn { background: #3A2A12; color: #F4C27A; }
[data-theme="ink"] .chip.over, [data-theme="claret"] .chip.over { background: #3D1A18; color: #FF9C94; }

/* Picks + lists */
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick { border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); }
.pick .t { font-family: 'Newsreader', Georgia, serif; font-size: 18px; font-weight: 600; line-height: 1.2; }
.story-row { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.story-row:last-child { border-bottom: 0; }
.thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.thumb svg { width: 24px; height: 24px; }
.story-row .t { font-family: 'Newsreader', Georgia, serif; font-size: 17px; font-weight: 600; line-height: 1.25; }
.story-row .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tick { color: var(--accent); }

/* Today wide layout */
.today-grid { display: block; }
.today-grid .side { display: none; }
.mobile-side > * { margin-top: 14px; }
@media (min-width: 900px) {
  .today-grid .side { display: block; }
  .today-grid .side > * + * { margin-top: 14px; }
  .mobile-side, .only-mobile-rem { display: none; }
  .today-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .today-grid .side { position: sticky; top: 84px; }
  .today-grid .side .card:first-child, .today-grid .side .reminder:first-child { margin-top: 0; }
}

/* ---------- Page headers ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 0 16px; }
.page-head h1 { margin: 0; font-family: 'Newsreader', Georgia, serif; font-size: 31px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.page-head .sub { font-family: 'Newsreader', Georgia, serif; font-style: italic; font-size: 17px; color: var(--muted); margin-top: 4px; }
.backbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 0; }

/* ---------- Reader ---------- */
.reader-top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}
.reader-top .inner { max-width: 720px; margin: 0 auto; height: 56px; padding: 0 8px; display: flex; align-items: center; justify-content: space-between; }
.reader-top .label { font-size: 13px; font-weight: 500; color: var(--muted); }
.progress { height: 3px; background: var(--line); }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.article { max-width: 680px; margin: 0 auto; padding: 24px 24px 40px; }
.article h1 { font-family: 'Newsreader', Georgia, serif; font-size: 36px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin: 12px 0 14px; }
.article .dek { font-family: 'Newsreader', Georgia, serif; font-size: 20px; font-style: italic; line-height: 1.45; color: var(--muted); margin: 0 0 16px; }
.article .byline { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.article .byline b { color: var(--text); font-weight: 600; }
.article .cover { border-radius: 16px; margin: 0 0 24px; width: 100%; }
.article-body { font-family: 'Newsreader', Georgia, serif; font-size: 19.5px; line-height: 1.65; color: var(--body); }
.article-body p { margin: 0 0 1.05em; }
.article-body h2 { font-family: 'Newsreader', Georgia, serif; color: var(--text); font-size: 25px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; margin: 1.6em 0 .6em; }
.article-body h3 { font-family: 'Inter', sans-serif; color: var(--text); font-size: 16px; font-weight: 600; margin: 1.4em 0 .4em; }
.article-body ul, .article-body ol { padding-left: 1.2em; margin: 0 0 1.05em; }
.article-body li { margin-bottom: .4em; }
.article-body blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); font-size: 22px; font-style: italic; color: var(--text); line-height: 1.4; }
.article-body strong { color: var(--text); }
.article-body a { color: var(--accent); }
.article-body figure { margin: 1.4em 0; }
.article-body figcaption { font-family: 'Inter', sans-serif; font-size: 13px; color: var(--muted); margin-top: 8px; }
.article-body img { border-radius: 14px; }
.article-body .note { font-family: 'Inter', sans-serif; font-size: 14px; line-height: 1.55; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--muted); }
.breakdown { font-family: 'Inter', sans-serif; font-size: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px 16px; margin: 1.2em 0 1.4em; }
.breakdown .r { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); font-variant-numeric: tabular-nums; }
.breakdown .r:last-child { border-bottom: 0; font-weight: 600; }
dfn, .term-link {
  font-style: normal; color: var(--accent); cursor: pointer;
  border-bottom: 2px dotted var(--accent); text-decoration: none;
  background: none; padding: 0; font: inherit; color: var(--accent);
}
.read-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 15;
  height: 44px; padding: 0 18px; border-radius: 99px;
  background: var(--text); color: var(--bg);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow); transition: opacity .3s ease, transform .3s ease;
}
.read-pill.hide { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.read-pill .dot { opacity: .5; }
.end-card { margin-top: 30px; text-align: center; padding: 26px 20px; }
.end-card .serif { font-size: 24px; font-weight: 600; margin: 6px 0; }

/* Popover for glossary words */
.popover {
  position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 520px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px; box-shadow: var(--shadow);
  animation: pop-in .2s ease both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.popover .w { font-family: 'Newsreader', Georgia, serif; font-size: 19px; font-weight: 600; }

/* ---------- My Money ---------- */
.month-switch { display: flex; align-items: center; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.month-switch button { width: 42px; height: 42px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--text); }
.month-switch button:disabled { color: var(--line); cursor: default; }
.month-switch span { font-size: 13px; font-weight: 600; min-width: 70px; text-align: center; }
.donut-wrap { display: flex; align-items: center; gap: 18px; margin-top: 14px; }
.donut { position: relative; width: 136px; height: 136px; flex-shrink: 0; }
.donut svg { width: 136px; height: 136px; transform: rotate(-90deg); }
.donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.legend .li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex-shrink: 0; }
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 0 16px; }
.exp-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; padding: 0; }
.exp-row:last-child { border-bottom: 0; }
.exp-row .n { font-size: 15px; font-weight: 500; }
.exp-row .c { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.exp-row .a { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.repeat-tag { color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.repeat-tag svg { width: 12px; height: 12px; }
.fab {
  position: fixed; z-index: 15; right: max(20px, calc(50% - 300px));
  bottom: calc(92px + env(safe-area-inset-bottom));
  min-height: 52px; padding: 0 22px; border-radius: 99px; border: 0;
  background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
}
.fab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); font-size: 14px; }
.empty .serif { font-size: 20px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.day-head { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 22px 0 8px; }

/* ---------- Sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  animation: slide-up .26s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; left: 50%; right: auto; width: 480px; border-radius: 26px; transform: translate(-50%, -50%); animation: pop-center .22s ease both; padding-bottom: 24px; }
  @keyframes pop-center { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
  .sheet .handle { display: none; }
}
.sheet .handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin: 0; font-family: 'Newsreader', Georgia, serif; font-size: 24px; font-weight: 600; }
.sheet form > * + * { margin-top: 18px; }
.amount-field { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; }
.amount-field .row { display: flex; align-items: baseline; gap: 4px; }
.amount-field .cur { font-size: 30px; font-weight: 500; color: var(--muted); }
.amount-field input { width: 180px; border: 0; background: transparent; font-size: 50px; font-weight: 600; letter-spacing: -0.03em; outline: none; font-variant-numeric: tabular-nums; padding: 0; }
.amount-field input::placeholder { color: var(--line); }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cats button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; padding: 0 4px; }
.cats button[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.text-input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 16px; outline: none; }
.text-input:focus { border-color: var(--accent); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; }
.switch { width: 50px; height: 30px; border-radius: 99px; border: 0; padding: 3px; background: var(--line); display: flex; justify-content: flex-start; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; width: 24px; height: 24px; border-radius: 99px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- Understand ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; font-size: 16px; outline: none; color: var(--text); min-width: 0; }
.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
@media (min-width: 700px) { .topics { grid-template-columns: repeat(3, 1fr); } }
.topic { min-height: 108px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; color: inherit; }
.topic .t { font-family: 'Newsreader', Georgia, serif; font-size: 22px; font-weight: 600; }
.topic.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.topic.primary .small { color: inherit; opacity: .85; }
.lesson { display: flex; align-items: center; gap: 14px; min-height: 60px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.lesson:last-child { border-bottom: 0; }
.lesson .n { width: 30px; height: 30px; flex-shrink: 0; border-radius: 99px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.lesson.next .n { border-color: var(--accent); color: var(--accent); }
.lesson.next .t { font-weight: 600; }
.lesson.done .n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.lesson.done .t { color: var(--muted); }
.lesson .t { flex: 1; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a, .chips button { min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
.chips .learned { border-color: var(--accent); color: var(--accent); }
.az-letter { font-family: 'Newsreader', Georgia, serif; font-size: 22px; font-weight: 600; color: var(--accent); margin: 24px 0 6px; }
.gl-row { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.gl-row .w { font-weight: 600; }
.gl-row .d { font-size: 14px; color: var(--muted); margin-top: 2px; }

/* ---------- Profile ---------- */
.avatar { width: 64px; height: 64px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-family: 'Newsreader', Georgia, serif; font-size: 28px; font-weight: 600; flex-shrink: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat .v { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 700px) { .themes { grid-template-columns: repeat(4, 1fr); } }
.theme-opt { text-align: left; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.theme-opt[aria-pressed="true"] { border: 2px solid var(--accent); padding: 11px; }
.theme-opt:disabled { cursor: not-allowed; }
.theme-opt .sw { height: 56px; border-radius: 12px; display: flex; align-items: flex-end; gap: 6px; padding: 8px; }
.theme-opt .sw i { width: 22px; height: 22px; border-radius: 99px; }
.theme-opt .sw b { flex: 1; height: 8px; border-radius: 99px; opacity: .6; align-self: center; }
.theme-opt:disabled .sw { opacity: .45; }
.theme-opt .nm { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.theme-opt .st { font-size: 12px; color: var(--muted); }
.theme-opt .meter { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.theme-opt .meter i { display: block; height: 100%; background: var(--accent); }
.settings { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 0 16px; }
.settings > * { border-bottom: 1px solid var(--line); }
.settings > *:last-child { border-bottom: 0; }
.settings .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; padding: 0; text-align: left; font-size: 15px; text-decoration: none; color: var(--text); }
.settings .item:last-child { border-bottom: 0; }
.fineprint { font-size: 12px; color: var(--muted); text-align: center; margin: 24px 0 10px; line-height: 1.6; }

/* Welcome */
.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; }
.welcome .logo-xl svg { width: 64px; height: 64px; }
.welcome h1 { font-family: 'Newsreader', Georgia, serif; font-size: 40px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 22px 0 8px; }
.welcome .lead { font-size: 17px; color: var(--muted); margin: 0 0 30px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 500; max-width: calc(100% - 40px); text-align: center;
  transition: opacity .25s ease, transform .25s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Wide screens: top navigation ---------- */
@media (min-width: 900px) {
  .tabbar {
    top: 0; bottom: auto; height: 68px; padding: 0 max(24px, calc(50% - 540px));
    border-top: 0; border-bottom: 1px solid var(--line);
    display: flex; justify-content: flex-end; gap: 6px;
  }
  .tabbar::before {
    content: "Intangible Money"; margin-right: auto; align-self: center;
    font-family: 'Newsreader', Georgia, serif; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--text);
    padding-left: 40px;
    background: no-repeat left center / 30px 30px;
    background-image: var(--logo-url);
  }
  .tabbar a { flex-direction: row; gap: 8px; font-size: 14px; padding: 0 16px; min-height: 44px; align-self: center; border-radius: 99px; }
  .tabbar a[aria-current="page"] { background: var(--accent-soft); }
  .tabbar svg { width: 20px; height: 20px; }
  #app { padding-top: 68px; padding-bottom: 60px; }
  body.no-tabs #app { padding-top: 0; }
  .brandbar.home-only { display: none; }
  .greeting { padding-top: 34px; }
  .greeting h1 { font-size: 32px; }
  .fab { bottom: 32px; right: max(24px, calc(50% - 300px)); }
  .read-pill { bottom: 28px; }
  .popover { bottom: 32px; }
  #toast { bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===================== Round 2 ===================== */

/* Beta chip */
.beta {
  display: inline-flex; align-items: center; vertical-align: middle;
  font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-left: 4px;
}

/* Welcome */
.welcome h1 { margin-top: 26px; }
.fact-card {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px;
  position: relative; overflow: hidden;
}
.fact-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  border: 1px solid var(--accent); opacity: .18; box-shadow: 0 0 0 22px transparent, 0 0 0 23px var(--accent-soft);
}
.fact-text { font-size: 20px; line-height: 1.4; color: var(--text); transition: opacity .16s ease; min-height: 56px; }
.perks { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-direction: column; gap: 14px; }
.perks li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--muted); }
.perks li b { color: var(--text); font-weight: 600; }
.perks .ico { color: var(--accent); margin-top: 1px; }
.coin-dot { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; background: radial-gradient(circle at 35% 35%, #F3D27A, #D9A931); box-shadow: inset 0 0 0 2px #B8891C; margin-top: 1px; }

/* Header coin pill */
.coin-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px;
}
.coin-ico { flex-shrink: 0; }

/* Greeting with a friendly sub-line */
.greeting { align-items: flex-start; }
.greeting .subline { font-size: 14px; color: var(--muted); margin-top: 4px; }
.greeting .date { padding-top: 8px; }

/* Start-here hero */
.hero {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  padding: 22px 22px 24px;
}
.hero .eyebrow { color: var(--on-accent); opacity: .85; }
.hero h2 { position: relative; font-size: 29px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.12; margin: 8px 0 8px; max-width: 85%; }
.hero p { position: relative; margin: 0 0 18px; font-size: 15px; opacity: .9; max-width: 34ch; }
.hero-rings { position: absolute; right: -40px; top: -40px; width: 240px; height: 240px; fill: none; stroke: var(--on-accent); opacity: .2; pointer-events: none; }
.btn.light { background: var(--on-accent); color: var(--accent); position: relative; }

/* Did you know (home) */
.fact-home { background: var(--accent-soft); border-color: transparent; }
.fact-home p { margin: 8px 0 0; font-size: 19px; line-height: 1.45; color: var(--text); }

/* Coins card in profile */
.coins-card { background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }

/* Reader: richer progress pill */
.progress { height: 4px; }
.read-pill { height: 48px; padding: 0 18px 0 8px; gap: 10px; }
.read-pill .ring { width: 32px; height: 32px; transform: rotate(-90deg); }
.read-pill .ring circle { fill: none; stroke-width: 4; }
.read-pill .ring-bg { stroke: color-mix(in srgb, var(--bg) 25%, transparent); }
.read-pill .ring-fg { stroke: var(--accent-soft); stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
[data-theme="ink"] .read-pill .ring-fg, [data-theme="claret"] .read-pill .ring-fg { stroke: var(--accent); }
.read-pill .pct { font-size: 15px; font-weight: 700; min-width: 38px; }
.read-pill .sep { width: 1px; height: 18px; background: currentColor; opacity: .3; }
.read-pill.done { background: var(--accent); color: var(--on-accent); }
.read-pill.done .ring-fg { stroke: var(--on-accent); }
.coin-earned { display: inline-block; margin: 2px 0 14px; padding: 6px 12px; border-radius: 99px; background: #FBEFC7; color: #6B4E0A; font-size: 13px; font-weight: 600; }

/* Guided tour */
.tour { position: fixed; inset: 0; z-index: 70; }
.tour-spot {
  position: fixed; border-radius: 18px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 14, 16, 0.62), 0 0 0 3px var(--accent);
  transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease;
}
.tour-card {
  position: fixed; left: 16px; right: 16px; max-width: 420px; margin: 0 auto;
  background: var(--surface); color: var(--text); border-radius: 20px; padding: 16px 18px 18px;
  box-shadow: var(--shadow); animation: pop-in .22s ease both;
}
.tour-title { font-size: 22px; font-weight: 600; margin: 4px 0 6px; }
.tour-text { margin: 0 0 14px; font-size: 15px; color: var(--muted); line-height: 1.5; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .2s; }
.tour-dots i.on { width: 18px; background: var(--accent); }

/* ===================== Round 3: splash + personalise ===================== */
.splash { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 0; }
.splash .logo-xl svg { width: 52px; height: 52px; }
.splash h1 { font-family: 'Newsreader', Georgia, serif; font-size: 42px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.04; margin: 34px 0 22px; }
.splash .fact-card { padding: 22px 22px 18px; gap: 10px; }
.splash .fact-text { font-size: 23px; line-height: 1.38; margin: 0; min-height: 96px; }
.splash-go { position: relative; overflow: hidden; margin-top: 28px; }
.splash-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 255, 255, 0.18); }
.personal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.personal-row .text-input { min-width: 0; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 20px 8px; margin: 0 -20px 6px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chips a { flex-shrink: 0; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); white-space: nowrap; }
.cat-chips a span { color: var(--muted); font-size: 12px; }
.cat-chips a.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cat-chips a.on span { color: var(--on-accent); opacity: .8; }
