/* Tend · the profile card, the account menu header, the starter rail, the newer Today widgets, the alternatives list
   and the message editors. Loads after toolkit.css and before motion.css. */

/* ---------- profile card (views/profileCard.js) ---------- */
.pc-trigger { cursor: pointer; border-radius: 6px; text-decoration: underline dotted transparent; text-decoration-thickness: 2px; text-underline-offset: 5px; transition: text-decoration-color 160ms var(--ease); }
.pc-trigger:hover, .pc-trigger:focus-visible { text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
.pc-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pcard { position: absolute; z-index: 90; width: min(300px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 14px; font-size: 14px; font-weight: 500; text-align: start; transform-origin: var(--ox, 24px) top; animation: pc-in 240ms var(--ease-spring, var(--ease)) both; }
.pcard.above { transform-origin: var(--ox, 24px) bottom; }
.pcard::before { content: ''; position: absolute; top: -7px; left: calc(var(--ox, 24px) - 6px); width: 12px; height: 12px; background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); rotate: 45deg; }
.pcard.above::before { top: auto; bottom: -7px; rotate: 225deg; }
.pcard.side-l { transform-origin: right var(--oy, 24px); } .pcard.side-r { transform-origin: left var(--oy, 24px); }
.pcard.side::before { top: var(--oy, 24px); }
.pcard.side-l::before { left: auto; right: -7px; rotate: 135deg; }
.pcard.side-r::before { left: -7px; rotate: -45deg; }
.pcard.out { animation: pc-out 160ms var(--ease) both; pointer-events: none; }
.pcard > * { animation: pc-rise 320ms var(--ease-out, var(--ease)) backwards; }
.pcard > :nth-child(2) { animation-delay: 50ms; } .pcard > :nth-child(3) { animation-delay: 100ms; } .pcard > :nth-child(4) { animation-delay: 150ms; }
@keyframes pc-in { from { opacity: 0; transform: translateY(-6px) scale(.92); } }
@keyframes pc-out { to { opacity: 0; transform: translateY(-4px) scale(.96); } }
@keyframes pc-rise { from { opacity: 0; transform: translateY(4px); } }
.pc-head { display: flex; gap: 12px; align-items: center; }
.pc-head b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.pcard .av-lg { width: 54px; height: 54px; font-size: 27px; border-radius: 16px; flex: none; }
.pc-level { display: flex; gap: 10px; align-items: center; margin-top: 12px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.pc-badge { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--accent); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.pc-bar { margin: 6px 0 4px; height: 7px; }
.pc-bar > i { animation: m-bar 760ms var(--ease-out, var(--ease)) 140ms backwards; transform-origin: left; }
html[dir="rtl"] .pc-bar > i { transform-origin: right; }
.pc-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; text-align: center; }
.pc-facts > div { padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); }
.pc-facts b { display: block; font-size: 18px; line-height: 1.2; }
.pc-facts span { display: block; font-size: 11.5px; line-height: 1.25; color: var(--ink-2); margin-top: 2px; }
.pc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-top: 10px; }
.pc-foot .row { gap: 12px; }
.pc-foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }

