/* The phone page, layout A of the 2026-11-24 prototype: grouped cards on a tinted ground, one accent, the phone's own font,
   references in mono. Each colour is Telegram's theme first (the grouped style: section cards on the secondary ground),
   the prototype's value outside Telegram. They fall back together: a key a client lacks (section_bg_color and the other
   keys of Bot API 6.10, section_separator_color of 7.6) takes the nearest key Telegram has given since 6.0, and the
   prototype's value comes only when Telegram gives none, so Telegram's text never lies on the page's own card. */
:root{
  --bg:var(--tg-theme-secondary-bg-color, var(--tg-theme-bg-color, #eef0f4)); --card:var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text:var(--tg-theme-text-color, #10161d); --hint:var(--tg-theme-hint-color, #5b6675);
  --line:var(--tg-theme-section-separator-color, var(--tg-theme-secondary-bg-color, #e1e4ea));
  --accent:var(--tg-theme-button-color, #1d74c4); --accent-ink:var(--tg-theme-button-text-color, #ffffff);
  --accent-text:var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #1a66ac)); --warn:var(--tg-theme-destructive-text-color, var(--tg-theme-text-color, #b93228));
  /* ponytail: color-mix needs iOS 16.2 / Chrome 111; an older webview draws these two flat. Hex fallbacks if such a phone turns up. */
  --raised:color-mix(in srgb, var(--text) 5%, var(--card)); --accent-soft:color-mix(in srgb, var(--accent) 14%, var(--card));
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,"SF Mono","Roboto Mono",Menlo,Consolas,monospace;
}
@media (prefers-color-scheme:dark){
  :root{
    color-scheme:dark;
    --bg:var(--tg-theme-secondary-bg-color, var(--tg-theme-bg-color, #0e1621)); --card:var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #17212b));
    --text:var(--tg-theme-text-color, #f1f4f7); --hint:var(--tg-theme-hint-color, #93a1b1);
    --line:var(--tg-theme-section-separator-color, var(--tg-theme-secondary-bg-color, #263341));
    --accent:var(--tg-theme-button-color, #2a74c2); --accent-ink:var(--tg-theme-button-text-color, #ffffff);
    --accent-text:var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #74b6f3)); --warn:var(--tg-theme-destructive-text-color, var(--tg-theme-text-color, #f08a80));
  }
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg)}
body{color:var(--text);font:16px/1.4 var(--font);-webkit-text-size-adjust:100%}
button{font:inherit;color:inherit;border:0;background:none;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent;text-align:inherit}
button:focus-visible,a:focus-visible,summary:focus-visible{outline:2px solid var(--accent-text);outline-offset:2px}
.ic{flex:none;display:block}
#app{max-width:440px;margin:0 auto;padding-bottom:calc(84px + var(--tg-content-safe-area-inset-bottom, 0px))}
.ref{font:13px/1.2 var(--mono);color:var(--hint);letter-spacing:-.01em}

/* buttons */
.btn{min-height:44px;padding:0 14px;border-radius:12px;font-weight:600;font-size:16px;display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap;text-decoration:none}
.btn.p{background:var(--accent);color:var(--accent-ink)}
.btn.s{background:var(--accent-soft);color:var(--accent-text)}
.btn.q{background:var(--raised);color:var(--text)}
.btn.t{color:var(--accent-text);padding:0 8px;min-width:44px}
.btn:disabled{opacity:.45;cursor:default}
.btn.sent:disabled{opacity:1}
.spin{flex:none;width:16px;height:16px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.choices{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.choices .btn{padding:0 4px;white-space:normal;overflow-wrap:anywhere;line-height:1.15;text-align:center}
/* four actions or more: the grid fills from the right, so the accept keeps the right edge as in .acts */
.choices.many{direction:rtl}
.choices.many>*{direction:ltr}

/* the list */
.sum{padding:16px 20px 2px}
.sum b{display:block;font-size:26px;font-weight:700;letter-spacing:-.02em}
.notice{display:block;color:var(--warn);font-weight:600}
.sec-h{position:sticky;top:0;z-index:1;background:var(--bg);display:flex;align-items:center;gap:8px;min-height:44px;margin:0;padding:10px 20px 4px;font-size:13px;font-weight:700;color:var(--hint);text-transform:uppercase;letter-spacing:.05em}
.sec-h .n{font-weight:500}
.sec-h .btn{margin-left:auto;text-transform:none;letter-spacing:0}
.group{margin:0 12px;background:var(--card);border-radius:14px;overflow:hidden}
.item{padding:13px 14px;display:flex;flex-direction:column;gap:9px}
.item+.item{border-top:1px solid var(--line)}
.head{display:flex;flex-direction:column;gap:3px;width:100%;text-align:start}
button.head{min-height:44px}
.head .top{display:flex;align-items:center;justify-content:space-between;min-height:16px}
.head .ic{color:var(--hint);transition:transform .15s}
.head[aria-expanded="true"] .ic{transform:rotate(90deg)}
.ttl{font-weight:600;line-height:1.3;text-wrap:balance;overflow-wrap:anywhere}
.meta{color:var(--hint);line-height:1.35;overflow-wrap:anywhere}
.more{line-height:1.45;background:var(--raised);border-radius:10px;padding:10px 12px;white-space:pre-line;overflow-wrap:anywhere}
.said{margin:0;color:var(--warn);font-weight:600}
.acts{display:flex;flex-direction:row-reverse;flex-wrap:wrap;gap:8px}
.acts .btn.p{min-width:132px}
.acts .sp{flex:1}
/* a card with no action: its link on the reference line, at its right; the 44 px target overhangs the line, not the title */
.line{display:flex;align-items:flex-start;gap:8px}
.line>.head{flex:1;min-width:0}
.line>.btn.t{margin:-14px -12px -14px 0}
.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:50vh;padding:32px;text-align:center}
.empty b{font-size:20px}

/* done today, folded */
.done{margin-top:20px}
.fold{display:flex;align-items:center;gap:8px;min-height:48px;padding:0 14px;font-weight:600;cursor:pointer;list-style:none}
.fold::-webkit-details-marker{display:none}
.fold .n{color:var(--hint);font-weight:500}
.fold .ic{margin-left:auto;color:var(--hint);transition:transform .15s}
.done[open] .fold .ic{transform:rotate(90deg)}
.donerow{display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 6px 8px 14px;border-top:1px solid var(--line)}
.donerow .w{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;overflow-wrap:anywhere}
.donerow .w b{font-weight:600}

.toast{position:fixed;left:12px;right:12px;bottom:calc(12px + var(--tg-content-safe-area-inset-bottom, 0px));z-index:6;max-width:416px;margin:0 auto;display:flex;align-items:center;gap:8px;min-height:48px;padding:6px 6px 6px 14px;border-radius:12px;background:var(--text);color:var(--card);box-shadow:0 6px 20px rgba(0,0,0,.28)}
.toast span{flex:1;min-width:0;overflow-wrap:anywhere}
.toast button{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px;border-radius:9px;color:color-mix(in srgb, var(--accent-text) 50%, var(--card));font-weight:700}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
