/* «Кофе на Воробьёвых» — 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 */
  /* «Приостановить поиск» / «Вернуться в поиск»: the darkest blue of the home hero (its muted gradient start);
     pressed — --ink */
  --btn-deep: #1C1E61;
  --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) */
  --field-dark: var(--btn-deep);   /* dark input background */
  --field-text: #FFFFFF;           /* text in dark inputs */
  --field-placeholder: #B4B9F0;    /* 7.9:1 on --field-dark */
  --field-focus: #839AFF;          /* focus border, 5.7:1 on --field-dark */
  --field-bad: #FF8A8E;            /* invalid border, 6.6:1 on --field-dark */
  --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;
}

/* ---------- decorative background: faculty names (js/faculty-bg.js) ---------- */

/* Opacity of the whole layer — tune here, one number. The brown and red go beyond the brand palette and are used
   only for this backdrop (docs/miniapp-design.md). */
:root {
  --faculty-bg-opacity: 0.225;
  --faculty-bg-color: #464AF3;                              /* home and the service screens */
}
:root[data-tab="history"] { --faculty-bg-color: #8B5E3C; } /* brown */
:root[data-tab="profile"] { --faculty-bg-color: #C9363B; } /* red */
:root[data-tab="feed"] { --faculty-bg-color: #839AFF; --faculty-bg-opacity: 0.4; } /* light blue, own opacity */

.faculty-bg {
  position: fixed;
  inset: 0;
  z-index: -1;          /* above the page colour (body background goes to the canvas), under everything else */
  overflow: hidden;
  contain: strict;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  color: var(--faculty-bg-color);
  opacity: var(--faculty-bg-opacity);
  transition: color var(--t-fast) var(--ease);
}

/* A square as big as the screen's diagonal, centred and turned 30° clockwise: the rows go down from left to right
   and cover the screen in any orientation. Rows touch, one step apart; even rows are shifted like brickwork. */
.faculty-bg-rows {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--faculty-bg-size, 200vmax);
  height: var(--faculty-bg-size, 200vmax);
  overflow: hidden;
  transform: translate(-50%, -50%) rotate(30deg);
}
/* The same text, measured once by js/faculty-bg.js outside the rotated square (the width of a row's period). */
.faculty-bg-rows, .faculty-bg-measure {
  --faculty-bg-step: 17px;
  font: 700 13px/var(--faculty-bg-step) var(--font-text);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.faculty-bg-measure { position: absolute; left: 0; top: 0; visibility: hidden; }

/* Two still bands: the odd rows, and the even rows one row lower, shifted like brickwork; each row leaves a gap of
   one row for the other band. Nothing moves (no transform, no animation). */
.faculty-bg-band {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
}
.faculty-bg-band--right { top: var(--faculty-bg-step); }
.faculty-bg-band > .faculty-bg-row { height: var(--faculty-bg-step); margin-bottom: var(--faculty-bg-step); }
.faculty-bg-band--right > .faculty-bg-row { text-indent: -3.6em; }

/* ---------- 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;
  /* stays clear of the tower on a 320 px screen and of the chart on a wide card; long pause texts wrap evenly */
  max-width: 232px;
  font-size: var(--fs-sm);
  font-weight: 500;
  text-wrap: balance;
}

.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); }

/* The pill as a button: «Смотреть анкеты» / «Заполнить». It keeps the 32 px pill (the line art is fitted around
   it); the tap area grows to 44 px with a transparent edge. */
