/* Fokus · black and gold, with day, night and system modes.
   Colours live in tokens; the three modes only swap token values. */

:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #f0ebe0;
  --surface-3: #e8e1d2;
  --line: #e2d9c6;
  --line-strong: #cfc2a6;
  --ink: #17140f;
  --muted: #6b6152;
  --faint: #978b76;
  --gold: #a87b16;
  --gold-bright: #c99a2e;
  --gold-soft: #f3e6c4;
  --on-gold: #17140f;
  --primary-bg: #17140f;
  --primary-ink: #f2d27a;
  --side-bg: #12100c;
  --side-ink: #e9dfc9;
  --side-muted: #9b8f78;
  --side-line: #2e281d;
  --grid-a: #fffdf8;
  --grid-b: #ece5d6;
  --block-mix: #fffdf8;
  --shadow: 0 18px 60px #2a1f0a26;
  --backdrop: #17140f66;
  --glow: #d9a93a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0b;
    --surface: #131313;
    --surface-2: #19191a;
    --surface-3: #222220;
    --line: #2a2721;
    --line-strong: #3d372b;
    --ink: #f3ede1;
    --muted: #a59d8d;
    --faint: #7a7365;
    --gold: #e2b54f;
    --gold-bright: #f3cf72;
    --gold-soft: #2b2416;
    --on-gold: #14110b;
    --primary-bg: #e2b54f;
    --primary-ink: #14110b;
    --side-bg: #060606;
    --side-ink: #ece3cf;
    --side-muted: #8f8676;
    --side-line: #22201b;
    --grid-a: #121212;
    --grid-b: #24221d;
    --block-mix: #161616;
    --shadow: 0 22px 80px #000a;
    --backdrop: #000b;
    --glow: #f0c45c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --surface: #131313;
  --surface-2: #19191a;
  --surface-3: #222220;
  --line: #2a2721;
  --line-strong: #3d372b;
  --ink: #f3ede1;
  --muted: #a59d8d;
  --faint: #7a7365;
  --gold: #e2b54f;
  --gold-bright: #f3cf72;
  --gold-soft: #2b2416;
  --on-gold: #14110b;
  --primary-bg: #e2b54f;
  --primary-ink: #14110b;
  --side-bg: #060606;
  --side-ink: #ece3cf;
  --side-muted: #8f8676;
  --side-line: #22201b;
  --grid-a: #121212;
  --grid-b: #24221d;
  --block-mix: #161616;
  --shadow: 0 22px 80px #000a;
  --backdrop: #000b;
  --glow: #f0c45c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, .wordmark, .welcome h1, .focus h1, .big {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
h1 { font-size: 34px; letter-spacing: -.02em; font-weight: 500; margin: 0; line-height: 1.1; }
h2 {
  font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 650; margin: 0 0 6px;
}
h3 { font-weight: 550; }
p, small { color: var(--muted); }
a { color: var(--gold); }
::selection { background: var(--gold-soft); }