/* ---------- account menu header (app.js) ---------- */
.menu .mh.mh-me { display: flex; gap: 10px; align-items: flex-start; min-width: 260px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600; }
.menu .mh-me a.mh-av { display: block; width: auto; padding: 0; border-radius: 16px; flex: none; }
.menu .mh-me a.mh-av:hover { background: none; }
.menu .mh-me a.mh-av:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mh-me .mh-name { display: inline-block; max-width: 100%; font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.mh-lvl { display: flex; justify-content: space-between; gap: 8px; margin: 7px 0 5px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mh-me .bar { height: 6px; }

/* ---------- starter rail (today.js) ---------- */
.st-rail-wrap { position: relative; margin-top: 18px; }
.th-more .st-rail-wrap { margin-top: 10px; }
.st-rail-wrap .starter-grid, .th-start .st-rail-wrap .starter-grid, .th-more .st-rail-wrap .starter-grid { margin-top: 0; }
.st-rail { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: 2px; scrollbar-width: thin; padding: 2px 2px 10px; border-radius: 16px; }
.st-rail:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-rail .starter-grid { grid-template-columns: none; grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: minmax(290px, 340px); }
.st-rail .starter-grid.compact { grid-template-rows: auto; grid-auto-columns: minmax(250px, 290px); }
.st-rail .starter { scroll-snap-align: start; height: 100%; }
.st-arrow { position: absolute; top: calc(50% - 5px); translate: 0 -50%; z-index: 2; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: opacity 160ms var(--ease), scale 160ms var(--ease); }
.st-arrow:hover { scale: 1.06; }
.st-arrow.prev { inset-inline-start: 6px; } .st-arrow.next { inset-inline-end: 6px; }
.st-rail-wrap.at-start .st-arrow.prev, .st-rail-wrap.at-end .st-arrow.next, .st-rail-wrap.no-scroll .st-arrow { opacity: 0; pointer-events: none; }
.st-rail-wrap:not(.at-end):not(.no-scroll) .st-rail { mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
html[dir="rtl"] .st-rail-wrap:not(.at-end):not(.no-scroll) .st-rail { mask-image: linear-gradient(to left, #000 calc(100% - 56px), transparent); }
@media (max-width: 720px) {
  .st-rail .starter-grid { grid-template-rows: auto; grid-auto-columns: 86%; }
  .st-rail .starter-grid.compact { grid-auto-columns: 80%; }
  .st-arrow { display: none; }
}

/* ---------- newer Today widgets (today.js) ---------- */
.wk-row { display: flex; gap: 16px; align-items: center; }
.wk-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.wk-days span { display: grid; justify-items: center; gap: 4px; }
.wk-days i { display: block; width: 100%; max-width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); }
.wk-days .on i { background: var(--good); }
.wk-days .half i { background: color-mix(in srgb, var(--good) 45%, var(--surface-3)); }
.wk-days .off i { background: var(--bad-soft); }
.wk-days .pending i { background: transparent; border: 2px solid var(--accent); }
.wk-days .future i { background: transparent; border: 1px dashed var(--line-2); }
.wk-days .today { color: var(--ink); }
.w-link { color: inherit; gap: 10px; padding: 10px 0; }
.w-link:hover { text-decoration: none; }
.w-link:hover .lt, .w-link:hover b.small { text-decoration: underline; }
.w-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.w-ach { display: grid; gap: 14px; }
.w-ach-row { display: flex; gap: 10px; align-items: flex-start; }
.w-ach-row .ai { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; background: var(--surface-2); }
.w-ach-row .bar { height: 6px; margin: 6px 0 4px; }
.w-why { margin: 10px 0 0; color: var(--ink-2); }
.w-why q { font-style: italic; }
.w-mood { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.w-mood span { display: grid; justify-items: center; gap: 4px; }
.w-mood i { display: grid; place-items: center; width: 100%; max-width: 36px; aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); font-style: normal; font-size: 20px; color: var(--ink-3); }
.w-mood .has i { background: var(--accent-soft); }
.ar-col { flex: none; }

/* ---------- alternatives for quit habits (habitForm.js, the urge window) ---------- */
.alt-box .alt-q { font-weight: 700; margin-bottom: 10px; }
.alt-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; counter-reset: alt; }
.alt-list li { display: flex; align-items: center; gap: 8px; padding-block: 5px; padding-inline: 10px 5px; min-height: 42px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); counter-increment: alt; }
.alt-list li::before { content: counter(alt); flex: none; width: 18px; text-align: center; font-size: 12px; font-weight: 800; color: var(--ink-3); }
.alt-list li.empty { background: none; border-style: dashed; padding-inline: 12px; }
.alt-list li.empty::before { content: none; }
.alt-list .icon-btn { flex: none; width: 32px; height: 32px; }
.alt-list .chip { flex: none; font-size: 11px; padding: 2px 8px; }
.urge-alts ul { margin: 6px 0 0; padding-inline-start: 18px; }
.urge-alts li + li { margin-top: 3px; }

/* ---------- message editors (views/messageEditor.js) ---------- */
.msg-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.msg-vars .chip { font-family: var(--mono); font-size: 12px; padding: 3px 9px; }
.msg-ideas .chips { gap: 6px; }
.msg-prev { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); min-width: 0; }
.msg-prev-head { gap: 8px; margin-bottom: 8px; }
.msg-preview { min-height: 76px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-preview .mp-title { font-weight: 800; margin-bottom: 4px; }
.msg-preview .mp-gap { height: 8px; }
.select.select-sm { width: auto; min-height: 34px; height: 34px; padding-block: 4px; font-size: 13px; }
.msg-site { align-items: start; gap: 16px; margin: 4px 0 8px; }
.msg-site #ms-vars .msg-vars { margin-top: 0; }
@media (max-width: 640px) {
  .msg-prev-head > .row { width: 100%; }
  .msg-prev-head .select-sm { flex: 1 1 100%; width: 100%; }
}

/* a hint reads as a hint wherever it sits (it was only styled inside .field) */
.hint { font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
#ml-lang { align-self: flex-start; min-height: 48px; align-items: stretch; }
#set-messages .adm-frow { margin-bottom: 14px; }
@media (max-width: 720px) { .widget-head .subtle-link { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 36px; min-height: 32px; } }

/* ---------- section loading: a thin bar under the top bar, only when a section takes longer than a moment (app.js) ---------- */
html.route-loading .topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 40% 100%; opacity: 0; animation: route-bar 1s linear 180ms infinite; pointer-events: none; }
@keyframes route-bar { 0% { opacity: 1; background-position: -70% 0; } 100% { opacity: 1; background-position: 170% 0; } }
html[dir="rtl"].route-loading .topbar::after { animation-direction: reverse; }

/* ---------- your profile, its own page (views/profile.js) ---------- */
.pf-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px); gap: 24px; align-items: center; padding: 26px; border-inline-start: 4px solid var(--hc, var(--accent)); }
.pf-hero .av-xl { width: 96px; height: 96px; font-size: 48px; border-radius: 28px; }
.pf-chips { gap: 6px; margin-bottom: 6px; }
.pf-who h2 { font-family: var(--serif); font-size: clamp(28px, 1.6vw + 18px, 42px); line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.pf-handle { margin-top: 4px; }
.pf-bio { margin: 10px 0 0; max-width: 60ch; }
.pf-meta { gap: 6px 10px; margin-top: 12px; }
.pf-level { display: grid; gap: 8px; justify-items: start; padding-inline-start: 22px; border-inline-start: 1px solid var(--line); }
.pf-level .bar { width: 100%; height: 8px; }
.pf-xp { display: flex; align-items: baseline; gap: 6px; }
.pf-xp b { font-family: var(--serif); font-size: 40px; line-height: 1; }
.pf-xp span { color: var(--ink-2); font-size: 13px; }
.pf-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.pf-tile { display: grid; gap: 4px; padding: 16px 18px; }
.pf-tile .pf-ic { color: var(--accent); }
.pf-tile b { font-family: var(--serif); font-size: 30px; line-height: 1.1; }
.pf-tile span:last-child { font-size: 13px; color: var(--ink-2); }
.pf-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pf-hline { display: block; margin-top: 2px; }
.pf-next { margin-top: 4px; }
.mh-view { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-weight: 700; }
.menu .mh-me a.mh-view { display: inline-flex; width: auto; padding: 0; background: none; color: var(--accent); }
.pf-edit-note { align-items: center; }
@media (max-width: 1100px) { .pf-hero { grid-template-columns: auto minmax(0, 1fr); } .pf-level { grid-column: 1 / -1; padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--line); padding-top: 16px; } .pf-cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .pf-hero { grid-template-columns: 1fr; padding: 20px; gap: 16px; } .pf-hero .av-xl { width: 72px; height: 72px; font-size: 36px; border-radius: 22px; } .pf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pf-edit-note { flex-wrap: wrap; } }
.pf-page .ach-card .pf-date { display: block; margin-top: 3px; }
.pf-next { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px 22px; }
html[dir="rtl"] .pf-who h2, html[dir="rtl"] .pf-who .pf-handle { text-align: right; }
@media (max-width: 720px) { .pf-bio a { display: inline-flex; align-items: center; min-height: 32px; } }