.hero-cta { position: relative; border: 0; color: #FFFFFF; cursor: pointer; transition: background-color var(--t-fast) var(--ease); }
.hero-cta::after { content: ""; position: absolute; inset: -6px -4px; }
.hero-cta:active { background: rgba(14, 15, 49, 0.45); }

/* Line art (js/hero-art.js): a 448×220 box of card pixels pinned to the bottom-right corner; on a narrower card
   its left part is cut off by the card, and the drawings that would be cut are switched off (.is-off). */
.hero-art {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 448px;
  height: 100%;
  min-height: 220px;
  color: #FFFFFF;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.hero--muted .hero-art { opacity: 0.55; }

.hero-art path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.hero-art .art-dot { fill: currentColor; stroke: none; }
.hero-art .is-off { display: none; }

/* Depth: the main line is the boldest, the small drawings a little fainter. */
.art-drawing[data-depth="2"] { opacity: 0.8; }
.art-drawing[data-depth="3"] { opacity: 0.64; }
/* A line of the second set that reaches a little into the card text (js/hero-art.js, underText — by the text measured
   in home.js): fainter still, so the text, which sits above the art, keeps its contrast. stroke/fill-opacity, not
   opacity: the drawing animation never touches them. */
.hero-art .is-under-text { stroke-opacity: 0.45; fill-opacity: 0.45; }

/* While drawing, every line starts hidden (pathLength="1": one dash the length of the line, offset past it);
   js animates the offset to 0 with the Web Animations API, then removes .is-drawing — a finished drawing has no
   dashes at all. visibility hides the round cap that would otherwise peek out as a dot before the line starts. */
.hero-art.is-drawing .art-stroke { stroke-dasharray: 1 1.02; stroke-dashoffset: 1; visibility: hidden; }
.hero-art.is-drawing .art-dot { opacity: 0; }

.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: 1.5px solid transparent;
  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; }

/* ---------- 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%; }
.btn-deep { background: var(--btn-deep); color: #FFFFFF; }
.btn-deep:active { background: var(--ink); }
.btn-quiet { background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-quiet:active { background: var(--bg); }
.btn-sm { min-height: 44px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn-rate { padding: 0 var(--s-1); }
.btn-rate--good { background: var(--ok-tint); color: var(--ok); }
.btn-rate--neutral { background: var(--brand-tint); color: var(--brand); }
.btn-rate--bad { background: var(--bad-tint); color: var(--bad); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }

/* ---------- home: this week, waiting, last meetings ---------- */

.meter { margin-top: var(--s-4); }
.meter-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.meter-label { color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.meter-value { color: var(--ink-2); font-weight: 700; }
/* Views — a continuous bar; meetings — one segment each (few and countable). */
.bar { height: 8px; margin-top: var(--s-2); overflow: hidden; border-radius: var(--r-pill); background: var(--brand-tint); }
.bar-fill {
  display: block;
  width: calc(var(--p, 0) * 1%);
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 600ms var(--ease);
}
.dots { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.dot { flex: 1; height: 8px; border-radius: var(--r-pill); background: var(--brand-tint); }
.dot.is-on { background: var(--brand); }
.card > .hint:last-child { margin-top: var(--s-3); }

.plain-list { margin: var(--s-3) 0 0; padding: 0; list-style: none; }
.plain-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--s-3);
  min-height: 48px;
  padding: var(--s-2) 0;
}
.plain-row + .plain-row { border-top: 1px solid var(--line); }
.plain-row--meeting { display: grid; grid-template-columns: 36px 1fr auto; }
.plain-main { display: flex; flex-direction: column; min-width: 0; }
.plain-name { min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.plain-meta { color: var(--text-3); font-size: var(--fs-sm); }
.avatar--sm { width: 36px; height: 36px; font-size: var(--fs-xs); }
.rating--ask { background: var(--brand); color: #FFFFFF; }

/* ---------- feed ---------- */

.feed-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.feed-head .screen-title { margin: 0; }
.feed-count { margin: 0; color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }

.feed-card { overflow: hidden; border-radius: var(--r-hero); background: var(--surface); box-shadow: var(--shadow-float); }
.feed-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 5;
  /* at most half the screen: the name and the answers stay in view on the first screen */
  max-height: min(calc(var(--viewport) * 0.5), 460px);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand) 40%, var(--brand-soft) 100%);
}
.feed-photo-img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.feed-photo-initials { color: #FFFFFF; font-family: var(--font-display); font-size: 64px; font-weight: 600; letter-spacing: 0.02em; }
.feed-body { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-5) var(--s-5) var(--s-6); }
.feed-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  overflow-wrap: break-word;
  hyphens: auto;
}
.feed-faculty { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.feed-body .note { margin-top: var(--s-3); }
.feed-section { margin-top: var(--s-4); }
.feed-label { margin: 0 0 var(--s-2); color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.feed-text { margin: 0; overflow-wrap: break-word; }
/* Shared interests: smaller and darker than the chips, so they don't read as buttons. */
.tags { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: var(--brand-tint);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* The two answers stay in reach above the tab bar while the card scrolls. */
.feed-actions {
  position: sticky;
  bottom: calc(var(--safe-bottom) + 88px);
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--s-2);
  padding: 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-float);
}
@supports (backdrop-filter: blur(12px)) {
  .feed-actions { background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(12px); }
}
.feed-actions .btn { min-height: 52px; padding: 0 var(--s-3); }

/* «Анкета скрыта · Отменить» for 5 seconds above the answers; the line runs out with the time. */
.undo {
  position: fixed;
  left: var(--s-4);
  right: var(--s-4);
  bottom: calc(var(--safe-bottom) + 164px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 448px;
  margin: 0 auto;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  overflow: hidden;
  border-radius: var(--r-row);
  background: var(--ink-2);
  color: #FFFFFF;
  box-shadow: var(--shadow-float);
  animation: toast-in var(--t-base) var(--ease);
}
.undo-text { flex: 1; font-size: var(--fs-sm); font-weight: 500; }
.undo-action {
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-size: var(--fs-sm);
  font-weight: 700;
}
.undo-action:active { background: rgba(255, 255, 255, 0.28); }
.undo-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--brand-soft);
  transform-origin: left center;
  animation: undo-timer 5s linear forwards;
}
@keyframes undo-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* «Взаимно!»: the hero's gradient and pattern, the name of the moment in the display face. */
.match {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-6) var(--s-6);
  border-radius: var(--r-hero);
  color: #FFFFFF;
  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);
  animation: match-in 420ms var(--ease);
}
.match-title { margin: 0; font-family: var(--font-display); font-size: clamp(40px, 12vw, 52px); line-height: 1; font-weight: 600; letter-spacing: -0.01em; }
.match-title:focus, .match-title:focus-visible { box-shadow: none; } /* focused for screen readers, not a control */
.match-text { margin: 0; max-width: 26ch; font-size: var(--fs-md); font-weight: 500; }
.match-handle { margin: var(--s-2) 0 var(--s-3); font-size: var(--fs-lg); font-weight: 700; overflow-wrap: anywhere; }
.match-hint { text-align: center; }
@keyframes match-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.state { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-6) var(--s-5); }
.state--image { align-items: center; text-align: center; }
.state-image { width: 120px; height: 120px; }
.state-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--ink-2); }
.state .btn { margin-top: var(--s-3); }
/* «Лимит исчерпан»: the bubble in the colour of «Вернуться в поиск» (--btn-deep). */
.state--deep { background: var(--btn-deep); box-shadow: var(--shadow-float); color: #FFFFFF; }
.state--deep .state-big {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  line-height: 1.1;
  font-weight: 650;
  color: #FFFFFF;
}
.state--deep .card-text { color: #D5D8FF; }   /* 11:1 on --btn-deep */
.state--deep .state-when { margin: var(--s-2) 0 0; color: #B4B9F0; font-size: var(--fs-xs); }   /* 7.9:1 */

/* ---------- history: «Встретились?» and the rating ---------- */

.meeting-ask, .meeting-note { grid-column: 1 / -1; }
.meeting-ask { display: flex; flex-direction: column; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.meeting-question { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
.meeting-hint { margin: 0; color: var(--text-3); font-size: var(--fs-xs); }
.ask-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.ask-actions--three { grid-template-columns: repeat(3, 1fr); }
.ask-actions > :only-child { grid-column: 1 / -1; }
.meeting-note { margin: 0; color: var(--text-2); font-size: var(--fs-xs); }

/* ---------- profile: workplace ---------- */

.field.is-off { opacity: 0.5; }
.chips--flat { margin-top: 0; }

/* ---------- 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 {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  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); }
/* The partner's photo over the initials (js/avatar.js): the centre of the picture in the centre of the circle. */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 50%;
}

.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); }
.skel--photo { aspect-ratio: 4 / 5; max-height: min(calc(var(--viewport) * 0.5), 460px); border-radius: var(--r-hero); }

@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); }

