:root {
  --bg: #07070a;
  --surface: #101015;
  --surface-2: #17171e;
  --surface-3: #20202a;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f4f4f7;
  --muted: #8d8d9b;
  --accent: #ff3b24;
  --accent-2: #ff7a3d;
  --best: #b67cff;      /* как «фиолетовый сектор» в таймингах Формулы 1 */
  --good: #34d399;
  --bad: #ff6b6b;
  --radius: 22px;
  --radius-sm: 14px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: .01em; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; }
#view { padding: calc(var(--safe-t) + 18px) 18px calc(var(--tab-h) + var(--safe-b) + 28px); animation: viewIn .35s ease both; }
#view.no-tabs { padding-bottom: calc(var(--safe-b) + 28px); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- нижняя навигация ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(560px, 100%);
  height: calc(var(--tab-h) + var(--safe-b)); padding: 8px 14px var(--safe-b);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; z-index: 20;
  background: rgba(10, 10, 14, .72); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 16px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; transition: color .2s, background .2s; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--accent); filter: drop-shadow(0 0 8px rgba(255, 59, 36, .55)); }

/* ---------- общие элементы ---------- */
h1 { font-size: 30px; line-height: 1.05; margin: 0; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 13px; margin: 0; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.page-head { display: grid; gap: 6px; margin: 6px 2px 20px; }
.card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 22px; border-radius: 16px; font-weight: 700; font-size: 16px; transition: transform .15s, opacity .2s, background .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 10px 30px rgba(255, 59, 36, .32); }
.btn.ghost { background: var(--surface-3); color: var(--text); }
.btn.danger { background: rgba(255, 107, 107, .12); color: var(--bad); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--muted); }
.chip.best { background: rgba(182, 124, 255, .16); color: var(--best); }
.chip.good { background: rgba(52, 211, 153, .14); color: var(--good); }
.chip.bad { background: rgba(255, 107, 107, .14); color: var(--bad); }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); display: grid; gap: 14px; justify-items: center; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px; gap: 4px; }
.seg button { height: 40px; border-radius: 12px; color: var(--muted); font-weight: 700; font-size: 14px; transition: .2s; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }

/* ---------- схема трассы ---------- */
.track-svg { display: block; width: 100%; height: auto; overflow: visible; }
.track-svg .halo { fill: none; stroke: var(--accent); /* цвет трассы задаётся из JS */ stroke-opacity: .28; filter: blur(7px); stroke-linecap: round; stroke-linejoin: round; }
.track-svg .base { fill: none; stroke: #2b2b36; stroke-linecap: round; stroke-linejoin: round; }
.track-svg .line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.track-svg .center { fill: none; stroke: rgba(255, 255, 255, .55); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 14; }
.track-svg .corner { fill: rgba(255, 255, 255, .78); font-weight: 700; font-family: inherit; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: rgba(7, 7, 10, .85); stroke-linejoin: round; }
.track-svg .draw { animation: draw 1.8s cubic-bezier(.5, 0, .2, 1) both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.track-svg .car { fill: #fff; filter: drop-shadow(0 0 6px #fff); }

/* ---------- карточка трассы ---------- */
.track-card { display: block; position: relative; padding: 18px 18px 16px; overflow: hidden; transition: transform .2s, border-color .2s; }
.track-card::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1; background: radial-gradient(circle, rgba(255, 59, 36, .16), transparent 65%); pointer-events: none; }
.track-card:active { transform: scale(.985); }
.track-card .map { margin: 6px 0 12px; padding: 0 4px; }
.track-card .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.track-card .name { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }

/* ---------- заезды ---------- */
.run { padding: 0; overflow: hidden; }
.run-head { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 15px 16px; }
.run-head .date { font-weight: 700; }
.run-head .best { font-weight: 800; font-size: 20px; text-align: right; color: var(--best); }
.run-head svg.chev { width: 18px; height: 18px; color: var(--muted); transition: transform .25s; }
.run.open .chev { transform: rotate(90deg); }
.run-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.run.open .run-body { grid-template-rows: 1fr; }
.run-body > div { overflow: hidden; }
.laps { padding: 0 16px 16px; display: grid; gap: 4px; }
.lap { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, .03); }
.lap .n { color: var(--muted); font-weight: 700; font-size: 13px; }
.lap .t { font-weight: 700; font-size: 17px; }
.lap .d { color: var(--muted); font-size: 13px; }
.lap.best { background: rgba(182, 124, 255, .13); box-shadow: inset 0 0 0 1px rgba(182, 124, 255, .35); }
.lap.best .t { color: var(--best); }
.run-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 0 16px 16px; }
.latest { border-color: rgba(255, 59, 36, .35); box-shadow: 0 0 0 1px rgba(255, 59, 36, .12), 0 16px 40px rgba(255, 59, 36, .08); }
.notes { padding: 0 16px 14px; color: var(--muted); font-size: 14px; }