/* Controls */
button, input, select, textarea {
  font: inherit; color: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 11px;
}
button, a, select { cursor: pointer; }
button { transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
button:hover { background: var(--surface-2); border-color: var(--line-strong); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
button.primary {
  background: var(--primary-bg); color: var(--primary-ink);
  border-color: transparent; font-weight: 650;
}
button.primary:hover { filter: brightness(1.08); background: var(--primary-bg); }
.selected { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
.quiet { border: 0; background: none; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); margin-top: 14px; }
details ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* Shell: sidebar on desktop, top bar on phones */
header[hidden] { display: none; }
header {
  position: fixed; inset: 0 auto 0 0; width: 212px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 28px 18px 20px;
  background: var(--side-bg); color: var(--side-ink);
  border-right: 1px solid var(--side-line);
}
header:not([hidden]) + main { margin-left: 212px; }
.wordmark {
  font-size: 30px; font-style: italic; font-weight: 600; letter-spacing: -.02em;
  color: var(--gold); text-decoration: none; display: inline-block;
}
header .wordmark { color: #e2b54f; padding-left: 6px; }
nav { display: flex; flex-direction: column; gap: 3px; margin-top: 22px; }
nav a {
  color: var(--side-muted); text-decoration: none;
  padding: 10px 13px; border-radius: 9px; font-size: 14.5px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
nav a:hover { color: var(--side-ink); background: #ffffff0d; }
nav a.on { color: #f3cf72; background: #e2b54f1a; font-weight: 650; box-shadow: inset 2px 0 0 #e2b54f; }
nav a .live {
  width: 8px; height: 8px; border-radius: 50%; background: #f0c45c;
  box-shadow: 0 0 0 0 #f0c45c99; animation: beacon 1.8s infinite;
}
#search, #profile {
  width: 100%; text-align: left; border-radius: 9px;
  border: 1px solid var(--side-line); padding: 10px 13px;
  background: transparent; color: var(--side-ink);
}
#search { margin-top: auto; }
#search:hover, #profile:hover { background: #ffffff0d; border-color: #4a4130; }
#search kbd { float: right; color: var(--side-muted); font: 12px inherit; }

/* Theme switch: day · night · system */
.theme {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
  padding: 3px; border-radius: 10px;
  border: 1px solid var(--side-line); background: #ffffff08;
}
.theme button {
  border: 0; background: none; color: var(--side-muted);
  padding: 7px 0; border-radius: 7px; font-size: 15px; line-height: 1;
}
.theme button:hover { color: var(--side-ink); background: #ffffff10; }
.theme button[aria-pressed="true"] { background: #e2b54f; color: #14110b; }
.welcome .theme, .legal .theme {
  border-color: var(--line); background: var(--surface-2); width: 132px;
}
.welcome .theme button, .legal .theme button { color: var(--muted); }
.welcome .theme button[aria-pressed="true"], .legal .theme button[aria-pressed="true"] {
  background: var(--primary-bg); color: var(--primary-ink);
}

main { padding: 22px 38px 40px; max-width: 1760px; }
.between, .line, .actions { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.actions { flex-wrap: wrap; }
.actions button { font-size: 13px; }
.heading { margin: 36px 0 26px; }
.heading:has(+ .plan) h1 { font-size: 28px; }
.gap { margin-top: 32px; }

/* Welcome and legal pages */
.welcome {
  position: relative; max-width: 720px; margin: 10vh auto;
  padding: clamp(26px, 6vw, 72px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px;
  box-shadow: var(--shadow);
}
.welcome::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px; border-radius: 26px 26px 0 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.welcome h1 { font-size: clamp(36px, 6vw, 64px); line-height: 1.03; margin: .35em 0; letter-spacing: -.03em; }
.welcome .theme { position: absolute; top: 22px; right: 22px; }
.legal-links { display: flex; gap: 18px; margin-top: 26px; font-size: 14px; }
.legal-links a { color: var(--muted); }
.legal main { max-width: 760px; margin: 0 auto; padding: 40px 16px 60px; line-height: 1.6; }
.legal h1 { font-size: clamp(28px, 5vw, 42px); margin: .6em 0 .4em; }
.legal h2 { font-size: 13px; margin-top: 2em; color: var(--gold); }
.legal .top { display: flex; justify-content: space-between; align-items: center; }

/* Surfaces */
.box, .card, .gridwrap, .entry {
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
}
.box { padding: 20px; }
.cols, .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stats { margin: 16px 0; }
.wide { grid-column: span 2; }
.big { font-size: 30px; margin-top: 8px; color: var(--ink); }

/* Start page */
.home { display: grid; grid-template-columns: 1.44fr 1fr; gap: 36px; }
.progress { height: 5px; width: 160px; background: var(--surface-3); border-radius: 5px; margin: 5px 0; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); border-radius: 5px; }
.line strong { font-size: 22px; font-family: "Iowan Old Style", Palatino, Georgia, serif; }

/* Task entry and cards */
.entry { display: flex; border-style: dashed; border-color: var(--line-strong); padding: 5px; gap: 4px; }
.entry input { flex: 1; min-width: 40px; background: none; border: none; box-shadow: none; }
.entry button { font-size: 11px; padding: 4px 7px; }
.card { padding: 10px 13px 10px 15px; position: relative; margin: 8px 0; transition: border-color .2s, box-shadow .2s; }
.card:hover { border-color: var(--line-strong); }
.task::before, .quest::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px; border-radius: 4px; background: var(--color);
}
.task.done { opacity: .55; }
.done .title { text-decoration: line-through; }
.title, .tag { background: none; border: 0; padding: 1px; color: inherit; text-align: left; }
.title:hover, .tag:hover { background: none; }
.tag { border: 1px solid var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 11px; padding: 2px 8px; }
.check {
  padding: 0; width: 19px; height: 19px; border-radius: 50%;
  border: 1.5px solid var(--color); color: var(--color); font-size: 11px; background: none;
}
.done .check { background: var(--color); color: var(--surface); }
.meta { display: flex; gap: 9px; align-items: center; margin-top: 8px; }
.meta small { margin-left: auto; font-variant-numeric: tabular-nums; }
.play {
  border: 0; background: none; color: var(--faint); padding: 0 2px; font-size: 12px;
  margin-left: auto; opacity: 0; transition: opacity .15s, color .15s;
}
.meta small + .play { margin-left: 0; }
.card:hover .play, .play:focus-visible { opacity: 1; }
.play:hover { color: var(--gold); background: none; }
@media (hover: none) { .play { opacity: 1; } }

/* The task that is being worked on right now glows. */
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.card.active {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--spin), var(--gold), #fff3c4, var(--gold-bright), var(--gold), #7a5a12, var(--gold)) border-box;
  border: 1.5px solid transparent;
  animation: spin 4s linear infinite, glow 2.4s ease-in-out infinite;
}
.card.active .play { opacity: 1; color: var(--gold); }
.card.active .live-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--gold);
}
@keyframes spin { to { --spin: 360deg; } }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 1px #0000, 0 0 14px -2px color-mix(in srgb, var(--glow) 45%, transparent); }
  50% { box-shadow: 0 0 0 1px #0000, 0 0 28px 2px color-mix(in srgb, var(--glow) 70%, transparent); }
}
@keyframes beacon {
  0% { box-shadow: 0 0 0 0 #f0c45c99; }
  70% { box-shadow: 0 0 0 8px #f0c45c00; }
  100% { box-shadow: 0 0 0 0 #f0c45c00; }
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 40px -6px color-mix(in srgb, var(--glow) 40%, transparent), inset 0 0 30px -12px color-mix(in srgb, var(--glow) 40%, transparent); }
  50% { box-shadow: 0 0 80px 4px color-mix(in srgb, var(--glow) 55%, transparent), inset 0 0 40px -10px color-mix(in srgb, var(--glow) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .card.active, .focus-ring.running, nav a .live { animation: none; }
  .card.active { box-shadow: 0 0 18px color-mix(in srgb, var(--glow) 55%, transparent); }
}

.rule { display: flex; align-items: center; gap: 8px; margin: 18px 0 9px; color: var(--faint); }
.rule::before { content: ""; height: 1px; background: var(--line); flex: 1; }
.rule button { font-size: 12px; }
.empty { color: var(--faint); font-size: 14px; padding: 6px 2px; }

/* Calendar grid */
.gridwrap { overflow: auto; max-height: calc(100vh - 230px); min-height: 290px; }
.timeline { display: grid; position: relative; grid-template-columns: 51px repeat(var(--days), minmax(65px, 1fr)); }
.hours, .day { height: 1056px; position: relative; }
.hour { height: 44px; color: var(--faint); text-align: right; padding: 2px 8px 0 0; font-size: 11px; background: var(--surface); }
.day {
  border-left: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, var(--grid-a) 0 43px, var(--grid-b) 43px 44px);
}
.block {
  position: absolute; min-height: 12px;
  border: 0; border-left: 3px solid var(--color);
  background: color-mix(in srgb, var(--color) 28%, var(--block-mix));
  color: var(--ink); border-radius: 5px; padding: 1px 5px;
  text-align: left; font-size: 11px; overflow: hidden; line-height: 1.25;
}
.block:hover { filter: brightness(1.06); background: color-mix(in srgb, var(--color) 36%, var(--block-mix)); }
.striped {
  background: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--color) 42%, var(--block-mix)) 0 4px,
    color-mix(in srgb, var(--color) 22%, var(--block-mix)) 4px 8px);
}
.block.active { box-shadow: 0 0 0 1.5px var(--gold), 0 0 16px color-mix(in srgb, var(--glow) 60%, transparent); }
.now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--gold); pointer-events: none; z-index: 2; }
.now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.calendarhead { display: grid; grid-template-columns: 51px repeat(7, 1fr); }
.dayhead { padding: 10px; font-size: 13px; text-align: center; background: var(--surface-2); border-right: 1px solid var(--line); }
.dayhead.today { color: var(--gold); font-weight: 650; }
.allrow { display: flex; gap: 5px; flex-wrap: wrap; margin: 5px 0; }
.allrow button { font-size: 12px; }

/* Week plan */
.plan { display: flex; gap: 12px; overflow-x: auto; margin: 0 -38px; padding: 0 16px 12px; }
.plan section {
  width: 214px; min-width: 214px; flex: none; min-height: calc(100vh - 330px);
  padding: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.plan h3 { text-align: left; font-weight: 500; margin: 2px 0 9px; padding: 4px 2px 11px; border-bottom: 2px solid var(--line); }
.plan .current { background: var(--surface); border-color: var(--line-strong); }
.plan .current h3 { border-color: var(--gold); color: var(--gold); }
.plan .past { opacity: .55; }
.plan .entry { gap: 1px; }
.plan .entry button { font-size: 0; }
.plan .entry button::before { font-size: 12px; content: "↟"; }
.plan .entry button[data-a="bottom"]::before { content: "↡"; }
.plan .entry input { width: 0; font-size: 13px; }
.plan .card { padding: 10px 10px 10px 13px; }
.plan .meta small { display: none; }
.plan .tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result { display: block; width: 100%; text-align: left; margin: 4px 0; }

/* Focus page */
.focus { max-width: 640px; text-align: center; margin: 9vh auto; }
.focus h1 { font-size: 44px; margin: 6px 0; }
.focus-ring {
  width: min(340px, 78vw); aspect-ratio: 1; margin: 28px auto; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  border: 1.5px solid var(--line-strong); background: var(--surface);
}
.focus-ring.running {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--spin), var(--gold), #fff3c4, var(--gold-bright), var(--gold), #7a5a12, var(--gold)) border-box;
  border: 3px solid transparent;
  animation: spin 6s linear infinite, breathe 4s ease-in-out infinite;
}
.focus .big { font-size: 58px; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.focus-ring small { position: absolute; bottom: 24%; left: 0; right: 0; letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.focus-ring.running small { color: var(--gold); }
.focus .actions { justify-content: center; }

/* Review charts */
.chart { height: 150px; display: flex; gap: 12px; align-items: flex-end; }
.chart > div { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.bar { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); min-height: 2px; width: 80%; margin: 4px auto; border-radius: 5px 5px 2px 2px; }
/* Bars split into quest colours, the first quest at the bottom. */
.bar.stack { background: none; display: flex; flex-direction: column-reverse; overflow: hidden; gap: 1.5px; }
.bar.stack i { display: block; min-height: 2px; background: var(--color); }
.bar.stack i.nogoal { background: repeating-linear-gradient(135deg, var(--color) 0 4px, color-mix(in srgb, var(--color) 45%, transparent) 4px 8px); }
.chart-head { align-items: center; gap: 8px; flex-wrap: wrap; }
.chart-head h2 { margin: 0; }

/* Quests */
.quest { min-height: 88px; width: 100%; text-align: left; font-size: 16px; }

/* Dialog and toast */
dialog {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 24px; width: min(460px, 94vw); box-shadow: var(--shadow);
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
dialog h3 { margin-top: 0; font-size: 22px; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 500; }
dialog label { display: grid; gap: 5px; margin: 13px 0; color: var(--muted); font-size: 13px; }
dialog .actions { margin-top: 20px; }
dialog input, dialog select, dialog textarea { width: 100%; }
dialog [role="alert"]:empty { display: none; }
dialog [role="alert"] { color: #d0574a; margin: 12px 0 0; }
dialog .series { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; color: var(--ink); }
dialog .series small { display: block; margin: 2px 0 8px; }
#notice {
  display: none; position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: 11px; z-index: 8;
  background: var(--primary-bg); color: var(--primary-ink); box-shadow: var(--shadow);
}
#notice.show { display: block; }
#notice button.primary { background: var(--primary-ink); color: var(--primary-bg); margin-left: 10px; padding: 6px 12px; }
.result small { color: var(--faint); }

/* Icons in navigation and header buttons */
nav svg, #search svg, #profile svg {
  width: 19px; height: 19px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
nav a { justify-content: flex-start; gap: 11px; }
nav a .live { margin-left: auto; }
#search, #profile { display: flex; align-items: center; gap: 10px; }
#search kbd { margin-left: auto; }
.calendarhead { grid-template-columns: 51px repeat(var(--days, 7), 1fr); }
.weeknav span { min-width: 120px; text-align: center; font-variant-numeric: tabular-nums; }
html { -webkit-tap-highlight-color: transparent; }
button, a, input, select { touch-action: manipulation; }

/* ---------- Phone: app layout with a bottom tab bar ---------- */
@media (max-width: 800px) {
  body { overscroll-behavior-y: none; }
  header {
    position: sticky; top: 0; z-index: 6; inset: auto; width: 100%;
    flex-direction: row; align-items: center; gap: 8px;
    padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
    border-right: 0; border-bottom: 1px solid var(--side-line);
    /* No backdrop-filter here: it would trap the fixed tab bar inside the header. */
    background: var(--side-bg);
  }
  header:not([hidden]) + main { margin-left: 0; }
  header .wordmark { font-size: 25px; padding: 0; margin-right: auto; }
  .theme { width: 104px; padding: 2px; }
  .theme button { padding: 6px 0; font-size: 14px; }
  #search, #profile {
    width: 38px; height: 38px; margin: 0; padding: 0; justify-content: center; border-radius: 50%;
  }
  #search span, #profile span, #search kbd { display: none; }

  /* Tab bar */
  nav {
    position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; margin: 0;
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
    padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
    background: color-mix(in srgb, var(--side-bg) 94%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--side-line);
  }
  nav a {
    position: relative; flex-direction: column; justify-content: center; gap: 3px;
    padding: 6px 0 4px; min-height: 50px; border-radius: 12px;
    font-size: 10.5px; letter-spacing: .01em; font-weight: 550;
  }
  nav a svg { width: 23px; height: 23px; }
  nav a:hover { background: none; }
  nav a.on { background: none; box-shadow: none; color: #f3cf72; }
  nav a.on svg { filter: drop-shadow(0 0 6px #e2b54f80); }
  nav a .live { position: absolute; top: 5px; right: calc(50% - 17px); width: 7px; height: 7px; margin: 0; }

  main { padding: 6px 16px calc(env(safe-area-inset-bottom) + 96px); overflow: hidden; }
  .heading { margin: 18px 0 14px; gap: 12px; }
  .heading h1, h1 { font-size: 28px; }
  .home, .cols, .stats { grid-template-columns: 1fr; }
  .home { gap: 22px; }
  .stats { gap: 10px; }
  .stats .box { padding: 14px 16px; }
  .wide { grid-column: auto; }
  .between { flex-wrap: wrap; }
  .line strong { font-size: 20px; }
  .progress { width: 120px; }

  /* Bigger, thumb-friendly controls; 16px inputs stop iOS from zooming in */
  input, select, textarea { font-size: 16px; }
  .actions button, .between > button { min-height: 40px; }
  .card { padding: 12px 14px 12px 16px; }
  .title { font-size: 16px; }
  .check { width: 24px; height: 24px; }
  .tag { padding: 4px 10px; }
  .play { font-size: 15px; padding: 6px 8px; margin-right: -6px; }
  .entry { padding: 4px; }
  .entry input { padding: 10px; }
  .entry button { padding: 8px 10px; font-size: 12px; }

  /* Calendar: three days fill the width; no sideways scrolling */
  .gridwrap { max-height: calc(100dvh - 330px); min-height: 320px; }
  .timeline { grid-template-columns: 42px repeat(var(--days), 1fr); }
  .calendarhead { grid-template-columns: 42px repeat(var(--days, 3), 1fr); }
  .hour { font-size: 10px; padding-right: 5px; }
  .block { font-size: 11.5px; }
  .weeknav { width: 100%; justify-content: space-between; }
  .weeknav span { flex: 1; }

  /* Week plan: swipe day by day */
  .plan { margin: 0 -16px; padding: 0 16px 12px; scroll-snap-type: x mandatory; scroll-padding: 0 16px; }
  .plan section { width: 78vw; min-width: 78vw; min-height: 60vh; scroll-snap-align: center; }
  .plan .entry button { padding: 8px; }

  .focus { margin: 4vh auto; }
  .focus h1 { font-size: 32px; }
  .focus .big { font-size: 48px; }
  .focus-ring { width: min(290px, 74vw); margin: 22px auto; }
  .focus .actions { flex-direction: column; align-items: stretch; max-width: 320px; margin: 0 auto; }
  .focus .actions button { min-height: 48px; font-size: 15px; }

  /* Dialogs become bottom sheets */
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0;
    border-width: 1px 0 0; max-height: 90dvh; overflow: auto;
    padding: 12px 18px calc(env(safe-area-inset-bottom) + 20px);
  }
  dialog::before {
    content: ""; display: block; width: 38px; height: 5px; border-radius: 3px;
    background: var(--line-strong); margin: 0 auto 14px;
  }
  dialog[open] { animation: sheet .22s ease-out; }
  dialog .footer { position: sticky; bottom: -20px; background: var(--surface); padding: 10px 0 4px; }
  dialog .footer button { flex: 1; min-height: 46px; }
  dialog .actions button { min-height: 42px; }
  #notice { bottom: calc(env(safe-area-inset-bottom) + 84px); text-align: center; }

  .welcome { margin: calc(env(safe-area-inset-top) + 4vh) auto; }
  .legal main { padding-top: calc(env(safe-area-inset-top) + 24px); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }

/* Settings sheet */
dialog h4 {
  margin: 22px 0 6px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
}
dialog h3 + h4 { margin-top: 4px; }
.versionlog details { border-top: 1px solid var(--line, rgba(127,127,127,.2)); padding: 6px 0; }
.versionlog summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.versionlog ul { margin: 6px 0 4px; padding-left: 20px; font-size: 13.5px; overflow-wrap: anywhere; }
dialog .hint { font-size: 13.5px; margin: 6px 0 10px; }
dialog label.row { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; }
dialog label.row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
dialog label.row input[type="time"] { width: auto; margin-left: auto; padding: 6px 8px; }

/* Sign-in */
.auth { margin-top: 26px; max-width: 400px; }
.auth h2 { color: var(--gold); margin-bottom: 12px; }
.auth form { display: grid; gap: 12px; }
.auth label { font-size: 13px; color: var(--muted); margin-bottom: -6px; }
.auth input { width: 100%; padding: 12px 13px; font-size: 16px; background: var(--surface-2); }
.auth .primary { padding: 12px; font-size: 15px; margin-top: 4px; }
.auth .quiet { justify-self: start; padding: 4px 0; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.auth small { font-size: 12.5px; }
.auth small a { color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; margin-bottom: 18px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 9px; border-radius: 8px; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px #0000001f; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--faint); font-size: 12.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
button.google { width: 100%; padding: 12px; font-weight: 600; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 9px; font-size: 14px;
  color: #c2453a; background: color-mix(in srgb, #c2453a 12%, transparent); }
.auth-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 9px; font-size: 14px; color: var(--ink); background: var(--gold-soft); }
.auth-sent p { color: var(--ink); }
.auth-sent .hint { color: var(--muted); font-size: 13.5px; }
dialog .danger { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); }
dialog .danger .quiet { color: #c2453a; }

/* ---------- UX round: chips, segments, now-card, journal, empty states ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--ink); border-color: var(--gold); background: var(--surface); }
.chip.on { color: var(--ink); border-color: var(--gold); background: var(--gold-soft); }
.seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button, .seg a { border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; text-decoration: none; text-align: center; }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px #0000001f; }
.wide-seg { margin-top: 24px; }
.summary { margin: 0 0 6px; font-size: 13.5px; }
.empty-state { display: grid; gap: 6px; justify-items: start; padding: 18px; margin: 4px 0 16px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 15px; }
.hint a { color: var(--gold); }

/* "+" in the task entry */
.entry .add { width: 34px; flex: none; padding: 0; font-size: 20px; line-height: 1; border-radius: 7px; color: var(--gold); background: var(--surface-2); }
.entry .add:hover { background: var(--gold-soft); }
.plan .entry .add { font-size: 18px; }
.plan .entry .add::before { content: none; }

/* What is running right now */
.now-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 14px 18px; margin: 0 0 18px; border-radius: 14px; text-decoration: none; color: var(--ink);
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--spin), var(--gold), #fff3c4, var(--gold-bright), var(--gold), #7a5a12, var(--gold)) border-box;
  border: 1.5px solid transparent; animation: spin 4s linear infinite, glow 2.4s ease-in-out infinite;
}
.now-card small { display: block; color: var(--gold); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.now-card strong { font-size: 17px; font-weight: 600; }
.now-time { font-variant-numeric: tabular-nums; font-size: 20px; font-family: "Iowan Old Style", Palatino, Georgia, serif; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: beacon 1.8s infinite; }
@media (prefers-reduced-motion: reduce) { .now-card, .pulse { animation: none; } }

/* Journal */
.journal-card {
  display: grid; gap: 8px; padding: 16px 18px; margin: 0 0 20px; border-radius: 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--gold);
}
.journal-card small { color: var(--gold); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.journal-card strong { font-size: 17px; font-weight: 600; font-family: "Iowan Old Style", Palatino, Georgia, serif; }
.journal-card label { display: grid; gap: 6px; }
.journal-card input { width: 100%; font-size: 16px; padding: 11px 12px; background: var(--surface-2); }
.journal-card .chip { justify-self: start; }
.journal-card.compact { grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 12px 16px; }
.journal-card.compact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moods { display: flex; gap: 8px; }
.moods button { width: 46px; height: 46px; border-radius: 50%; font-size: 22px; padding: 0; background: var(--surface-2); filter: grayscale(.6); opacity: .75; }
.moods button[aria-checked="true"] { filter: none; opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.moods button:hover { filter: none; opacity: 1; }
.journal { display: grid; gap: 10px; max-width: 720px; }
.journal label { font-size: 13px; color: var(--muted); margin-top: 10px; }
.journal input, .journal textarea { width: 100%; font-size: 16px; padding: 12px 13px; line-height: 1.55; }
.journal textarea { resize: vertical; min-height: 180px; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 17px; }
.journal .saved { margin: 0; font-size: 12.5px; color: var(--faint); min-height: 1em; }
.journal-list { display: grid; gap: 8px; max-width: 720px; }
.journal-list .card { display: grid; gap: 3px; text-align: left; width: 100%; padding: 12px 16px; }
.journal-list small { color: var(--gold); }
.journal-list span { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Calendar blocks: title and time on their own lines */
.block .bt { display: block; overflow: hidden; text-overflow: ellipsis; }
.block .tm { display: block; color: var(--muted); font-size: 10.5px; }

@media (max-width: 800px) {
  .seg button { padding: 8px 16px; }
  .entry .add { width: 40px; font-size: 22px; }
  .chip { padding: 7px 13px; }
  /* A whole week on a phone: seven narrow columns, titles only */
  .dense .calendarhead, .dense .timeline { grid-template-columns: 30px repeat(var(--days), 1fr); }
  .dense .dayhead { padding: 6px 0; font-size: 11px; }
  .dense .dayhead small { display: none; }
  .dense .hour { font-size: 9px; padding-right: 3px; }
  .dense .block { font-size: 9.5px; padding: 1px 2px; border-left-width: 2px; line-height: 1.15; }
  .dense .block .tm { display: none; }
  .now-card { margin: 0 0 14px; }
  .moods button { width: 48px; height: 48px; }
}

@media (max-width: 800px) {
  .dense .dayhead b { display: block; font-size: 15px; font-weight: 600; }
}

/* ---------- Month view ---------- */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mhead { background: var(--surface-2); padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.mday {
  position: relative; display: grid; grid-template-rows: auto 1fr auto; align-content: start; gap: 4px;
  min-height: 112px; padding: 6px 7px; border: 0; border-radius: 0; background: var(--surface); text-align: left; overflow: hidden;
}
.mday:hover { background: var(--surface-2); }
.mday.out { background: var(--surface-2); }
.mday.out .num, .mday.out .items { opacity: .45; }
.mday .num { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.mday.today .num { color: var(--gold); }
.mday.today { box-shadow: inset 0 0 0 1.5px var(--gold); }
.mday .mood { font-size: 13px; }
.mday .items { display: grid; gap: 2px; min-width: 0; }
.mday .items i {
  font-style: normal; font-size: 11.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--color) 22%, var(--surface));
}
.mday .items i b { display: none; }
.mday .items i.done { opacity: .5; text-decoration: line-through; }
.mday .items em { font-style: normal; color: var(--muted); }
.mday .items .more { background: none; color: var(--muted); padding: 0 5px; }
.mday .worked { font-size: 10.5px; color: var(--gold); }
.day-list { display: grid; gap: 6px; }
.day-list .result { display: flex; align-items: center; gap: 8px; margin: 0; }
.day-list .result b { width: 8px; height: 8px; border-radius: 50%; background: var(--color); flex: none; }
.day-list .result.done { opacity: .55; }

/* ---------- Journal extras ---------- */
.prompt { display: grid; gap: 4px; margin-top: 18px; padding: 12px 14px; border-radius: 11px; background: var(--gold-soft); }
.prompt span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--gold); }
.prompt strong { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 18px; font-weight: 500; color: var(--ink); }
.prompt .quiet { justify-self: start; padding: 2px 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.trend { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; max-width: 720px; height: 110px; }
.trend button { display: grid; grid-template-rows: 1fr auto; align-items: end; height: 100%; padding: 0; border: 0; background: none; }
.trend i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--gold); min-height: 4px; }
.trend i.none { background: var(--surface-3); }
.trend i.m1 { opacity: .35; } .trend i.m2 { opacity: .5; } .trend i.m3 { opacity: .7; } .trend i.m4 { opacity: .85; }
.trend small { font-size: 10px; text-align: center; margin-top: 3px; }

@media (max-width: 800px) {
  .month { margin: 0 -8px; }
  .mhead { padding: 6px 0; font-size: 11px; }
  .mday { min-height: 64px; padding: 5px 4px; gap: 3px; }
  .mday .num { font-size: 12.5px; }
  .mday .mood { font-size: 11px; }
  /* On phones entries become coloured dots */
  .mday .items { display: flex; flex-wrap: wrap; gap: 3px; }
  .mday .items i { width: 7px; height: 7px; padding: 0; border-radius: 50%; font-size: 0; background: var(--color); }
  .mday .items i.done { opacity: .4; text-decoration: none; }
  .mday .items .more { width: auto; height: auto; font-size: 9.5px; background: none; color: var(--muted); }
  .mday .worked { display: none; }
}

/* ---------- Streak flame ---------- */
.streak {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px 5px 8px; border-radius: 999px;
  border: 1px solid #e2b54f55; background: #e2b54f14; color: #f3cf72; font-weight: 700; font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.streak[hidden] { display: none; }
.streak:hover { background: #e2b54f26; border-color: #e2b54f; }
header .streak { align-self: flex-start; margin: 6px 0 0 4px; }
.flame { display: inline-block; transform-origin: 50% 90%; animation: flicker 2.2s ease-in-out infinite; }
.streak .flame { font-size: 17px; }
.tier1 .flame { filter: saturate(.6); font-size: 15px; }
.tier2 .flame { filter: drop-shadow(0 0 3px #ffb34780); }
.tier3 .flame { filter: drop-shadow(0 0 6px #ffb347b0); }
.tier4 .flame { filter: drop-shadow(0 0 9px #ff8a3dcc) saturate(1.3); }
.tier5 .flame { filter: hue-rotate(185deg) saturate(1.6) drop-shadow(0 0 10px #59b8ffcc); }
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  30% { transform: scale(1.08, 1.12) rotate(2deg); }
  60% { transform: scale(.96, 1.04) rotate(-1deg); }
}
.streak-hero { display: grid; justify-items: center; gap: 2px; margin: 4px 0 14px; }
.streak-hero .flame { font-size: 64px; line-height: 1; }
.streak-hero strong { font-size: 44px; line-height: 1; font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--gold); }
.streak-hero small { color: var(--muted); }
.milestone { display: grid; gap: 4px; margin: 12px 0; }
.milestone span { font-size: 13.5px; font-weight: 600; }
.milestone .progress { width: 100%; }
/* Milestone celebration */
.celebrate { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: #000a; animation: fadeout 3.2s forwards; }
.celebrate .burst { display: grid; justify-items: center; gap: 4px; padding: 28px 36px; border-radius: 22px; background: var(--surface);
  border: 1.5px solid var(--gold); box-shadow: 0 0 60px #e2b54f66; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.celebrate .flame { font-size: 84px; line-height: 1; }
.celebrate strong { font-size: 30px; font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--gold); }
.celebrate small { color: var(--muted); }
.celebrate i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  transform: rotate(var(--a)) translateY(0); animation: spark 1.1s var(--d) ease-out forwards; opacity: 0; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@keyframes spark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-170px); } }
@keyframes fadeout { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .flame, .celebrate, .celebrate .burst { animation: none; }
  .celebrate i { display: none; }
}
@media (max-width: 800px) {
  header .streak { align-self: center; margin: 0; padding: 4px 9px 4px 6px; font-size: 14px; }
  header .wordmark { margin-right: 0; }
  header #search { margin-left: auto; }
}

/* ---------- Pomodoro ---------- */
.focus .seg { margin: 6px auto 0; }
.pomo-lengths { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.focus-ring .ring { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke-width: 2.4; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 100; transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--glow) 70%, transparent)); }
/* The spinning gold border is replaced by the filling ring in Pomodoro mode. */
.focus-ring.pomo { border: 1.5px solid var(--line); background: var(--surface); animation: none; }
.focus-ring.pomo.work { box-shadow: 0 0 60px -12px color-mix(in srgb, var(--glow) 55%, transparent); }
.focus-ring.pomo.break .bar, .focus-ring.pomo.done .bar { stroke: #6fb59b; filter: none; }
.focus-ring.pomo.break small, .focus-ring.pomo.done small { color: #6fb59b; }
.now-card.resting { animation: none; border: 1.5px solid #6fb59b; background: var(--surface); }
.now-card.resting small { color: #6fb59b; }

/* ---------- Leftovers, week focus, tip ---------- */
.rollover { padding: 14px 16px; margin: 0 0 18px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); display: grid; gap: 8px; }
.rollover h2 { margin: 0; }
.roll-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--color); margin: 6px 0; }
.roll-item span { flex: 1; min-width: 0; display: grid; }
.roll-item b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll-item small { color: var(--muted); }
.week-focus { margin: -12px 0 18px; font-size: 14px; color: var(--muted); }
.week-focus b { color: var(--ink); }
.tip { margin: 0 0 16px; padding: 10px 14px; border-radius: 11px; background: var(--gold-soft); font-size: 13.5px; color: var(--ink); }
.tip .quiet { padding: 0 0 0 6px; text-decoration: underline; color: var(--ink); }

/* ---------- Swipe & drag ---------- */
.card.task { touch-action: pan-y; }
.card.swiping { transition: none; z-index: 1; }
.card.task:not(.swiping) { transition: transform .25s ease, border-color .2s, box-shadow .2s; }
.card[data-swipe]::after {
  position: absolute; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 700; color: var(--muted); pointer-events: none;
}
.card[data-swipe="later"]::after { content: "Morgen →"; left: -96px; }
.card[data-swipe="done"]::after { content: "✓ Erledigt"; right: -96px; }
.card[data-swipe="undo"]::after { content: "↺ Offen"; right: -96px; }
.card.armed[data-swipe="later"] { border-color: var(--gold); box-shadow: -6px 0 18px -8px var(--gold); }
.card.armed[data-swipe="done"], .card.armed[data-swipe="undo"] { border-color: #6fb59b; box-shadow: 6px 0 18px -8px #6fb59b; }
.card.armed[data-swipe]::after { color: var(--ink); }
.card.dragging { opacity: .45; }
.plan section.drop-here { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold-soft); }
.card.task[draggable="true"] { cursor: grab; }

/* ---------- Subtasks ---------- */
.badge { border: 1px solid var(--line-strong); border-radius: 10px; padding: 1px 7px; font-size: 11px; color: var(--muted); background: none; }
.subs { display: grid; gap: 6px; }
.sub { display: flex; align-items: center; gap: 8px; }
.sub input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
.sub .sub-text { flex: 1; padding: 7px 9px; }
.sub input[type="checkbox"]:checked + .sub-text { text-decoration: line-through; color: var(--muted); }
.sub-add { display: flex; gap: 6px; margin-top: 6px; }
.sub-add input { flex: 1; }
.sub-add button { width: 40px; padding: 0; font-size: 18px; color: var(--gold); }

/* ---------- Freeze & friends ---------- */
.freeze { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #59b8ff 12%, var(--surface)); font-size: 13.5px; color: var(--ink); }
.freeze.used { background: var(--surface-2); color: var(--muted); }
.row-form { display: flex; gap: 8px; margin: 8px 0; }
.row-form input { flex: 1; min-width: 0; }
.code { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.code strong { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; color: var(--gold); font-size: 16px; }
.friend { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.f-flame { font-size: 22px; }
.f-main { flex: 1; min-width: 0; display: grid; }
.f-main small { color: var(--muted); }

/* ---------- Weekly ritual ---------- */
.ritual-cta { display: grid; gap: 2px; padding: 14px 18px; margin: 0 0 18px; border-radius: 14px; text-decoration: none; color: var(--ink);
  background: var(--gold-soft); border: 1px solid var(--gold); font-weight: 650; }
.ritual-cta small { font-weight: 400; color: var(--muted); }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.steps li { padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); border: 1px solid var(--line); }
.steps li.on { color: var(--on-gold); background: var(--gold); border-color: var(--gold); font-weight: 650; }
.steps li.done { color: var(--ink); }
.week-moods { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin: 8px 0; }
.week-moods b { display: block; font-size: 22px; }
.week-moods small { font-size: 11px; }
.ritual-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ritual-days h3 { margin: 0 0 8px; font-size: 14px; }
.ritual-days .mini { margin: 4px 0; padding-left: 8px; border-left: 3px solid var(--color); color: var(--ink); font-size: 14px; }
.ritual-nav { margin-top: 22px; justify-content: flex-end; }
@media (max-width: 800px) {
  .ritual-days { grid-template-columns: 1fr; }
  .row-form { flex-wrap: wrap; }
  .ritual-nav button { flex: 1; min-height: 46px; }
}
.stats.compact { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) {
  .stats.compact { gap: 8px; }
  .stats.compact .box { padding: 10px 12px; }
  .stats.compact h2 { font-size: 10px; letter-spacing: .08em; }
  .stats.compact .big { font-size: 19px; margin-top: 4px; }
}

/* Dialogs open with focus on the title, not in a field (no keyboard on phones). */
dialog h3:focus { outline: none; }

/* ---------- Reordering ---------- */
.card.task { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card.drop-before { box-shadow: 0 -3px 0 0 var(--gold); }
.card.drop-after { box-shadow: 0 3px 0 0 var(--gold); }
.actions.order { align-items: center; margin: 12px 0 4px; }
.actions.order span { font-size: 13px; color: var(--muted); margin-right: 4px; }
.picker .result.current { border-color: var(--gold); background: var(--gold-soft); }
.picker .result small { color: var(--muted); }
.focus .chip { margin-top: 2px; }

/* Grip for reordering (touch screens; with a mouse the whole card is draggable) */
.grip { display: none; }
@media (hover: none) {
  .card.task:has(.grip) { padding-right: 46px; }
  .grip {
    display: grid; place-items: center; position: absolute; top: 0; right: 0; bottom: 0; width: 44px;
    border: 0; border-radius: 0 11px 11px 0; background: none; padding: 0;
    color: var(--muted); font-size: 19px; font-weight: 700; letter-spacing: -3px; line-height: 1;
    touch-action: none; -webkit-user-select: none; user-select: none; cursor: grab;
  }
  .grip:active { color: var(--gold); }
  .card.task .play { margin-right: 0; }
}
.card-placeholder { margin: 8px 0; border: 1.5px dashed var(--gold); border-radius: 11px; background: var(--gold-soft); opacity: .6; }
.card.sorting { transform: scale(1.03); box-shadow: 0 18px 40px #0008; border-color: var(--gold); transition: transform .12s, box-shadow .12s; pointer-events: none; }
.card.sorting .grip { color: var(--gold); }

.per-quest { display: flex; align-items: center; gap: 8px; }
.per-quest i { width: 9px; height: 9px; border-radius: 50%; background: var(--color); flex: none; }
.per-quest b { margin-left: auto; white-space: nowrap; flex: none; }
.per-quest small { min-width: 0; }
.per-quest b { margin-left: auto; font-weight: 600; color: var(--ink); }
.per-quest small { color: var(--faint); }

/* ---------- Repeat dialog ---------- */
dialog fieldset { border: 0; padding: 0; margin: 14px 0; }
dialog legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.rhythm .seg { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
.rhythm .seg label, .daychips label { margin: 0; display: block; }
.rhythm .seg input, .daychips input { position: absolute; opacity: 0; pointer-events: none; }
.rhythm .seg span { display: block; text-align: center; padding: 8px 4px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.rhythm .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px #0000001f; }
.rhythm .seg input:focus-visible + span, .daychips input:focus-visible + span { outline: 2px solid var(--gold); }
.daychips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 10px; }
.daychips span { display: block; text-align: center; padding: 9px 0; border-radius: 9px; border: 1px solid var(--line-strong); font-size: 13px; color: var(--muted); cursor: pointer; }
.daychips input:checked + span { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); font-weight: 650; }
.ends label.row { margin: 6px 0; }
.ends input[type="radio"] { width: 18px; height: 18px; accent-color: var(--gold); }
.gcolor { margin: -6px 0 6px; font-size: 12.5px; }
.gcolor span { font-weight: 650; color: var(--ink); }

/* ---------- Garden: plants grow while you focus ---------- */
:root {
  --soil: #6b4a33; --soil-top: #8a6446; --tuft: #4f8f45;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --soil: #4a3424; --soil-top: #5e4330; --tuft: #2f6a35;
  }
}
:root[data-theme="dark"] {
  --soil: #4a3424; --soil-top: #5e4330; --tuft: #2f6a35;
}
.focus-ring { overflow: visible; }
.ring-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%; }
.plant-slot { width: 50%; aspect-ratio: 110 / 116; margin-top: 2%; }
.ring-plant, .planted svg { width: 100%; height: 100%; overflow: visible; display: block; }
.focus-ring .big { font-size: 46px; line-height: 1.05; }
.focus-ring small { position: static; }
.soil { fill: var(--soil); } .soil-top { fill: var(--soil-top); }
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 5.5s ease-in-out infinite; }
.sway.still { animation: none; }
.sway.pop { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1), sway 5.5s ease-in-out .7s infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
@keyframes pop { from { transform: scale(.82); } }
.wobble { transform-box: fill-box; transform-origin: 50% 100%; animation: wobble 3s ease-in-out infinite; }
@keyframes wobble { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-7deg); } 80% { transform: rotate(6deg); } 85% { transform: rotate(-4deg); } 90% { transform: rotate(2deg); } }
.petals { animation: fall 6s ease-in infinite; }
@keyframes fall { from { transform: translateY(-20px); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(30px) translateX(8px); opacity: 0; } }
.grow-hint { margin: -10px 0 16px; font-size: 14px; }

.garden { margin: 0 0 22px; }
.garden h2 { margin: 0; }
.garden .between { align-items: baseline; margin-bottom: 8px; }
.garden-art { width: 100%; height: auto; display: block; border-radius: 18px; border: 1px solid var(--line); background: var(--s2); }
.garden-art .stars { fill: #fff; display: none; }
.garden-art .moon-g { display: none; }
.garden-art.night .stars, .garden-art.night .moon-g { display: inline; }
.garden-art.night .sun-g { display: none; }
.garden-art .karst path { fill: #8d9a8c; } .garden-art .jungle { fill: #3f8a4f; }
.garden-art .waves path, .garden-art .glitter path { stroke: #ffffff; stroke-width: 1.1; fill: none; stroke-linecap: round; opacity: .55; animation: shimmer 3.5s ease-in-out infinite; }
.garden-art .glitter path { stroke: var(--sc); stroke-width: 1.6; opacity: .8; }
.garden-art .waves path:nth-child(2), .garden-art .glitter path:nth-child(2n) { animation-delay: -1.2s; }
.garden-art .waves path:nth-child(3), .garden-art .glitter path:nth-child(3n) { animation-delay: -2.3s; }
@keyframes shimmer { 0%, 100% { opacity: .15; transform: translateX(-3px); } 50% { opacity: .8; transform: translateX(3px); } }
.garden-art .boat { animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(3px, 1.5px); } }
.garden-art .win { fill: #5a3a22; }
.garden-art .glow { display: none; fill: #ffd36b; filter: drop-shadow(0 0 3px #ffb84a); }
.garden-art.night .glow { display: inline; }
.garden-art .wet { fill: #dcc08a; } .garden-art .sand { fill: #f3dfae; }
.garden-art .foam { fill: none; stroke: #ffffff; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 18 10; opacity: .85; animation: foam 6s linear infinite; }
@keyframes foam { to { stroke-dashoffset: -112; } }
.garden-art .shell { fill: #f7d6c8; } .garden-art .star { fill: #f08a5d; }
.garden-art .grass { fill: #5aae5c; }
.garden-art .tint { fill: var(--tint); opacity: var(--tint-o); pointer-events: none; }
.garden-art .tuft { stroke: #3f8a45; stroke-width: 1; fill: none; stroke-linecap: round; }
.garden-art .cloud { fill: var(--cloud); opacity: .85; animation: drift 60s linear infinite; }
.garden-art .cloud.c2 { animation-duration: 85s; animation-delay: -30s; }
@keyframes drift { from { transform: translateX(-120px); } to { transform: translateX(420px); } }
.garden-art .birds path { stroke: #ffffff; stroke-width: 1.3; fill: none; }
.garden-art .birds { animation: birds 40s linear infinite; }
@keyframes birds { from { transform: translate(-40px, 60px); } to { transform: translate(440px, 30px); } }
.garden-art .fly { animation: flutter 14s ease-in-out infinite; transform: translate(var(--fx), var(--fy)); }
@keyframes flutter { 0%, 100% { transform: translate(var(--fx), var(--fy)); } 25% { transform: translate(calc(var(--fx) + 30px), calc(var(--fy) - 18px)); } 50% { transform: translate(calc(var(--fx) + 8px), calc(var(--fy) - 34px)); } 75% { transform: translate(calc(var(--fx) - 24px), calc(var(--fy) - 12px)); } }
.garden-art .flap { transform-box: fill-box; transform-origin: center; animation: flap .35s ease-in-out infinite alternate; }
@keyframes flap { to { transform: scaleX(.3); } }
.garden-art .gp { cursor: pointer; animation: rise .8s cubic-bezier(.2, 1.4, .4, 1) var(--d) both; }
@keyframes rise { from { opacity: 0; } }
.garden-art .gp .grow { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-in .9s cubic-bezier(.2, 1.5, .4, 1) var(--d) both; }
.garden-art .gp .sway { animation-duration: 6s; }
@keyframes grow-in { from { transform: scale(0); } }
.garden-art .gp:hover .sway { filter: brightness(1.12); }
.garden-art .shadow { fill: #00000022; }
.garden-art .gp.live .sway { filter: drop-shadow(0 0 6px #ffe08a); }
.garden-art .empty { fill: var(--ink); font-size: 12px; opacity: .75; }
.garden-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.garden-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--color); margin-right: 6px; }
.planted { text-align: center; }
.planted svg { width: 170px; height: 164px; margin: 6px auto 4px; }
.planted-art { display: flex; justify-content: center; flex-wrap: wrap; }
.planted.many svg { width: 104px; height: 100px; margin: 4px -6px; }
@media (max-width: 700px) {
  .focus-ring .big { font-size: 38px; }
  .grow-hint { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .sway, .sway.pop, .garden-art *, .wobble, .petals { animation: none !important; }
}

/* ---------- Notes and sub-tasks on the focus page ---------- */
.focus-notes-cta { margin-top: 18px; }
.focus-notes { text-align: left; max-width: 520px; margin: 26px auto 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.focus-notes > .between { align-items: center; margin-bottom: 8px; }
.focus-notes > .between h2 { margin: 0; }
.focus-notes > .between .quiet { padding: 4px 6px; font-size: 13px; }
.focus-notes h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 8px; }
.focus-notes h2 + textarea, .focus-notes .fsub-add + h2 { margin-top: 16px; }
.fsubs { display: grid; gap: 2px; }
.fsub { display: flex; align-items: center; gap: 10px; padding: 7px 4px; cursor: pointer; border-radius: 8px; }
.fsub input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; margin: 0; }
.fsub.done span { text-decoration: line-through; color: var(--muted); }
.fsub-add { display: flex; gap: 6px; margin-top: 6px; }
.fsub-add input { flex: 1; }
.focus-notes textarea { width: 100%; resize: vertical; font-size: 16px; }
.focus-notes .saved { margin: 4px 0 0; font-size: 12px; min-height: 1em; }

/* ---------- Beach collection ---------- */
.collection { margin: 0 0 22px; }
.collection .between { align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.collection .between .actions { align-items: center; gap: 6px; flex-wrap: nowrap; }
.collection .between .quiet { padding: 4px 6px; font-size: 13px; }
.collection.folded .between { margin-bottom: 0; }
.collection h2 { margin: 0; }
.species { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.species > div { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 8px 5px 10px; text-align: center; min-width: 0; overflow: hidden; }
.species svg { width: 100%; height: 70px; display: block; }
/* Long names like "Meeresschildkröte" break inside the card instead of spilling out. */
.species b { display: block; font-size: 12.5px; line-height: 1.25; margin-top: 2px; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.species small { display: block; font-size: 11.5px; line-height: 1.3; overflow-wrap: anywhere; }
.species .unknown svg { filter: brightness(0); opacity: .14; }
.species .unknown b { color: var(--faint); }
/* Browser notification hint on the focus page */
.notify-nudge { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 14px auto 0; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }

/* v30: kleinere Meldungen, lesbarer Garten-Hinweis, Darstellung in den Einstellungen, Plus-Knopf */
#notice { padding: 9px 14px; font-size: 14px; cursor: default; }
.garden-art .empty { fill: #fff; opacity: 1; stroke: rgba(0, 0, 0, .55); stroke-width: 2.5px; paint-order: stroke; font-weight: 600; }
dialog .theme { border-color: var(--line); background: var(--surface-2); width: 160px; }
dialog .theme button { color: var(--muted); }
dialog .theme button[aria-pressed="true"] { background: var(--primary-bg); color: var(--primary-ink); }
.chart-empty { margin: 18px 0 6px; }
@media (max-width: 800px) {
  .fab {
    position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 7;
    width: 56px; height: 56px; padding: 0; border-radius: 50%; box-shadow: var(--shadow);
    font-size: 0; display: grid; place-items: center;
  }
  .fab span { display: none; }
  .fab::before { content: "+"; font-size: 30px; line-height: 1; font-weight: 400; }
  body:has(.fab) #notice { bottom: calc(env(safe-area-inset-bottom) + 150px); }
}

/* v31: Quest-Auswahl beim Hinzufügen, Zeit und Dauer bei Einträgen */
.quest-pick { display: grid; gap: 8px; margin-top: 10px; }
.quest-pick label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-left: 5px solid var(--color); border-radius: 10px; color: var(--ink); font-size: 15px; cursor: pointer; }
.quest-pick input { width: auto; accent-color: var(--color); }
.quest-pick label:has(input:checked) { background: var(--surface-2); border-color: var(--color); }
.timefields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.timefields label { margin: 13px 0 0; min-width: 0; }
.timefields label:first-child { grid-column: 1 / -1; }
.timefields input { min-width: 0; }
.duration { margin-top: 14px; }
.duration label { display: flex; justify-content: space-between; margin: 0 0 4px; }
.duration b { color: var(--ink); font-weight: 600; }
.duration input[type="range"] { width: 100%; padding: 0; height: 32px; accent-color: var(--gold); border: 0; background: none; }
.untilnow { margin-top: 8px; }
.logtime { margin: 14px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.logtime .quiet { text-decoration: underline; padding: 4px; }

/* v34: Einträge im Kalender ziehen */
.gridwrap .block[data-a="event"] { cursor: grab; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.block .grab-end { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.block.moving { z-index: 5; cursor: grabbing; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .35); opacity: .92; }
.block.selected { z-index: 4; outline: 2px solid var(--color); outline-offset: 0; }
.block.saving { opacity: .6; }
@media (hover: hover) and (pointer: fine) {
  .block:hover .grab-end::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 16px; height: 2px; margin-left: -8px; border-radius: 2px; background: currentColor; opacity: .35; }
}
/* Touch: a selected entry shows a round handle at the bottom to change its length. */
@media (pointer: coarse) {
  .block .grab-end { height: 22px; bottom: -6px; }
  .block:not(.selected) .grab-end { pointer-events: none; }
  .block.selected { overflow: visible; }
  .block.selected .grab-end::after { content: ""; position: absolute; right: 8px; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--color); }
}

/* v35: Ganztägige Termine als Zeile unter den Wochentagen */
.calendarhead.allday { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.alllabel { font-size: 10px; color: var(--faint); text-align: right; padding: 6px 6px 0 0; hyphens: manual; line-height: 1.1; }
.allcell { display: grid; gap: 3px; align-content: start; padding: 4px 3px; border-right: 1px solid var(--line); min-width: 0; }
.allpill, .allmore { display: block; width: 100%; min-width: 0; padding: 2px 6px; border: 0; border-radius: 4px; font-size: 11.5px; line-height: 1.35; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.allpill { background: color-mix(in srgb, var(--color) 30%, var(--block-mix)); border-left: 3px solid var(--color); color: var(--ink); }
.allmore { background: none; color: var(--muted); padding: 1px 6px; }
.allmore:hover { color: var(--ink); }
.dense .alllabel { font-size: 0; padding: 0; }
.dense .allpill { font-size: 9.5px; padding: 1px 2px; border-left-width: 2px; }
.dense .allmore { font-size: 9.5px; padding: 0 2px; }
.dense .allmore span { display: none; }
