/* Random Coffee МГУ — Mini App. Design system: docs/miniapp-design.md.
   No inline styles anywhere (CSP style-src 'self'): dynamic values come in as CSS variables set with
   style.setProperty (--p of the progress ring, --font-display) or as classes / data attributes. */

:root {
  color-scheme: light;

  /* Brand */
  --brand: #464AF3;          /* actions, selected chips, links, progress — 5.9:1 on white */
  --brand-soft: #839AFF;     /* decoration only: gradient end, ring track, pattern — never text */
  --brand-tint: #ECEDFE;     /* quiet chip and avatar backgrounds; --brand on it 5.1:1 */
  --ink: #0E0F31;            /* body text — 18.6:1 */
  --ink-2: #1C1E61;          /* headings, pressed state, active tab — 14.9:1 */
  --text-2: #4A4C6E;         /* secondary text, derived from ink — 8.2:1 */
  --text-3: #63657F;         /* captions and dates — 5.7:1 on white, 5.3:1 on --bg */
  --line: #E8E8E8;           /* dividers */
  --field: #F0F0F5;          /* input backgrounds (a lighter --line tinted towards the page) */
  --idle: #C4C4C4;           /* inactive icons, the sheet grabber — never text */
  --bg: #F5F6FB;             /* page and Telegram header */
  --surface: #FFFFFF;
  --ok: #177A42;             /* «Хорошо», success toasts */
  --ok-tint: #E6F4EC;
  --bad: #C9363B;            /* errors, «Не очень» — 5.2:1 */
  --bad-tint: #FBEBEC;
  --scrim: rgba(14, 15, 49, 0.42);

  /* Type: system faces only. --font-display is replaced by js/fonts.js with one serif family that covers
     both Latin and Cyrillic on this device; without one it stays the sans stack below. */
  --font-text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-text);
  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;

  /* Space, shape, depth */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --r-hero: 28px;
  --r-card: 20px;
  --r-row: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(28, 30, 97, 0.05), 0 6px 18px rgba(70, 74, 243, 0.06);
  --shadow-float: 0 14px 36px rgba(28, 30, 97, 0.16), 0 2px 6px rgba(28, 30, 97, 0.06);
  --focus: 0 0 0 3px rgba(70, 74, 243, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 200ms;
  --t-base: 260ms;

  /* Safe areas: the device (env) or Telegram's own (fullscreen), plus Telegram's content inset */
  --safe-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --viewport: var(--tg-viewport-stable-height, 100vh);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-md)/1.45 var(--font-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); }

.num { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- layout ---------- */

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + var(--s-6)) var(--s-4) calc(var(--safe-bottom) + 112px);
}

.screen { display: flex; flex-direction: column; gap: var(--s-4); }
.screen.is-entering { animation: screen-in var(--t-base) var(--ease); }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.screen-title {
  margin: 0 0 var(--s-1);
  font-size: var(--fs-xl);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

.greeting { margin: 0; font-size: var(--fs-xl); line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; color: var(--ink-2); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  padding: var(--s-5) var(--s-5) var(--s-6);
  border-radius: var(--r-hero);
  color: #FFFFFF;
  /* Text sits on the top-left, where the gradient is still #464AF3 (white 5.9:1); the light corner holds the art. */
  background:
    url("assets/pattern.svg") 0 0 / 28px 28px repeat,
    linear-gradient(135deg, var(--brand) 0%, var(--brand) 38%, var(--brand-soft) 100%);
  box-shadow: var(--shadow-float);
}

.hero--muted {
  background:
    url("assets/pattern.svg") 0 0 / 28px 28px repeat,
    linear-gradient(135deg, var(--ink-2) 0%, var(--ink-2) 45%, #3A3EA8 100%);
}

.hero-copy { position: relative; z-index: 1; }

.hero-kicker { margin: 0 0 var(--s-2); font-size: var(--fs-sm); font-weight: 600; }

.hero-date {
  margin: 0;
  font-family: var(--font-display);
  /* «30 сентября» stays on one line from 320 px: the size follows the width, never a break inside the date */
  font-size: clamp(26px, 8.4vw, 34px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hero-sub { margin: var(--s-1) 0 0; font-size: var(--fs-sm); font-weight: 500; }

.hero-countdown {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-top: var(--s-4);
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: rgba(14, 15, 49, 0.28);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hero-action { margin-top: var(--s-4); }

.hero-art {
  position: absolute;
  right: var(--s-4);  /* at least 16 px from the right and bottom edges at any width */
  bottom: var(--s-4);
  width: 108px;
  height: 135px;
  color: #FFFFFF;
  pointer-events: none;
}
.hero--muted .hero-art { opacity: 0.55; }

.hero-art path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero-art .art-star { fill: currentColor; stroke: none; }

/* The one unprompted motion: the line draws once on the first load (js adds .is-drawing). */
.hero-art.is-drawing .art-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 700ms var(--ease) forwards; }
.hero-art.is-drawing .art-line--rise { animation-delay: 260ms; }
.hero-art.is-drawing .art-star { opacity: 0; animation: appear var(--t-fast) var(--ease) 900ms forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

.notice {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-row);
  background: var(--brand-tint);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

/* ---------- segmented control ---------- */

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: var(--s-1);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.segmented-thumb {
  position: absolute;
  top: var(--s-1);
  bottom: var(--s-1);
  left: var(--s-1);
  width: calc(50% - var(--s-1));
  border-radius: var(--r-pill);
  background: var(--brand);
  transition: transform var(--t-base) var(--ease), background-color var(--t-base) var(--ease);
}
.segmented[data-value="skip"] .segmented-thumb { transform: translateX(100%); background: var(--ink-2); }
.segmented[data-value="none"] .segmented-thumb { opacity: 0; }

.segmented button {
  position: relative;
  z-index: 1;
  min-height: 48px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: color var(--t-fast) var(--ease);
}
.segmented button[aria-checked="true"] { color: #FFFFFF; }

.hint { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }

/* ---------- cards ---------- */

.card {
  padding: var(--s-5);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.card-title { margin: 0; font-size: var(--fs-md); font-weight: 650; color: var(--ink-2); }
.card-text { margin: var(--s-1) 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.card-actions { margin-top: var(--s-4); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--brand-tint);
  color: var(--brand);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.chip:active { transform: scale(0.97); }
.chip[aria-checked="true"] { background: var(--brand); color: #FFFFFF; }
/* A selected checkbox chip has a tick, so the choice doesn't rest on colour alone. */
.chip--check[aria-checked="true"]::before {
  content: "";
  flex: none;
  width: 10px;
  height: 5px;
  margin: -3px var(--s-2) 0 -2px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-6);
  border: 0;
  border-radius: var(--r-pill);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { background: var(--line); color: var(--text-3); transform: none; cursor: default; }
.btn-primary { background: var(--brand); color: #FFFFFF; }
.btn-primary:active { background: var(--ink-2); }
.btn-secondary { background: var(--brand-tint); color: var(--brand); }
.btn-light { background: #FFFFFF; color: var(--brand); }
.btn-light:active { background: var(--brand-tint); }
.btn-block { width: 100%; }

/* ---------- profile ring ---------- */

.ring-card { display: flex; align-items: center; gap: var(--s-4); width: 100%; border: 0; text-align: left; }
.ring-card:active { transform: scale(0.99); }
.ring-card .card-title, .ring-card .card-text { display: block; }

.ring { position: relative; flex: none; width: 72px; height: 72px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
/* a thin line leaves a 58 px hole: «100» with a small «%» fits */
.ring circle { fill: none; stroke-width: 3; }
.ring .ring-track { stroke: var(--brand-tint); }
.ring .ring-value {
  stroke: url(#ring-gradient);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p, 0));
  transition: stroke-dashoffset 600ms var(--ease);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 23px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ring-num { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.02em; }
.ring-pct { margin-left: 1px; font-size: var(--fs-xs); font-weight: 600; }
.ring-copy { min-width: 0; }

/* ---------- history ---------- */

.month { margin: var(--s-3) 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }

.meetings { display: flex; flex-direction: column; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }

.meeting {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.avatar--b { background: var(--ok-tint); color: var(--ok); }
.avatar--c { background: #E9E9F2; color: var(--ink-2); }
.avatar--gone { background: var(--field); color: var(--text-3); }

.meeting-main { min-width: 0; }
.meeting-name {
  display: -webkit-box;
  margin: 0;
  font-weight: 600;
  overflow: hidden;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.meeting-date { margin: 0; color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

.rating {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.rating--good { background: var(--ok-tint); color: var(--ok); }
.rating--neutral { background: var(--brand-tint); color: var(--brand); }
.rating--bad { background: var(--bad-tint); color: var(--bad); }
.rating--none { background: var(--field); color: var(--text-3); }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-8) var(--s-4); text-align: center; }
.empty img { width: 132px; height: 132px; }
.empty-title { margin: var(--s-2) 0 0; font-size: var(--fs-lg); font-weight: 700; color: var(--ink-2); }
.empty-text { margin: 0; max-width: 30ch; color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- skeletons ---------- */

.skel {
  border-radius: var(--r-card);
  background: linear-gradient(100deg, #ECEDF4 30%, #F6F6FA 50%, #ECEDF4 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel--hero { height: 212px; border-radius: var(--r-hero); }
.skel--bar { height: 56px; border-radius: var(--r-pill); }
.skel--card { height: 120px; }
.skel--row { height: 68px; }
.skel--title { width: 55%; height: 28px; border-radius: var(--r-row); }

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- profile ---------- */

.profile-head { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: var(--s-4); }

.photo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-tint);
  box-shadow: 0 0 0 3px var(--surface), 0 6px 18px rgba(70, 74, 243, 0.18);
}
.photo--initials {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand) 40%, var(--brand-soft) 100%);
  color: #FFFFFF;
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.profile-id { min-width: 0; }

.profile-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.15;
  font-weight: 600;
  color: var(--ink-2);
  /* long double names: two lines at most, broken by syllables (lang="ru"), not in the middle of a letter run */
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.profile-faculty { margin: var(--s-1) 0 0; color: var(--text-2); font-size: var(--fs-sm); }


.rows { padding: var(--s-1) 0; }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 60px;
  padding: var(--s-3) var(--s-5);
  border: 0;
  background: transparent;
  text-align: left;
  transition: background-color var(--t-fast) var(--ease);
}
.row + .row { border-top: 1px solid var(--line); }
.row:active { background: var(--bg); }
.row-main { min-width: 0; }
.row-label { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.row-value { display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; }
.row-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-more {
  flex: none;
  padding: 1px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--brand-tint);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.row-value--empty { color: var(--text-3); }
.row svg { width: 18px; height: 18px; color: var(--idle); }

/* ---------- bottom sheet ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.backdrop.is-open { opacity: 1; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 21;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: calc(var(--viewport) * 0.9);
  border-radius: var(--r-hero) var(--r-hero) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transform: translate(-50%, 100%);
  transition: transform var(--t-base) var(--ease);
}
.sheet.is-open { transform: translate(-50%, 0); }

.sheet-grabber { width: 36px; height: 4px; margin: var(--s-2) auto 0; border-radius: var(--r-pill); background: var(--idle); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-5) var(--s-2); }
.sheet-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--ink-2); }
.sheet-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: calc(-1 * var(--s-2));
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
}
.sheet-close svg { width: 20px; height: 20px; }
/* top padding: the first row of chips keeps its focus ring and shadow inside the scroll area */
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4) var(--s-5) var(--s-5); scroll-padding: var(--s-4); }
.sheet-meta { display: flex; flex-direction: column; gap: 2px; }
.sheet-meta .hint { font-size: var(--fs-xs); }
.sheet-count { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-body .chips { margin-top: 0; }
.sheet-foot { padding: var(--s-3) var(--s-5) calc(var(--safe-bottom) + var(--s-4)); border-top: 1px solid var(--line); }
.in-telegram .sheet-foot { display: none; }
.in-telegram .sheet-body { padding-bottom: calc(var(--safe-bottom) + var(--s-6)); }

html.sheet-open, body.sheet-open { overflow: hidden; overscroll-behavior: none; }

/* ---------- form controls ---------- */

.field { display: block; }
.field-label { display: block; margin-bottom: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }

.input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid transparent;
  border-radius: var(--r-row);
  background: var(--field);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.input:focus { border-color: var(--brand); background: var(--surface); box-shadow: none; }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { min-height: 96px; resize: none; line-height: 1.4; }
.input::placeholder { color: var(--text-3); }

.field-meta { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-2); font-size: var(--fs-xs); color: var(--text-3); }
.counter { margin-left: auto; font-variant-numeric: tabular-nums; }
.counter.is-over, .field-error { color: var(--bad); }

.note {
  margin: var(--s-3) 0 0;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-row);
  background: var(--brand-tint);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.note--warn { background: var(--bad-tint); color: var(--bad); }

.options { display: flex; flex-direction: column; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }

.option {
  display: grid;
  grid-template-columns: 1fr 22px;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 52px;
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid transparent;
  border-radius: var(--r-row);
  background: var(--field);
  text-align: left;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.option-sub { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.option-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--idle); transition: border var(--t-fast) var(--ease); }
.option[aria-checked="true"] { background: var(--brand-tint); border-color: var(--brand); }
.option[aria-checked="true"] .option-mark { border: 7px solid var(--brand); }

.search { margin-bottom: var(--s-3); }
.search-empty { margin: var(--s-3) 0; color: var(--text-3); font-size: var(--fs-sm); }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--s-3));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(calc(100% - 2 * var(--s-4)), 360px);
  padding: 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}
@supports (backdrop-filter: blur(12px)) {
  .tabbar { background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(12px); }
}
body.sheet-open .tabbar { opacity: 0; transform: translate(-50%, 24px); pointer-events: none; }

.tabbar-thumb {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc((100% - 12px) / 3);
  border-radius: var(--r-pill);
  background: var(--brand-tint);
  transition: transform var(--t-base) var(--ease);
}
.tabbar[data-active="history"] .tabbar-thumb { transform: translateX(100%); }
.tabbar[data-active="profile"] .tabbar-thumb { transform: translateX(200%); }

.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: color var(--t-fast) var(--ease);
}
.tab svg { width: 24px; height: 24px; }
.tab svg path, .tab svg circle { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--ink-2); }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 92px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  width: min(calc(100% - 2 * var(--s-4)), 448px);
  transform: translateX(-50%);
  pointer-events: none;
}
body.sheet-open .toasts { bottom: calc(var(--safe-bottom) + var(--s-6)); }

.toast {
  max-width: 100%;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-row);
  background: var(--ink-2);
  color: #FFFFFF;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-float);
  animation: toast-in var(--t-base) var(--ease);
}
.toast--success { background: var(--ok); }
.toast--error { background: var(--bad); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- gate (no access) ---------- */

.gate { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-8) var(--s-4); text-align: center; }
.gate img { width: 120px; height: 120px; }
.gate-title { margin: var(--s-2) 0 0; font-size: var(--fs-lg); font-weight: 700; color: var(--ink-2); }
.gate-text { margin: 0; max-width: 32ch; color: var(--text-2); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .hero-art.is-drawing .art-line { stroke-dashoffset: 0; }
  .hero-art.is-drawing .art-star { opacity: 1; }
  .skel { animation: none; }
}
