@font-face {
  font-family: "Daykeep Pixel";
  src: url("assets/daykeep-pixel.woff") format("woff");
  font-display: swap;
}
/* Body text and labels: Pixelify Sans (SIL Open Font License), a pixel face drawn to stay readable at UI sizes. */
@font-face {
  font-family: "Pixelify Sans";
  src: url("assets/fonts/PixelifySans.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* Day: baby-blue sky, warm cream cards, navy ink. Dusk (below) swaps in a twilight navy. */
  color-scheme: light;
  --bg: #c9e3f5;
  --page-glow: #ffffff8c;
  --page-dots: #ffffff73;
  --bar: #eef6fc;
  --panel: #fcf6ea;
  --panel-alt: #f6efe1;
  --panel-highlight: #ffffff;
  --well: #f1e9db;
  --raised: #fffdf8;
  --hover: #e6f0f8;
  --hairline: #e0dacb;
  --edge: #b9cddd;
  --edge-strong: #93afc7;
  --edge-hover: #5c84aa;
  --ink: #22324a;
  --muted: #43566d;
  --quiet: #55677d;
  --gold: #7a4c08;
  --gold-fill: #f6c165;
  --gold-fill-hover: #ffd583;
  --on-gold: #22324a;
  --green: #3a7a2a;
  --violet: #6550b0;
  --ember: #b2512a;
  --red: #b33c4c;
  --water: #3a6fae;
  --shadow: #92b4d0;
  --outline: #22324a;
  --overlay: #3b55767a;
  --label-bg: #fcf6eaeb;
  --title-shadow: 3px 3px 0 #ffffff, 5px 5px 0 #92b4d0;
  --sky: #bcdef4;
  --field-bg: #fffdf8;
  --field-inset: #e4dccb;
  /* Underground stays dark in both themes, so the coloured roots stand out. */
  --soil-ink: #f8efe0;
  --soil-muted: #e0cbb4;
  --soil-label: #2b1d18eb;
  --soil-edge: #7a5a46;
  --soil-shadow: #2b1d18;
  --soil-panel: #3d2c23;
  --tint-mix: 13%;
  --line-mix: 42%;
  --pixel: "Daykeep Pixel", "Courier New", monospace;
  --mono: "Pixelify Sans", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Pixelify Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="dusk"] {
  color-scheme: dark;
  --bg: #18213b;
  --page-glow: #3a4d8a3d;
  --page-dots: #8fa0d81f;
  --bar: #1c2643;
  --panel: #222d4c;
  --panel-alt: #253151;
  --panel-highlight: #ffffff0d;
  --well: #1b2441;
  --raised: #2a3658;
  --hover: #33406a;
  --hairline: #2f3b5f;
  --edge: #3b4a73;
  --edge-strong: #4c5c8a;
  --edge-hover: #8291c0;
  --ink: #f3ecdf;
  --muted: #b5c0dc;
  --quiet: #95a2c6;
  --gold: #f4c47e;
  --gold-fill: #f4c47e;
  --gold-fill-hover: #ffd79c;
  --on-gold: #1c2643;
  --green: #b6d98f;
  --violet: #c3b2ef;
  --ember: #f0a582;
  --red: #ef939c;
  --water: #9cc4f0;
  --shadow: #0d1326;
  --outline: #0d1326;
  --overlay: #0b1124cc;
  --label-bg: #1b2441e0;
  --title-shadow: 3px 3px 0 #2f3d6b, 5px 5px 0 #0d1326;
  --sky: #243259;
  --field-bg: #18203a;
  --field-inset: #10172d;
  --soil-muted: #bcc5de;
  --soil-label: #111830eb;
  --soil-edge: #3e4a72;
  --soil-shadow: #0d1326;
  --soil-panel: #222d4c;
  --tint-mix: 16%;
  --line-mix: 45%;
}
/* Soft washes of each accent, mixed from the theme's own colours. */
:root {
  --gold-tint: color-mix(in srgb, var(--gold-fill) var(--tint-mix), var(--panel));
  --gold-line: color-mix(in srgb, var(--gold) var(--line-mix), var(--edge));
  --green-tint: color-mix(in srgb, var(--green) var(--tint-mix), var(--panel));
  --green-line: color-mix(in srgb, var(--green) var(--line-mix), var(--edge));
  --violet-tint: color-mix(in srgb, var(--violet) var(--tint-mix), var(--panel));
  --violet-line: color-mix(in srgb, var(--violet) var(--line-mix), var(--edge));
  --ember-tint: color-mix(in srgb, var(--ember) var(--tint-mix), var(--panel));
  --ember-line: color-mix(in srgb, var(--ember) var(--line-mix), var(--edge));
  --red-tint: color-mix(in srgb, var(--red) var(--tint-mix), var(--panel));
  --red-line: color-mix(in srgb, var(--red) var(--line-mix), var(--edge));
  --water-tint: color-mix(in srgb, var(--water) var(--tint-mix), var(--panel));
  --water-line: color-mix(in srgb, var(--water) var(--line-mix), var(--edge));
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 50% 7%, var(--page-glow) 0%, transparent 64%),
    radial-gradient(circle, var(--page-dots) 0 0.6px, transparent 0.9px);
  background-size: 100% 930px, 7px 7px;
}
[hidden] { display: none !important; }
h1, h2, h3, p, figure { margin: 0; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  position: relative;
  z-index: 1;
}
#content:focus { outline: none; }
.icon { display: block; width: 18px; height: 18px; flex: 0 0 auto; image-rendering: pixelated; }
.layout { width: min(1160px, calc(100% - 72px)); margin-inline: auto; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 10px; background: var(--gold-fill); color: var(--on-gold); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
/* Installed on a phone, the page runs edge to edge (viewport-fit=cover): keep content clear of the notch and the
   home indicator. The insets are 0 everywhere else. */
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.companion-tray { margin-bottom: env(safe-area-inset-bottom); margin-right: env(safe-area-inset-right); }
.toast { margin-bottom: env(safe-area-inset-bottom); }

.topbar {
  background: color-mix(in srgb, var(--bar) 96%, transparent);
  border-bottom: 1px solid var(--edge);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--shadow) 30%, transparent);
}
.top-inner { min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; }
.brand { width: max-content; display: flex; align-items: center; gap: 11px; }
/* The logo (assets/logo, drawn by build_logo.py): a sprout taking root plus the "enroot" wordmark. Both are pixel
   art shown at whole-number scales so they stay crisp, and each comes in a Day and a Dusk version. */
.brand-icon { display: grid; place-items: center; width: 32px; height: 32px; }
.brand-icon .icon, .gate-brand .icon { width: 32px; height: 32px; filter: drop-shadow(2px 2px 0 var(--shadow)); }
.brand-name { display: flex; }
.wordmark { display: block; width: 80px; height: 22px; image-rendering: pixelated; }
:root:not([data-theme="dusk"]) .logo-dusk, :root[data-theme="dusk"] .logo-day { display: none; }
.main-nav { display: flex; gap: 5px; align-self: stretch; align-items: center; }
.main-nav a {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 39px; padding: 6px 16px; border: 1px solid transparent;
  color: var(--muted); font: 700 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em;
  white-space: nowrap;
}
.main-nav .icon { width: 15px; height: 15px; opacity: .76; }
.main-nav a:hover { background: var(--hover); color: var(--ink); }
.main-nav a[aria-current="page"] {
  color: var(--gold); background: var(--gold-tint); border-color: var(--gold-line);
  box-shadow: inset 0 -2px 0 var(--hairline), 2px 2px 0 var(--shadow);
}
.main-nav a[aria-current="page"] .icon { opacity: 1; }
.account { display: flex; align-items: center; gap: 10px; justify-self: end; }
.sign-in-button { min-height: 30px; padding-inline: 10px; }
.user-button { display: flex; align-items: center; min-width: 28px; min-height: 28px; }
.device-button {
  display: flex; align-items: center; gap: 7px; justify-self: end;
  padding: 7px 0 7px 6px; background: none; border: 0; color: var(--quiet);
  font: 11px/1.2 var(--mono); white-space: nowrap;
}
.device-button:hover { color: var(--gold); }
.device-button .icon { width: 15px; height: 15px; }
.companion-button { min-height: 31px; padding: 3px 8px 3px 4px; }
.companion-button canvas { display: block; flex: 0 0 auto; width: 23px; height: 23px; image-rendering: pixelated; }

