/* App layout on top of tokens.css. Token variables only: no new colors here. */

[hidden] { display: none !important; }
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }
.screen { padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.ico { display: inline-flex; flex: none; }
.m0 { margin: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.text-soft { color: var(--text-soft); }
.pre { white-space: pre-line; line-height: 1.8; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 8px; }
.row > .input { flex: 1; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
html { color-scheme: dark; }
select.input { cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }
a.btn--secondary { color: var(--text); }

/* Loading, toast */
.loading { min-height: 60dvh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.spin { width: 20px; height: 20px; border-radius: var(--r-pill); border: 2px solid var(--raised); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; inset-inline: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 480px;
  background: var(--raised); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 16px; font-size: 14px; text-align: center; z-index: 50; }

/* Top bar of non-tab screens */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar__title { flex: 1; font-weight: 600; text-align: center; }
.topbar__spacer { width: var(--tap); flex: none; }
.icon-btn { flex: none; cursor: pointer; }
.icon-btn--bare { border: 0; background: none; color: var(--muted); }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
[dir="ltr"] .topbar .ico svg, [dir="rtl"] .send .ico svg { transform: scaleX(-1); }

/* Tab screens */
.with-tabs { min-height: 100dvh; display: flex; flex-direction: column; }
.with-tabs .screen { flex: 1; min-height: 0; }
.with-tabs .tabbar { position: sticky; bottom: 0; }

/* Welcome */
.welcome__top { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 600; font-size: 18px; color: var(--accent); }
.lang-pick__wrap { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.lang-pick { border: 0; background: transparent; color: var(--text); font-size: 14px; }
.lang-pick option { background: var(--surface); }
.welcome__body { align-items: center; justify-content: center; text-align: center; }
.emblem { position: relative; width: 168px; height: 168px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.emblem > svg { position: absolute; inset: 0; }
.emblem .ico { position: relative; }
.dev { color: var(--muted); }
.dev summary { cursor: pointer; text-align: center; min-height: var(--tap); display: flex; align-items: center; justify-content: center; }

/* Consent checkbox card */
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check > span { display: flex; flex-direction: column; gap: 4px; }
.check__title { font-weight: 500; }

/* Home */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.balance-tile { display: flex; flex-direction: column; align-items: center; min-width: 72px; padding: 8px 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-decoration: none; }
.balance-tile__num { font-size: 22px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.mode-card { display: flex; align-items: center; gap: 16px; padding: 18px 16px; min-height: 96px; border-radius: var(--r-2xl); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.mode-card__icon { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--raised); color: var(--text); display: flex; align-items: center; justify-content: center; flex: none; }
.mode-card--accent { border-color: var(--accent); }
.mode-card--accent .mode-card__icon { background: var(--accent); color: var(--on-accent); }
.mode-card__text { display: flex; flex-direction: column; gap: 4px; }
.mode-card__title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chip--sm { padding: 2px 10px; font-size: 12px; font-weight: 400; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row-link { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 64px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.row-link__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row-link__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--raised); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.tile--sm { width: 36px; height: 36px; border-radius: var(--r-sm); }

/* Setup: objectives */
.objective { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 12px; padding-inline: 12px 4px; min-height: 52px; }
.objective__input { flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent; outline: none; }
.objective:focus-within { border-color: var(--accent); }

/* Live session */
.live { height: 100dvh; display: flex; flex-direction: column; }
.live__head { display: flex; flex-direction: column; gap: 12px; padding: max(16px, env(safe-area-inset-top)) var(--gutter) 8px; }
.live__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live__title .label { display: inline-flex; align-items: center; gap: 4px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip--objective { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; flex: none; }
.live__scroll { flex: 1; overflow-y: auto; padding: 8px var(--gutter) 16px; overscroll-behavior: contain; }
.live__scroll .chat { min-height: 100%; }
.chat__empty { align-self: stretch; }
.chat__note { align-self: center; font-size: 12px; }
.bubble-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble { overflow-wrap: anywhere; }
.live__sheet { padding-bottom: max(16px, env(safe-area-inset-bottom)); gap: 10px; }
.live__status { min-height: 20px; }
.live__bar { display: flex; align-items: center; gap: 8px; }
.live__input { flex: 1; min-width: 0; min-height: 48px; }
.mic { flex: none; cursor: pointer; }
.mic--off { background: var(--raised); color: var(--muted); box-shadow: none; }
.decision { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.decision[hidden] { display: none; }
.chat--static { justify-content: flex-start; }

/* Report */
.report-head { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring__label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; }
.objective-result { display: flex; gap: 12px; align-items: flex-start; }
.objective-result--open { background: transparent; border: 1px dashed var(--border-dashed); }
.objective-result__mark { width: 30px; height: 30px; border-radius: var(--r-pill); background: var(--raised); color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; }
.objective-result__mark.ok { background: var(--ok-bg); color: var(--ok); }
.rate[aria-pressed="true"] { background: var(--raised); }
