/* Puzzle Club — токены и компоненты по дизайну «Organic» (claude.ai/design, Puzzle Club).
   Caprasimo и Figtree не знают кириллицы: логотип — Caprasimo, заголовки — Rubik, текст — Nunito. */
:root {
  --color-bg: #f5ead8;
  --color-surface: #ebddc5;
  --color-text: #201e1d;
  --color-accent: #c67139;
  --color-divider: color-mix(in srgb, #201e1d 16%, transparent);

  --color-neutral-100: #f9f4ed;
  --color-neutral-300: #dcd3c4;
  --color-neutral-400: #c0b6a5;
  --color-neutral-700: #645c50;
  --color-neutral-800: #474238;
  --color-neutral-900: #2e2b25;

  --color-accent-100: #fff2eb;
  --color-accent-200: #ffe1d0;
  --color-accent-300: #ffc6a5;
  --color-accent-400: #f6a06b;
  --color-accent-600: #b2622d;
  --color-accent-700: #8c491a;
  --color-accent-800: #643312;
  --color-accent-900: #402310;

  --color-accent-2-100: #f0fae1;
  --color-accent-2-200: #e1eecc;
  --color-accent-2-300: #ccdbb2;
  --color-accent-2-400: #aebf92;
  --color-accent-2-500: #8fa073;
  --color-accent-2-600: #728157;
  --color-accent-2-700: #56633f;
  --color-accent-2-800: #3d472b;
  --color-accent-2-900: #272e1b;

  --font-brand: "Caprasimo", "Rubik", system-ui, sans-serif;
  --font-heading: "Rubik", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;

  --radius-md: 16px;
  --radius-lg: 28px;
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2e2b25 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2e2b25 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2e2b25 22%, transparent);
  --ease-pop: cubic-bezier(.3, 1.3, .5, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--color-accent-2-100);
  color: var(--color-accent-2-900);
  font: 400 15px/1.55 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; line-height: 1.08; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-800); }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
[hidden] { display: none !important; }

.brand { font-family: var(--font-brand); font-size: 24px; color: inherit; text-decoration: none; letter-spacing: 0; }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--color-accent-700); }
.muted { color: var(--color-accent-2-800); }

/* — кнопки — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  cursor: pointer; text-decoration: none; border: 1px solid transparent; border-radius: 999px;
  font: 600 15px/1.2 var(--font-heading); padding: 10px 18px; background: transparent; color: var(--color-text);
  transition: background-color .15s, color .15s, transform .15s var(--ease-pop);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); color: var(--color-bg); }
.btn-olive { background: var(--color-accent-2-700); color: var(--color-accent-2-100); }
.btn-olive:hover { background: var(--color-accent-2-800); color: var(--color-accent-2-100); }
.btn-ghost { color: var(--color-accent-700); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-soft { background: var(--color-accent-2-200); color: var(--color-accent-2-800); }
.btn-soft:hover { background: var(--color-accent-2-300); }
.btn-soft[aria-pressed="true"] { background: var(--color-accent-2-700); color: var(--color-accent-2-100); }
.btn-lg { padding: 12px 24px; font-size: 16px; }

.input {
  width: 100%; min-height: 44px; padding: 8px 16px; font-size: 15px; color: var(--color-text);
  caret-color: var(--color-accent); background: var(--color-bg);
  border: 1px solid var(--color-divider); border-radius: 999px;
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.field-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--color-neutral-700); }

.tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-olive { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }

.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font: 700 14px var(--font-body); background: var(--color-accent-400); color: var(--color-accent-900);
}

/* Переключатель-«пилюля» (фильтры в дизайне) */
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--color-accent-2-200); border-radius: 999px; padding: 4px; }
.pills button {
  border: 0; cursor: pointer; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px;
  background: transparent; color: var(--color-accent-2-800);
}
.pills button:hover { background: var(--color-accent-2-300); }
.pills button[aria-pressed="true"] { background: var(--color-accent-2-700); color: var(--color-accent-2-100); }

.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 3px solid var(--color-bg); box-shadow: 0 0 0 1px var(--color-divider);
  transition: transform .15s var(--ease-pop);
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-accent-2-800); }

/* ---------- главная ---------- */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 32px 72px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 24px 0; gap: 16px; flex-wrap: wrap; }
.nav-links { display: flex; gap: 24px; font-size: 15px; font-weight: 700; align-items: center; flex-wrap: wrap; }
.nav-links a:not(.btn) { color: inherit; text-decoration: none; }
.nav-links a:not(.btn):hover { color: var(--color-accent-700); }

