/* ---------- tokens ---------- */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1f2a2e;
  --muted: #5d6b70;
  --line: #e1ddd3;
  --accent: #2f6f73;
  --accent-2: #e09f3e;
  --accent-soft: #dcebea;
  --accent-text: #ffffff;
  --danger: #b4443b;
  --ok: #3c8a4f;
  --sos: #2d6cb5;
  --p0: #d79a2b;
  --p1: #3f7cc4;
  --p2: #2b9a8f;
  --p3: #8a5cc2;
  --p4: #4f9a45;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 35, .05), 0 4px 16px rgba(20, 30, 35, .06);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="ocean"]  { --accent: #1f6fa8; --accent-2: #3fb6c9; --accent-soft: #dbeaf6; }
:root[data-theme="forest"] { --accent: #2f7a3e; --accent-2: #c8a23a; --accent-soft: #dfeedd; }
:root[data-theme="sunset"] { --accent: #c0563b; --accent-2: #8c4fb3; --accent-soft: #f7e1d8; }
:root[data-theme="aurora"] { --accent: #6a4fc9; --accent-2: #2fb38f; --accent-soft: #e6e0f8; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1c;
    --surface: #1d2528;
    --surface-2: #253033;
    --text: #e7eceb;
    --muted: #9aa8ab;
    --line: #2f3b3e;
    --accent: #5fb3b0;
    --accent-soft: #23393a;
    --accent-text: #0e1415;
    --danger: #e0776c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
  :root[data-theme="ocean"]  { --accent: #63aee3; --accent-soft: #1d3346; }
  :root[data-theme="forest"] { --accent: #6cbf73; --accent-soft: #1f3522; }
  :root[data-theme="sunset"] { --accent: #ee8b6c; --accent-soft: #3d2620; }
  :root[data-theme="aurora"] { --accent: #a48ef0; --accent-soft: #2c2645; }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.fine { font-size: .75rem; color: var(--muted); margin-top: 2rem; }
.row { display: flex; align-items: center; }
.row.gap { gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; gap: .5rem; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.spacer { flex: 1; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 16px; padding-top: max(.6rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-stats { display: flex; gap: .3rem; margin-left: auto; }
.brand { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-text); font-size: 1rem; }
.brand.big { font-size: 1.6rem; justify-content: center; margin-bottom: .5rem; }
.brand.big .brand-mark { width: 44px; height: 44px; font-size: 1.4rem; }
main { padding: 16px; padding-bottom: 96px; outline: none; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .45rem 0; font-size: .68rem; color: var(--muted); text-decoration: none;
}
.tabbar a.active { color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 1.15rem; line-height: 1; }
.chip-stat {
  font-size: .78rem; font-weight: 600; padding: .2rem .5rem; border-radius: 999px;
  background: var(--surface-2); white-space: nowrap;
}
.chip-stat.risk { background: color-mix(in srgb, var(--accent-2) 25%, var(--surface)); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; }
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 1rem;
    position: sticky; top: 0; height: 100vh;
    padding: 1.25rem 1rem; border-right: 1px solid var(--line); background: var(--surface);
  }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem;
    border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500;
  }
  .side-nav a:hover { background: var(--surface-2); }
  .side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
  .side-stats { display: flex; flex-direction: column; gap: .4rem; padding: .8rem; border-radius: 12px; background: var(--surface-2); }
  .sidebar .sos-btn { margin-top: auto; }
  main { padding: 2rem 2.5rem 4rem; }
}

/* ---------- page + cards ---------- */
.page { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.page.narrow { max-width: 640px; }
.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: .25rem; }
.page-head p { margin: 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); min-width: 0;
}
.card.soft { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent); }
.tag { font-size: .72rem; padding: .15rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.done-tag { font-size: .8rem; color: var(--ok); font-weight: 700; }
.link { color: var(--accent); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.link.back { font-size: .9rem; }
.empty { text-align: center; padding: 1rem; }
.notice { background: var(--accent-soft); padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; margin: 0; }
.nudge { margin: .75rem 0 0; padding: .55rem .75rem; border-radius: 10px; background: color-mix(in srgb, var(--accent-2) 18%, var(--surface)); font-size: .9rem; }
.nudge.soft { background: var(--accent-soft); }
.crisis { font-size: .82rem; color: var(--muted); border-left: 3px solid var(--danger); padding: .3rem .7rem; margin: .5rem 0 0; }
blockquote { margin: .5rem 0; padding: .5rem .8rem; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.big-line { font-size: 1.2rem; font-weight: 600; margin: .3rem 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 42px; padding: .5rem 1rem; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.small { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
.btn.big { min-height: 52px; padding: .7rem 1.4rem; font-size: 1.05rem; }
.btn.wide { width: 100%; }
.sos-btn { background: var(--sos); border-color: var(--sos); color: #fff; }
.sos-btn:hover { background: var(--sos); filter: brightness(1.08); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.label { font-weight: 650; font-size: .95rem; }
.label.small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
.form-section { margin: .6rem 0 -.3rem; padding-top: .8rem; border-top: 1px dashed var(--line); font-size: 1.05rem; color: var(--accent); }
.form-note { font-size: .88rem; color: var(--muted); margin: 0; padding: .5rem .75rem; background: var(--surface-2); border-radius: 10px; }
.form-error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: .9rem; }
.input {
  width: 100%; min-height: 44px; padding: .55rem .75rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px;
}
textarea.input { resize: vertical; line-height: 1.45; min-height: 64px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.done { text-decoration: line-through; color: var(--muted); }
.input.search { max-width: 480px; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 32px; }
input[type="checkbox"] { accent-color: var(--accent); width: 20px; height: 20px; }

.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 460px; }
.pill {
  min-height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.pill:hover { background: var(--surface-2); }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.scale.compact .pill { min-height: 32px; font-size: .82rem; }
.scale-ends { display: flex; justify-content: space-between; max-width: 460px; font-size: .75rem; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: .4rem; }
.list-item { display: flex; align-items: center; gap: .4rem; }
.bullet { width: 22px; text-align: center; color: var(--muted); flex: none; }
.star { width: 32px; height: 32px; border: none; background: none; font-size: 1.2rem; color: var(--muted); cursor: pointer; flex: none; padding: 0; }
.star.on { color: var(--accent-2); }
.x {
  flex: none; width: 32px; height: 32px; border-radius: 8px; border: none; background: none;
  color: var(--muted); font-size: 1.15rem; cursor: pointer; line-height: 1;
}
.x:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.x:disabled { opacity: .3; cursor: default; }
.add { align-self: flex-start; margin-top: .2rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .3rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; text-align: left;
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip.static { cursor: default; }

.ranked { margin: 0; padding-left: 1.6rem; display: flex; flex-direction: column; gap: .4rem; }
.ranked li { padding-left: .2rem; }
.ranked li::marker { font-weight: 700; color: var(--accent); }
.ranked li { display: list-item; }
.ranked li > .input { display: inline-block; width: calc(100% - 72px); }
.rank-move { display: inline-flex; vertical-align: middle; }

.table-rows { display: flex; flex-direction: column; gap: .6rem; }
.row-card {
  position: relative; display: grid; gap: .6rem; padding: .8rem; padding-right: 2.6rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
@media (min-width: 760px) { .row-card { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.row-card .row-remove { position: absolute; top: .4rem; right: .3rem; }
.cell { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.check { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; margin-top: auto; min-height: 44px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s ease; }
.task-check { flex: none; }
.questions { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.questions li { margin: .15rem 0; }

.wheel-layout { display: grid; gap: 1.2rem; }
@media (min-width: 860px) { .wheel-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
.wheel-rows { display: flex; flex-direction: column; gap: .35rem; margin: .4rem 0; }
.wheel-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 26px 32px; gap: .5rem; align-items: center; }
.wheel-row .input { min-height: 38px; padding: .35rem .6rem; }
.wheel-score { font-weight: 700; text-align: center; color: var(--accent); }
.wheel-chart { display: flex; flex-direction: column; align-items: center; }
.radar { width: 100%; max-width: 340px; overflow: visible; }
.radar-ring { fill: none; stroke: var(--line); }
.radar-spoke { stroke: var(--line); }
.radar-shape { fill: color-mix(in srgb, var(--accent) 25%, transparent); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.radar-prev { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.radar-dot { fill: var(--accent); }
.radar-label { font-size: 11px; fill: var(--text); font-family: var(--font); }
.radar-score { font-weight: 700; fill: var(--accent); }
.extremes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; }
.extremes ol { margin: .2rem 0 0; padding-left: 1.2rem; font-size: .9rem; }

details.about { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; }
details.about summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.about p { margin: .5rem 0 .2rem; }
.intro { max-width: 70ch; }

.savebar {
  position: sticky; bottom: 72px; z-index: 10;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: .7rem; border-radius: 14px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: var(--shadow);
}
@media (min-width: 900px) { .savebar { bottom: 1rem; } }

/* ---------- tool head & toolbox ---------- */
.tool-head { align-items: center; }
.tool-icon { font-size: 1.6rem; }
.tool-icon.big {
  font-size: 2rem; width: 60px; height: 60px; flex: none; display: grid; place-items: center;
  border-radius: 16px; background: color-mix(in srgb, var(--pc) 16%, var(--surface));
}
.tool-head .eyebrow { color: var(--pc); }
.point { display: flex; flex-direction: column; gap: .6rem; margin-top: .5rem; }
.point-title { font-size: 1rem; padding-left: .7rem; border-left: 4px solid var(--pc); }
.tool-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tool-card {
  display: flex; flex-direction: column; gap: .3rem; padding: 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--pc);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .12s ease;
}
.tool-card:hover { transform: translateY(-2px); }
.tool-card h3 { margin: .2rem 0 0; }
.tool-card p { margin: 0; flex: 1; }
.used { color: var(--ok); font-weight: 600; }

.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li + li { border-top: 1px solid var(--line); }
.entry-list a { display: flex; align-items: center; gap: .75rem; padding: .7rem .2rem; color: var(--text); text-decoration: none; }
.entry-list a:hover { background: var(--surface-2); }
.entry-list.card { padding: .2rem .8rem; }
.entry-icon { font-size: 1.3rem; width: 30px; text-align: center; flex: none; }
.entry-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.entry-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 1.3rem; }
.overdue { color: var(--danger); font-weight: 600; }
.day-group { display: flex; flex-direction: column; gap: .4rem; }
.day-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .4rem 0 0; }

/* ---------- helper ---------- */
.situations { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.situations.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: .6rem; }
.situation {
  display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600;
  transition: transform .12s ease, border-color .12s ease;
}
.situation:hover { transform: translateY(-1px); border-color: var(--accent); }
.situation.urgent { border-color: var(--sos); background: color-mix(in srgb, var(--sos) 9%, var(--surface)); }
.sit-icon { font-size: 1.5rem; }
.helper-card { background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
.picks { display: flex; flex-direction: column; gap: .7rem; }
.pick {
  display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); text-decoration: none;
}
.pick-sos { border: 2px solid var(--sos); }
.pick-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-size: .8rem; font-weight: 700; }
.pick-icon { font-size: 1.6rem; flex: none; }
.pick-main { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
@media (max-width: 520px) {
  .pick { flex-wrap: wrap; }
  .pick-main { flex-basis: calc(100% - 80px); }
  .pick > .btn { margin-left: auto; }
}

/* ---------- home widgets ---------- */
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-bottom: .6rem; }
.mood {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: var(--text);
}
.mood.on { border-color: var(--accent); background: var(--accent-soft); }
.mood-e { font-size: 1.6rem; }
.mood-l { font-size: .72rem; color: var(--muted); }
.urge-val { color: var(--accent); }
.checkin, .exercise { display: flex; flex-direction: column; gap: .5rem; }

.growth { display: flex; gap: 1rem; align-items: center; }
.growth-tree { width: 130px; flex: none; }
.growth-info { flex: 1; min-width: 0; }
.growth-info h2 { font-size: 1.4rem; margin: 0 0 .4rem; }
.tree { width: 100%; }
.tree-ground { fill: color-mix(in srgb, var(--p4) 22%, transparent); }
.tree-seed { fill: #8a6a45; }
.tree-stem, .tree-branch { fill: none; stroke: #7a5a3a; stroke-width: 4; stroke-linecap: round; }
.tree-trunk { fill: #7a5a3a; }
.tree-leaf, .tree-crown { fill: color-mix(in srgb, var(--accent) 55%, var(--p4)); opacity: .92; }
.tree-fruit { fill: var(--accent-2); }
.xpbar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: .3rem 0; }
.xpbar.small { height: 6px; }
.xpbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .5s ease; }
.stat-pills { margin: .5rem 0; }
.stat-pill { font-size: .82rem; padding: .25rem .6rem; border-radius: 999px; background: var(--surface-2); }

.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 320px; margin: .5rem 0; }
.hm { aspect-ratio: 1; border-radius: 6px; display: grid; place-items: center; font-size: .7rem; }
.hm.off { background: var(--surface-2); }
.hm.on { background: var(--accent); }
.hm.shield { background: color-mix(in srgb, var(--accent-2) 45%, var(--surface)); }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.legend .lg.mood { background: var(--accent); }
.legend .lg.urge { background: var(--accent-2); }

/* ---------- progress ---------- */
.big-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: .4rem 0 .8rem; }
.big-stats > div { display: flex; flex-direction: column; padding: .6rem; border-radius: 12px; background: var(--surface-2); text-align: center; }
.big-stats b { font-size: 1.3rem; }
.big-stats span { font-size: .75rem; color: var(--muted); }
.badges { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: .5rem; }
.badge {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem;
  padding: .8rem .5rem; border-radius: 12px; background: var(--surface-2); opacity: .75;
}
.badge.earned { opacity: 1; background: color-mix(in srgb, var(--accent-2) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent); }
.badge-icon { font-size: 1.8rem; }
.badge:not(.earned) .badge-icon { filter: grayscale(1); opacity: .6; }
.mini-progress { width: 80%; height: 5px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: .2rem; }
.mini-progress span { display: block; height: 100%; background: var(--accent); }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .7rem .4rem;
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.theme-swatch.on { border-color: var(--accent); }
.theme-swatch:disabled { cursor: not-allowed; opacity: .6; }
.swatch { width: 40px; height: 40px; border-radius: 50%; }
.t-calm .swatch { background: linear-gradient(135deg, #2f6f73, #e09f3e); }
.t-ocean .swatch { background: linear-gradient(135deg, #1f6fa8, #3fb6c9); }
.t-forest .swatch { background: linear-gradient(135deg, #2f7a3e, #c8a23a); }
.t-sunset .swatch { background: linear-gradient(135deg, #c0563b, #8c4fb3); }
.t-aurora .swatch { background: linear-gradient(135deg, #6a4fc9, #2fb38f); }
.trend-wrap { overflow-x: auto; }
.trend { width: 100%; min-width: 360px; }
.trend .grid { stroke: var(--line); }
.trend .axis { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.trend .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend .line.mood { stroke: var(--accent); }
.trend .line.urge { stroke: var(--accent-2); }
.trend .dot.mood { fill: var(--accent); }
.trend .dot.urge { fill: var(--accent-2); }
.bars { display: flex; flex-direction: column; gap: .4rem; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 28px; gap: .5rem; align-items: center; font-size: .85rem; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 9px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.bar-val { text-align: right; font-weight: 600; }
.xp-table { display: flex; flex-direction: column; gap: .35rem; max-width: 420px; }
.xp-table > div { padding: .3rem 0; border-bottom: 1px dashed var(--line); }

/* ---------- SOS ---------- */
.sos-layout { display: grid; gap: 1rem; }
@media (min-width: 900px) { .sos-layout { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.sos-stage { display: flex; flex-direction: column; gap: .7rem; border-top: 4px solid var(--sos); }
.sos-side { display: flex; flex-direction: column; gap: .8rem; }
.sos-side ul { margin: 0; padding-left: 1.1rem; }
.seg { display: flex; gap: .4rem; flex-wrap: wrap; }
.seg-btn { min-height: 40px; padding: .3rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn.on { background: var(--sos); border-color: var(--sos); color: #fff; }
.sos-run { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: center; padding: .5rem 0; }
.ring-wrap { position: relative; width: 200px; height: 200px; }
.ring svg { width: 200px; height: 200px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--sos); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring-time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.breath { display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 150px; }
.breath-ball {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--sos) 35%, white), var(--sos));
  transform: scale(.6); transition: transform 4s ease-in-out; opacity: .9;
}
.breath[data-phase="in"] .breath-ball { transform: scale(1); transition-duration: 4s; }
.breath[data-phase="hold"] .breath-ball { transform: scale(1); }
.breath[data-phase="out"] .breath-ball { transform: scale(.6); transition-duration: 6s; }
.breath-text { font-weight: 700; color: var(--sos); }
@media (prefers-reduced-motion: reduce) { .breath-ball { transition: none; } }
.dents { margin: 0; display: grid; gap: .5rem; }
.dents dt { font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.dents dd { margin: 0 0 0 2rem; white-space: pre-wrap; }
.dents-k { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: var(--accent-text); font-size: .8rem; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(ellipse at top, var(--accent-soft), var(--bg) 60%); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1.8rem 1.5rem; box-shadow: var(--shadow); text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; margin: 1rem 0 1.2rem; }
.tabs a { padding: .5rem; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth .fine { max-width: 420px; text-align: center; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

/* ---------- toasts / modal / burst ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; top: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast {
  display: flex; align-items: center; gap: .5rem; padding: .65rem 1rem; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-10px); transition: all .25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-xp { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); color: #fff; }
.toast-badge { background: var(--surface); color: var(--text); border: 2px solid var(--accent-2); }
.toast-error { background: var(--danger); color: #fff; }
.toast-icon { font-size: 1.2rem; }
.modal-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(10, 15, 18, .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; padding: 1.4rem; width: min(100%, 420px); box-shadow: var(--shadow); }
.burst { position: fixed; z-index: 110; pointer-events: none; }
.burst i {
  position: absolute; width: 8px; height: 8px; border-radius: 2px; background: hsl(var(--h) 75% 55%);
  animation: burst .85s ease-out forwards;
}
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(200deg); opacity: 0; } }

/* ---------- print ---------- */
@media print {
  .sidebar, .topbar, .tabbar, .savebar, .link.back, details.about, .add, .x, .chips { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .card { box-shadow: none; border: none; }
  .input { border: none; border-bottom: 1px solid #999; border-radius: 0; }
}
