/* Georgia has old-style digits (3, 7, 9 dip below the line). Pull digits only from a face with level ones. */
@font-face { font-family: "LevelNums"; font-weight: 100 500; src: local("Charter Roman"), local("Charter-Roman"), local("Charter"), local("Times New Roman"), local("TimesNewRomanPSMT"); unicode-range: U+30-39; }
@font-face { font-family: "LevelNums"; font-weight: 600 900; src: local("Charter Bold"), local("Charter-Bold"), local("Times New Roman Bold"), local("TimesNewRomanPS-BoldMT"); unicode-range: U+30-39; }
:root {
  --bg: #17110d;        /* dark brown */
  --card: #221a14;
  --card2: #2e241c;
  --line: #3b2f25;
  --text: #f5ecdf;
  --text2: #d3c0a8;
  --muted: #9a8672;
  --accent: #d9b98a;    /* tan */
  --on-accent: #1c140e;
  --good: #9ccb6b;
  --bad: #ee7b6c;
  --warn: #e6b450;
  --serif: "LevelNums", Georgia, "Times New Roman", serif;
  --timer: ui-serif, "New York", "Iowan Old Style", Georgia, serif; /* the clock keeps its own face */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
[data-theme=midnight] { --bg: #0b1020; --card: #131a2e; --card2: #1c2540; --line: #2a3555; --text: #eef1fa; --text2: #b9c2dc; --muted: #7d88a8; --accent: #e8b86d; --on-accent: #121627; }
[data-theme=rose] { --bg: #1a0b0e; --card: #261216; --card2: #341a20; --line: #47242c; --text: #faece9; --text2: #dfbdb8; --muted: #a57f7c; --accent: #e8b4a0; --on-accent: #24100f; }
[data-theme=blossom] { --bg: #1b1418; --card: #261c22; --card2: #33262e; --line: #47363f; --text: #fbeef3; --text2: #dcc0cc; --muted: #a08692; --accent: #f5a9c4; --on-accent: #2a1420; }
[data-theme=ivy] { --bg: #0d1510; --card: #152019; --card2: #1e2c23; --line: #2c3f33; --text: #eef4ea; --text2: #bdccb9; --muted: #7f927f; --accent: #b5d08f; --on-accent: #111a12; }
[data-theme=royal] { --bg: #130d1f; --card: #1d1530; --card2: #291e42; --line: #3a2c5a; --text: #f3eefb; --text2: #c9bfe0; --muted: #8b7fa8; --accent: #e3c06a; --on-accent: #1a1226; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 var(--serif);
  -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }

#view { max-width: 560px; margin: 0 auto; padding: calc(var(--sat) + 16px) 18px calc(var(--sab) + 90px); animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }

h1 { font: 600 30px/1.1 var(--serif); margin: 6px 0 18px; letter-spacing: -.01em; }
h2 { font: 600 18px/1.2 var(--serif); margin: 0 0 12px; }
h2 small { display: block; font: 400 13px/1.3 var(--serif); color: var(--muted); margin-top: 3px; }
.lbl, .eyebrow { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.lbl { margin: 20px 0 8px; }
.lbl em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 12px; }

/* Bottom tab bar */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: var(--sab); }
#tabs button { position: relative; flex: 1; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; transition: color .15s; }
#tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#tabs button.on { color: var(--accent); }
#tabs svg { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
#tabs button.on svg { transform: translateY(-1px) scale(1.12); }
#tabs button::before { content: ""; position: absolute; top: -1px; left: 50%; width: 26px; height: 2px; margin-left: -13px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform .25s ease; }
#tabs button.on::before { transform: scaleX(1); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 0 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--text2); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 15px; transition: background .15s, border-color .15s; }
.chip:active { opacity: .7; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip[style*="--c"].on { background: color-mix(in srgb, var(--c) 20%, var(--card)); border-color: var(--c); color: var(--text); font-weight: 500; }
.chip.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.chip.dash { border-style: dashed; color: var(--muted); background: none; }
.chip .muted { color: var(--text2); }
.tagpill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); background: var(--card2); border-radius: 6px; padding: 2px 8px; }
.tagpill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

/* Segmented control + underline tabs */
.seg { display: flex; background: var(--card); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; height: 34px; border-radius: 8px; font-size: 14px; color: var(--text2); }
.seg button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.subtabs { display: flex; gap: 22px; overflow-x: auto; margin: 0 -18px 16px; padding: 0 18px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { padding: 12px 0 10px; color: var(--muted); font-size: 15px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs button.on { color: var(--text); border-color: var(--accent); font-weight: 600; }

/* Inputs */
input[type=text], input[type=number], input[type=tel], input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); outline: none; -webkit-appearance: none; appearance: none; font-size: 16px;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; text-overflow: ellipsis; }
.modal input, .modal select, .modal textarea, .card input { background: var(--card2); }

.btn { min-height: 48px; padding: 0 18px; border-radius: 12px; background: var(--card2); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: opacity .15s; }
.btn:active { opacity: .7; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 62px; font-size: 19px; border-radius: 14px; margin-top: 26px; }

/* Timer home + setup */
.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h2 .ic { color: var(--accent); vertical-align: -3px; margin-right: 8px; }
h2 small { margin-left: 25px; }
.lbl .ic, .ck-lbl .ic { vertical-align: -2px; margin-right: 6px; color: var(--accent); }
.home { padding-top: 10px; }
.home .eyebrow { display: block; }
.today { font: 500 clamp(40px, 12.5vw, 54px)/1.1 var(--timer); letter-spacing: -.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.tick { stroke: var(--line); stroke-width: 1.5; stroke-linecap: round; }
.tick.maj { stroke: var(--muted); }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin: 10px 0 2px; }
.trio div + div { border-left: 1px solid var(--line); }
.trio .ic { color: var(--accent); display: block; margin: 0 auto 4px; }
.trio b { font: 600 20px/1.2 var(--timer); margin-right: 5px; }
.trio span { font-size: 12px; color: var(--muted); }
.btn.big .ic { margin-right: 2px; }
.checkin { margin-top: 26px; padding: 16px 16px 12px; }
.ck-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 18px; }
.ck-head span { font-size: 12px; color: var(--muted); }
.ck-lbl { font-size: 13px; color: var(--text2); margin: 18px 0 8px; }
.ck-lbl { display: flex; align-items: center; }
.slept { margin-left: auto; font: 600 18px/1 var(--timer); color: var(--accent); }
.sleep { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.sleep .rm { width: 36px; height: 44px; border-radius: 10px; background: var(--card2); color: var(--muted); font-size: 20px; }
.modal .sleep input, .modal .scale button { background: var(--card2); }
.modal .scale button.on { background: var(--accent); }
.isub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.sleep label { min-width: 0; }
.sleep label span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.sleep input { min-width: 0; min-height: 44px; padding: 8px 10px; background: var(--card2); border-color: transparent; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale button { height: 48px; border-radius: 10px; background: var(--card2); color: var(--muted); display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.scale button.on { background: var(--accent); color: var(--on-accent); }
.scaleword { text-align: center; font-size: 12px; color: var(--accent); margin-top: 6px; min-height: 16px; }
.ckdone { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-top: 26px; padding: 13px 16px; border-radius: 12px; background: var(--card); color: var(--text2); font-size: 14px; }
.ckdone .ic { color: var(--accent); }
.fscore { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.fscore > div:first-child { flex: none; }
.fscore b { font: 600 34px/1 var(--timer); }
.livehead { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; }
.group { padding: 2px 0 20px; border-bottom: 1px solid var(--line); }
.group .lbl { margin-top: 18px; }
.group:last-of-type { border-bottom: 0; }
.back { color: var(--accent); font-size: 16px; padding: 8px 8px 8px 0; }
.btn.ghost { background: none; color: var(--text2); }

.rate { display: flex; gap: 6px; }
.rate button { flex: 1; height: 46px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-weight: 600; color: var(--text2); }
.modal .rate button, .card .rate button { background: var(--card2); }
.rate button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Live timer */
.live { text-align: center; }
.ringwrap { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 10px auto 6px; }
.ringwrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--card2); stroke-width: 5; }
.ring-fg.sweep { transition: none; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .5s linear, stroke .3s; }
.ring-fg.done { stroke: var(--good); }
.ringin { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.elapsed { font: 500 clamp(48px, 16vw, 68px)/1 var(--timer); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.paused .elapsed { opacity: .45; }
.live-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.live-actions .btn { min-height: 58px; font-size: 16px; }
.live-actions .btn:not(.primary) .ic { color: var(--accent); }
.live-actions .wide { grid-column: 1 / -1; }
.badge { display: inline-flex; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--bg); color: var(--accent); align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }

/* Stats */
.filters { position: sticky; top: 0; z-index: 10; background: var(--bg); margin: calc(-1 * (var(--sat) + 16px)) -18px 0; padding: calc(var(--sat) + 12px) 18px 0; }
.filters select { min-height: 38px; padding: 6px 26px 6px 10px; font-size: 14px; color: var(--text2); background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; }
.filters .row { margin-top: 8px; gap: 8px; }
.hero { display: flex; justify-content: space-between; gap: 16px; padding: 4px 2px 16px; }
.xl { font: 600 44px/1.05 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.kpi { padding: 13px 14px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin: -1px 0 0 -1px; }
.kpi b { display: block; font: 600 21px/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.up { color: var(--good); } .down { color: var(--bad); } .flat { color: var(--muted); }
.warn { display: inline-block; font-size: 11px; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 5px; padding: 0 5px; white-space: nowrap; vertical-align: 1px; }
.cap { font-size: 13px; color: var(--text2); margin-top: 10px; }
.cap b { color: var(--text); }

svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .ax { fill: var(--muted); font-size: 9px; }
svg.chart .vl { fill: var(--text2); font-size: 9px; font-weight: 600; }
svg.chart .hit { fill: transparent; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text2); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.pie { display: flex; align-items: center; gap: 16px; }
.pie svg { width: 46%; max-width: 170px; flex: none; }
.pie path, .pie circle { cursor: pointer; }
.pie text { font-size: 11px; font-weight: 700; fill: #1c140e; pointer-events: none; }
.pielegend { flex: 1; min-width: 0; font-size: 13px; }
.pielegend div { display: flex; align-items: center; gap: 7px; padding: 4px 0; }
.pielegend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.pielegend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.pielegend b { font-variant-numeric: tabular-nums; font-weight: 600; }

.hbar { display: grid; grid-template-columns: minmax(74px, 36%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; cursor: pointer; }
.hbar .name { color: var(--text2); line-height: 1.25; overflow-wrap: anywhere; }
.hbar .track { height: 16px; border-left: 1px solid var(--line); }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; transition: width .35s ease; }
.hbar .val { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.hbar .val small { display: block; font-weight: 400; font-size: 11px; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.tbl th { color: var(--muted); font-weight: 500; text-align: center; padding: 2px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; color: var(--text2); max-width: 96px; }
.tbl td { text-align: center; padding: 8px 2px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.tbl td.c { cursor: pointer; font-weight: 600; }
.tbl.plain { border-spacing: 0; font-size: 13px; }
.tbl.plain td, .tbl.plain th { padding: 9px 8px; border-radius: 0; border-top: 1px solid var(--line); white-space: nowrap; max-width: none; }
.tbl.plain tr:first-child th { border-top: 0; }
.tbl.plain td:first-child { white-space: normal; min-width: 118px; color: var(--text); }
.tbl.plain small { display: block; font-size: 10px; }
.scrollx { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }

.prog { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; margin: 6px 0 14px; }
.prog div { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s ease; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); min-height: 48px; }
.list-row:first-child { border-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.report li { margin: 7px 0; color: var(--text2); }
.report ul { margin: 0; padding-left: 18px; }
.report b { color: var(--text); }
.grade { font: 600 38px/1 var(--serif); width: 58px; height: 58px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; flex: none; }

/* History */
.sess { display: block; width: 100%; text-align: left; background: var(--card); border-left: 3px solid var(--c); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.sess:active { background: var(--card2); }
.sess .top { display: flex; justify-content: space-between; gap: 8px; }
.sess .dur { font: 600 17px var(--timer); }
.sess .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sess .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.sess .note { font-size: 13px; color: var(--text2); margin-top: 6px; }

/* Modal sheet */
.modal { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 45%, rgba(0,0,0,.75)); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 18px calc(var(--sab) + 18px); animation: up .22s ease; -webkit-overflow-scrolling: touch; }
.sheet.still { animation: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; }
.swatches button.on { border-color: var(--text); }

/* Settings lists */
.ihead { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 14px 7px; }
.ilist { background: var(--card); border-radius: 12px; overflow: hidden; margin-top: 22px; }
.ihead + .ilist { margin-top: 0; }
.irow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 14px; text-align: left; position: relative; }
.irow + .irow::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--line); }
button.irow:active, label.irow:active { background: var(--card2); }
.irow .grow { flex: 1; min-width: 0; }
.irow .ival { color: var(--muted); font-size: 15px; }
.irow .chev { color: var(--muted); font-size: 20px; line-height: 1; margin-left: -4px; }
.irow .sw { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); flex: none; }
.irow .tick { color: var(--accent); font-weight: 700; font-size: 17px; }
.irow.danger { color: var(--bad); }
.irow.accent { color: var(--accent); }
.irow input[type=number] { width: 84px; min-height: 36px; padding: 4px 10px; text-align: right; background: var(--card2); border-color: transparent; }
.ifoot { font-size: 13px; color: var(--muted); margin: 8px 14px 0; line-height: 1.35; }

/* Theme picker */
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.themes button { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 4px 0; line-height: 1.2; }
.themes i { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); box-shadow: 0 0 0 2px var(--card); }
.themes button.on { color: var(--text); }
.themes button.on i { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }

/* Lock */
#lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 20px; }
#lock[hidden] { display: none; }
.dots { display: flex; gap: 16px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--muted); }
.dots i.on { background: var(--accent); border-color: var(--accent); }
.dots.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 16px; }
.pad button { height: 72px; border-radius: 50%; background: var(--card); font: 500 26px var(--serif); }
.pad button:active { background: var(--card2); }

#tip { position: fixed; z-index: 80; max-width: 240px; background: color-mix(in srgb, var(--bg) 55%, #000); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-line; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
#toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--sab) + 80px); transform: translateX(-50%); background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600; max-width: 86vw; text-align: center; animation: fade .2s; }
.empty { text-align: center; color: var(--muted); padding: 46px 24px; line-height: 1.45; }
.emptyic, .donebadge { display: flex; width: 68px; height: 68px; border-radius: 50%; align-items: center; justify-content: center; margin: 0 auto 14px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.done { text-align: center; padding: 14px 0 6px; }
.done .today { margin: 4px 0 8px; }
.tile { display: inline-flex; width: 30px; height: 30px; border-radius: 8px; align-items: center; justify-content: center; flex: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.tile.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, transparent); }
.profile { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 14px; padding: 14px 16px; }
.profile b { display: block; font-size: 19px; }
.profile span { font-size: 13px; color: var(--muted); }
.grings { display: flex; justify-content: space-around; gap: 12px; margin: 4px 0 16px; }
.gring { position: relative; width: 44%; max-width: 150px; text-align: center; }
.gring svg { display: block; width: 100%; }
.gring .ring-bg, .gring .ring-fg { stroke-width: 7; }
.gring .in { position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gring b { font: 600 22px/1.1 var(--timer); }
.gring span { font-size: 12px; color: var(--muted); }
.gring em { display: block; font-style: normal; font-size: 13px; color: var(--text2); margin-top: 8px; }
.dayh { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 2px 8px; }
.dayh span:last-child { color: var(--accent); letter-spacing: 0; text-transform: none; font-size: 13px; }
.sline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.sline span { display: inline-flex; align-items: center; gap: 5px; }
.sline .pips { gap: 3px; }
.pips i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.pips i.on { background: var(--accent); }
.search { position: relative; }
.search .ic { position: absolute; left: 13px; top: 14px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
/* Motion. `.enter` is added to #view only when you navigate, so in-place updates (tapping a chip) never replay it. */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(28px); } }
@keyframes slideL { from { opacity: 0; transform: translateX(-28px); } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes ringIn { from { stroke-dashoffset: var(--full); } }
@keyframes pieIn { from { opacity: 0; transform: rotate(-50deg) scale(.82); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.08); } }
@keyframes tick { from { stroke-dashoffset: 24; } }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.enter > :not(.filters) { animation: rise .36s cubic-bezier(.2, .8, .2, 1) backwards; }
.enter > :nth-child(2) { animation-delay: .04s; } .enter > :nth-child(3) { animation-delay: .08s; } .enter > :nth-child(4) { animation-delay: .12s; }
.enter > :nth-child(5) { animation-delay: .16s; } .enter > :nth-child(6) { animation-delay: .2s; } .enter > :nth-child(n+7) { animation-delay: .24s; }
.enter.fwd > :not(.filters) { animation-name: slideR; animation-delay: 0s; }
.enter.back > :not(.filters) { animation-name: slideL; animation-delay: 0s; }
.enter .grow, .enter .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: growY .6s cubic-bezier(.2, .8, .2, 1) .12s backwards; }
.enter .draw { stroke-dasharray: 1; animation: draw 1s ease-out .15s backwards; }
.enter .vl { animation: fade .4s .5s backwards; }
.enter .ring-fg:not(#ring) { animation: ringIn 1.1s cubic-bezier(.2, .8, .2, 1) .1s backwards; }
.enter .hbar .fill { transform-origin: 0 50%; animation: growX .6s cubic-bezier(.2, .8, .2, 1) .1s backwards; }
.enter .pie svg { animation: pieIn .6s cubic-bezier(.2, .8, .2, 1) .1s backwards; }
.enter .prog div { transform-origin: 0 50%; animation: growX .7s cubic-bezier(.2, .8, .2, 1) .1s backwards; }
.enter .done .donebadge, .enter .emptyic { animation: pop .5s cubic-bezier(.3, 1.4, .5, 1) backwards; }
.enter .done .donebadge path { stroke-dasharray: 24; animation: tick .45s ease-out .3s backwards; }
.btn, .chip, .sess, .irow, .rate button, .scale button { transition: transform .12s ease, background .15s, opacity .15s, border-color .15s, color .15s; }
.btn:active, .chip:active, .rate button:active, .scale button:active { transform: scale(.96); opacity: 1; }
.sess:active { transform: scale(.985); }
.modal { animation: fade .2s ease; }
#ask .sheet { animation: pop .22s ease; }
#toast { animation: toastIn .25s ease; }
.badge.bump { animation: pop .3s ease; }
.live:not(.paused) #tState::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: 7px; vertical-align: 1px; animation: pulse 1.8s ease-in-out infinite; }
.live.paused .elapsed { opacity: 1; animation: pulse 2.4s ease-in-out infinite; }
/* Hover (mouse/trackpad only, so nothing sticks after a tap on a phone): data marks zoom, rows and cards nudge. */
@keyframes nudge { 0%, 100% { translate: 0; } 25% { translate: -3px 0; } 60% { translate: 2px 0; } 85% { translate: -1px 0; } }
svg.chart .bar, svg.chart .seg, svg.chart .col, svg.chart rect[data-tip], svg.chart circle.hit, .pie path, .pie circle { transform-box: fill-box; transition: transform .16s ease, filter .16s ease, fill .16s, stroke .16s; }
.hbar .fill, .hbar .name, .tbl td.c, .irow .chev, .irow .tile, .kpi b, .sess, .list-row .tile { transition: transform .16s ease, filter .16s ease, color .16s, background .16s; }
/* Touch has no hover, so the tapped mark gets the same zoom (.sel) for as long as its tooltip is up. */
svg.chart .col.sel .bar { transform: scale(1.12, 1.03); transform-origin: 50% 100%; filter: brightness(1.18); }
svg.chart .col.sel .seg { transform: scaleX(1.35); transform-origin: 50% 50%; filter: brightness(1.2); }
svg.chart .col.sel .vl { fill: var(--text); }
svg.chart rect[data-tip].sel:not(.hit) { transform: scale(1.4); transform-origin: 50% 50%; stroke: var(--text); stroke-width: 1; }
svg.chart circle.hit.sel { fill: color-mix(in srgb, var(--accent) 28%, transparent); stroke: var(--accent); stroke-width: 1.5; transform: scale(1.15); transform-origin: 50% 50%; }
.pie path.sel, .pie circle.sel { transform: scale(1.06); transform-origin: 90px 90px; transform-box: view-box; filter: brightness(1.15); }
.hbar.sel .fill { transform: scaleY(1.3); filter: brightness(1.18); }
.hbar.sel .name { color: var(--text); }
.tbl td.c.sel { transform: scale(1.14); filter: brightness(1.12); }
.sess:active, button.irow:active, .ckdone:active { animation: nudge .38s ease; }
@media (hover: hover) {
  svg.chart .col:hover .bar { transform: scale(1.12, 1.03); transform-origin: 50% 100%; filter: brightness(1.18); }
  svg.chart .col:hover .seg { transform: scaleX(1.35); transform-origin: 50% 50%; filter: brightness(1.2); }
  svg.chart .col:hover .vl { fill: var(--text); }
  svg.chart rect[data-tip]:not(.hit):hover { transform: scale(1.4); transform-origin: 50% 50%; stroke: var(--text); stroke-width: 1; }
  svg.chart circle.hit:hover { fill: color-mix(in srgb, var(--accent) 28%, transparent); stroke: var(--accent); stroke-width: 1.5; transform: scale(1.15); transform-origin: 50% 50%; }
  .pie path:hover, .pie circle:hover { transform: scale(1.06); transform-origin: 90px 90px; transform-box: view-box; filter: brightness(1.15); }
  .hbar:hover .fill { transform: scaleY(1.3); filter: brightness(1.18); }
  .hbar:hover .name { color: var(--text); }
  .tbl td.c:hover { transform: scale(1.14); filter: brightness(1.12); }
  .kpi:hover b { transform: scale(1.06); transform-origin: 0 50%; color: var(--accent); }
  .kpi b { display: block; }
  .sess:hover { transform: translateY(-2px) scale(1.012); background: var(--card2); box-shadow: 0 8px 22px rgba(0, 0, 0, .28); animation: nudge .38s ease; }
  .irow:hover:is(button, label) { background: var(--card2); }
  button.irow:hover { animation: nudge .38s ease; }
  .irow:hover .chev { transform: translateX(4px); color: var(--accent); }
  .irow:hover .tile, .list-row:hover .tile { transform: scale(1.1) rotate(-4deg); }
  .btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
  .chip:hover { border-color: var(--c, var(--accent)); color: var(--text); transform: translateY(-1px); }
  .rate button:hover, .scale button:hover, .seg button:not(.on):hover { background: var(--card2); color: var(--text); transform: translateY(-1px); }
  .subtabs button:hover { color: var(--text); }
  #tabs button:hover { color: var(--text2); }
  #tabs button:hover svg { transform: translateY(-2px) scale(1.12); }
  .ckdone:hover { background: var(--card2); animation: nudge .38s ease; }
  .back:hover { text-decoration: underline; }
}
/* ---------- Polish layer: depth, a floating tab bar, softer cards ---------- */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 55% at 50% -12%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%), radial-gradient(70% 40% at 105% 105%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%); }
#view { padding-bottom: calc(var(--sab) + 108px); }
h1 { font-size: 32px; }
.card, .kpis, .ilist, .profile, .ckdone, .hero { border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 14px 26px -22px rgba(0, 0, 0, .7); }
.card, .kpis, .profile, .hero { border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--card2) 38%, var(--card)), var(--card)); }
.sess { border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-left: 3px solid var(--c); border-radius: 14px; }
.hero { padding: 16px 18px; margin-bottom: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 17%, var(--card)), var(--card) 70%); }
.filters { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#tabs { left: 12px; right: 12px; bottom: max(10px, var(--sab)); max-width: 536px; margin: 0 auto; padding-bottom: 0; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 24px;
  background: color-mix(in srgb, var(--card) 84%, transparent); box-shadow: 0 16px 34px -10px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05); }