/* «Моя анкета»: the profile rows in a folder that opens in place (js/profile.js). */
.folder { padding: 0; overflow: hidden; }
.folder-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 68px;
  padding: var(--s-3) var(--s-5);
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background-color var(--t-fast) var(--ease);
}
.folder-head:active { background: var(--bg); }
.folder-head:focus-visible { outline: none; box-shadow: inset var(--focus); }
.folder-icon {
  width: 40px; height: 40px; padding: 8px;
  border-radius: var(--r-row);
  background: var(--brand-tint);
  color: var(--brand);
}
.folder-main { display: flex; flex-direction: column; min-width: 0; }
.folder-title { font-weight: 650; color: var(--ink-2); }
.folder-sub { color: var(--text-3); font-size: var(--fs-xs); }
.folder-head > svg:last-child { width: 18px; height: 18px; color: var(--idle); transition: transform var(--t-fast) var(--ease); }
.folder.is-open .folder-head > svg:last-child { transform: rotate(90deg); }
.folder-rows { border-top: 1px solid var(--line); }

/* Statistics: a period switch, a ring of the answers and its legend with the numbers. Slice colours are fixed per
   answer (validated as a categorical set on white: lightness, chroma, colour-blind separation); the amber is below
   3:1 on white, so every number is written in the legend. Text never takes a slice colour. */