.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 48px; align-items: center; padding: 40px 0 72px; }
.hero-copy { display: flex; flex-direction: column; gap: 16px; max-width: 500px; }
.hero h1 { font-size: clamp(42px, 7vw, 64px); line-height: 1.02; }
.hero-copy > p { font-size: 18px; color: var(--color-accent-2-800); }
.hero-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.hero-art { position: relative; justify-self: center; width: 100%; max-width: 420px; aspect-ratio: 1; }
.hero-art .disc { position: absolute; inset: 0; border-radius: 50%; background: var(--color-accent-2-200); }
.hero-art .tiles { position: absolute; inset: 14%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hero-art .badge {
  position: absolute; right: 2%; bottom: 10%; background: var(--color-bg); border-radius: 999px; padding: 10px 16px;
  box-shadow: var(--shadow-md); display: flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 700; color: var(--color-text);
}
.hero-art .badge .avatar { width: 28px; height: 28px; font-size: 11px; }

.section { display: flex; flex-direction: column; gap: 24px; padding-bottom: 80px; scroll-margin-top: 16px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head > div { display: flex; flex-direction: column; gap: 6px; }
.section-head > .pills { flex-direction: row; gap: 4px; }
.section h2 { font-size: clamp(30px, 5vw, 40px); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.step { background: var(--color-accent-2-200); border-radius: var(--radius-lg); padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.step .num {
  width: 52px; height: 52px; border-radius: 50%; background: var(--color-accent-2-700); color: var(--color-accent-2-100);
  display: grid; place-items: center; font: 600 24px var(--font-heading);
}
.step h3 { font-size: 24px; }
.step p { color: var(--color-accent-2-800); }
.step.warm { background: var(--color-accent-200); }
.step.warm .num { background: var(--color-accent); color: var(--color-bg); }
.step.warm p { color: var(--color-accent-800); }

/* Полка картин + панель создания */
.create { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 18px; }
.pz {
  display: flex; flex-direction: column; gap: 10px; text-align: left; cursor: pointer; border: 0;
  background: var(--color-accent-2-200); border-radius: var(--radius-lg); padding: 12px 12px 16px;
  transition: box-shadow .2s, background-color .2s, transform .2s var(--ease-pop);
}
.pz:hover { box-shadow: var(--shadow-md); }
.pz[aria-pressed="true"] { background: var(--color-bg); box-shadow: 0 0 0 3px var(--color-accent), var(--shadow-md); }
.pz .arch { aspect-ratio: 4 / 3; border-radius: 999px 999px 16px 16px; overflow: hidden; background: var(--color-accent-2-300); display: grid; place-items: center; }
.pz .arch img { width: 100%; height: 100%; object-fit: cover; }
.pz .meta { padding: 0 4px; display: flex; flex-direction: column; gap: 6px; }
.pz .title { font-weight: 800; font-size: 16px; line-height: 1.25; }
.pz .sub { font-size: 13px; color: var(--color-accent-2-800); }
.pz.upload .arch { background: var(--color-bg); border: 2px dashed var(--color-accent-2-400); color: var(--color-accent-2-700); font: 600 34px var(--font-heading); }

.panel {
  position: sticky; top: 16px; background: var(--color-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 24px; display: flex; flex-direction: column; gap: 18px; color: var(--color-text);
}
.panel .pick { display: flex; gap: 14px; align-items: center; }
.panel .pick .thumb { flex: none; width: 72px; height: 72px; border-radius: 999px 999px 14px 14px; overflow: hidden; background: var(--color-surface); }
.panel .pick .thumb img { width: 100%; height: 100%; object-fit: cover; }
.panel .pick h3 { font-size: 22px; }
.panel .pick span { font-size: 14px; color: var(--color-neutral-700); }
.err { color: #a3361b; font-size: 14px; font-weight: 700; min-height: 1.2em; }

/* Недавние лобби — строки как «Your circle» */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-lg);
  color: inherit; text-decoration: none; transition: background-color .2s;
}
.row:hover { background: var(--color-bg); box-shadow: var(--shadow-sm); color: inherit; }
.row .thumb { flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--color-accent-2-300); position: relative; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row .name { font-weight: 800; font-size: 16px; }
.row .rstatus { font-size: 14px; color: var(--color-accent-2-800); }
.row .rbar { height: 6px; border-radius: 999px; background: var(--color-accent-2-200); overflow: hidden; margin-top: 2px; }
.row .rbar div { height: 100%; border-radius: 999px; background: var(--color-accent); }
.row .big { flex: none; font: 600 22px var(--font-heading); color: var(--color-accent-2-700); }

/* FAQ */
.faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 40px; padding: 16px 0 0; align-items: start; scroll-margin-top: 16px; }
.faq-intro { display: flex; flex-direction: column; gap: 6px; max-width: 360px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--color-bg); border-radius: var(--radius-lg); color: var(--color-text); overflow: hidden; }
.faq-item button {
  width: 100%; border: 0; background: transparent; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; gap: 16px; padding: 18px 22px; font-size: 16px; font-weight: 800; text-align: left;
}
.faq-item button span {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--color-accent-2-200);
  color: var(--color-accent-2-800); display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.faq-item p { padding: 0 22px 20px; font-size: 15px; color: var(--color-neutral-800); }

/* Зелёный блок призыва */
.join {
  margin-top: 96px; background: var(--color-accent-2-700); color: var(--color-accent-2-100); border-radius: 48px; padding: 48px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 32px; align-items: center;
  position: relative; overflow: hidden;
}
.join::before { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: var(--color-accent-2-600); }
.join > * { position: relative; }
.join h2 { font-size: clamp(32px, 5vw, 44px); color: var(--color-accent-2-100); }
.join p { font-size: 16px; color: var(--color-accent-2-200); margin-top: 10px; }
.join-form { display: flex; gap: 8px; background: var(--color-bg); border-radius: 999px; padding: 6px; flex-wrap: wrap; }
.join-form .input { flex: 1; min-width: 160px; border: 0; background: transparent; }

.footer { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; padding-top: 64px; }
.footer .cols { display: flex; gap: 56px; flex-wrap: wrap; font-size: 14px; }
.footer .cols div { display: flex; flex-direction: column; gap: 8px; }
.footer .cols a { color: var(--color-accent-2-800); text-decoration: none; }
.footer .cols a:hover { color: var(--color-accent-700); }

@media (max-width: 860px) {
  .create { grid-template-columns: 1fr; }
  .panel { position: static; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px 56px; }
  .nav-links { gap: 14px; }
  .nav-links a:not(.btn) { display: none; }
  .hero { padding: 16px 0 56px; gap: 32px; }
  .join { padding: 32px 22px; border-radius: 32px; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pz { padding: 8px 8px 12px; border-radius: 22px; }
  .pz .title { font-size: 14px; }
  .nav { padding: 16px 0; }
}

/* ---------- игра ---------- */
body.play { overflow: hidden; background: var(--color-accent-2-300); height: 100dvh; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: grab; }
#cv.dragging { cursor: grabbing; }
.play .bar {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 2;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: color-mix(in srgb, var(--color-bg) 94%, transparent); backdrop-filter: blur(8px);
  border-radius: 999px; padding: 8px 8px 8px 20px; box-shadow: var(--shadow-md); color: var(--color-text);
}
.play .bar .brand { font-size: 20px; }
.play .bar .title { font-weight: 700; color: var(--color-neutral-700); max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play .bar .btn { padding: 8px 14px; font-size: 14px; }
.progress { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--color-accent-2-800); font-variant-numeric: tabular-nums; }
.progress .track { width: 90px; height: 6px; border-radius: 999px; background: var(--color-accent-2-200); overflow: hidden; }
.progress .track div { height: 100%; width: 0; border-radius: 999px; background: var(--color-accent); transition: width .5s ease-out; }
.players { display: flex; gap: 4px; }
.players .avatar { width: 32px; height: 32px; font-size: 12px; color: #fff; border: 2px solid var(--color-bg); margin-left: -8px; }
.players .avatar:first-child { margin-left: 0; }
.spacer { flex: 1; }
.preview {
  position: fixed; right: 12px; bottom: 12px; z-index: 2; max-width: min(320px, 45vw); max-height: 40vh;
  border-radius: 999px 999px 18px 18px; border: 6px solid var(--color-bg); box-shadow: var(--shadow-lg);
}
.play .status {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; color: var(--color-text);
  background: var(--color-bg); border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow-md); font-weight: 700;
}
.play .status:empty { display: none; }
#toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%) translateY(-6px); z-index: 4; pointer-events: none;
  background: var(--color-accent-2-800); color: var(--color-accent-2-100); border-radius: 999px; padding: 8px 16px; font-weight: 700;
  opacity: 0; transition: opacity .2s, transform .3s var(--ease-pop);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
dialog {
  border: 0; border-radius: 32px; background: var(--color-surface); color: var(--color-text);
  padding: 24px; width: min(400px, calc(100vw - 32px)); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent); }
dialog form { display: grid; gap: 14px; }
dialog h2 { font-size: 26px; }
.done {
  position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--color-neutral-900) 40%, transparent);
}
.done .card {
  width: min(420px, 100%); background: var(--color-bg); border-radius: 32px; padding: 28px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px; text-align: center; color: var(--color-text);
  animation: pop .45s var(--ease-pop);
}
.done h2 { font-size: 34px; }
.done .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.done .stat { background: var(--color-accent-2-100); border-radius: var(--radius-md); padding: 12px 14px; text-align: left; }
.done .stat b { display: block; font: 600 24px var(--font-heading); color: var(--color-accent-2-800); }
.done .stat span { font-size: 13px; color: var(--color-accent-2-800); }
.done .stat.warm { background: var(--color-accent-100); }
.done .stat.warm b { color: var(--color-accent-700); }
.done .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@media (max-width: 640px) {
  .play .bar { top: 6px; left: 6px; right: 6px; gap: 6px; padding: 6px 6px 6px 14px; border-radius: 26px; }
  .play .bar .title, .progress .track { display: none; }
  .play .bar .brand { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- аккаунт, друзья, уведомления ---------- */
.small { font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--color-accent-700); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.avatar { position: relative; border: 0; padding: 0; }
.avatar .dot {
  position: absolute; right: -1px; bottom: -1px; width: 28%; height: 28%; min-width: 10px; min-height: 10px;
  border-radius: 50%; background: var(--color-neutral-400); border: 3px solid var(--color-accent-2-100);
}
.avatar .dot.on { background: var(--color-accent); }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--color-accent-2-300); }