/* ---------- focus mode on a goal (views/focusMode.js) ---------- */
html.fm-open { overflow: hidden; }
.fm-overlay { --fmc: var(--accent); position: fixed; inset: 0; z-index: 110; display: grid; grid-template-rows: auto 1fr; overflow-y: auto; color: var(--ink); background: radial-gradient(1100px 680px at 50% 34%, color-mix(in srgb, var(--fmc) 13%, var(--bg)), var(--bg) 70%); animation: fm-in 280ms var(--ease-out, var(--ease)) both; }
.fm-overlay[data-kind="break"] { --fmc: var(--c-sage); }
@keyframes fm-in { from { opacity: 0; transform: scale(.985); } }
.fm-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px clamp(16px, 3vw, 40px); }
.fm-goal { font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.fm-center { display: grid; justify-items: center; align-content: center; gap: 18px; padding: 0 16px 40px; }
.fm-phase { font-size: 14px; padding: 6px 14px; color: var(--ink); background: color-mix(in srgb, var(--fmc) 18%, transparent); }
.fm-ring { position: relative; width: min(80vw, 48vh, 380px); aspect-ratio: 1; }
.fm-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.fm-track { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.fm-arc { fill: none; stroke: var(--fmc); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 500ms linear, stroke 400ms var(--ease); }
.fm-readout { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; }
.fm-time { font-family: var(--serif); font-size: clamp(54px, 9vw, 100px); line-height: 1; font-variant-numeric: tabular-nums; direction: ltr; }
.fm-sub { color: var(--ink-2); font-size: 14px; max-width: 26ch; }
.fm-overlay.paused .fm-time { animation: fm-blink 1.8s ease-in-out infinite; }
@keyframes fm-blink { 50% { opacity: .35; } }
.fm-rounds { display: flex; gap: 8px; }
.fm-rounds i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.fm-rounds i.on { background: var(--accent); }
.fm-rounds i.now { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.fm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fm-pill { position: fixed; inset-inline-start: 18px; bottom: 18px; z-index: 70; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 999px; background: var(--surface); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-lg); font-weight: 700; animation: fm-in 220ms var(--ease) both; }
.fm-pill.break { border-color: color-mix(in srgb, var(--c-sage) 60%, var(--line)); }
.fm-pill.paused { opacity: .85; }
@media (max-width: 760px) { .fm-pill { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 12px; } .fm-actions .btn-lg { padding-inline: 16px; } }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit .input { flex: 1; min-width: 0; }
.input-unit span { color: var(--ink-3); font-size: 13px; }
.fm-sum { color: var(--ink-2); margin: 2px 0 14px; }
.fm-done { padding: 6px 0; } .fm-done-ic { font-size: 44px; line-height: 1.2; } .fm-done .lead { font-size: 17px; font-weight: 700; margin: 8px 0 4px; }
.goal-card-wrap { position: relative; display: grid; }
.goal-card-wrap .gc-focus { position: absolute; bottom: 14px; inset-inline-end: 14px; z-index: 2; }
.goal-card-wrap:has(.gc-focus) .goal-card { padding-bottom: 58px; }