/* ---------- профиль ---------- */
.avatar { width: 76px; height: 76px; border-radius: 26px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #fff; overflow: hidden; flex: none; box-shadow: 0 10px 28px rgba(255, 59, 36, .25); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 44px; height: 44px; border-radius: 15px; font-size: 18px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin: 4px 2px 18px; }
.profile-head .who { min-width: 0; flex: 1; }
.profile-head .name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fab { position: fixed; right: max(18px, calc(50% - 262px)); bottom: calc(var(--tab-h) + var(--safe-b) + 18px); z-index: 15; height: 56px; padding: 0 22px 0 18px; border-radius: 20px; box-shadow: 0 14px 34px rgba(255, 59, 36, .45); }
.fab svg { width: 22px; height: 22px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric { padding: 14px 12px; text-align: center; }
.metric b { display: block; font-size: 24px; font-weight: 800; }
.metric span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.stat { padding: 12px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .035); }
.stat span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat b { display: block; font-size: 19px; margin-top: 3px; }
.spark { display: block; width: 100%; height: 86px; margin-top: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.45; }

/* ---------- формы ---------- */
.field { display: grid; gap: 7px; }
.field > label, .field > .lbl { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.input { width: 100%; height: 52px; padding: 0 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: rgba(255, 59, 36, .7); box-shadow: 0 0 0 4px rgba(255, 59, 36, .14); }
.input::placeholder { color: #5b5b68; }
textarea.input { height: auto; min-height: 84px; padding: 14px 16px; resize: vertical; }
select.input { appearance: none; }
.error { color: var(--bad); font-size: 14px; min-height: 20px; }
.picker { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.picker svg { width: 18px; height: 18px; color: var(--muted); }
.lap-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 44px 44px; gap: 8px; align-items: center; }
.lap-row .idx { color: var(--muted); font-weight: 700; text-align: center; }
.lap-row .star { width: 44px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.lap-row .star.on { background: rgba(182, 124, 255, .16); border-color: rgba(182, 124, 255, .55); color: var(--best); }
.lap-row .star svg, .lap-row .del svg { width: 20px; height: 20px; }
.lap-row .del { width: 44px; height: 52px; display: grid; place-items: center; color: var(--muted); }
.lap-row .input.bad { border-color: var(--bad); }

/* ---------- авторизация ---------- */
.auth { min-height: calc(100dvh - 60px); display: grid; align-content: center; gap: 22px; }
.brand { display: grid; gap: 14px; justify-items: start; }
.brand .logo { width: 64px; height: 64px; border-radius: 22px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; box-shadow: 0 0 40px rgba(255, 59, 36, .25); }
.brand .logo svg { width: 40px; height: 40px; }
.avatar-pick { display: flex; align-items: center; gap: 14px; }
.avatar-pick input { display: none; }

/* ---------- слои: шторка, всплывающие меню, тосты ---------- */
#layer { position: relative; z-index: 50; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s ease both; z-index: 50; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 28px 28px 0 0; padding: 10px 18px calc(var(--safe-b) + 22px); z-index: 51; animation: rise .32s cubic-bezier(.2, .8, .2, 1) both; }
.sheet .grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet-head { position: sticky; top: -10px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 4px 0 8px; background: var(--surface); }
.sheet h3 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.sheet.closing { animation: sink .22s ease both; }
.backdrop.closing { animation: fadeOut .22s ease both; }
@keyframes rise { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes sink { to { transform: translate(-50%, 100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.option { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 8px; text-align: left; font-weight: 700; }
.option.selected { border-color: rgba(255, 59, 36, .7); background: rgba(255, 59, 36, .1); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 90px); transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-strong); font-weight: 600; z-index: 60; animation: toast 2.6s ease both; max-width: 90vw; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 50%, var(--surface) 80%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; margin-bottom: 8px; padding: 6px 4px 6px 0; }
.back svg { width: 18px; height: 18px; }

/* ---------- v2: общие дополнения ---------- */
.btn.small { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.chip.pick { cursor: pointer; border: 1px solid var(--line); }
.chip.pick.on { background: rgba(255, 59, 36, .16); color: var(--accent-2); border-color: rgba(255, 59, 36, .5); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.sheet .stack > *, .sheet .field, .sheet .two > *, .sheet .card { min-width: 0; }
.sheet .input { min-width: 0; max-width: 100%; }
.input.slim { height: 44px; border-radius: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.guest { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.tab .ico { position: relative; display: grid; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; font-style: normal; }
.badge.dot { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; font-size: 11px; }
.icon-btn.ok { background: rgba(52, 211, 153, .16); color: var(--good); }
.switch-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.switch-row span { display: grid; gap: 2px; font-size: 14px; }
.switch-row b { font-size: 16px; }
.switch-row input { appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: var(--surface-3); position: relative; transition: background .2s; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(20px); }

/* список заездов */
.run-list { display: grid; gap: 10px; }
.year { margin: 8px 2px 0; }
.run-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 20px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); }
.run-row:active { transform: scale(.985); }
.datebox { width: 56px; height: 56px; border-radius: 16px; display: grid; place-content: center; text-align: center; color: #fff; line-height: 1; }
.datebox b { font-size: 22px; font-weight: 800; }
.datebox span { font-size: 11px; font-weight: 800; letter-spacing: .08em; margin-top: 3px; opacity: .92; }
.run-row .title { font-weight: 800; }
.run-row .sub { font-size: 13px; }
.run-row .pos { text-align: right; display: grid; gap: 2px; }
.run-row .pos b { font-size: 20px; font-weight: 800; }
.medal-1 { color: #f5c542 !important; }
.medal-2 { color: #c3cad6 !important; }
.medal-3 { color: #cd7f32 !important; }
.run-row .pos span { font-size: 12px; color: var(--muted); }

/* страница заезда */
.timing { padding: 6px 0; overflow: hidden; }
.trow { display: grid; grid-template-columns: 34px 1fr 86px 66px; gap: 6px; align-items: center; padding: 10px 14px; font-size: 14px; }
.trow + .trow { border-top: 1px solid var(--line); }
.trow.thead { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.trow .p { font-weight: 800; color: var(--muted); }
.trow .who { display: flex; gap: 8px; align-items: baseline; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.trow .who i { font-style: normal; color: var(--muted); font-size: 12px; font-weight: 700; }
.trow .best { font-weight: 800; text-align: right; }
.trow .best.purple { color: var(--best); }
.trow > span:last-child { text-align: right; font-size: 12px; }
.trow.me { background: rgba(255, 59, 36, .1); box-shadow: inset 3px 0 0 var(--accent); }
.cards2 { display: grid; gap: 14px; }
.ppos { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.weather { display: flex; gap: 10px; margin: -6px 0 18px; flex-wrap: wrap; }
.wcell { padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 2px; min-width: 88px; }
.wcell span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.wcell b { font-size: 17px; }
.part { padding: 14px; display: grid; gap: 12px; }

/* ближайший заезд на главной */
.next { position: relative; overflow: hidden; display: grid; gap: 14px; border-color: rgba(255, 59, 36, .3); }
.next::before { content: ""; position: absolute; inset: -30% -10% auto auto; width: 70%; aspect-ratio: 1; background: radial-gradient(circle, rgba(255, 59, 36, .22), transparent 65%); pointer-events: none; }
.pill { padding: 6px 12px; border-radius: 999px; background: #fff; color: #111; font-weight: 800; font-size: 13px; }
.next-body { display: grid; grid-template-columns: 1fr 42%; gap: 10px; align-items: center; }
.next-title h3 { margin: 0; font-size: 28px; line-height: 1.05; letter-spacing: -.02em; font-weight: 800; }
.next-title p { margin: 8px 0 0; font-size: 14px; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cd { text-align: center; padding: 10px 4px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.cd b { display: block; font-size: 28px; font-weight: 800; }
.cd span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.plan-mini { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }

/* друзья и чаты */
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); }
.pname { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view.chat-mode { padding: 0 0 0; }
.chat { display: flex; flex-direction: column; min-height: 100dvh; }
.chat-top { position: sticky; top: 0; z-index: 10; background: rgba(10, 10, 14, .85); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.chat-head { display: flex; gap: 12px; align-items: center; padding: calc(var(--safe-t) + 10px) 14px 10px; }
.pinned-box:empty { display: none; }
.pinned { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 14px 10px; padding: 8px 12px 8px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--c, var(--accent)); }
.pin-main { display: grid; min-width: 0; font-size: 14px; }
.pin-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-main .muted { font-size: 12px; }
.cdtext { font-weight: 800; font-size: 15px; white-space: nowrap; color: var(--c, var(--accent)); }
.composer .send svg, .composer .send { color: #fff; }
.composer .send svg { width: 24px; height: 24px; stroke-width: 2.6; }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 96px; }
.msg { max-width: 82%; align-self: flex-start; padding: 8px 12px; border-radius: 18px 18px 18px 6px; background: var(--surface-3); }
.msg.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.msg .from { font-size: 12px; font-weight: 800; color: var(--accent-2); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .time { font-size: 11px; opacity: .6; text-align: right; margin-top: 2px; }
.composer { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(560px, 100%); display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(var(--safe-b) + 10px); background: rgba(10, 10, 14, .88); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.composer textarea.input { min-height: 46px; height: 46px; max-height: 120px; padding: 12px 16px; border-radius: 23px; resize: none; }
.composer .send { height: 46px; width: 46px; padding: 0; border-radius: 50%; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* iOS: поля даты и времени имеют собственную минимальную ширину и вылезают за колонку */
.input[type="date"], .input[type="time"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%; text-align: left; line-height: 50px; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.input[type="date"]::-webkit-date-and-time-value, .input[type="time"]::-webkit-date-and-time-value { text-align: left; min-width: 0; margin: 0; }
.input[type="date"]::-webkit-datetime-edit, .input[type="time"]::-webkit-datetime-edit { padding: 0; }

/* состав заезда и ответы на приглашение */
.roster { display: grid; gap: 6px; }
.pending { opacity: .4; filter: grayscale(.6); }
.plan-mini { display: grid; gap: 10px; }
.pinned { flex-wrap: wrap; }
.pin-side { display: grid; justify-items: end; gap: 2px; }

/* скачивание приложения на экране входа */
.brand-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; }
.dl-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); font-size: 14px; font-weight: 700; }
.dl-btn svg { color: var(--good); }
.dl-btn:active { transform: scale(.97); }

/* экран входа: размытая анимированная трасса на фоне и стеклянная карточка */
.auth { position: relative; min-height: calc(100dvh - 60px); display: grid; align-content: center; }
.auth-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.auth-art { position: absolute; inset: -8%; width: 116%; height: 116%; animation: authDrift 30s ease-in-out infinite alternate; }
.auth-art .glint { animation: glint 7s linear infinite; }
.auth-veil { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 40%, rgba(7, 7, 10, .35), rgba(7, 7, 10, .8)); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }
.auth-card { position: relative; z-index: 1; padding: 20px 18px; border-radius: 28px; background: rgba(16, 16, 21, .55); border: 1px solid var(--line-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.auth-dl { position: fixed; z-index: 2; top: calc(var(--safe-t) + 14px); right: 16px; background: rgba(16, 16, 21, .6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
@keyframes glint { to { stroke-dashoffset: -100; } }
@keyframes authDrift { from { transform: translate(-2%, -1%) scale(1.02); } to { transform: translate(2%, 1%) scale(1.1); } }