dialog .dlg-x {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--color-accent-2-200); color: var(--color-accent-2-800); font-size: 22px; line-height: 1; cursor: pointer;
}
dialog .dlg-x:hover { background: var(--color-accent-2-300); }

.auth-dlg form, .invite-dlg[open], .player-dlg[open] { display: grid; gap: 12px; }
.auth-dlg h2, .invite-dlg h2, .player-dlg h2 { font-size: 26px; padding-right: 36px; }
.auth-dlg .input.code { font: 600 28px var(--font-heading); letter-spacing: .4em; text-align: center; padding-left: calc(16px + .4em); }
.row-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.row-links .btn { font-size: 14px; padding: 6px 10px; }
.at-input { position: relative; }
.at-input span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--color-neutral-700); font-weight: 700; }
.at-input .input { padding-left: 32px; }
.share-row { display: flex; gap: 8px; align-items: center; background: var(--color-bg); border-radius: 999px; padding: 4px 4px 4px 16px; }
.share-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px var(--font-body); color: var(--color-accent-2-800); }

.tray { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.notice {
  background: var(--color-bg); color: var(--color-text); border-radius: 22px; padding: 14px 18px; box-shadow: var(--shadow-lg);
  font-weight: 700; animation: pop .4s var(--ease-pop); transition: opacity .25s, transform .25s;
}
.notice.leaving { opacity: 0; transform: translateY(8px); }
.notice-actions { display: flex; gap: 8px; margin-top: 10px; }
.notice-actions .btn { padding: 8px 14px; font-size: 14px; }

.whoami { display: flex; gap: 12px; align-items: center; background: var(--color-accent-2-100); border-radius: 999px; padding: 6px 16px 6px 6px; }
.whoami .field-label { margin: 0; }
.whoami b { font-size: 15px; }

.teaser {
  display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--color-accent-2-200); border-radius: var(--radius-lg); padding: 26px;
}
.teaser h3 { font-size: 24px; margin-bottom: 6px; }
.teaser p { max-width: 520px; }