#tabs button { height: 60px; z-index: 0; }
#tabs button::before { top: 7px; bottom: 7px; left: 14%; right: 14%; width: auto; height: auto; margin: 0; border-radius: 16px; z-index: -1; background: color-mix(in srgb, var(--accent) 15%, transparent); transform: scale(.7); opacity: 0; transition: transform .28s cubic-bezier(.3, 1.4, .5, 1), opacity .2s; }
#tabs button.on::before { transform: none; opacity: 1; }
#toast { bottom: calc(var(--sab) + 96px); border-radius: 14px; box-shadow: 0 12px 26px -10px rgba(0, 0, 0, .6); }
.btn.primary, .seg button.on, .rate button.on, .scale button.on, .grade { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 84%, #fff), var(--accent)); }
.btn.primary { box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--accent) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.big { border-radius: 18px; }
.ring-fg { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 50%, transparent)); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.sheet { border-radius: 24px 24px 0 0; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: -6px auto 14px; }
#ask .sheet::before { display: none; }
.greet { text-align: center; margin-bottom: 4px; }
.greet b { display: block; font-size: 22px; letter-spacing: -.01em; }
.greet span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.week { display: flex; justify-content: center; align-items: flex-end; gap: 16px; height: 70px; margin-top: 16px; }
.week div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; cursor: pointer; }
.week i { width: 10px; border-radius: 5px; background: var(--card2); transition: height .4s ease; }
.week span { font-size: 11px; color: var(--muted); }
.week .on i { background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent); }
.week .on span { color: var(--accent); font-weight: 700; }
.enter .week i { transform-origin: 50% 100%; animation: growY .6s cubic-bezier(.2, .8, .2, 1) .15s backwards; }
.ckdone .chev { color: var(--muted); font-size: 20px; }
.ckdone.due { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--text); }
.ckdone.due > .ic { animation: pulse 1.8s ease-in-out infinite; }
.brk { justify-content: space-between; margin-bottom: 8px; }
.brk small { font-weight: 400; font-size: 12px; color: var(--muted); }
.herorow { display: flex; justify-content: space-between; gap: 16px; }
.hero { display: block; padding-bottom: 0; overflow: hidden; }
.hero .spark { display: block; width: calc(100% + 36px); height: 46px; margin: 8px -18px 0; }
.hero:not(:has(.spark)) { padding-bottom: 16px; }
.quick, .tip { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-top: 10px; padding: 12px 16px; border-radius: 16px; background: var(--card); border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); color: var(--text); font-size: 15px; transition: transform .12s ease, background .15s; }
.quick:active, .tip:active { transform: scale(.98); background: var(--card2); }
.quick > .ic { color: var(--accent); }
.tip { align-items: flex-start; font-size: 14px; line-height: 1.4; color: var(--text2); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--card)), var(--card) 75%); }
.tip > .ic { color: var(--accent); margin-top: 2px; }
.tip b { color: var(--text); }
.tip small { color: var(--muted); font-size: 11px; white-space: nowrap; margin-top: 2px; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mbadge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 4px 10px; border-radius: 14px; background: var(--card2); cursor: pointer; opacity: .55; transition: transform .16s ease, opacity .16s; }
.mbadge span { display: flex; width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center; color: var(--muted); border: 1.5px dashed var(--line); }
.mbadge b { font-size: 12px; font-weight: 600; line-height: 1.2; }
.mbadge i { display: block; width: 70%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.mbadge u { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.mbadge.got { opacity: 1; }
.mbadge.got span { color: var(--on-accent); border: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 84%, #fff), var(--accent)); box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.mbadge.sel, .mbadge:active { transform: scale(1.05); opacity: 1; }
.enter .mbadge.got span { animation: pop .5s cubic-bezier(.3, 1.4, .5, 1) backwards; }
.group { background: var(--card); border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 18px; padding: 0 14px 16px; margin-bottom: 10px; }
.group .lbl { margin-top: 16px; }
.group:last-of-type { border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); }
.group input, .group .seg { background: var(--card2); }
.group .chip:not(.on) { background: var(--card2); }
.trio b { font-family: var(--timer); }
@media (hover: hover) { .mbadge:hover { transform: scale(1.05); opacity: 1; } .quick:hover, .tip:hover { background: var(--card2); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