main.layout { padding-top: 20px; }
.scene::after {
  content: ""; position: absolute; inset: 3px; pointer-events: none;
  background:
    linear-gradient(var(--gold),var(--gold)) left top / 8px 2px,
    linear-gradient(var(--gold),var(--gold)) left top / 2px 8px,
    linear-gradient(var(--gold-line),var(--gold-line)) right top / 8px 2px,
    linear-gradient(var(--gold-line),var(--gold-line)) right top / 2px 8px,
    linear-gradient(var(--gold-line),var(--gold-line)) left bottom / 8px 2px,
    linear-gradient(var(--gold-line),var(--gold-line)) left bottom / 2px 8px,
    linear-gradient(var(--gold),var(--gold)) right bottom / 8px 2px,
    linear-gradient(var(--gold),var(--gold)) right bottom / 2px 8px;
  background-repeat: no-repeat;
}
.hero-date, .page-kicker {
  display: flex; align-items: center; gap: 9px; margin-bottom: 9px;
  color: var(--gold); font: 700 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.hero-date .icon, .page-kicker .icon { width: 13px; height: 13px; }
h1, h2 { font-family: var(--pixel); font-weight: 400; text-transform: uppercase; }
h1 { font-size: 55px; line-height: 1.09; letter-spacing: .018em; }
.date-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.date-arrow, .square-button {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--raised); border: 1px solid var(--edge-strong); box-shadow: 2px 2px 0 var(--shadow);
}
.date-arrow:hover:not(:disabled), .square-button:hover { background: var(--hover); border-color: var(--edge-hover); }
.date-arrow:disabled .icon { opacity: .4; }
.date-picker {
  height: 34px; min-width: 119px; position: relative; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 11px; background: var(--raised); box-shadow: 2px 2px 0 var(--shadow);
  border: 1px solid var(--edge-strong); color: var(--ink); font: 700 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em;
}
.date-picker:hover, .date-picker:focus-within { background: var(--hover); border-color: var(--edge-hover); }
.date-picker:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.date-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-picker input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-picker .icon { width: 15px; height: 15px; }
.today-button { padding: 7px 8px; border: 0; background: var(--label-bg); color: var(--gold); font: 11px/1.3 var(--mono); }
.today-button:hover { text-decoration: underline; }

.companion-stage, .companion-tray { --avatar-size: 75px; pointer-events: none; }
.companion-actor { position: absolute; bottom: 0; left: calc((100% - var(--avatar-size)) * var(--companion-position, .35)); width: var(--avatar-size); }
.companion-sprite { display: block; width: var(--avatar-size); height: var(--avatar-size); image-rendering: pixelated; }
.companion-caption {
  position: absolute; bottom: calc(var(--avatar-size) - 4px); left: 50%; transform: translateX(-50%);
  max-width: min(150px, 45vw); width: max-content; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 6px; color: var(--gold); background: var(--hover); border: 1px solid var(--gold-line);
  box-shadow: 2px 2px 0 var(--shadow);
  font: 700 10px/1.2 var(--mono); white-space: nowrap;
}
/* The day's note, as a speech bubble from the companion. It slides against the companion's walk, and further
   left if it would pass the trail's right end, so it stays in the scene with its tail above the companion's head.
   --shift is how far the bubble sits left of the companion's centre (100cqw is the trail's width). */
.camp-trail { container-type: inline-size; }
.companion-speech {
  --p: var(--companion-position, .35);
  --shift: max(calc(var(--p) * 100%), calc(100% - (1 - var(--p)) * (100cqw - var(--avatar-size)) - var(--avatar-size) / 2));
  position: absolute; z-index: 2; left: 50%; bottom: calc(var(--avatar-size) + 5px);
  transform: translateX(calc(-1 * var(--shift)));
  display: grid; gap: 2px; width: max-content; max-width: var(--speech-width, 320px);
  padding: 7px 10px 8px; pointer-events: auto; text-align: left;
  color: var(--on-gold); background: #f6e8d4; border: 2px solid var(--outline);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--outline) 60%, transparent);
}
.companion-speech::before, .companion-speech::after {
  content: ""; position: absolute; left: clamp(12px, var(--shift), calc(100% - 12px));
  clip-path: polygon(0 0, 100% 0, 50% 100%); transform: translateX(-50%);
}
.companion-speech::after { bottom: -9px; width: 14px; height: 8px; background: var(--outline); }
.companion-speech::before { z-index: 1; bottom: -5px; width: 9px; height: 5px; background: #f6e8d4; }
.companion-speech:hover { background: #fff4e2; }
.companion-speech:hover::before { background: #fff4e2; }
.companion-speech:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* The note is for the Daily Log; on Insights and the Stream the companion just keeps you company. */
.page-trail .companion-speech { display: none; }
.speech-name { color: #8a4f3a; font: 700 9px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.speech-words {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
  font-size: 13px; line-height: 1.35; overflow-wrap: anywhere;
}
.companion-tray {
  position: fixed; z-index: 10; right: 19px; bottom: 17px;
  width: calc(var(--avatar-size) + 14px); height: calc(var(--avatar-size) + 9px);
  background: radial-gradient(ellipse at 50% 75%, var(--hover) 4%, var(--panel) 68%); border: 1px solid var(--edge-strong);
  box-shadow: 3px 3px 0 var(--shadow); isolation: isolate;
}
.companion-tray .companion-actor { left: 7px; }
.companion-tray .companion-caption { right: -5px; left: auto; transform: none; bottom: calc(var(--avatar-size) + 2px); }

.daily-grid { display: grid; grid-template-columns: 1.51fr 1fr; gap: 22px; align-items: start; margin-top: 24px; }
.daily-aside { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.panel {
  min-width: 0; border: 1px solid var(--edge); background: var(--panel);
  box-shadow: inset 0 1px 0 var(--panel-highlight), 3px 3px 0 var(--shadow);
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 19px; }
.panel-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.icon-tile {
  width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--raised); border: 1px solid var(--edge); color: var(--gold);
  box-shadow: inset 0 1px 0 #ffffff10;
}
.icon-tile.gold { background: var(--gold-tint); border-color: var(--gold-line); }
.icon-tile.violet { background: var(--violet-tint); border-color: var(--violet-line); }
.icon-tile.ember { background: var(--ember-tint); border-color: var(--ember-line); }
.icon-tile .icon { width: 20px; height: 20px; }
.icon-tile .mood-heading-icon { width: 22px; height: 22px; }
h2 { font-size: 22px; line-height: 1.12; letter-spacing: .045em; }
.section-description { color: var(--muted); font-size: 12px; margin-top: 3px; }
.outline-button, .primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  flex: 0 0 auto; min-height: 34px; padding: 7px 10px; border: 1px solid var(--edge-strong);
  background: var(--raised); color: var(--ink); box-shadow: 2px 2px 0 var(--shadow);
  font: 700 10px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em;
}
.outline-button .icon, .primary-button .icon { width: 15px; height: 15px; }
.outline-button:hover { color: var(--gold); background: var(--hover); border-color: var(--edge-hover); }
.primary-button { background: var(--gold-fill); color: var(--on-gold); border-color: var(--gold-fill-hover); min-height: 38px; padding-inline: 15px; }
.primary-button:hover:not(:disabled) { background: var(--gold-fill-hover); }
.primary-button:disabled { background: var(--well); border-color: var(--edge); color: var(--quiet); }
.text-link, .text-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  color: var(--gold); text-decoration: none; white-space: nowrap; font-size: 12px;
}
.text-link:hover, .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-link .icon, .text-button .icon { width: 15px; height: 15px; }

.habit-col-head, .habit-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 46px); align-items: center; gap: 6px; padding-inline: 19px; }
.habit-col-head {
  min-height: 28px; background: var(--well); border-block: 1px solid var(--hairline);
  color: var(--quiet); font: 700 9px/1 var(--mono); letter-spacing: .075em; text-transform: uppercase;
}
.habit-col-head span:not(:first-child) { text-align: center; }
.habit-row { min-height: 53px; border-bottom: 1px solid var(--hairline); padding-block: 5px; background: var(--panel); }
.habit-row:nth-child(2n+1) { background: var(--panel-alt); }
.habit-row:hover { background: var(--hover); }
.habit-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.habit-name > span:last-child { min-width: 0; }
.habit-name strong { display: block; color: var(--ink); font-size: 13px; font-weight: 640; overflow-wrap: anywhere; }
.habit-name small { display: block; color: var(--quiet); font-size: 11px; line-height: 1.28; overflow-wrap: anywhere; }
.habit-icon {
  width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--raised); border: 1px solid var(--edge);
}
.habit-icon .icon { width: 17px; height: 17px; }
.habit-icon[data-icon="water"] { background: var(--water-tint); border-color: var(--water-line); }
.habit-icon[data-icon="screen"], .habit-icon[data-icon="meditate"] { background: var(--violet-tint); border-color: var(--violet-line); }
.habit-icon[data-icon="read"], .habit-icon[data-icon="meal"], .habit-icon[data-icon="spark"] { background: var(--ember-tint); border-color: var(--ember-line); }
.habit-icon[data-icon="call"] { background: var(--red-tint); border-color: var(--red-line); }
.habit-icon[data-icon="exercise"], .habit-icon[data-icon="walk"], .habit-icon[data-icon="leaf"], .habit-icon[data-icon="bike"] { background: var(--green-tint); border-color: var(--green-line); }
.habit-icon[data-icon="music"], .habit-icon[data-icon="code"], .habit-icon[data-icon="moon"] { background: var(--violet-tint); border-color: var(--violet-line); }
.habit-icon[data-icon="art"], .habit-icon[data-icon="write"], .habit-icon[data-icon="sun"], .habit-icon[data-icon="coin"],
.habit-icon[data-icon="star"], .habit-icon[data-icon="broom"], .habit-icon[data-icon="cup"], .habit-icon[data-icon="paw"] { background: var(--ember-tint); border-color: var(--ember-line); }
.habit-icon[data-icon="heart"], .habit-icon[data-icon="pill"] { background: var(--red-tint); border-color: var(--red-line); }
.habit-icon[data-icon="chat"] { background: var(--water-tint); border-color: var(--water-line); }
.tier {
  display: inline-flex; justify-self: center; min-width: 54px; padding: 3px 6px;
  align-items: center; justify-content: center; border: 1px solid;
  font: 700 9px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase;
}
.tier-1 { color: var(--gold); background: var(--gold-tint); border-color: var(--gold-line); }
.tier-2 { color: var(--violet); background: var(--violet-tint); border-color: var(--violet-line); }
.tier-3 { color: var(--green); background: var(--green-tint); border-color: var(--green-line); }
.grade-button {
  justify-self: center; display: grid; place-items: center; width: 44px; height: 40px;
  background: var(--well); border: 1px solid var(--edge); box-shadow: inset 0 -1px 0 var(--hairline);
}
.grade-button .icon { width: 18px; height: 18px; opacity: .46; }
.grade-button:hover { background: var(--hover); border-color: var(--edge-hover); }
.grade-button:hover .icon, .grade-button[aria-pressed="true"] .icon { opacity: 1; }
.grade-button[data-grade="0"][aria-pressed="true"] { background: var(--red-tint); border-color: var(--red-line); }
.grade-button[data-grade="1"][aria-pressed="true"] { background: var(--gold-tint); border-color: var(--gold-line); }
.grade-button[data-grade="2"][aria-pressed="true"] { background: var(--green-tint); border-color: var(--green-line); }
.habit-row:last-child { border-bottom: 0; }
.empty-panel { color: var(--muted); padding: 24px 19px; }
.off-day-habits { border-top: 1px solid var(--hairline); }
.off-day-habits summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; padding: 11px 19px;
  color: var(--muted); font-size: 12px; cursor: pointer; background: var(--well);
}
.off-day-habits summary:hover { color: var(--ink); }
.off-day-habits summary small { color: var(--quiet); font-size: 11px; }
.off-day-habits[open] summary { border-bottom: 1px solid var(--hairline); }
.off-day-habits .habit-row { background: var(--well); }
.off-day-habits .habit-row:nth-child(2n+1) { background: var(--panel-alt); }
.off-day-habits .habit-row:hover { background: var(--hover); }
.off-day-habits .habit-name strong { color: var(--muted); }

.mood-panel .panel-heading { padding-bottom: 15px; }
.mood-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 0 18px 0; }
.mood-button {
  display: grid; gap: 5px; align-content: center; justify-items: center; min-width: 0; min-height: 73px;
  background: var(--well); border: 1px solid var(--edge); box-shadow: inset 0 -2px 0 var(--hairline);
  color: var(--muted); padding: 7px 2px;
  font: 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .025em;
}
.mood-button .icon { width: 34px; height: 34px; }
.mood-button:hover, .mood-button[aria-pressed="true"] {
  color: var(--ink); border-color: var(--mood-color, var(--gold));
  background: color-mix(in srgb, var(--mood-color, var(--gold)) 15%, var(--well));
}
.mood-button[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--mood-color, var(--gold)); }
.mood-footer {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 43px;
  padding: 9px 19px; color: var(--quiet); font-size: 11px;
}
.mood-footer .text-button { font-size: 11px; }

/* Ratings besides mood: a row of five color steps, worst to best whichever way the scale runs. */
.rating-log { border-top: 1px solid var(--hairline); padding: 4px 18px 0; }
.rating-row { padding: 10px 0 9px; }
.rating-row + .rating-row { border-top: 1px solid var(--hairline); }
.rating-head { display: flex; align-items: baseline; gap: 8px; min-height: 18px; margin-bottom: 6px; }
.rating-head strong { font-size: 12px; font-weight: 640; }
.rating-value { flex: 1; min-width: 0; color: var(--quiet); font-size: 11px; }
.rating-value[data-set="true"] { color: var(--ink); }
.rating-head .text-button { font-size: 11px; }
.rating-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.rating-button {
  display: grid; place-items: center; min-width: 0; min-height: 38px; padding: 4px 0;
  background: var(--well); border: 1px solid var(--edge); box-shadow: inset 0 -2px 0 var(--hairline);
}
.rating-button .icon { width: 24px; height: 24px; opacity: .7; }
.rating-button:hover, .rating-button[aria-pressed="true"] {
  border-color: var(--mood-color); background: color-mix(in srgb, var(--mood-color) 15%, var(--well));
}
.rating-button:hover .icon, .rating-button[aria-pressed="true"] .icon { opacity: 1; }
.rating-button[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--mood-color); }
.rating-ends { display: flex; justify-content: space-between; margin-top: 4px; color: var(--quiet); font: 9px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .03em; }
.rating-footer { padding: 6px 18px 12px; }
.rating-log[hidden] + .rating-footer { border-top: 1px solid var(--hairline); padding-top: 10px; }
.rating-footer .text-button { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.rating-footer .icon { width: 12px; height: 12px; }
.rating-choices { list-style: none; margin: 0; padding: 0; }
.manager-row.rating-choice { grid-template-columns: 74px minmax(0, 1fr) auto; }
.rating-choice small { display: block; color: var(--muted); font-size: 11px; }
.rating-choice[data-on="true"] strong { color: var(--green); }
.rating-faces { display: flex; gap: 1px; }
.rating-faces .icon { width: 14px; height: 14px; }
.rating-choice .manager-actions .primary-button { min-height: 28px; padding-inline: 9px; font-size: 9px; }

.icon-tile.green { background: var(--green-tint); border-color: var(--green-line); }
.daily-grid { grid-template-rows: auto 1fr; }
.daily-grid > .mood-panel { grid-column: 2; grid-row: 1; }
.daily-grid > .habit-panel { grid-column: 1; grid-row: 1 / span 2; }
.daily-grid > .daily-aside { grid-column: 2; grid-row: 2; }

/* The scene: your day above ground, your roots below it. */
.scene {
  position: relative; isolation: isolate; overflow: hidden; background: var(--sky);
  border: 1px solid var(--edge-strong); box-shadow: 4px 4px 0 var(--shadow);
}
.scene::after { z-index: 4; }
.scene-sky {
  position: absolute; z-index: -1; inset: 0 0 auto; height: calc(var(--sky, 198px) + 8px);
}
/* The canvas paints the sky, hills and soil behind everything else in the scene. */
.scene > canvas { position: absolute; z-index: -2; left: 0; top: 0; display: block; image-rendering: pixelated; pointer-events: none; }
.scene-heading { position: relative; z-index: 2; padding: 24px 28px; width: max-content; max-width: 100%; }
.scene-sky .hero-date { margin-bottom: 7px; }
.scene h1 { font-size: 34px; margin-bottom: 14px; text-shadow: var(--title-shadow); }
.scene-soil { position: relative; margin-top: var(--sky, 198px); }
.soil-heading { position: absolute; z-index: 3; inset: 14px 18px auto; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.soil-heading h2 { font-size: 18px; color: var(--soil-ink); text-shadow: 2px 2px 0 var(--soil-shadow); }
.soil-heading button { pointer-events: auto; min-height: 30px; padding: 4px 9px; font-size: 10px; }
.rootscape-labels { position: relative; height: var(--soil, 216px); }
/* Labels sit on the dark soil in both themes, so they always use light text. */
.rootscape-labels {
  --ink: var(--soil-ink); --muted: var(--soil-muted); --quiet: var(--soil-muted); --edge: var(--soil-edge);
  --panel: var(--soil-panel); --well: var(--soil-panel); --raised: var(--soil-panel); --hover: var(--soil-edge); --shadow: var(--soil-shadow);
  --gold: #f4c47e; --green: #b6d98f; --ember: #f0a582;
  --gold-tint: color-mix(in srgb, var(--gold) 16%, var(--soil-panel)); --gold-line: color-mix(in srgb, var(--gold) 45%, var(--soil-edge));
  --green-tint: color-mix(in srgb, var(--green) 16%, var(--soil-panel)); --green-line: color-mix(in srgb, var(--green) 45%, var(--soil-edge));
  --ember-tint: color-mix(in srgb, var(--ember) 16%, var(--soil-panel)); --ember-line: color-mix(in srgb, var(--ember) 45%, var(--soil-edge));
}
.camp-trail { position: absolute; z-index: 1; left: calc(var(--tree-x, 50%) + 92px); right: 19%; top: calc(var(--sky, 198px) - var(--avatar-size) + 1px); height: var(--avatar-size); }
.root-label {
  position: absolute; display: grid; justify-items: center; gap: 1px; max-width: 128px; padding: 3px 6px 4px;
  transform: translate(-50%, 6px); text-align: center; color: var(--ink); background: var(--soil-label); border: 1px solid var(--edge);
  border-top: 2px solid var(--hue); box-shadow: 2px 2px 0 var(--shadow);
}
.root-label[data-align="start"] { transform: translate(-10px, 6px); }
.root-label[data-align="end"] { transform: translate(calc(-100% + 10px), 6px); }
.root-label[data-compact] { min-width: 24px; min-height: 24px; align-content: center; padding: 2px 5px; transform: translate(-50%, 2px); }
.root-label[data-compact] strong { font: 400 12px/1 var(--pixel); color: var(--hue); }
.root-label:hover, .root-label:focus-visible, .root-label[aria-pressed="true"] { border-color: var(--hue); background: var(--panel); z-index: 2; }
.root-label strong { font-size: 11px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.root-label small { display: flex; align-items: center; gap: 4px; color: var(--muted); font: 700 8px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.root-detail { position: relative; min-height: 46px; display: grid; align-content: center; gap: 8px; padding: 8px 18px; background: var(--well); border-top: 1px solid var(--hairline); }
.root-hint { color: var(--muted); font-size: 12px; }
.root-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.root-card-name { display: flex; align-items: center; gap: 7px; padding-left: 8px; border-left: 3px solid var(--hue); }
.root-card-name strong { font-size: 13px; overflow-wrap: anywhere; }
.root-card-name small { color: var(--muted); font: 700 9px/1.3 var(--mono); text-transform: uppercase; white-space: nowrap; }
.root-card ul { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 150px; margin: 0; padding: 0; list-style: none; }
.root-card li { padding: 2px 7px; font-size: 11px; background: var(--raised); border: 1px solid var(--edge); }
.root-card li small { margin-left: 3px; color: var(--muted); font-size: 10px; }
.root-card li[data-state="glow"] { border-color: var(--gold-line); }
.root-card li[data-state="glow"] small { color: var(--gold); }
.root-card li[data-state="dry"] { border-style: dashed; color: var(--muted); }
.root-card > button { min-height: 28px; padding: 3px 10px; font-size: 10px; }
.root-key { display: flex; flex-wrap: wrap; gap: 5px; }
.root-chip { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 8px; color: var(--ink); font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--edge); }
.root-chip b { color: var(--hue); font: 400 12px/1 var(--pixel); }
.root-chip[aria-pressed="true"], .root-chip:hover { border-color: var(--hue); }
.root-health { padding: 0 4px; font: 700 8px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .05em; border: 1px solid; white-space: nowrap; }
.root-health[data-health="thriving"] { color: var(--green); border-color: var(--green-line); background: var(--green-tint); }
.root-health[data-health="steady"], .root-health[data-health="resting"] { color: var(--green); border-color: var(--green-line); background: var(--green-tint); }
.root-health[data-health="thirsty"] { color: var(--gold); border-color: var(--gold-line); background: var(--gold-tint); }
.root-health[data-health="wilting"] { color: var(--ember); border-color: var(--ember-line); background: var(--ember-tint); }
.root-health[data-health="unfed"] { color: var(--quiet); border-color: var(--edge); background: var(--well); }
.rootlet-label {
  position: absolute; z-index: 3; transform: translate(-50%, 7px); padding: 1px 5px; white-space: nowrap; pointer-events: none;
  font: 600 10px/1.4 var(--sans); color: var(--ink); background: var(--soil-label); border: 1px solid var(--edge); visibility: hidden;
}
.rootlet-label[data-shown] { visibility: visible; }
.rootlet-label[data-state="glow"] { color: var(--gold); border-color: var(--gold-line); }
.rootlet-label[data-state="dry"] { color: var(--muted); border-style: dashed; }
.rootscape-empty { position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 12px; width: min(380px, 86%); text-align: center; color: var(--soil-ink); font-size: 13px; }
.scene[data-empty] .root-detail { display: none; }
.rootscape-empty p { margin: 0; }
.name-field input { min-height: 44px; font-size: 15px; }
.ideas { margin: 2px 0 10px; }
.ideas-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.ideas-head h4 { margin: 0; color: var(--quiet); font: 700 10px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.ideas-arrows { display: flex; gap: 4px; }
.ideas-head h4 { display: flex; align-items: center; gap: 6px; }
.info-tip-button {
  display: inline-grid; place-items: center; width: 16px; height: 16px; min-height: 0; padding: 0;
  color: var(--muted); background: var(--panel); border: 1px solid var(--edge-strong); border-radius: 0;
  font: 700 10px/1 var(--mono); cursor: pointer;
}
.info-tip-button:hover, .info-tip-button[aria-expanded="true"] { color: var(--gold); border-color: var(--gold-line); background: var(--gold-tint); }
.info-tip-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.info-tip {
  margin: 0 0 7px; padding: 7px 9px; color: var(--muted); background: var(--panel);
  border: 1px solid var(--gold-line); box-shadow: 3px 3px 0 var(--shadow); font-size: 11px; line-height: 1.45;
}
.ideas-arrows .carousel-arrow { width: 26px; height: 26px; min-height: 0; padding: 0; }
.ideas-arrows .carousel-arrow:disabled { opacity: .35; cursor: default; }
.idea-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 2px;
}
.idea-track::-webkit-scrollbar { display: none; }
.idea-card {
  display: grid; align-content: start; justify-items: start; gap: 3px; min-height: 74px; padding: 8px; scroll-snap-align: start;
  text-align: left; color: inherit; background: var(--panel); border: 1px solid var(--edge); transition: border-color .12s, background .12s, transform .12s;
}
.idea-card:hover { background: var(--hover); border-color: var(--edge-hover); transform: translateY(-1px); }
.idea-card[aria-pressed="true"] { background: var(--green-tint); border-color: var(--green-line); box-shadow: inset 0 -2px 0 var(--green-line); }
.idea-card strong { font-size: 12px; font-weight: 640; line-height: 1.25; }
.idea-card small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.idea-card .habit-icon { margin-bottom: 1px; }
.root-idea { grid-auto-rows: min-content; }
.idea-track:has(.root-idea) { grid-auto-columns: 156px; }
.icon-track { grid-auto-columns: 38px; gap: 5px; padding: 2px; }
.icon-track .icon-choice { width: 38px; height: 38px; scroll-snap-align: start; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.icon-track .icon-choice .icon { width: 20px; height: 20px; }
.icon-choice:hover:not(:disabled) { transform: translateY(-1px); }
.icon-choice[aria-checked="true"] { box-shadow: 0 0 0 2px var(--gold); }
.icon-choice:disabled { opacity: .3; cursor: default; }
.icon-picker[data-locked] .ideas-arrows { visibility: hidden; }
.tier-toggle { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.tier-toggle button { min-height: 36px; font: 400 13px/1 var(--pixel); }
.more-options { margin: 4px 0 12px; border: 1px solid var(--hairline); background: var(--well); }
.more-options summary { display: flex; align-items: baseline; gap: 8px; padding: 9px 11px; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
.more-options summary:hover { color: var(--ink); }
.more-options summary small { margin-left: auto; color: var(--quiet); font-weight: 400; font-size: 11px; text-align: right; }
.more-options[open] summary { border-bottom: 1px solid var(--hairline); }
.more-options[open] summary small { display: none; }
.more-options-body { display: grid; gap: 4px; padding: 11px 11px 2px; }
.activity-carousel { display: grid; grid-template-columns: auto 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px; background: var(--raised); border: 1px solid var(--edge); }
.activity-carousel canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.activity-carousel output { font-size: 13px; font-weight: 600; }
.habit-empty { display: grid; justify-items: start; gap: 12px; }
.habit-empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 3px; }
.root-editor-statement { color: var(--muted); font-style: italic; font-size: 12px; margin: -3px 0 8px; }
.link-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.link-chip { position: relative; display: inline-flex; }
.link-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.link-chip span { padding: 5px 8px; font-size: 11px; color: var(--muted); background: var(--raised); border: 1px solid var(--edge); }
.link-chip input:checked + span { color: var(--ink); background: var(--green-tint); border-color: var(--green-line); box-shadow: inset 0 -2px 0 var(--green-line); }
.link-chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.link-chip small { color: var(--green); font: 700 8px/1 var(--mono); margin-left: 4px; text-transform: uppercase; }
.feeds-field { border: 0; padding: 0; margin-inline: 0; }
.feeds-field legend { font-weight: 600; font-size: 12px; margin-bottom: 4px; padding: 0; }
.feeds-field .field-help { margin-top: 5px; }
.manager-row.root-manager-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
.root-manager-row small { display: block; color: var(--muted); font-size: 11px; }
.target-panel .panel-heading { padding-block: 14px; }
.target-body { padding: 0 18px 15px; }
.target-empty { color: var(--muted); font-size: 12px; }
.target-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.target-streak { display: grid; justify-items: end; line-height: 1; }
.target-streak strong { color: var(--gold); font: 400 26px/1 var(--pixel); }
.target-streak small { color: var(--quiet); font: 700 9px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.target-progress { margin-top: 11px; }
.progress-track { display: block; height: 8px; background: var(--well); border: 1px solid var(--edge); }
.progress-track > span { display: block; height: 100%; background: var(--violet); box-shadow: inset 0 -2px 0 var(--violet-line); }
.target-progress p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.target-progress strong { color: var(--ink); }
.target-mastered { margin-top: 9px; color: var(--gold); font-size: 12px; }
.target-note { margin-top: 3px; color: var(--quiet); font-size: 11px; }
.reward-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.reward-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; background: var(--well); border: 1px solid var(--edge);
  color: var(--quiet); font-size: 10px;
}
.reward-chip b { color: var(--muted); font: 700 9px/1 var(--mono); }
.reward-chip b::after { content: "d"; }
.reward-chip[data-earned] { background: var(--green-tint); border-color: var(--green-line); color: var(--ink); }
.reward-chip[data-earned] b { color: var(--green); }
.target-tag {
  display: inline-block; margin-left: 6px; padding: 1px 4px; vertical-align: 1px; border: 1px solid var(--violet-line);
  background: var(--violet-tint); color: var(--violet); font: 700 8px/1.3 var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: .06em;
}
.target-options { display: grid; gap: 6px; list-style: none; margin: 0 0 10px; padding: 0; }
.target-option {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; width: 100%;
  padding: 9px 10px; text-align: left; background: var(--well); border: 1px solid var(--edge); color: inherit;
}
.target-option:hover { background: var(--hover); border-color: var(--edge-hover); }
.target-option[aria-pressed="true"] { background: var(--violet-tint); border-color: var(--violet); }
.target-option .habit-name strong { font-size: 12px; }
.target-status { color: var(--violet); font: 700 9px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; text-align: right; }
.target-option .reward-chips { grid-column: 1 / -1; margin-top: 4px; }
.unlock-toast { right: auto; left: 15px; background: var(--green-tint); border-color: var(--green-line); }
.carousel-lock { width: 12px; height: 12px; flex: 0 0 auto; }
.wardrobe-lock-note { margin-top: 6px; color: var(--ember); font-size: 11px; }
.wardrobe-lock-note:empty { display: none; }

.week-panel .panel-heading { padding-block: 14px; }
.week-panel .icon-tile { width: 31px; height: 31px; }
.week-panel .icon-tile .icon { width: 17px; height: 17px; }
.date-range { color: var(--quiet); font: 700 10px/1.35 var(--mono); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.week-days {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px;
  padding: 0 18px 14px;
}
.week-day {
  display: grid; justify-items: center; align-content: center; gap: 6px; min-width: 0; min-height: 53px;
  border: 1px solid var(--edge); background: var(--well); color: var(--muted); padding: 4px 0;
}
.week-day:disabled { opacity: .57; }
.week-day:not(:disabled):hover { border-color: var(--edge-hover); background: var(--hover); }
.week-day[aria-current="date"] { border-color: var(--gold-line); background: var(--gold-tint); color: var(--gold); }
.week-day span { font: 700 9px/1 var(--mono); text-transform: uppercase; letter-spacing: .045em; }
.week-day b { position: relative; font: 700 12px/1 var(--mono); }
.week-day b::after {
  position: absolute; width: 3px; height: 3px; right: -6px; top: 0;
  background: transparent; content: "";
}
.week-day[data-logged="true"] b::after { background: var(--green); }
.week-footer {
  min-height: 42px; border-top: 1px solid var(--hairline); padding: 8px 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 9px;
}
.week-footer > span { color: var(--quiet); font-size: 10px; white-space: nowrap; }
.legend-dot { display: inline-block; vertical-align: 2px; width: 4px; height: 4px; margin-right: 3px; background: var(--green); }

.stream-shortcut {
  display: flex; align-items: center; gap: 12px; min-height: 70px; padding: 12px 17px;
  background: linear-gradient(100deg, var(--green-tint), var(--panel) 74%); border-color: var(--green-line);
}
.stream-shortcut:hover { border-color: var(--green-line); background: linear-gradient(100deg, color-mix(in srgb, var(--green) 24%, var(--panel)), var(--panel) 74%); }
.stream-shortcut strong { display: block; color: var(--green); font-weight: 650; font-size: 13px; }
.stream-shortcut small { display: block; margin-top: 1px; color: var(--quiet); font-size: 11px; }
.shortcut-arrow { margin-left: auto; width: 16px; height: 16px; }

.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 27px; padding: 13px 1px calc(26px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hairline);
  color: var(--quiet); font-size: 11px;
}
.site-footer > span { display: flex; align-items: center; gap: 7px; }
.site-footer .icon { width: 14px; height: 14px; }
.site-footer .text-button { font-size: 11px; }
.footer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.reminder-fields { display: grid; gap: 14px; }
.reminder-fields .form-field { max-width: 180px; }
.reminder-note { font-size: 12px; line-height: 1.5; }

.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  padding: 17px 2px 22px; border-bottom: 1px solid var(--edge); margin-bottom: 22px;
}
.page-heading h1 { text-shadow: var(--title-shadow); }
.page-description { color: var(--muted); font-size: 15px; margin-top: 6px; }
.page-kicker { margin-bottom: 4px; }
.page-tools { display: flex; align-items: flex-end; gap: 10px; }
.page-trail {
  --avatar-size: 59px; position: relative; width: 144px; height: var(--avatar-size); flex: 0 0 auto;
  border-bottom: 1px dashed var(--edge-strong);
  background: linear-gradient(0deg, color-mix(in srgb, var(--hover) 60%, transparent) 0%, transparent 68%);
}
.page-trail .companion-caption { bottom: calc(var(--avatar-size) - 8px); }
.insights-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 11px; margin-bottom: 16px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--well); border: 1px solid var(--edge); }
.segmented button {
  min-height: 31px; padding: 5px 10px; border: 1px solid transparent;
  color: var(--muted); background: transparent; font: 700 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .045em;
}
.segmented button:hover { background: var(--hover); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--gold-tint); border-color: var(--gold-line); color: var(--gold); }
.top-habits-panel { margin-bottom: 16px; }
.top-habits-panel .panel-heading { padding-bottom: 13px; }
.top-habits-body { padding: 0 18px 15px; }
.top-habit-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 8px; padding: 0; margin: 0; list-style: none;
}
.top-habit {
  min-width: 0; padding: 10px 11px; background: var(--well); border: 1px solid var(--edge);
  box-shadow: inset 2px 0 0 var(--green-line);
}
.top-habit.strength-possible { box-shadow: inset 2px 0 0 var(--gold-line); }
.top-habit-line { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.top-habit-line .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.top-habit-line strong { color: var(--ink); }
.top-habit-line strong.delta-positive { color: var(--green); font-family: var(--mono); white-space: nowrap; }
.top-habit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; margin: 7px 0 0 24px; color: var(--quiet); font-size: 11px; }
.strength-tag { padding: 1px 6px; color: var(--green); border: 1px solid var(--green-line); font: 700 9px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.strength-possible .strength-tag { color: var(--gold); border-color: var(--gold-line); }
.top-habits-empty { color: var(--muted); font-size: 13px; }
.top-habits-note { color: var(--muted); margin-top: 8px; font-size: 11px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.insight-stat { padding: 13px 15px; }
.insight-stat > span { display: block; color: var(--muted); font: 700 10px/1.35 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.insight-stat > strong { display: block; margin-top: 3px; color: var(--gold); font: 28px/1.16 var(--pixel); }
.insight-stat > small { display: block; margin-top: 3px; color: var(--quiet); font-size: 11px; }
.trend-panel, .calendar-panel, .compare-panel { margin-bottom: 20px; }
.global-body { padding: 0 18px 16px; }
.global-optin { display: grid; gap: 4px; margin-bottom: 12px; padding: 10px 11px; background: var(--well); border: 1px solid var(--edge); }
.global-optin .checkbox-label { color: var(--ink); font-size: 13px; }
.global-optin .field-help { margin: 0; line-height: 1.45; }
.global-optin .share-ratings { margin-top: 6px; }
.global-optin .share-ratings:has(input:disabled) { opacity: .55; cursor: default; }
.outcome-switch { display: flex; flex-wrap: wrap; margin-bottom: 12px; }
.global-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.global-list .top-habit.strength-unclear { box-shadow: inset 2px 0 0 var(--edge-strong); }
.global-list .strength-unclear .strength-tag { color: var(--quiet); border-color: var(--edge-strong); }
.global-list .top-habit-line strong.delta-negative { color: var(--red); font-family: var(--mono); white-space: nowrap; }
.keeps-tag { color: var(--gold); }
@media (max-width: 640px) { .global-body { padding-inline: 12px; } }
.root-insight-list { list-style: none; margin: 0; padding: 0 18px; }
.root-insight { display: grid; grid-template-columns: 40px minmax(0, 1fr) 82px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.root-insight:last-child { border-bottom: 0; }
.root-insight .root-thumb { width: 40px; height: 40px; image-rendering: pixelated; background: var(--well); border: 1px solid var(--hairline); }
.root-insight-text { min-width: 0; }
.root-insight-text strong { display: block; color: var(--ink); font-size: 13px; }
.root-insight-text small { display: block; color: var(--quiet); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.root-insight-text small + small { color: var(--muted); }
.roots-insight-panel .table-note { padding-inline: 18px; }
.chart-body { padding: 0 18px 12px; }
.chart-key { display: flex; flex-wrap: wrap; gap: 5px 17px; align-items: center; color: var(--muted); padding: 0 0 9px; font: 11px/1.3 var(--mono); }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; background: var(--gold); }
.chart-legend:nth-child(2) i { background: var(--green); }
.chart-box { position: relative; background: var(--well); border: 1px solid var(--hairline); }
.chart-box canvas { display: block; width: 100%; height: 270px; }
.chart-empty {
  position: absolute; inset: 0 24px 20px; display: grid; place-content: center; text-align: center;
  pointer-events: none; color: var(--muted); font-size: 12px;
}
.chart-empty p { background: var(--panel); border: 1px solid var(--hairline); padding: 7px 12px; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 1; min-width: 124px; padding: 7px 8px;
  color: var(--ink); background: var(--raised); border: 1px solid var(--edge-strong); box-shadow: 2px 2px 0 var(--shadow);
  font: 10px/1.45 var(--mono); white-space: nowrap;
}
.chart-data { margin-top: 8px; color: var(--muted); }
.chart-data summary { color: var(--gold); width: fit-content; font-size: 12px; cursor: pointer; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th, td { padding: 8px 11px; border-bottom: 1px solid var(--hairline); }
thead th { color: var(--quiet); font: 700 10px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .045em; }
tbody th { font-weight: 600; }
.table-note { padding: 10px 17px; color: var(--quiet); font-size: 11px; }

.calendar-body { padding: 0 18px 15px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-dow { color: var(--quiet); font: 700 10px/1.3 var(--mono); text-transform: uppercase; padding: 1px 3px 4px; }
.calendar-day {
  position: relative; display: flex; align-items: center; gap: 6px; justify-content: space-between;
  min-width: 0; min-height: 37px; padding: 5px 7px; color: var(--muted);
  background: var(--well); border: 1px solid var(--edge); font: 700 10px/1.25 var(--mono); text-align: left;
}
.calendar-day[data-level="0"] { background: var(--red-tint); border-color: var(--red-line); }
.calendar-day[data-level="1"] { background: var(--gold-tint); border-color: var(--gold-line); }
.calendar-day[data-level="2"] { background: color-mix(in srgb, var(--green) 18%, var(--panel)); border-color: var(--green-line); }
.calendar-day[data-level="3"] { background: color-mix(in srgb, var(--green) 36%, var(--panel)); border-color: var(--green-line); color: var(--ink); }
.calendar-day[data-level="4"] { background: color-mix(in srgb, var(--green) 60%, var(--panel)); border-color: var(--green); color: var(--ink); }
.calendar-day:not(:disabled):hover { border-color: var(--gold); color: var(--ink); }
.calendar-day .icon { width: 19px; height: 19px; }
.calendar-day .mark-today { color: var(--gold); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 9px; color: var(--muted); font-size: 11px; }
.calendar-legend .calendar-day { display: inline-block; width: 12px; min-height: 12px; padding: 0; pointer-events: none; }
.comparison { min-width: 465px; }
.comparison th:first-child, .comparison td:first-child { padding-left: 18px; }
.comparison th:last-child, .comparison td:last-child { padding-right: 18px; }
.compare-habit { display: inline-flex; align-items: center; gap: 8px; }
.compare-habit .icon { width: 16px; height: 16px; }
.compare-number { color: var(--ink); font-family: var(--mono); white-space: nowrap; }
.compare-count { color: var(--quiet); font: 10px/1.2 var(--mono); white-space: nowrap; }
.delta-positive { color: var(--green); }
.delta-negative { color: var(--red); }
.dot-plot { padding: 0 18px; }
.dot-key { padding-bottom: 4px; }
.dot-key .dot { position: static; transform: none; }
.dot-rows { margin: 0; padding: 0; list-style: none; }
.dot-row {
  display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) 82px; align-items: center; gap: 14px;
  min-height: 34px; border-bottom: 1px solid var(--hairline);
}
.dot-row:last-child { border-bottom: 0; }
.dot-row .compare-habit { min-width: 0; font-size: 13px; font-weight: 600; }
.dot-row .compare-habit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-track { position: relative; height: 18px; margin: 0 9px; }
.dot-rows .dot-track::before { content: ""; position: absolute; inset: 50% 0 auto; height: 1px; background: var(--edge); }
.dot-axis { min-height: 26px; color: var(--quiet); font: 700 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.dot-axis .dot-track span { position: absolute; top: 50%; transform: translate(-50%, -50%); line-height: 0; }
.dot-axis .icon { width: 16px; height: 16px; }
.dot-bar { position: absolute; top: calc(50% - 2px); height: 4px; background: var(--quiet); opacity: .55; }
.dot-bar.delta-positive { background: var(--green); }
.dot-bar.delta-negative { background: var(--red); }
.dot {
  position: absolute; top: 50%; width: 10px; height: 10px; transform: translate(-50%, -50%);
  border: 2px solid var(--shadow); box-sizing: content-box;
}
.chart-legend i.dot { width: 8px; height: 8px; border-width: 1px; }
.dot-key .chart-legend i.dot-done { background: var(--green); }
.dot-key .chart-legend i.dot-partial { width: 6px; height: 6px; background: var(--gold); }
.dot-key .chart-legend i.dot-missed { background: var(--red); }
.dot-key .chart-legend i.few { background: var(--panel); color: var(--muted); border-color: currentColor; }
.dot-done { background: var(--green); z-index: 3; }
.dot-partial { width: 6px; height: 6px; background: var(--gold); z-index: 1; }
.dot-missed { background: var(--red); z-index: 2; }
.dot.few { background: var(--panel); border-color: currentColor; }
.dot-done.few { color: var(--green); }
.dot-partial.few { color: var(--gold); }
.dot-missed.few { color: var(--red); }
.dot-delta { font: 700 12px/1 var(--mono); text-align: right; white-space: nowrap; }
.dot-delta small { display: block; margin-top: 3px; color: var(--quiet); font: 700 9px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.dot-delta.strength-unclear, .lift-pending { color: var(--quiet); }
.dot-delta.strength-possible { opacity: .85; }
.dot-axis .dot-delta { font: inherit; }
.dot-plot .chart-data { margin: 10px 0 0; }
.dot-plot .comparison th:first-child, .dot-plot .comparison td:first-child { padding-left: 0; }

/* The stream: the same world as the Daily Log, with water where the roots would be. */
.stream-scene { height: var(--scene-height, 291px); margin-bottom: 18px; }
.stream-trail {
  --avatar-size: 59px; position: absolute; z-index: 1; left: 50%; right: 4%;
  top: calc(var(--sky, 150px) - var(--avatar-size) + 1px); height: var(--avatar-size);
}
.stream-trail .companion-speech { display: none; }
.stream-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stream-field { margin: 0 20px; }
.stream-field textarea { min-height: 170px; font-size: 14px; line-height: 1.5; }
.note-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px 20px; }
#stream-feedback { color: var(--gold); font-size: 12px; }
.tally-body { display: grid; justify-items: start; gap: 12px; padding: 0 18px 18px; }
.tally-count { color: var(--muted); font-size: 13px; }
.tally-count strong { display: block; margin-bottom: 2px; color: var(--green); font: 34px/1.1 var(--pixel); }
.tally-body .segmented button { min-height: 28px; }
.tally-note { color: var(--quiet); font-size: 11px; }
/* Your words, folding into a leaf on the way to the water. */
.note-card {
  position: fixed; z-index: 15; pointer-events: none; overflow: hidden; padding: 8px 10px;
  color: var(--ink); background: var(--field-bg); border: 2px solid var(--gold);
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; will-change: transform, opacity;
}
.leaf-flight { position: fixed; z-index: 16; pointer-events: none; image-rendering: pixelated; will-change: transform, opacity; }

dialog {
  width: min(540px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 0;
  background: var(--panel); color: var(--ink); border: 1px solid var(--edge-strong); box-shadow: 5px 5px 0 var(--shadow);
}
dialog::backdrop { background: var(--overlay); }
.dialog-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 17px 18px 13px; border-bottom: 1px solid var(--hairline);
}
.dialog-body { padding: 12px 18px 16px; }
.dialog-note { color: var(--quiet); font-size: 11px; margin-top: 10px; }
.manager-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
  min-height: 46px; border-bottom: 1px solid var(--hairline); padding: 6px 0;
}
.manager-row .habit-name strong { font-size: 12px; }
.manager-actions { display: flex; gap: 5px; }
.manager-actions .outline-button { min-height: 28px; padding-inline: 7px; font-size: 9px; }
.add-habit { margin-top: 14px; }
.archived-list { margin-top: 13px; }
.archived-list summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.field-help { color: var(--quiet); font-size: 11px; }
.habit-editor { margin-bottom: 10px; padding: 12px; background: var(--well); border: 1px solid var(--edge); }
.habit-editor h3 { font-size: 13px; margin-bottom: 7px; color: var(--gold); }
.form-field { display: grid; gap: 4px; min-width: 0; margin-bottom: 8px; }
/* Fields look sunken into the card: a chunky border with a shadow along the inside top and left. On focus the
   border turns gold and a gold block appears behind the field, like a selected menu slot. */
.form-field > label, .field-label, .schedule-field legend, .feeds-field legend {
  color: var(--muted); font: 700 10px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .07em;
}
.name-field > label { color: var(--ink); font: 600 13px/1.35 var(--sans); text-transform: none; letter-spacing: 0; }
.form-field label span { color: var(--quiet); font-weight: 400; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; min-height: 38px; padding: 8px 10px; color: var(--ink); background-color: var(--field-bg);
  border: 2px solid var(--edge-strong); border-radius: 0; box-shadow: inset 2px 2px 0 var(--field-inset);
  font-size: 13px; transition: border-color .12s, box-shadow .12s;
}
.form-field :is(input, select, textarea):hover { border-color: var(--edge-hover); }
.form-field :is(input, select, textarea):focus {
  outline: none; border-color: var(--gold); box-shadow: inset 2px 2px 0 var(--field-inset), 3px 3px 0 var(--gold-fill);
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--quiet); opacity: 1; }
.form-field textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.form-field select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 11px center; background-size: 10px 6px;
}
:root { --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' shape-rendering='crispEdges' fill='%2322324a'%3E%3Crect width='2' height='2'/%3E%3Crect x='2' y='2' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='8' width='2' height='2'/%3E%3C/svg%3E"); }
:root[data-theme="dusk"] { --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' shape-rendering='crispEdges' fill='%23f4c47e'%3E%3Crect width='2' height='2'/%3E%3Crect x='2' y='2' width='2' height='2'/%3E%3Crect x='4' y='4' width='2' height='2'/%3E%3Crect x='6' y='2' width='2' height='2'/%3E%3Crect x='8' width='2' height='2'/%3E%3C/svg%3E"); }
.schedule-field { border: 0; padding: 0; margin-inline: 0; }
.schedule-field legend { font-weight: 600; font-size: 12px; padding: 0; margin-bottom: 4px; }
.schedule-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-toggle { position: relative; display: block; cursor: pointer; }
.day-toggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.day-toggle span[aria-hidden] {
  display: grid; place-items: center; min-height: 32px; background: var(--well); border: 1px solid var(--edge);
  color: var(--quiet); font: 700 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
}
.day-toggle:hover span[aria-hidden] { border-color: var(--edge-hover); color: var(--ink); }
.day-toggle input:checked + span { background: var(--gold-tint); border-color: var(--gold-line); color: var(--gold); }
.day-toggle input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.schedule-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 11px; margin-top: 6px; font-size: 11px; }
#schedule-summary { color: var(--muted); margin-right: auto; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; }
.settings-form { padding-block: 15px 18px; }
.settings-form .editor-actions { margin-top: 12px; }
.companion-settings { display: grid; grid-template-columns: 118px minmax(0, 1fr); align-items: start; gap: 13px; }
.companion-preview {
  display: grid; place-items: center; min-height: 118px; position: sticky; top: 0;
  background: radial-gradient(ellipse at 50% 76%, var(--hover), var(--well) 70%);
  border: 1px solid var(--edge-strong);
}
.companion-preview canvas { display: block; width: 104px; height: 104px; image-rendering: pixelated; }
.companion-carousel { display: grid; gap: 5px; }
.carousel-row { display: grid; grid-template-columns: 78px 28px minmax(0, 1fr) 28px; align-items: center; gap: 5px; }
.carousel-label { color: var(--muted); font: 700 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.carousel-arrow { width: 28px; height: 28px; box-shadow: 1px 1px 0 var(--shadow); }
.carousel-arrow .icon { width: 12px; height: 12px; }
.carousel-value {
  display: flex; align-items: center; gap: 6px; min-width: 0; height: 28px; padding: 0 8px;
  background: var(--raised); border: 1px solid var(--edge-strong); font-size: 12px;
}
.carousel-value span:not(.carousel-swatch) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carousel-value small { color: var(--muted); font: 10px/1 var(--mono); }
.carousel-swatch { flex: 0 0 auto; width: 10px; height: 10px; border: 1px solid var(--ink); }
.companion-shuffle { margin-top: 9px; }
.companion-actions { justify-content: space-between; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.checkbox-label { cursor: pointer; }
.checkbox-label input {
  appearance: none; flex: 0 0 auto; width: 18px; height: 18px; margin: 0; cursor: pointer;
  background: var(--field-bg); border: 2px solid var(--edge-strong); box-shadow: inset 2px 2px 0 var(--field-inset);
}
.checkbox-label:hover input { border-color: var(--edge-hover); }
.checkbox-label input:checked {
  border-color: var(--gold-line); box-shadow: inset -2px -2px 0 #00000024;
  background: var(--gold-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 7' shape-rendering='crispEdges' fill='%2322324a'%3E%3Crect x='6' width='2' height='2'/%3E%3Crect x='5' y='2' width='2' height='2'/%3E%3Crect x='3' y='3' width='2' height='2'/%3E%3Crect x='2' y='4' width='2' height='2'/%3E%3Crect x='0' y='2' width='2' height='2'/%3E%3Crect x='1' y='3' width='2' height='2'/%3E%3C/svg%3E") center / 10px 9px no-repeat;
}
.backup-body { color: var(--muted); }
.backup-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-block: 15px 11px; }
#backup-status { color: var(--gold); font-size: 12px; }
.toast {
  position: fixed; z-index: 20; right: 15px; bottom: 15px; max-width: min(380px, calc(100% - 30px));
  background: var(--panel); border: 1px solid var(--gold-line); padding: 9px 12px; box-shadow: 2px 2px 0 var(--shadow);
  color: var(--ink); font-size: 12px;
}

@media (min-width: 1500px) {
  .layout { width: min(1230px, calc(100% - 104px)); }
}

@media (max-width: 1010px) {
  .layout { width: calc(100% - 44px); }
  .daily-grid { gap: 15px; grid-template-columns: 1.22fr 1fr; }
  .daily-aside { gap: 14px; }
  .scene h1 { font-size: 30px; }
  .scene-heading { padding-inline: 20px; }
  .camp-trail { right: 3%; --speech-width: 210px; }
  .panel-heading { padding-inline: 13px; }
  .habit-row, .habit-col-head { padding-inline: 12px; grid-template-columns: minmax(0, 1fr) repeat(3, 44px); }
  .mood-footer, .rating-log, .rating-footer { padding-inline: 13px; }
  .mood-options, .week-days, .week-footer { padding-inline: 12px; }
  h1 { font-size: 49px; }
  h2 { font-size: 20px; }
  .mood-options { gap: 5px; }
}

@media (max-width: 740px) {
  .layout { width: calc(100% - 32px); }
  .top-inner { min-height: 63px; gap: 8px; }
  .main-nav { gap: 1px; }
  .main-nav a { gap: 5px; padding: 6px 7px; min-height: 37px; letter-spacing: 0; font-size: 10px; }
  .main-nav .icon { width: 13px; height: 13px; }
  .brand { gap: 7px; }
  .brand-name { font-size: 18px; letter-spacing: .04em; }
  .device-button span { display: none; }
  .device-button { width: 32px; height: 32px; padding: 0; justify-content: center; border: 1px solid var(--hairline); }
  main.layout { padding-top: 18px; }
  .daily-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 15px; }
  .daily-grid { grid-template-rows: none; }
  .daily-grid > .mood-panel, .daily-grid > .habit-panel, .daily-grid > .daily-aside { grid-column: 1; grid-row: auto; }
  /* Until there is a habit, adding one is the first thing to do. */
  .daily-grid > .habit-panel:has(.habit-empty) { order: -1; }
  .daily-aside { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stream-shortcut { grid-column: 1 / -1; }
  .page-heading { padding-top: 9px; }
  .page-description { font-size: 13px; }
  .stream-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stream-note .panel-heading, .note-footer { padding-inline: 12px; }
  .stream-field { margin-inline: 12px; }
  .stream-field textarea { min-height: 140px; }
  .tally-body { padding-inline: 12px; }
}

@media (max-width: 545px) {
  .top-inner { grid-template-columns: 1fr auto; padding-block: 9px 7px; row-gap: 6px; }
  .main-nav { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .main-nav a { justify-content: center; min-height: 34px; font-size: 10px; padding-inline: 3px; }
  .device-button { grid-row: 1; grid-column: 2; }
  .companion-settings { grid-template-columns: minmax(0, 1fr); }
  .companion-button { padding-right: 4px; }
  .companion-button-label { display: none; }
  .speech-words { font-size: 12px; }
  .scene-heading { padding: 14px 14px 0; }
  /* The date and its controls say enough on a phone; the title stays for screen readers. */
  .scene h1 { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); }
  .soil-heading { inset: 9px 10px auto; }
  .soil-heading h2 { font-size: 15px; }
  .camp-trail { --avatar-size: 55px; left: 55%; right: 2%; --speech-width: 165px; }
  .root-chip { min-height: 28px; padding-inline: 7px; }
  .root-detail { padding: 9px 10px; }
  .companion-preview { position: static; }
  .dot-plot { padding: 0 13px; }
  .dot-row { grid-template-columns: 104px minmax(0, 1fr) 56px; gap: 8px; }
  .dot-row .compare-habit { font-size: 12px; }
  .carousel-row { grid-template-columns: 70px 28px minmax(0, 1fr) 28px; }
  .daily-aside { grid-template-columns: minmax(0, 1fr); }
  .stream-trail { --avatar-size: 47px; left: 45%; }
  .mood-options { gap: 6px; }
  .mood-button { min-height: 68px; }
  .habit-col-head, .habit-row { grid-template-columns: minmax(0, 1fr) repeat(3, 42px); gap: 4px; padding-inline: 9px; }
  .habit-name { gap: 7px; }
  .habit-name strong { font-size: 12px; }
  .habit-name small { font-size: 10px; }
  .habit-icon { width: 27px; height: 27px; }
  .habit-icon .icon { width: 16px; height: 16px; }
  .grade-button { width: 42px; height: 40px; }
  .panel-title { gap: 8px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 15px; padding-bottom: 15px; }
  .page-heading h1 { font-size: 44px; }
  .page-tools { width: 100%; justify-content: flex-end; }
  .page-trail { --avatar-size: 47px; width: 105px; align-self: flex-end; }
  .summary-grid { gap: 6px; margin-bottom: 14px; }
  .top-habits-body { padding-inline: 12px; }
  .root-insight-list, .roots-insight-panel .table-note { padding-inline: 12px; }
  .root-insight { grid-template-columns: 34px minmax(0, 1fr) 56px; gap: 9px; }
  .root-insight .root-thumb { width: 34px; height: 34px; }
  .insight-stat { padding: 8px 6px; }
  .insight-stat > span { letter-spacing: 0; font-size: 9px; }
  .insight-stat > strong { font-size: 22px; }
  .insight-stat > small { font-size: 9px; }
  .trend-panel .panel-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .chart-body, .calendar-body { padding-inline: 10px; }
  .date-range { font-size: 9px; letter-spacing: 0; }
  .calendar-grid { gap: 3px; }
  .calendar-day { padding: 2px 3px; gap: 1px; min-height: 31px; }
  .calendar-day .icon { width: 13px; height: 13px; }
  .calendar-dow { font-size: 9px; }
  .site-footer { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 350px) {
  .layout { width: calc(100% - 22px); }
  .habit-col-head, .habit-row { padding-inline: 6px; }
  .panel-heading { gap: 8px; }
  .manager-row { gap: 4px; }
  .manager-actions .outline-button { padding-inline: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Sign-in gate --------------------------------------------------------------------------------------------- */
.auth-gate {
  display: none; min-height: 100vh; padding: 40px 16px; place-items: center;
  background: radial-gradient(ellipse at 50% 0%, var(--page-glow), transparent 70%), linear-gradient(var(--sky), var(--bg) 75%);
}
body:not([data-auth="in"]) .auth-gate { display: grid; }
body:not([data-auth="in"]) :is(.skip-link, .topbar, main, .toast, .companion-tray) { display: none !important; }
.gate-inner { display: grid; justify-items: center; gap: 12px; width: min(440px, 100%); text-align: center; }
.gate-brand { display: flex; align-items: center; gap: 9px; color: var(--gold); font: 400 18px/1 var(--pixel); letter-spacing: .06em; text-transform: uppercase; }
.gate-inner > h1 { font: 400 clamp(26px, 6vw, 36px)/1.1 var(--pixel); color: var(--ink); text-transform: uppercase; }
.gate-copy { color: var(--muted); font-size: 14px; max-width: 34ch; }
.gate-status { color: var(--quiet); font: 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.gate-mount { width: 100%; display: grid; justify-items: center; margin-top: 6px; }
body[data-auth="out"] .gate-status { display: none; }

/* Locked wardrobe items explain how to earn them */
.carousel-value[data-locked] { position: relative; cursor: help; color: var(--muted); }
.carousel-value[data-locked]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 5; width: max-content; max-width: 230px;
  padding: 6px 8px; transform: translateX(-50%); color: var(--ink); background: var(--raised); border: 1px solid var(--gold);
  box-shadow: 2px 2px 0 var(--shadow); font: 600 11px/1.35 var(--sans); text-align: left; white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.carousel-value[data-locked]:hover::after, .carousel-value[data-locked]:focus-visible::after { opacity: 1; }

/* Day / Dusk switch */
.theme-button { width: 31px; min-height: 31px; padding: 0; }
.theme-button .icon { width: 17px; height: 17px; }
/* The pixel icons are pale pastels drawn for dark backgrounds; Day deepens them so they read on cream. */
:root[data-theme="day"] .icon:not([src*="mood-"], [src*="logo/"]) { filter: brightness(.6) saturate(1.6) contrast(1.15); }
/* Clerk's sign-in fields, matched to Enroot's. Clerk's injected styles are more specific, hence !important. */
.cl-formFieldInput.daykeep-field {
  border: 2px solid var(--edge-strong) !important; border-radius: 0 !important; background-color: var(--field-bg) !important;
  box-shadow: inset 2px 2px 0 var(--field-inset) !important;
}
.cl-formFieldInput.daykeep-field:hover { border-color: var(--edge-hover) !important; }
.cl-formFieldInput.daykeep-field:focus {
  outline: none; border-color: var(--gold) !important; box-shadow: inset 2px 2px 0 var(--field-inset), 3px 3px 0 var(--gold-fill) !important;
}