.circle { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 24px; align-items: start; }
.circle-list { display: flex; flex-direction: column; gap: 10px; }
button.row { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.friend-row[aria-pressed="true"] { background: var(--color-bg); box-shadow: var(--shadow-sm); }
.row .name small { font-weight: 600; color: var(--color-accent-2-700); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn { padding: 8px 14px; font-size: 14px; }
.rows .empty { padding: 14px 16px; }
.add-friend {
  border-radius: 999px; padding: 12px; border: 2px dashed var(--color-accent-2-400); background: transparent;
  color: var(--color-accent-2-800); font: 600 15px var(--font-heading); cursor: pointer;
}
.add-friend:hover { background: var(--color-accent-2-200); }
.add-form { display: grid; gap: 10px; background: var(--color-accent-2-200); border-radius: var(--radius-lg); padding: 16px; }
.add-form .err { min-height: 0; }

.friend-panel h3 { font-size: 26px; }
.friend-panel .pick span { font-size: 14px; color: var(--color-neutral-700); }
.panel-empty { display: grid; gap: 8px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats3 .stat { background: var(--color-accent-2-100); border-radius: var(--radius-md); padding: 12px 14px; }
.stats3 .stat b { display: block; font: 600 24px var(--font-heading); color: var(--color-accent-2-800); }
.stats3 .stat span { font-size: 13px; color: var(--color-accent-2-800); }
.stats3 .stat.warm { background: var(--color-accent-100); }
.stats3 .stat.warm b { color: var(--color-accent-700); }
.lobby-card { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px; border-radius: var(--radius-md); background: var(--color-surface); }
.lobby-card .thumb { flex: none; width: 56px; height: 56px; border-radius: 999px 999px 12px 12px; overflow: hidden; }
.lobby-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lobby-card > div { flex: 1; min-width: 140px; display: flex; flex-direction: column; }
.small-btn { font-size: 13px; padding: 6px 10px; justify-self: start; align-self: flex-start; }

.join .share-link { color: var(--color-accent-2-800); padding-left: 12px; }

.invite-dlg { width: min(440px, calc(100vw - 32px)); }
.invite-list { display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.invite-row { display: flex; gap: 12px; align-items: center; background: var(--color-bg); border-radius: 999px; padding: 6px 6px 6px 8px; }
.invite-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.invite-row .btn { padding: 8px 14px; font-size: 14px; }
.player-dlg .pick { display: flex; gap: 14px; align-items: center; }
.play .players .avatar { cursor: pointer; }

/* ---------- общие добавки: навигация, кнопки, переключатель ---------- */
.nav-links a[aria-current="page"] { color: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-accent-2-400); color: var(--color-accent-2-800); background: transparent; }
.btn-secondary:hover { background: var(--color-accent-2-200); color: var(--color-accent-2-900); }
.btn-ghost-light { color: var(--color-accent-2-100); border-color: color-mix(in srgb, var(--color-accent-2-100) 40%, transparent); }
.btn-ghost-light:hover { background: var(--color-accent-2-600); color: var(--color-accent-2-100); }
.kicker.olive { color: var(--color-accent-2-700); }
.kicker.light { color: var(--color-accent-300); }
.center { text-align: center; }
.switch { flex: none; border: 0; cursor: pointer; width: 50px; height: 30px; border-radius: 999px; padding: 3px; display: flex; justify-content: flex-start; background: var(--color-neutral-300); transition: background-color .2s; }
.switch span { width: 24px; height: 24px; border-radius: 50%; background: var(--color-bg); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease-pop); }
.switch.on { background: var(--color-accent-2-600); }
.switch.on span { transform: translateX(20px); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toggle-row > div { display: flex; flex-direction: column; }
.dlg-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dlg-actions .btn-lg, .dlg-actions .btn-primary { flex: 1; }
.side-card { background: var(--color-bg); color: var(--color-text); border-radius: 32px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- страница «Играть» ---------- */
.modes-layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; padding-top: 16px; }
.modes-main { flex: 1 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.modes-aside { flex: 0 1 330px; min-width: min(280px, 100%); display: flex; flex-direction: column; gap: 16px; }
.race-hero {
  position: relative; overflow: hidden; background: var(--color-accent-2-700); color: var(--color-accent-2-100);
  border-radius: 40px; padding: 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 24px; align-items: center;
}
.race-hero::before { content: ""; position: absolute; right: -70px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: var(--color-accent-2-600); }
.race-hero > * { position: relative; }
.race-hero-copy { display: flex; flex-direction: column; gap: 10px; }
.race-hero h1 { font-size: clamp(36px, 6vw, 48px); line-height: 1.02; color: var(--color-accent-2-100); }
.race-hero p { color: var(--color-accent-2-200); }
.race-hero-art { justify-self: center; width: 180px; height: 220px; border-radius: 999px 999px 28px 28px; background: center/cover; box-shadow: var(--shadow-lg); }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 16px; }
.mode-card {
  text-align: left; cursor: pointer; border: 0; font: inherit; color: inherit; text-decoration: none;
  border-radius: 32px; padding: 24px; display: flex; flex-direction: column; gap: 10px; min-height: 190px;
  transition: box-shadow .2s, transform .2s var(--ease-pop);
}
.mode-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
.mode-card .shape { width: 56px; height: 56px; }
.mode-card .mode-title { font: 600 28px var(--font-heading); }
.mode-card .mode-desc { font-size: 14px; line-height: 1.4; opacity: .9; }
.mode-card .mode-meta { margin-top: auto; font-size: 13px; font-weight: 800; }
.mode-card.race { background: var(--color-bg); }
.mode-card.race .shape { border-radius: 50%; background: var(--color-accent); }
.mode-card.together { background: var(--color-accent-2-200); }
.mode-card.together .shape { border-radius: 999px 999px 16px 16px; background: var(--color-accent-2-500); }
.mode-card.ranks { background: var(--color-accent); color: var(--color-bg); }
.mode-card.ranks:hover { color: var(--color-bg); }
.mode-card.ranks .shape { border-radius: 20px; background: var(--color-accent-200); }
.code-form { display: flex; gap: 8px; background: var(--color-accent-2-100); border-radius: 999px; padding: 5px; }
.code-form .input { flex: 1; min-width: 0; border: 0; background: transparent; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.online-list { display: flex; flex-direction: column; gap: 6px; }
.online-row { display: flex; align-items: center; gap: 12px; padding: 4px; }
.online-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.online-row > div span { font-size: 12px; color: var(--color-neutral-700); }
.league-card { background: var(--color-accent-200); color: var(--color-accent-900); border-radius: 32px; padding: 22px; display: flex; align-items: center; gap: 16px; }
.league-card .league-pts { flex: none; min-width: 64px; height: 64px; padding: 0 10px; border-radius: 999px; background: var(--color-accent); color: var(--color-bg); display: grid; place-items: center; font: 600 24px var(--font-heading); }
.league-card > div { display: flex; flex-direction: column; font-size: 13px; }
.league-card b { font-size: 16px; }
.setup-dlg { width: min(500px, calc(100vw - 32px)); border-radius: 40px; padding: 28px; }
.setup-dlg[open] { display: flex; flex-direction: column; gap: 16px; }
.setup-dlg h2 { font-size: 30px; padding-right: 36px; }
.pic-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; }
.pic { flex: none; width: 84px; border: 0; padding: 4px; border-radius: 18px; background: var(--color-surface); cursor: pointer; display: flex; flex-direction: column; gap: 4px; scroll-snap-align: start; color: inherit; }
.pic img, .pic.random span { width: 76px; height: 64px; border-radius: 999px 999px 10px 10px; object-fit: cover; display: grid; place-items: center; }
.pic.random span { background: var(--color-accent-2-300); font: 600 26px var(--font-heading); color: var(--color-accent-2-800); }
.pic small { font-size: 11px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pic[aria-pressed="true"] { background: var(--color-accent-2-700); color: var(--color-accent-2-100); }

/* ---------- страница «Рейтинг» ---------- */
.ranks-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 16px 0 28px; }
.ranks-head h1 { font-size: clamp(34px, 6vw, 52px); margin-top: 6px; }
.ranks-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.ranks-layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.ranks-main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ranks-aside { flex: 0 1 330px; min-width: min(280px, 100%); display: flex; flex-direction: column; gap: 16px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; padding-top: 10px; }
.podium:empty { display: none; }
.pod { border: 0; background: none; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 0 1 170px; }
.pod .avatar { box-shadow: 0 0 0 4px var(--color-accent-2-100), 0 0 0 7px var(--color-accent-2-400); }
.pod-1 .avatar { box-shadow: 0 0 0 4px var(--color-accent-2-100), 0 0 0 7px var(--color-accent); }
.pod-name { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.pod-name span { font-size: 13px; color: var(--color-accent-2-800); }
.pod-block { width: 100%; border-radius: 24px 24px 8px 8px; display: grid; place-items: center; font: 600 34px var(--font-heading); background: var(--color-accent-2-300); color: var(--color-accent-2-900); }
.pod-1 .pod-block { height: 150px; background: var(--color-accent); color: var(--color-bg); }
.pod-2 .pod-block { height: 110px; }
.pod-3 .pod-block { height: 84px; }
.rank-table { display: flex; flex-direction: column; background: var(--color-bg); border-radius: 32px; padding: 8px; }
.rank-table:empty { display: none; }
.rank-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 70px 70px 90px; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 20px; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rank-table.time .rank-row { grid-template-columns: 40px minmax(0, 1fr) 70px 90px; }
.rank-row:hover { background: var(--color-accent-2-100); }
.rank-row.head { cursor: default; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-700); }
.rank-row.head:hover { background: none; }
.rank-row.me { background: var(--color-accent-100); }
.rank-row .rk { font: 600 18px var(--font-heading); color: var(--color-accent-2-700); text-align: center; }
.rank-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank-row .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .pts { text-align: right; font: 600 17px var(--font-heading); color: var(--color-accent-2-800); }
.ranks-main .empty { background: var(--color-accent-2-200); border-radius: 28px; padding: 26px; text-align: center; }
.division { position: relative; overflow: hidden; background: var(--color-accent-2-700); color: var(--color-accent-2-100); border-radius: 32px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.division[hidden] { display: none; }
.division::before { content: ""; position: absolute; right: -50px; top: -50px; width: 160px; height: 160px; border-radius: 50%; background: var(--color-accent-2-600); }
.division > * { position: relative; }
.division h2 { font-size: 30px; color: var(--color-accent-2-100); }
.div-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.div-bar { height: 10px; border-radius: 999px; background: var(--color-accent-2-800); overflow: hidden; }
.div-bar div { height: 100%; border-radius: 999px; background: var(--color-accent-300); transition: width .8s ease-out; }
.leagues { display: flex; flex-direction: column; gap: 8px; }
.league-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.league-row i { width: 14px; height: 14px; border-radius: 50%; }
.league-row b { flex: 1; }
.league-row span { color: var(--color-neutral-700); font-size: 13px; }
.league-row.l0 i { background: var(--color-accent); }
.league-row.l1 i { background: var(--color-accent-2-500); }
.league-row.l2 i { background: var(--color-accent-2-300); }
.league-row.l3 i { background: var(--color-neutral-300); }
.recent { display: flex; flex-direction: column; gap: 8px; }
.match { display: flex; align-items: center; gap: 10px; }
.match .place { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 600 15px var(--font-heading); background: var(--color-accent-2-200); }
.match .place.win { background: var(--color-accent); color: var(--color-bg); }
.match > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.match > div span { font-size: 12px; color: var(--color-neutral-700); }
.match .delta { font-weight: 800; color: var(--color-accent-2-700); }
.how p { margin: 0; }
@media (max-width: 560px) {
  .rank-row { grid-template-columns: 30px minmax(0, 1fr) 0 50px 64px; }
  .rank-row > :nth-child(3) { visibility: hidden; }
  .rank-table.time .rank-row { grid-template-columns: 30px minmax(0, 1fr) 0 70px; }
  .podium { gap: 6px; }
}

/* ---------- игра: панель, комната ожидания, отсчёт, итоги ---------- */
.mode-kicker { white-space: nowrap; }
.side { position: fixed; right: 12px; top: 76px; bottom: 12px; z-index: 2; width: 320px; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.side > * { pointer-events: auto; }
.side-toggle { align-self: flex-end; display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; border-radius: 999px; padding: 9px 16px; font: 800 13px var(--font-body); background: var(--color-accent-2-700); color: var(--color-accent-2-100); box-shadow: var(--shadow-md); }
.side-toggle span { display: inline-block; transition: transform .3s; }
.side[data-open="false"] .side-toggle span { transform: rotate(180deg); }
.side-body { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; padding: 2px; }
.side[data-open="false"] .side-body { display: none; }
.side .side-card { padding: 18px; gap: 12px; box-shadow: var(--shadow-md); border-radius: 28px; }
.clock-row { display: flex; justify-content: space-between; align-items: baseline; }
.clock { font: 600 42px/1 var(--font-heading); color: var(--color-accent-2-900); font-variant-numeric: tabular-nums; }
.count { font-size: 14px; font-weight: 800; color: var(--color-accent-2-800); }
.side-bar { height: 10px; border-radius: 999px; background: var(--color-accent-2-200); overflow: hidden; }
.side-bar div { height: 100%; width: 0; border-radius: 999px; background: var(--color-accent); transition: width .4s ease; }
.side-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-btns .btn { padding: 10px; font-size: 14px; }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; }
.reactions button { flex: 1; border: 1px solid var(--color-accent-2-300); background: transparent; cursor: pointer; border-radius: 999px; padding: 7px 10px; font: 700 13px var(--font-body); color: var(--color-accent-2-800); white-space: nowrap; }
.reactions button:hover { background: var(--color-accent-2-100); }
.list-head { display: flex; justify-content: space-between; align-items: center; }
.standings-live { display: flex; flex-direction: column; gap: 4px; }
.live-row { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 18px; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.live-row.me { background: var(--color-accent-100); }
.live-row .rk { flex: none; width: 20px; text-align: center; font: 600 17px var(--font-heading); color: var(--color-accent-2-700); }
.live-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.live-row .line { display: flex; justify-content: space-between; gap: 8px; }
.live-row .line b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-row .line span { font-size: 12px; color: var(--color-neutral-700); white-space: nowrap; }
.live-row .rbar { height: 6px; border-radius: 999px; background: var(--color-accent-2-200); overflow: hidden; }
.live-row .rbar div { height: 100%; border-radius: 999px; background: var(--color-accent); transition: width .6s ease; }
.live-row .rbar div.other { background: var(--color-accent-2-500); }
.leave { align-self: stretch; text-align: center; background: var(--color-bg); }
.side-mini { display: none; align-self: flex-end; flex-direction: column; align-items: center; gap: 8px; border: 0; cursor: pointer; font: inherit; color: var(--color-text); background: var(--color-bg); border-radius: 999px; padding: 14px 8px; box-shadow: var(--shadow-md); width: 64px; }
.side[data-open="false"] .side-mini { display: flex; }
.side-mini .clock { font-size: 17px; }
.side-mini .count { font-size: 11px; }
.side-mini .mini-bar { width: 8px; height: 70px; border-radius: 999px; background: var(--color-accent-2-200); display: flex; flex-direction: column-reverse; overflow: hidden; }
.side-mini .mini-bar span { display: block; border-radius: 999px; background: var(--color-accent); }
.side-mini .rank-mini { font: 600 15px var(--font-heading); color: var(--color-accent-2-700); }
.side-mini .rank-mini:empty { display: none; }
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: 4; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 110px); }
.toast { display: flex; align-items: center; gap: 10px; width: fit-content; background: var(--color-bg); color: var(--color-text); border-radius: 999px; padding: 8px 16px 8px 8px; box-shadow: var(--shadow-md); font-size: 14px; font-weight: 700; }
.overlay { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--color-accent-2-900) 45%, transparent); }
.overlay[hidden] { display: none; }
.modal-card { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--color-bg); color: var(--color-text); border-radius: 40px; box-shadow: var(--shadow-lg); padding: 30px; display: flex; flex-direction: column; gap: 16px; animation: pop .45s var(--ease-pop); }
.modal-card h2 { font-size: clamp(28px, 6vw, 38px); }
.lobby-mode { display: flex; flex-direction: column; gap: 2px; background: var(--color-accent-2-700); color: var(--color-accent-2-100); border-radius: 24px; padding: 14px 18px; }
.lobby-mode span { font-size: 13px; opacity: .9; }
.lobby-players { display: flex; gap: 14px; flex-wrap: wrap; min-height: 76px; }
.lp { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; font-size: 12px; font-weight: 700; text-align: center; }
.lp.host .avatar { box-shadow: 0 0 0 3px var(--color-bg), 0 0 0 5px var(--color-accent); }
.lp.waiting i { width: 48px; height: 48px; border-radius: 50%; border: 2px dashed var(--color-accent-2-400); }
.lp.waiting span { color: var(--color-neutral-700); }
.countdown { background: color-mix(in srgb, var(--color-accent-2-900) 35%, transparent); pointer-events: none; }
.countdown span { width: 220px; height: 220px; border-radius: 50%; background: var(--color-accent); color: var(--color-bg); display: grid; place-items: center; font: 600 clamp(48px, 14vw, 100px) var(--font-heading); box-shadow: var(--shadow-lg); text-align: center; }
.standings { display: flex; flex-direction: column; gap: 6px; }
.st-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 10px; border-radius: 999px; background: var(--color-accent-2-100); }
.st-row.me { background: var(--color-accent-100); }
.st-row .rk { width: 22px; font: 600 18px var(--font-heading); color: var(--color-accent-2-700); text-align: center; }
.st-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.st-row span:last-child { font-size: 14px; color: var(--color-neutral-800); white-space: nowrap; }
.play .preview { right: auto; left: 16px; bottom: auto; top: 76px; }
@media (max-width: 899px) {
  .side { top: auto; width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - 100px); }
  .side[data-open="true"] .side-body { background: color-mix(in srgb, var(--color-accent-2-300) 70%, transparent); border-radius: 30px; padding: 6px; }
  .play .bar .mode-kicker { display: none; }
}