:root {
  --stat-liked: #464AF3;
  --stat-passed: #E8913A;
  --stat-undecided: #2E9E8F;
}
.stats { display: flex; flex-direction: column; gap: var(--s-4); }
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--field);
}
.segmented-item {
  min-height: 36px;
  padding: 0 var(--s-2);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.segmented-item.is-active { background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-1); }
.segmented-item:focus-visible { outline: none; box-shadow: var(--focus); }
.stats-body { display: grid; grid-template-columns: 132px 1fr; align-items: center; gap: var(--s-5); }
.stats-ring { position: relative; width: 132px; height: 132px; }
.stats-svg { display: block; width: 100%; height: 100%; }
.stats-svg circle { fill: none; stroke-width: 14; }
.stats-track { stroke: var(--field); }
.stats-slice { stroke-linecap: butt; }
.stats-slice--liked { stroke: var(--stat-liked); background: var(--stat-liked); }
.stats-slice--passed { stroke: var(--stat-passed); background: var(--stat-passed); }
.stats-slice--undecided { stroke: var(--stat-undecided); background: var(--stat-undecided); }
.stats-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.stats-number { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 600; line-height: 1; color: var(--ink-2); }
.stats-caption { margin-top: 2px; color: var(--text-3); font-size: var(--fs-xs); }
.stats-legend { display: flex; flex-direction: column; gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.stats-legend-item { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); }
.stats-swatch { width: 12px; height: 12px; border-radius: 4px; }
.stats-label { color: var(--text-2); }
.stats-value { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stats-empty { margin-top: calc(-1 * var(--s-2)); }
.stats-viewed { margin: 0; padding-top: var(--s-3); border-top: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-sm); }
@media (max-width: 340px) {
  .stats-body { grid-template-columns: 1fr; justify-items: center; }
  .stats-legend { width: 100%; }
}

/* ---------- 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-dark);
  color: var(--field-text);
  caret-color: var(--field-text);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.input:focus { border-color: var(--field-focus); background: var(--field-dark); box-shadow: none; }
.input[aria-invalid="true"] { border-color: var(--field-bad); }
textarea.input { min-height: 96px; resize: none; line-height: 1.4; }
.input::placeholder { color: var(--field-placeholder); }
.input::selection { background: var(--brand); color: #FFFFFF; -webkit-text-fill-color: #FFFFFF; }
/* Autofill must not turn the dark field white. */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--field-text);
  caret-color: var(--field-text);
  box-shadow: 0 0 0 100px var(--field-dark) inset;
  transition: background-color 9999s ease-out 0s;
}

