:root {
  color-scheme: dark;
  --bg: #141513;
  --surface: #20211e;
  --text: #e8e2d9;
  --muted: #aaa69d;
  --accent: #c5a883;
  --line: #393a34;
  --gutter: 20px;
  --gap: 16px;
  --tab-height: 60px;
  font: 16px system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
.shell {
  width: min(100%, 560px);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) calc(var(--tab-height) + env(safe-area-inset-bottom));
  overflow: hidden;
}
.app-content {
  min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: calc(var(--gap) + env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) var(--gap) max(var(--gutter), env(safe-area-inset-left));
}
.view { flex: 1 0 auto; min-width: 0; width: 100%; }
h1 { font-size: 28px; font-weight: 400; line-height: 1.25; margin: 0 0 20px; }
h2 { font-size: 18px; font-weight: 500; margin: 0 0 10px; }
p { line-height: 1.55; margin: 0 0 14px; overflow-wrap: anywhere; }
.space { min-height: clamp(180px, 36dvh, 360px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; isolation: isolate; gap: 12px; }
.space h1 { font-size: 36px; font-weight: 300; letter-spacing: -.03em; margin: 0; }
.space p { margin: 0; }
.halo { position: absolute; z-index: -1; width: min(230px, 100%); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle,#c5a88317 0%,#c5a88305 45%,transparent 72%); pointer-events: none; }
textarea { width: 100%; min-height: 110px; resize: vertical; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); padding: 16px; font: inherit; line-height: 1.6; display: block; }
textarea::placeholder { color: var(--muted); }
button, .file-label { min-height: 44px; background: var(--accent); color: #141513; border: 0; border-radius: 12px; padding: 10px 16px; font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button:disabled { opacity: .5; cursor: default; }
.quiet, .icon-btn { background: transparent; color: var(--muted); }
.actions, .settings-actions, .session-actions, .topic-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.actions { justify-content: space-between; margin-top: 12px; }
.settings-actions { justify-content: flex-start; }
.session-actions { justify-content: center; }
.panel, .entry { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 0 0 14px; }
.panel:last-child, .entry:last-child { margin-bottom: 0; }
.entry p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0; }
.muted, time, #notice { color: var(--muted); font-size: 14px; }
#notice { margin: 12px 0 0; flex: 0 0 auto; }
#notice:empty { display: none; }
.timer { font-size: 34px; font-variant-numeric: tabular-nums; font-weight: 300; }
.space .timer { margin: 8px 0; }
#practice-text { font-size: clamp(18px, 5vw, 24px); max-width: 100%; text-wrap: balance; }
#reflection { padding-top: 16px; }
.icon-btn { width: 44px; height: 44px; padding: 10px; flex-shrink: 0; }
.icon-btn[aria-pressed=true] { color: var(--accent); }
.icon-btn[aria-pressed=true] svg { fill: currentColor; }
.session-actions .icon-btn { border: 1px solid var(--line); }
.topic-source, #favorite-details { font-size: 14px; color: var(--muted); }
.topic-source { text-align: center; max-width: 100%; }
.topic-source p { margin: 8px 0; }
.topic-source a { color: var(--accent); }
#favorite-details { margin-top: 14px; }
summary { cursor: pointer; padding: 8px 0; }
.fav-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 8px 0; }
.fav-row .select-topic { flex: 1; min-width: 0; text-align: left; justify-content: flex-start; color: var(--text); padding: 10px 0; font-size: 15px; overflow-wrap: anywhere; white-space: normal; }
.file-label { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.sr, #import { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-light { color-scheme: light; --bg: #eee9df; --surface: #fff; --text: #1a1d21; --muted: #665f56; --accent: #806244; --line: #cfc7ba; }
.theme-light button:not(.quiet):not(.icon-btn):not(.preset-card):not(.controls__btn):not(.presets-arrow):not(.theme-toggle):not(.audio-toggle):not(.modal__btn) { color: #fff; }
@media (max-width: 350px) { :root { --gutter: 16px; } .panel, .entry { padding: 14px; } .actions { gap: 8px; } .actions button { padding: 10px 12px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Meditation duration controls, scoped to the practice cards and dialog. */
.practice-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.duration-button { background: transparent; border: 1px solid var(--line); color: var(--muted); gap: 8px; padding: 10px 12px; white-space: nowrap; }
.theme-light .duration-button { color: var(--muted); }
.duration-dialog { box-sizing: border-box; position: fixed; inset: 0; width: min(340px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); }
.duration-dialog::backdrop { background: #0009; }
.duration-dialog form { display: flex; flex-direction: column; gap: 12px; }
.duration-dialog h2 { margin: 0; }
.duration-dialog input { box-sizing: border-box; width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; padding: 12px; }
.duration-presets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.duration-preset { background: var(--bg); color: var(--muted); border: 1px solid var(--line); padding: 8px; }
.theme-light .duration-preset { color: var(--muted); }
.duration-preset[aria-pressed=true] { border-color: var(--accent); color: var(--accent); }
.theme-light .duration-preset[aria-pressed=true] { color: var(--accent); }
.duration-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
