/* Today (v2). Scope: [data-screen="today"]; sheets use .td- classes. */

/* ---------- layout: the ring alone on the left, centred; the day on the right ---------- */
[data-screen="today"] .td-layout { display: block; }
[data-screen="today"] .td-ring { display: grid; place-items: center; padding: 4px 0 30px; }
[data-screen="today"] .td-col { min-width: 0; }
@media (min-width: 1024px) {
  [data-screen="today"] .td-layout { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 600px); gap: 64px; align-items: start; }
  /* the ring sits in the middle of its column and of the visible screen, and stays there while the right side scrolls */
  [data-screen="today"] .td-ring { position: sticky; top: calc(var(--safe-t) + 72px); height: calc(100dvh - var(--safe-t) - 72px - var(--bottom-space)); min-height: 420px; padding: 0; }
}

/* ---------- the ring ---------- */
[data-screen="today"] .td-stone { position: relative; display: grid; place-items: center; margin: 0 0 6px; }
[data-screen="today"] .td-stone .stone { position: relative; z-index: 1; overflow: visible; filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.35)); transition: transform var(--spring-bouncy-dur) var(--spring-bouncy); }
:root[data-theme="light"] [data-screen="today"] .td-stone .stone { filter: drop-shadow(0 18px 26px rgb(28 34 52 / 0.18)); }
/* the ring never moves: no bounce when the score grows (the glow brightens instead) */
@keyframes td-pop { 0% { transform: scale(1); } 35% { transform: scale(1.045); } 100% { transform: scale(1); } }
/* the light under the stone grows with the score; it does not move on its own */
[data-screen="today"] .td-stone__glow {
  position: absolute; inset: -18%; z-index: 0; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(var(--stone-glow) / var(--glow-a, 0.2)), rgb(var(--stone-glow) / calc(var(--glow-a, 0.2) * 0.35)) 45%, transparent 72%);
  filter: blur(6px);
}
:root[data-theme="light"] [data-screen="today"] .td-stone__glow { background: radial-gradient(closest-side, rgb(var(--fg-rgb) / calc(var(--glow-a, 0.2) * 0.12)), transparent 70%); }
[data-screen="today"] .td-stone .stone__facet { transition: opacity var(--dur-fast) var(--ease-out); }
/* naming a facet: the picked part stays lit, the rest of the stone steps back */
[data-screen="today"] .td-stone.has-facet .stone__facet:not(.is-picked) { opacity: 0.28; }
[data-screen="today"] .td-stone.has-facet .stone__facet.is-picked { filter: brightness(1.25); }
/* the name of the hovered or tapped facet: one quiet line where the stone ends */
[data-screen="today"] .td-facet-tag {
  position: absolute; z-index: 2; bottom: -2px; left: 50%; transform: translate(-50%, 3px);
  font-size: 13px; font-weight: 550; letter-spacing: -0.01em; color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums;
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
[data-screen="today"] .td-facet-tag.is-on { opacity: 1; transform: translate(-50%, 0); }


/* ---------- notices, fixing yesterday ---------- */
[data-screen="today"] .td-notice-slot:not(:empty) { margin-bottom: 18px; }
[data-screen="today"] .td-notice-slot .notice { border-top: 0; padding-top: 0; }
[data-screen="today"] .td-edit-slot:not(:empty) { margin: 0 0 20px; }
[data-screen="today"] .td-editbar .notice__text { font-weight: 600; color: var(--fg); }

/* ---------- main task card ---------- */
[data-screen="today"] .td-main {
  position: relative; padding: 20px 22px 22px; border-radius: var(--r-xl);
  background: linear-gradient(160deg, rgb(var(--fg-rgb) / 0.075), rgb(var(--fg-rgb) / 0.03));
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 48px -32px rgb(0 0 0 / 0.6);
}
:root[data-theme="light"] [data-screen="today"] .td-main { background: rgb(255 255 255 / 0.8); box-shadow: inset 0 0 0 1px var(--line), 0 16px 32px -28px rgb(28 34 52 / 0.3); }
[data-screen="today"] .td-main__label { font-size: 13px; font-weight: 600; color: var(--muted); }
[data-screen="today"] .td-main__title { margin-top: 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; text-wrap: balance; }
[data-screen="today"] .td-main.is-done .td-main__title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
[data-screen="today"] .td-main.is-calm .td-main__title { font-size: 19px; }
[data-screen="today"] .td-main__actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
[data-screen="today"] .td-main__actions .btn--l { flex: 1 1 auto; }
[data-screen="today"] .td-main__add { display: flex; gap: 10px; margin-top: 12px; }
[data-screen="today"] .td-main__input { flex: 1; min-width: 0; font-size: 16px; }
[data-screen="today"] .btn--l { min-height: 52px; padding: 0 24px; font-size: 16px; }
[data-screen="today"] .btn--accent.hold .hold__fill { background: rgb(255 255 255 / 0.3); }
[data-screen="today"] .btn--ghost.hold .hold__fill { background: rgb(var(--fg-rgb) / 0.14); }

/* ---------- today's other plans ---------- */
[data-screen="today"] .td-plans { margin-top: 26px; }
[data-screen="today"] .td-plans__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
[data-screen="today"] .td-plans__title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
[data-screen="today"] .td-plans__all { font-size: 13px; color: var(--muted); text-decoration: none; }
@media (hover: hover) { [data-screen="today"] .td-plans__all:hover { color: var(--fg); } }
[data-screen="today"] .td-plans__list { list-style: none; }
[data-screen="today"] .td-plan { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); }
[data-screen="today"] .td-plan__check { border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
[data-screen="today"] .td-plan__check[aria-pressed="true"] .td-token { background: var(--fg); color: var(--bg); box-shadow: none; }
[data-screen="today"] .td-plan__text { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
[data-screen="today"] .td-plan.is-done .td-plan__text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
[data-screen="today"] .td-plan__new { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; }
[data-screen="today"] .td-plan__new svg { width: 18px; height: 18px; margin: 0 5px; }
@media (hover: hover) { [data-screen="today"] .td-plan__new:hover { color: var(--fg); } }
[data-screen="today"] .td-plan__input { flex: 1; min-width: 0; margin: 6px 0; }

/* ---------- rows ---------- */
[data-screen="today"] .td-rows { margin-top: 26px; border-bottom: 1px solid var(--line); }
[data-screen="today"] .td-sec { border-top: 1px solid var(--line); scroll-margin-top: 90px; }
[data-screen="today"] .td-sec__head { margin: 0; font: inherit; }
[data-screen="today"] .td-row {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0;
  border: 0; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
[data-screen="today"] .td-row__t { flex: none; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
[data-screen="today"] .td-row__s { flex: 1; min-width: 0; display: flex; justify-content: flex-end; font-size: 14px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
[data-screen="today"] .td-row__lead { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
[data-screen="today"] .td-row__sep { flex: none; white-space: pre; }
[data-screen="today"] .td-row__tail { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; }   /* long translations end in … instead of leaving the screen */
[data-screen="today"] .td-row__s.is-on .td-row__tail { color: var(--fg); }
[data-screen="today"] .td-row__chev { flex: none; display: grid; place-items: center; color: var(--faint); transition: transform var(--dur) var(--ease-out); }
[data-screen="today"] .td-row__chev svg { width: 16px; height: 16px; }
[data-screen="today"] .td-row[aria-expanded="true"] .td-row__chev { transform: rotate(180deg); }
@media (hover: hover) { [data-screen="today"] .td-row:hover .td-row__chev { color: var(--fg); } }
[data-screen="today"] .td-body { padding: 2px 0 24px; display: flex; flex-direction: column; gap: 16px; }
[data-screen="today"] .td-row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
[data-screen="today"] .td-hint, [data-screen="today"] .td-note { font-size: 13px; color: var(--muted); }
[data-screen="today"] .td-check { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--fg); color: var(--bg); flex: none; }
[data-screen="today"] .td-check svg { width: 14px; height: 14px; stroke-width: 2.2; }

[data-screen="today"] .td-row__s { gap: 0; overflow: hidden; text-overflow: ellipsis; display: block; text-align: right; }
[data-screen="today"] .td-row__s.is-on { color: var(--fg); }

[data-screen="today"] .td-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
[data-screen="today"] .td-time { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; min-height: 52px; }
/* habits */
[data-screen="today"] .td-habits { list-style: none; margin-top: -8px; }
[data-screen="today"] .td-habits li + li { border-top: 1px solid var(--line); }
[data-screen="today"] .td-habit { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 8px 0; border: 0; background: none; color: var(--fg); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
[data-screen="today"] .td-token { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1.6px var(--line-strong); color: transparent; transition: background var(--dur) var(--ease-out), box-shadow var(--dur), color var(--dur), transform var(--spring-bouncy-dur) var(--spring-bouncy); }
[data-screen="today"] .td-token svg { width: 15px; height: 15px; stroke-width: 2.4; }
[data-screen="today"] .td-habit:active .td-token { transform: scale(0.86); }
[data-screen="today"] .td-habit[aria-pressed="true"] .td-token { background: var(--fg); color: var(--bg); box-shadow: none; }
[data-screen="today"] .td-habit__name { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.01em; overflow-wrap: anywhere; transition: color var(--dur); }
[data-screen="today"] .td-habit[aria-pressed="true"] .td-habit__name { color: var(--muted); }


[data-screen="today"] .td-screen__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; gap: 12px; }
[data-screen="today"] .td-screen__v { font-size: 15px; font-weight: 600; white-space: nowrap; }
[data-screen="today"] .td-note-input { min-height: 96px; resize: vertical; font-size: 15px; line-height: 1.45; }

[data-screen="today"] .td-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
[data-screen="today"] .td-switch-row > label { display: flex; flex-direction: column; justify-content: center; min-width: 44px; min-height: 44px; overflow-wrap: anywhere; cursor: pointer; }
[data-screen="today"] .td-switch-row .switch { height: 44px; }
[data-screen="today"] .td-switch-row .switch__track { inset-block: 6.5px; }
[data-screen="today"] .td-switch-row .switch__thumb { margin-top: 6.5px; }
[data-screen="today"] .td-switch-row__t { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
[data-screen="today"] .td-switch-row__s { margin-top: 2px; font-size: 13px; color: var(--muted); max-width: 42ch; }
[data-screen="today"] .td-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
[data-screen="today"] .td-steps .chip { min-width: 44px; min-height: 44px; max-width: 100%; padding-block: 6px; white-space: normal; overflow-wrap: anywhere; text-align: start; line-height: 1.2; }
[data-screen="today"] :is(.td-hard-done, .td-hard-action) { min-width: 0; max-width: 100%; }
[data-screen="today"] :is(.td-hard-done, .td-hard-action) > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
[data-screen="today"] :is(.td-hard-done, .td-hard-action) svg { flex: none; }
[data-screen="today"] .td-hard-done { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
[data-screen="today"] .td-cta.td-hard-action { padding-block: 8px; }
[data-screen="today"] .td-hard-done svg { width: 18px; height: 18px; color: var(--green); }

@media (max-width: 420px) {
  [data-screen="today"] .td-main { padding: 18px; }
  [data-screen="today"] .td-main__title { font-size: 22px; }
  [data-screen="today"] .td-row__t { font-size: 16px; }
  [data-screen="today"] .td-row__s { font-size: 13px; }
}

/* ---------- sheets (render outside the screen) ---------- */
.td-sheet-text { font-size: 15px; color: var(--muted); line-height: 1.5; }
.td-sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.td-sheet-actions .btn { flex: 1; min-height: 48px; }

/* score sheet */
.td-score__top { display: flex; align-items: center; gap: 16px; padding: 4px 0 18px; }
.td-score__top .stone { flex: none; }
.td-score__total { font-size: 17px; font-weight: 500; color: var(--muted); letter-spacing: -0.01em; }
.td-score__total b { font-size: 30px; font-weight: 700; color: var(--fg); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-right: 4px; }
.td-score__status { margin-top: 4px; font-size: 14px; color: var(--muted); }
.td-score__status.is-pass { color: var(--fg); font-weight: 600; }
.td-score__parts { list-style: none; border-top: 1px solid var(--line); }
.td-score__part { padding: 14px 0; border-bottom: 1px solid var(--line); }
.td-score__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.td-score__name { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px; }
.td-score__name svg { width: 14px; height: 14px; color: var(--faint); }
.td-score__pts { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.td-score__pts small { color: var(--faint); font-weight: 500; font-size: inherit; }
.td-score__part .bar { margin-top: 10px; height: 4px; }
.td-score__note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.td-score__part.is-out .td-score__name, .td-score__part.is-out .td-score__pts { color: var(--faint); }
.td-score__out { font-size: 13px; color: var(--faint); }
.td-score__rules { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.td-score__rules p { font-size: 14px; color: var(--muted); line-height: 1.45; }
.td-score__earn { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.td-score__earn h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 6px; }
.td-score__earn p { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; color: var(--muted); }
.td-score__earn p .num { color: var(--fg); font-weight: 600; }

/* sheets opened from Today: keep the panel fixed (a .glass rule later in the cascade sets position: relative) */
.sheet.td-panel { position: fixed; }
.td-score__hint { margin-top: 14px; font-size: 13px; color: var(--muted); }
[data-screen="today"] .td-plans__add { display: flex; align-items: center; min-height: 48px; border-top: 1px solid var(--line); }
[data-screen="today"] .td-main__go { width: 48px; padding: 0; flex: none; }
[data-screen="today"] .td-main__go[hidden] { display: none; }

/* ---------- v3: section icons, drag to reorder, notes composer ---------- */
[data-screen="today"] .td-sec__head { display: flex; align-items: center; }
[data-screen="today"] .td-sec__head .td-row { flex: 1; min-width: 0; }
[data-screen="today"] .td-row__ic { flex: none; width: 22px; display: grid; place-items: center; color: var(--muted); }
[data-screen="today"] .td-row__ic svg { width: 19px; height: 19px; }
[data-screen="today"] .td-grip { flex: none; width: 28px; height: 44px; display: grid; place-items: center; color: var(--faint); cursor: grab; touch-action: none; opacity: 0.5; }
[data-screen="today"] .td-grip svg { width: 16px; height: 16px; }
@media (hover: hover) { [data-screen="today"] .td-grip { opacity: 0; transition: opacity var(--dur-fast); } [data-screen="today"] .td-sec:hover .td-grip { opacity: 0.8; } }
[data-screen="today"] .td-sec.is-dragging { position: relative; z-index: 5; background: rgb(var(--bg-rgb) / 0.92); box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.6), inset 0 0 0 1px var(--line); border-radius: 14px; transition: none; }
[data-screen="today"] .td-rows.is-sorting { user-select: none; -webkit-user-select: none; }
[data-screen="today"] .td-rows.is-sorting .td-sec:not(.is-dragging) { transition: transform var(--dur) var(--ease-out); }
[data-screen="today"] .td-plans__title { display: inline-flex; align-items: center; gap: 10px; }
[data-screen="today"] .td-plans__title svg { width: 19px; height: 19px; color: var(--muted); }
[data-screen="today"] .td-plans__count { margin-left: auto; margin-right: 14px; font-size: 13px; color: var(--muted); }
[data-screen="today"] .td-plans { margin-top: 0; }
[data-screen="today"] .td-compose-wrap { display: flex; gap: 8px; align-items: flex-end; }
[data-screen="today"] .td-compose { flex: 1; min-width: 0; min-height: 44px; max-height: 220px; padding-top: 11px; padding-bottom: 11px; resize: none; font-size: 15px; line-height: 1.4; }
[data-screen="today"] .td-link { font-size: 13px; color: var(--muted); text-decoration: none; }
@media (hover: hover) { [data-screen="today"] .td-link:hover { color: var(--fg); } }
/* the ring: centred exactly in its column, a little larger */
@media (min-width: 1024px) { [data-screen="today"] .td-layout { grid-template-columns: minmax(0, 1fr) 520px; gap: 48px; } }
[data-screen="today"] .td-stone { margin: 0 auto; }


/* narrow phones, long words (Russian): the plans header stays on one line, row states wrap instead of being cut */
[data-screen="today"] .td-plans__title, [data-screen="today"] .td-plans__count, [data-screen="today"] .td-plans__all { white-space: nowrap; }
[data-screen="today"] .td-plans__title { min-width: 0; flex: 1 1 auto; }
[data-screen="today"] .td-plans__title > span { overflow: hidden; text-overflow: ellipsis; }
[data-screen="today"] .td-plans__count { margin-left: auto; font-size: 13px; color: var(--muted); }
@media (max-width: 420px) {
  [data-screen="today"] .td-plans__title { gap: 8px; font-size: 14px; }
  [data-screen="today"] .td-plans__head { gap: 10px; }
}
@media (max-width: 420px) { [data-screen="today"] .td-row__t { font-size: 16px; } [data-screen="today"] .td-row { gap: 10px; } }
@media (max-width: 380px) {
  [data-screen="today"] .td-row__t { font-size: 15px; }
  [data-screen="today"] .td-plans__title { font-size: 13.5px; gap: 6px; }
  [data-screen="today"] .td-plans__all, [data-screen="today"] .td-plans__count { font-size: 12.5px; }
}
/* the two time fields always fit the row, whatever the font and language */
[data-screen="today"] .td-times { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
[data-screen="today"] .td-times .td-field { min-width: 0; }
[data-screen="today"] .td-time { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 420px) { [data-screen="today"] .td-time { font-size: 17px; padding-left: 10px; padding-right: 8px; } }

[data-screen="today"] .td-note--ask { color: var(--fg); font-weight: 600; }

/* desktop: two balanced halves; the list is as big as the ring calls for and sits in the middle of the screen
   when it is short (scrolls normally when it is long, the ring stays put) */
@media (min-width: 1024px) {
  .screen--wide[data-screen="today"] { max-width: min(1560px, calc(100vw - 2 * var(--pad))); }
  [data-screen="today"] .td-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 5vw, 96px); align-items: center;
    min-height: calc(100dvh - var(--safe-t) - 72px - var(--bottom-space)); }
  [data-screen="today"] .td-col { width: 100%; max-width: 640px; justify-self: center; }
}
@media (min-width: 1360px) { [data-screen="today"] .td-col { zoom: 1.12; } }
@media (min-width: 1680px) { [data-screen="today"] .td-col { zoom: 1.25; max-width: 600px; } }

/* plans fold away: tap the title or the arrow */
[data-screen="today"] .td-plans__fold { display: inline-flex; align-items: center; gap: inherit; border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; min-width: 0; }
[data-screen="today"] .td-plans__fold span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-screen="today"] .td-plans__chev { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-right: -4px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
[data-screen="today"] .td-plans__chev .ico { width: 16px; height: 16px; }
@media (hover: hover) { [data-screen="today"] .td-plans__chev:hover { color: var(--fg); background: var(--hover); } }
[data-screen="today"] .td-plans__head { align-items: center; }
[data-screen="today"] .td-plans.is-folded .td-plans__head { margin-bottom: 0; }
/* the plans header reads like the rows below: same title size, its arrow in the rows' arrow column */
[data-screen="today"] .td-plans__title { font-size: 17px; font-weight: 600; }
[data-screen="today"] .td-plans__chev { margin-right: 22px; }
@media (max-width: 420px) { [data-screen="today"] .td-plans__title { font-size: 15px; } }
[data-screen="today"] .td-plans__all--foot { display: none; }
@media (max-width: 480px) {
  [data-screen="today"] .td-plans__head .td-plans__all { display: none; }
  [data-screen="today"] .td-plans__all--foot:not([hidden]) { display: inline-block; margin: 4px 0 0; font-size: 13px; }
}

/* desktop: the ring is pinned to the middle of its half of the screen, whatever the list does */
@media (min-width: 1024px) {
  [data-screen="today"] .td-ring { align-self: start; position: sticky; top: calc(var(--safe-t) + 72px); }
}


/* ================= v4 ================= */

/* ---------- the ring alone (no rows, no plans): exactly in the middle of the screen ----------
   three rows (free, ring, free): the notice hangs in the lower free row, so the ring stays put when it comes or goes */
[data-screen="today"].is-ring-only .td-layout {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-items: center; align-items: start; gap: 0;
  min-height: calc(100dvh - var(--safe-t) - 72px - var(--bottom-space));
}
[data-screen="today"].is-ring-only .td-ring { grid-row: 2; position: static; height: auto; min-height: 0; width: 100%; padding: 0; }
[data-screen="today"].is-ring-only .td-col { grid-row: 3; width: 100%; max-width: 520px; zoom: 1; padding-top: 20px; }
[data-screen="today"].is-ring-only .td-notice-slot:not(:empty) { margin: 0; }

/* ---------- no scored section: one quiet empty ring and a way to Settings ---------- */
[data-screen="today"] .td-stone.is-empty .stone { filter: none; }
[data-screen="today"] .td-ring-hint {
  position: absolute; z-index: 2; bottom: 2px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px 0 14px; border: 0; border-radius: var(--r-pill);
  background: none; color: var(--muted); font: 550 14px/1.2 var(--f-sans); letter-spacing: -0.01em; white-space: nowrap; cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
[data-screen="today"] .td-ring-hint .ico, [data-screen="today"] .td-ring-hint svg { width: 15px; height: 15px; }
@media (hover: hover) { [data-screen="today"] .td-ring-hint:hover { color: var(--fg); background: var(--hover); } }

/* ---------- Sleep: two plain buttons, the one that fits the time of day in the accent colour ---------- */
[data-screen="today"] .td-sleep-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
[data-screen="today"] .td-sleep-btn { min-height: 52px; padding: 0 14px; font-size: 16px; letter-spacing: -0.01em; }
[data-screen="today"] .td-sleep-btn svg { width: 19px; height: 19px; flex: none; }
[data-screen="today"] .td-sleep-btn > span { min-width: 0; }
[data-screen="today"] .btn--ghost.td-sleep-btn { background: rgb(var(--fg-rgb) / 0.05); }
@media (hover: hover) { [data-screen="today"] .btn--ghost.td-sleep-btn:hover { background: rgb(var(--fg-rgb) / 0.09); opacity: 1; } }
[data-screen="today"] .td-cta { min-height: 48px; padding: 0 22px; }

/* ---------- plans: every plan can be deleted (on hover or focus with a mouse, always on touch) ---------- */
[data-screen="today"] .td-plan__del {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin: 0 18px 0 0; padding: 0; border: 0; border-radius: 50%;   /* inside the column, ring included; its centre on the arrows' column (36px from the edge) */
  background: none; color: var(--faint); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
[data-screen="today"] .td-plan__del svg { width: 15px; height: 15px; }
[data-screen="today"] .td-plan__del:active { transform: scale(0.88); }
@media (hover: hover) and (pointer: fine) {
  [data-screen="today"] .td-plan__del { opacity: 0; }
  [data-screen="today"] .td-plan:hover .td-plan__del, [data-screen="today"] .td-plan:focus-within .td-plan__del { opacity: 1; }
  [data-screen="today"] .td-plan__del:hover { color: var(--red); background: rgb(var(--fg-rgb) / 0.06); }
}

/* ---------- notes: a composer whose button lights up only with text, the latest notes readable and editable in place ---------- */
[data-screen="today"] .td-compose-wrap { align-items: flex-end; gap: 10px; }
[data-screen="today"] .td-compose { font-size: 16px; }
[data-screen="today"] .td-compose__go {
  position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: rgb(var(--fg-rgb) / 0.08); color: rgb(var(--fg-rgb) / 0.32); cursor: default; -webkit-tap-highlight-color: transparent;
  transition: background 200ms var(--ease-out), color 200ms var(--ease-out), box-shadow 200ms var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
[data-screen="today"] .td-compose__go svg { width: 18px; height: 18px; stroke-width: 2.4; }
[data-screen="today"] .td-compose__go.is-ready {
  background: linear-gradient(180deg, rgb(var(--cta-rgb, var(--accent-rgb)) / 1), rgb(var(--cta-rgb, var(--accent-rgb)) / 0.86)); color: var(--on-accent); cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.32), inset 0 0 0 1px rgb(255 255 255 / 0.1), 0 8px 18px -10px rgb(var(--cta-rgb, var(--accent-rgb)) / 0.8);
}
[data-screen="today"] .td-compose__go.is-ready:active { transform: scale(0.9); }

[data-screen="today"] .td-notes { list-style: none; margin-top: 4px; }
[data-screen="today"] .td-memo { border-top: 1px solid var(--line); }
[data-screen="today"] .td-memo:first-child { border-top: 0; }
[data-screen="today"] .td-memo__card {
  width: 100%; display: flex; flex-direction: column; gap: 5px; padding: 14px 0; border: 0; background: none;
  color: var(--fg); text-align: left; cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent; transition: opacity var(--dur-fast);
}
[data-screen="today"] .td-memo__card:active { opacity: 0.6; }
[data-screen="today"] .td-memo__text {
  font-size: 16px; font-weight: 400; line-height: 1.5; letter-spacing: -0.01em; white-space: pre-line;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
[data-screen="today"] .td-memo__when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (hover: hover) { [data-screen="today"] .td-memo__card:hover .td-memo__text { opacity: 0.8; } }
/* open: the same text, now the whole of it, in a soft card. The text stays exactly where it was (same left edge,
   same top as the closed note): the card's own padding is taken back by a negative margin, so only its soft
   background reaches a little (8px) into the side gutter. */
[data-screen="today"] .td-memo.is-open {
  margin: 4px -8px; padding: 10px 8px 6px; border-top-color: transparent; border-radius: 14px;
  background: rgb(var(--fg-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line);
  animation: td-memo-open 200ms var(--ease-out) both;
}
[data-screen="today"] .td-memo.is-open + .td-memo { border-top-color: transparent; }
@keyframes td-memo-open { from { opacity: 0.4; transform: scale(0.985); } }
[data-screen="today"] .td-memo__edit {
  display: block; width: 100%; min-height: 24px; max-height: 50dvh; padding: 0; margin: 0; border: 0; background: none; resize: none; outline: none;
  font: 400 16px/1.5 var(--f-sans); letter-spacing: -0.01em; color: var(--fg); overflow-wrap: anywhere;
}
[data-screen="today"] .td-memo__foot { display: flex; align-items: center; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
[data-screen="today"] .td-memo__foot .td-memo__when { flex: 1; min-width: 0; }
[data-screen="today"] .td-memo__btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-pill);
  background: none; color: var(--muted); font: 550 13px var(--f-sans); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast), background var(--dur-fast);
}
[data-screen="today"] .td-memo__btn svg { width: 15px; height: 15px; }
[data-screen="today"] .td-memo__done { color: var(--fg); }
@media (hover: hover) {
  [data-screen="today"] .td-memo__btn:hover { background: rgb(var(--fg-rgb) / 0.06); }
  [data-screen="today"] .td-memo__del:hover { color: var(--red); }
}
[data-screen="today"] .td-allnotes { align-self: flex-start; gap: 4px; padding: 0 10px 0 14px; text-decoration: none; }
[data-screen="today"] .td-allnotes svg { width: 15px; height: 15px; }
[data-screen="today"] .td-body > .td-allnotes { margin-top: -6px; }

/* ---------- hard day ---------- */
[data-screen="today"] .td-steps .chip { transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out); }
[data-screen="today"] .td-steps .chip:active { transform: scale(0.96); }

/* ---------- the shared section screen (#/s/<key>): short, so it sits in the middle of the screen ----------
   centred when shown; then held at that top (rows.js holdCentre sets the margin), so opening more content never moves it */
.screen.sc-screen { display: flex; flex-direction: column; justify-content: center; min-height: 100dvh; }
.screen.sc-screen.is-held { justify-content: flex-start; }
/* the content grew past the bottom bar: the top gap shrinks smoothly so it fits (rows.js holdCentre) */
.screen.is-held.is-gliding > .sc-wrap, .screen.is-held.is-gliding > .nt-wrap { transition: margin-top 260ms var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .screen.is-held.is-gliding > .sc-wrap, .screen.is-held.is-gliding > .nt-wrap { transition: none; } }
[data-screen="section"] .sc-wrap { width: 100%; max-width: 560px; margin: 0 auto; }
[data-screen="section"] .sc-title { display: flex; align-items: center; gap: 12px; }
[data-screen="section"] .sc-title__ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgb(var(--fg-rgb) / 0.07); color: var(--muted); }
[data-screen="section"] .sc-title__ic svg { width: 22px; height: 22px; }
[data-screen="section"] .sc-state { margin: 8px 0 22px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
[data-screen="section"] .sc-body { display: flex; flex-direction: column; gap: 16px; }
[data-screen="section"] .sc-body .td-habits { margin-top: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
[data-screen="section"] .sc-edit { align-self: flex-start; margin-top: 4px; gap: 6px; text-decoration: none; }
[data-screen="section"] .sc-edit svg { width: 15px; height: 15px; }
/* no plans block: the rows bring their own top line, so the notice above them does not draw a second one */
[data-screen="today"] .td-notice-slot:has(+ .td-plans[hidden]) .notice,
[data-screen="today"].is-ring-only .td-notice-slot .notice { border-bottom: 0; padding-bottom: 0; }
[data-screen="today"] .td-notice-slot:has(+ .td-plans[hidden] + .td-rows:not([hidden])) { margin-bottom: 20px; }

/* Keyboard ring inside the row, the same everywhere (PLAN v4 1.10): rows and links whose text ran right up to their
   own edge get a little inner room, and a matching negative margin keeps the text exactly where it was. */
[data-screen="today"] .td-row { margin-left: -10px; padding: 0 6px 0 10px; border-radius: 12px; }
[data-screen="today"] .td-memo__card { width: calc(100% + 20px); margin: 0 -10px; padding: 14px 10px; border-radius: 12px; }
[data-screen="today"] .td-plans__fold { margin: -6px -8px; padding: 6px 8px; border-radius: 10px; }
[data-screen="today"] .td-plan__new { margin-left: -8px; padding: 0 10px 0 8px; border-radius: 10px; }
[data-screen="today"] .td-plans__all { margin: -6px -8px; padding: 6px 8px; border-radius: 10px; }
[data-screen="today"] .td-plans__all--foot:not([hidden]) { margin: -2px -8px -6px; }
/* "Plans for today" lines up with the rows below: the same 22px icon box, the same gap, the same text size */
[data-screen="today"] .td-plans__title { gap: 14px; }
[data-screen="today"] .td-plans__fold svg { width: 19px; height: 19px; margin: 0 1.5px; flex: none; }
@media (max-width: 420px) { [data-screen="today"] .td-plans__title { gap: 10px; font-size: 16px; } }
@media (max-width: 380px) { [data-screen="today"] .td-plans__title { gap: 10px; font-size: 15px; } }
/* the plans header's right side lines up with the rows below (round 2): its arrow sits in the rows' arrow column
   (the rows end where the grip column starts), its count ends where the rows' states end */
[data-screen="today"] .td-plans__head { gap: 10px; }
[data-screen="today"] .td-plans__chev { margin-right: 28px; }
[data-screen="today"] .td-plans__count { margin-right: -6px; }
/* wider than a phone, "All plans" is in the header after the count: its text ends where the rows' states end */
@media (min-width: 481px) {
  [data-screen="today"] .td-plans__head:has(.td-plans__all:not([hidden])) .td-plans__count { margin-right: 0; }
  [data-screen="today"] .td-plans__head .td-plans__all:not([hidden]) { margin-right: -10px; }
}
/* a very narrow phone: the title may take two lines rather than be cut */
@media (max-width: 340px) {
  [data-screen="today"] .td-plans__title { font-size: 14px; }
  [data-screen="today"] .td-plans__fold span, [data-screen="today"] .td-plans__title { white-space: normal; text-overflow: clip; text-align: left; line-height: 1.2; }
}
/* a narrow phone: a row's state that does not fit ("Шаг сделан" next to "Тяжёлый день") takes a second line, never cut */
@media (max-width: 400px) {
  [data-screen="today"] .td-row__s { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.2; text-wrap: balance; }
}
/* a very narrow phone (320): a two-word row title may take two lines too, so the state beside it is never cut */
@media (max-width: 340px) {
  [data-screen="today"] .td-row__t { white-space: normal; line-height: 1.15; flex: 1 1 0; min-width: min-content; }
  [data-screen="today"] .td-row__s { flex: 0 1 auto; min-width: 0; }
}
/* 320: a long state (fr "Couche-toi maintenant · 5 h 15 min") may take a third line */
@media (max-width: 340px) { [data-screen="today"] .td-row__s { -webkit-line-clamp: 3; } }
/* 320: "Я заснул" / "Я встал" stay on one line in their buttons (on Today and on the Sleep screen) */
@media (max-width: 340px) { .td-sleep-btn { padding: 0 8px !important; font-size: 15px !important; gap: 6px; } .td-sleep-btn svg { width: 17px !important; height: 17px !important; } .td-sleep-btn > span { white-space: nowrap; } }
@media (max-width: 340px) { .td-time { font-size: 15px !important; padding-left: 8px !important; padding-right: 4px !important; } }   /* "10:41 PM" whole at 320 */
/* a phone: the picked part's line sits just under the ring's bottom labels ("Привычки", "Планы"), never on them */
@media (max-width: 400px) { [data-screen="today"] .td-facet-tag { bottom: -18px; } [data-screen="today"] .td-stone { margin-bottom: 18px; } }
/* a phone: a short state ("Не указано") gets the last pixels it needs to stay on one line beside a long title */
@media (max-width: 420px) { [data-screen="today"] .td-row { gap: 8px; } [data-screen="today"] .td-row__s { letter-spacing: -0.01em; } }
@media (max-width: 420px) { [data-screen="today"] .td-plans__count { margin-right: -8px; } }   /* the rows' gap is 8px on a phone: the count still ends where their states end */
/* a phone: a short state ("Не указано") keeps its one line; when both do not fit, the title takes the second line */
@media (max-width: 420px) {
  [data-screen="today"] .td-row__t { white-space: normal; line-height: 1.15; flex: 1 1 0; min-width: min-content; }
  [data-screen="today"] .td-row__s { flex: 0 1 auto; min-width: 0; }
}
/* v5: the plans block reads as one more row: its head is as tall as the rows' heads and the rows follow with no extra gap */
[data-screen="today"] .td-plans__head { min-height: 56px; margin-bottom: 0; }
[data-screen="today"] .td-plans:not([hidden]) + .td-rows { margin-top: 0; }
[data-screen="today"] .td-plans:not(.is-folded) .td-plans__add { margin-bottom: 4px; }

/* v6: the bars in the day breakdown take the app colour (score-sheet.js adds bar--accent) */
.td-score__part .bar--accent > i { background: var(--accent); }
/* v6: Neon draws its own light; the ring's drop shadow would only grey it */
:root[data-ring-style="neon"] [data-screen="today"] .td-stone .stone { filter: none; }

/* v6 (owner): the "a new plan made the ring smaller" line sits right under the title (the 56 px title row left a gap) */
[data-screen="today"] .td-plans__head + .td-plans__counted { margin: -10px 0 10px 33px; padding: 0; font-size: 13.5px; line-height: 1.35; color: var(--muted); }
@media (max-width: 420px) { [data-screen="today"] .td-plans__head + .td-plans__counted { margin-left: 0; } }
[data-screen="today"] .td-extra-slot:empty { display: none; }
[data-screen="today"] .td-extra-slot { display: grid; gap: 10px; margin-bottom: 14px; }
[data-screen="today"].is-ring-only .td-extra-slot { display: none; }

/* today9 (owner): the plans header folds and unfolds from anywhere on it, like the rows; no "All plans" link */
[data-screen="today"] .td-plans__head { cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* wider than a phone the count is now the header's last text: it ends where the rows' states end */
@media (min-width: 481px) { [data-screen="today"] .td-plans__count { margin-right: -2px; } }
/* a sleep tap answers in the same frame (owner 2026-11-19: "it lags"): a short press glow until the screen redraws */
[data-screen="today"] .td-sleep-btn.is-logged { animation: td-logged 420ms var(--ease-out, ease-out); }
@keyframes td-logged { 0% { transform: scale(0.97); filter: brightness(1.25); } 100% { transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) { [data-screen="today"] .td-sleep-btn.is-logged { animation: none; } }