.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 { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.counter.is-over, .field-error { color: var(--bad); }

.note {
  margin: var(--s-3) 0 0;
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid var(--brand);   /* a bubble, as .bubble below */
  border-radius: var(--r-row);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.note--warn { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }

/* A bubble: small or grey text that would otherwise lie right on the faculty-name background (the lead of a
   registration step, a question's label, hints, the empty history, the gate). White, framed in the brand blue;
   big titles stay on the background. Own nodes get the class in JS; the field editors shared with the profile
   sheets (js/fields.js) are framed only on the registration screen, by the selectors below. */
.bubble,
.reg-body .field:not(.field--pick),
.reg-body > .hint,
.reg-body > .stack > .hint,
.reg-actions > .hint,
.reg-body .sheet-meta,
.reg-body .search-empty {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  border: 1.5px solid var(--brand);
  border-radius: var(--r-row);
  background: var(--surface);
}
.bubble .hint, .reg-body .field .field-meta, .reg-body .sheet-meta .hint { color: var(--text-2); }
.reg-body > .hint, .reg-body > .stack > .hint, .reg-actions > .hint, .reg-body .search-empty { color: var(--text-2); }
.bubble--tight { align-self: flex-start; padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); }

.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(4, 1fr);
  width: min(calc(100% - 2 * var(--s-4)), 400px);
  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) / 4);
  border-radius: var(--r-pill);
  background: var(--brand-tint);
  transition: transform var(--t-base) var(--ease);
}
.tabbar[data-active="feed"] .tabbar-thumb { transform: translateX(100%); }
.tabbar[data-active="history"] .tabbar-thumb { transform: translateX(200%); }
.tabbar[data-active="profile"] .tabbar-thumb { transform: translateX(300%); }

.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, .tab svg rect { 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)); }
:root[data-tab="feed"] .toasts { bottom: calc(var(--safe-bottom) + 164px); } /* above the feed's answers */

.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); }

/* ---------- registration (js/registration.js) ---------- */

.reg { display: flex; flex-direction: column; gap: var(--s-4); }
.reg-head { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; }
.reg-back {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: calc(-1 * var(--s-2));
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}
.reg-back svg { width: 22px; height: 22px; transform: scaleX(-1); }
.reg-back:active { background: var(--brand-tint); }
.in-telegram .reg-back { display: none; } /* Telegram's own BackButton */
.reg-progress { flex: 1; min-width: 0; }
.reg-bar { height: 4px; margin-top: 0; }
.reg-step { margin: var(--s-2) 0 0; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }

.reg-title {
  margin: var(--s-2) 0 0;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}
.reg-title:focus, .reg-welcome-title:focus { box-shadow: none; }
.reg-lead { color: var(--text-2); } /* always a .bubble */
.reg-body { display: flex; flex-direction: column; gap: var(--s-4); }
.reg-body .chips { margin-top: 0; }

/* The main action: Telegram's MainButton in Telegram; in a browser an own button held above the page bottom. */
.reg-actions {
  position: sticky;
  bottom: calc(var(--safe-bottom) + var(--s-4));
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.reg-primary { box-shadow: var(--shadow-float); }
.reg-primary.is-busy { opacity: 0.72; }
.in-telegram .reg-primary { display: none; }
.in-telegram .reg-actions { position: static; }
.btn-text { min-height: 44px; background: transparent; color: var(--brand); box-shadow: none; }
.btn-text:active { background: var(--brand-tint); }
/* On the registration screen the text buttons lie on the faculty background: framed like a bubble. */
.reg-actions .btn-text { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--brand); }
.reg-actions .btn-text:active { background: var(--brand-tint); }
.reg-or { margin-top: var(--s-2); text-align: center; }

/* The first and the last screen: the hero's gradient — the one loud thing of the registration. */
.reg-welcome {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-8) var(--s-6) var(--s-6);
  border-radius: var(--r-hero);
  color: #FFFFFF;
  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);
}
.reg-welcome-kicker { margin: 0; font-size: var(--fs-sm); font-weight: 600; }
.reg-welcome-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 10.5vw, 46px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.reg-welcome-text { margin: 0; max-width: 30ch; font-size: var(--fs-md); font-weight: 500; }
.reg-welcome--done { padding-top: var(--s-8); animation: match-in 420ms var(--ease); }
.reg-welcome--done .btn { margin-top: var(--s-3); }
.reg-welcome-steps { display: flex; flex-direction: column; gap: var(--s-3); margin: var(--s-3) 0 0; padding: 0; list-style: none; counter-reset: step; }
.reg-welcome-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: var(--s-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  counter-increment: step;
}
.reg-welcome-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.reg-howto, .reg-points { display: flex; flex-direction: column; gap: var(--s-3); margin: 0; padding: 0 0 0 var(--s-5); color: var(--ink); }
.reg-points { list-style: none; padding: 0; }
.reg-howto.bubble { padding: var(--s-3) var(--s-4) var(--s-3) calc(var(--s-4) + var(--s-5)); }
.reg-points.bubble { padding: var(--s-3) var(--s-4); }
.reg-points li { position: relative; padding-left: var(--s-5); }
.reg-points li::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

/* The university check: two ways, each a full-width card. */
.methods { display: flex; flex-direction: column; gap: var(--s-3); }
.method {
  display: grid;
  grid-template-columns: 1fr 18px;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 76px;
  padding: var(--s-4) var(--s-5);
  border: 0;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  text-align: left;
}
.method:active { transform: scale(0.99); }
.method:disabled { opacity: 0.55; transform: none; cursor: default; }
.method svg { width: 18px; height: 18px; color: var(--idle); }
.method-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.method-title { color: var(--ink-2); font-size: var(--fs-md); font-weight: 650; }
.method-sub { color: var(--text-3); font-size: var(--fs-sm); }

.input--code { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: 0.4em; text-align: center; }
.input--code::placeholder { letter-spacing: 0.4em; color: var(--field-placeholder); }
.input--age { max-width: 160px; font-size: var(--fs-xl); font-weight: 600; }

/* The photo picker: the file input is visually hidden, its <label> is the big tap area. */
.pick-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pick-input:focus-visible + .pick { box-shadow: var(--focus); }
.pick {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--s-3);
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: min(calc(var(--viewport) * 0.46), 420px);
  border: 2px dashed var(--brand-soft);
  border-radius: var(--r-hero);
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.pick--card { aspect-ratio: 16 / 10; }
.pick:active { background: #E2E4FD; }
.pick-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) center / 22px 2.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2.5px 22px no-repeat,
    var(--surface);
  box-shadow: var(--shadow-1);
}
.pick-label { position: relative; z-index: 1; max-width: 26ch; padding: 0 var(--s-4); }
.pick-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick--chosen { align-content: end; border-style: solid; border-color: transparent; }
.pick--chosen .pick-icon { display: none; }
.pick--chosen .pick-label {
  margin-bottom: var(--s-4);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill);
  background: rgba(14, 15, 49, 0.62);
  color: #FFFFFF;
  font-size: var(--fs-sm);
}

.reg-pending { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3); padding: var(--s-5); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-1); }
.reg-pending-text { margin: 0; color: var(--ink-2); font-weight: 600; }
/* A still clock: a ring and two hands (no motion without a person's action). */
.reg-pending-mark { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--brand-tint); box-shadow: inset 0 0 0 2.5px var(--brand); }
.reg-pending-mark::before, .reg-pending-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2.5px;
  border-radius: 2px;
  background: var(--brand);
  transform-origin: 50% 100%;
}
.reg-pending-mark::before { height: 14px; margin-left: -1.25px; }
.reg-pending-mark::after { height: 10px; margin-left: -1.25px; transform: rotate(120deg); }

.doc-text { margin: 0; color: var(--ink); font-size: var(--fs-sm); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- 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;
  }
  /* js/hero-art.js doesn't animate under reduced motion; should a drawing be in progress, show it whole */
  .hero-art.is-drawing .art-stroke { stroke-dasharray: none; stroke-dashoffset: 0; visibility: visible; }
  .hero-art.is-drawing .art-dot { opacity: 1; }
  .skel { animation: none; }
  .undo-timer { display: none; }
}

/* ---------- «Сообщить о проблеме» (js/report.js) ---------- */

/* The one strong element of the sheet: the emergency number first, calm (no alarm red), then the plain rule. */
.safety {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-row);
  background: var(--brand-tint);
  color: var(--ink-2);
}
.safety-num {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.safety-text { margin: 0; font-size: var(--fs-sm); line-height: 1.4; }
.report-meeting { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: var(--s-3); }
.report .stack-sm > .field-label { margin: 0; }
.report .pick--card { aspect-ratio: 3 / 1; }
.report-done { margin: 0; color: var(--ink-2); font-weight: 600; }

/* Under a meeting in the history: a quiet action, or the number of the report already sent. */
.meeting-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-top: calc(-1 * var(--s-1));
  border-top: 1px solid var(--line);
}
.meeting-report {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.meeting-report:active { color: var(--ink-2); }
.meeting-report:focus-visible { border-radius: var(--r-row); box-shadow: var(--focus); outline: none; }
.meeting-reported { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }
