/* ============================================================
   Редизайн Belotche — social. Зарежда се след screens.css и games.css.
   Екрани: Социални (#/friends), Игра с приятели (#/room), Класация,
   Турнири, Правила, Сподели. Figma: 11, 49, 12, 34, 27, 25, 26, 33.
   Движението е само transform/opacity/box-shadow и спира с
   html[data-motion="off"] (base.css) — нищо не носи смисъл само чрез него.
   ============================================================ */

/* Иконки, които ги няма в общия комплект: копиране (Figma „Иконка копирай")
   и боите като маска, за да приемат цвета на текста. */
.bi-copy   { --bi: url(../assets/brand/social/copy.svg); }
.bi-suit-s { --bi: url(../assets/brand/suits/S.svg); }
.bi-suit-h { --bi: url(../assets/brand/suits/H.svg); }
.bi-suit-d { --bi: url(../assets/brand/suits/D.svg); }
.bi-suit-c { --bi: url(../assets/brand/suits/C.svg); }

/* ============================================================
   ОБЩИ — заглавие с бутон, табове-хапчета, бележка, „Копирано"
   ============================================================ */
.sx-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; min-height: 40px; }
.sx-head h1, .sx-head h2 { margin: 0; }
.sx-head h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.3px; }
.sx-head h2 { font-size: 1.375rem; line-height: 1.27; letter-spacing: -.2px; }
.sx-sub { color: var(--text-dim); font-size: .8125rem; font-weight: 600; }
.sx-head .btn { flex: none; }
/* Figma „Бутон · back / search / plus": 40 px, радиус 14, повърхност */
.sx-ib { width: 40px; height: 40px; border-radius: 14px; background: var(--surface); font-size: 20px; }
.sx-ib[aria-expanded="true"] { border-color: var(--brand); color: var(--brand); }

/* Табове като хапчета (Figma „Таб", 57:37) */
.sx-tabs, .soc-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.sx-tabs::-webkit-scrollbar, .soc-tabs::-webkit-scrollbar { display: none; }
.sx-tabs button, .soc-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim);
  font-weight: 700; font-size: .8125rem; cursor: pointer;
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.sx-tabs button:active, .soc-tab:active { transform: scale(.95); }
.sx-tabs button[aria-pressed="true"], .soc-tab[aria-pressed="true"] {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: var(--glow-sm);
}
.sx-count { min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: .6875rem; line-height: 18px; text-align: center;
  background: var(--brand); color: var(--brand-ink); }
[aria-pressed="true"] > .sx-count { background: var(--brand-ink); color: var(--brand); }

.sx-h { font-size: 1.125rem; margin: 22px 0 10px; }
.sx-lead { margin: -6px 0 16px; color: var(--text-dim); font-size: .875rem; line-height: 1.5; }

/* „Също важи" — лаймова бележка (Figma 33) */
.sx-note { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-radius: 18px;
  background: var(--brand-soft); border: 1px solid var(--brand-line); }
.sx-note p { margin: 0; color: var(--text); }
.sx-note .btn { margin-top: 6px; }

/* Празно състояние с икона вместо емоджи */
.sx-empty, .soc-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 26px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px dashed var(--line-2);
}
.sx-empty p, .soc-empty p { margin: 0; }
.sx-empty-ic, .soc-empty-ic {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 26px;
  animation: popIn var(--dur-3) var(--ease-spring) both, floatY 4.5s ease-in-out .4s infinite;
}

/* Копирано: картата светва в лайм, а над нея изскача етикет */
.sx-flash { animation: sxCopied .8s var(--ease-out); }
@keyframes sxCopied {
  0%   { box-shadow: 0 0 0 0 rgba(95,208,114,.55); }
  100% { box-shadow: 0 0 0 16px rgba(95,208,114,0); }
}
.sx-copied {
  position: absolute; top: -11px; right: 14px; z-index: 2; pointer-events: none;
  padding: 3px 10px; border-radius: var(--r-pill); background: var(--brand); color: var(--brand-ink);
  font-size: .6875rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; box-shadow: var(--glow-sm);
  animation: sxTag 1.4s var(--ease-out) forwards;
}
@keyframes sxTag {
  0%   { opacity: 0; transform: translateY(8px) scale(.6); }
  14%  { opacity: 1; transform: translateY(0) scale(1.08); }
  24%  { transform: none; }
  78%  { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ============================================================
   СОЦИАЛНИ (#/friends) — Figma 11 и 49
   ============================================================ */
.soc-search { display: flex; align-items: center; gap: 10px; margin: -6px 0 12px; }
.soc-search:not([hidden]) { animation: dropIn var(--dur-3) var(--ease-out) both; }
.soc-search .bi { color: var(--text-dim); font-size: 20px; }
.soc-search .input { flex: 1; min-width: 0; }

.soc-tabs { margin-bottom: 14px; }
.soc-tab { flex: 1 1 auto; justify-content: center; padding: 0 12px; gap: 5px; }
.soc-tab[aria-disabled="true"] { color: var(--text-mut); }
.soc-soon { padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-dim);
  font-size: .5625rem; letter-spacing: 1px; text-transform: uppercase; line-height: 14px; }

/* Лаймовата карта „Покани приятел" */
.soc-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  padding: 14px 12px 14px 16px; border: 0; border-radius: var(--r-lg);
  background: var(--brand); color: var(--brand-ink); box-shadow: var(--glow);
  animation: riseIn var(--dur-4) var(--ease-out) both;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.soc-hero:active { transform: scale(.98); }
@media (hover: hover) { .soc-hero:hover { box-shadow: 0 0 34px rgba(222,255,0,.6); } }
.soc-hero-ic, .soc-hero-sh { flex: none; display: grid; place-content: center; background: var(--bg); color: var(--brand); }
.soc-hero-ic { width: 42px; height: 42px; border-radius: 14px; font-size: 22px; }
.soc-hero-sh { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
.soc-hero-t { display: block; font-size: 1.125rem; font-weight: 700; line-height: 1.33; }
.soc-hero-s { display: block; font-size: .8125rem; font-weight: 500; line-height: 1.38; }

/* Етикет „ОНЛАЙН 3" */
.soc-label { display: flex; align-items: center; gap: 6px; margin: 22px 0 8px;
  font-size: .6875rem; line-height: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.soc-count { color: var(--brand); }
.soc-count.dim { color: var(--text-mut); }
.soc-h { font-size: 1.125rem; margin: 22px 0 4px; }
.soc-sug > p { margin-bottom: 10px; }
.soc-lists .soc-empty { margin-top: 18px; }

.soc-list { display: flex; flex-direction: column; gap: 8px; }
.soc-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface); border: 1px solid transparent; border-radius: 18px;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.soc-row.sug { border-color: var(--line); border-radius: var(--r-md); }
.soc-row.off > .soc-ava, .soc-row.off > .grow { opacity: .55; }
.soc-row.joined { animation: popIn var(--dur-3) var(--ease-spring) both, halo 1.2s ease-out .1s 1; }
.soc-row.leaving { opacity: 0; transform: translateX(28px); }
.soc-ava {
  position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-content: center; font-size: 22px;
  background: var(--surface-2); border: 2px solid var(--line-2);
}
.soc-row:not(.off):not(.sug) .soc-ava { border-color: var(--brand); }
.soc-dot.live-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border: 2px solid var(--surface); }
.soc-nm { font-weight: 700; font-size: .9375rem; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soc-st { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--text-dim); line-height: 1.5; }
.soc-st.on { color: var(--brand); }
.soc-st .bi { font-size: 13px; flex: none; }
.soc-st > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soc-row .btn.sm { flex: none; padding: 0 14px; }
.soc-x { width: 36px; height: 36px; font-size: 15px; color: var(--text-dim); background: transparent; border-color: transparent; }
.soc-x:hover { color: var(--danger); border-color: var(--line); }
.soc-add {
  flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px;
  border: 0; border-radius: var(--r-sm); background: var(--brand); color: var(--brand-ink);
  font-weight: 700; font-size: .8125rem; cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.soc-add .bi { font-size: 14px; }
.soc-add:active { transform: scale(.94); }
@media (hover: hover) { .soc-add:hover { box-shadow: var(--glow-sm); } }

/* „Игра с приятели" на мястото на картата „Моят клуб" */
.soc-room {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 22px; padding: 14px;
  text-align: left; cursor: pointer; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--brand-line); border-radius: var(--r-lg);
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.soc-room:active { transform: scale(.98); }
@media (hover: hover) { .soc-room:hover { border-color: var(--brand); } }
.soc-room-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 22px; }
.soc-room .kicker, .soc-room-t, .soc-room-s { display: block; }
.soc-room-t { font-size: 1.125rem; font-weight: 700; line-height: 1.33; }
.soc-room-s { font-size: .8125rem; color: var(--text-dim); line-height: 1.38; }
.soc-room .btn { flex: none; pointer-events: none; }

.soc-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.soc-link {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--text); font-size: .75rem; font-weight: 700; cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.soc-link .bi { font-size: 24px; color: var(--brand); transition: transform var(--dur-2) var(--ease-spring); }
.soc-link:active { transform: scale(.95); }
@media (hover: hover) { .soc-link:hover { border-color: var(--brand-line); } .soc-link:hover .bi { transform: translateY(-2px) scale(1.1); } }

/* Листът „Покани приятел" (Figma 49) */
.soc-invite { display: flex; flex-direction: column; gap: 12px; }
.soc-inv-top {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg);
  border: 1px solid var(--brand);
  background: linear-gradient(147deg, color-mix(in srgb, var(--brand) 30%, var(--surface)) 0%, var(--surface-2) 72%);
}
.soc-inv-top p { margin: 0; font-size: .8125rem; color: var(--text); }
.soc-inv-ic { flex: none; font-size: 32px; color: var(--brand); display: grid; animation: popIn .5s var(--ease-spring) .1s both; }
.soc-code {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 16px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line);
}
.soc-code-k { font-size: .6875rem; line-height: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.soc-code-v { font-size: 1.375rem; line-height: 1.27; font-weight: 800; letter-spacing: 2px; color: var(--brand); word-break: break-all; }
.soc-code .btn { flex: none; }
.soc-inv-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.soc-inv-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 10px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2);
  color: var(--text); font-weight: 600; font-size: .8125rem; cursor: pointer;
}
.soc-inv-btn .bi { color: var(--brand); font-size: 18px; }
.soc-inv-btn:active { transform: scale(.96); }

/* ============================================================
   ИГРА С ПРИЯТЕЛИ (#/room) — Figma 12 и 34
   ============================================================ */
/* Лаймовото сияние зад масата — фон на страницата, не отделен слой */
.rm-page {
  background: radial-gradient(closest-side, rgba(95,208,114,.12), rgba(95,208,114,0)) no-repeat 50% 40px / 340px 340px;
}
.rm-lead { color: var(--text-dim); font-size: .875rem; margin-top: -6px; }
.rm-label { margin: 20px 0 8px; font-size: .6875rem; line-height: 14px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-dim); }
.rm-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px; }
.rm-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1.125rem; }
.rm-h .bi { color: var(--brand); font-size: 20px; }
.rm-page .hint { font-size: .8125rem; line-height: 1.4; color: var(--text-mut); }
.rm-hint { margin: 6px 2px 12px; }
.rm-err {
  margin-bottom: 12px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  animation: riseIn var(--dur-3) var(--ease-out) both;
}

/* Свързване: чипът се върти като монета */
.rm-busy { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 90px 16px; text-align: center; color: var(--text-dim); }
.rm-busy h3 { margin: 0; font-weight: 700; }
.rm-busy-chip { perspective: 300px; }
.rm-busy-chip .chip { animation: chipFlip 1.1s var(--ease-out) infinite; filter: drop-shadow(0 0 14px rgba(95,208,114,.45)); }

/* Отворените маси */
.rm-open-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rm-open {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text);
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.rm-open:active { transform: scale(.98); }
.rm-open:disabled { opacity: .6; }
@media (hover: hover) { .rm-open:hover { border-color: var(--brand-line); } }
.rm-open .t { font-weight: 700; font-size: .9375rem; }
.rm-open .s { font-size: .75rem; color: var(--text-dim); }
.rm-open .badge { flex: none; }
.rm-stack { display: flex; flex: none; }
.rm-mini { width: 30px; height: 30px; border-radius: 50%; display: grid; place-content: center; font-size: 15px;
  background: var(--surface-3); border: 2px solid var(--surface-2); }
.rm-mini + .rm-mini { margin-left: -10px; }
.rm-mini.free { background: var(--brand-soft); border: 1.5px dashed var(--brand); color: var(--brand); font-size: 12px; }

/* Настройки (Figma „Настройки" + „Избор") */
.rm-set { padding-top: 0; padding-bottom: 0; }
.rm-set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rm-set-row:last-child { border-bottom: 0; }
.rm-set-k { min-width: 0; font-size: .8125rem; font-weight: 600; color: var(--text); }
.seg.rm-seg { flex: none; padding: 3px; gap: 2px; border: 0; border-radius: var(--r-sm); background: var(--bg); }
.seg.rm-seg button { flex: none; min-height: 34px; padding: 0 10px; border-radius: 9px; font-size: .8125rem; }
.seg.rm-seg button[aria-pressed="true"] { box-shadow: none; }
.rm-private { justify-content: flex-start; color: var(--text-dim); font-size: .8125rem; }
.rm-private .bi { color: var(--brand); font-size: 18px; }
.rm-create { margin-top: 2px; }
.rm-code-in { text-align: center; text-transform: uppercase; letter-spacing: .3em; font-weight: 900; font-size: 1.2rem; }
.rm-join .field { margin-bottom: 12px; }

/* ---- Масата с четирите места ---- */
.rm-table {
  display: grid; margin: 4px 0 2px;
  grid-template-columns: minmax(0, 1fr) minmax(136px, 176px) minmax(0, 1fr);
  grid-template-areas: ". top ." "left oval right" ". bottom .";
  align-items: center; justify-items: center; gap: 12px 6px;
}
.rm-oval {
  grid-area: oval; position: relative; width: 100%; aspect-ratio: 200 / 130; border-radius: 50%;
  display: grid; place-content: center; justify-items: center;
  background: var(--felt); border: 2px solid color-mix(in srgb, var(--brand) 72%, #000);
  box-shadow: 0 0 36px rgba(95,208,114,.14), inset 0 0 24px rgba(0,0,0,.35);
}
.rm-oval-in { position: absolute; inset: 12% 8%; border-radius: 50%; border: 1.5px dashed rgba(95,208,114,.3); }
.rm-target { position: relative; font-size: 2.5rem; font-weight: 800; letter-spacing: -.5px; line-height: 1; color: var(--brand);
  text-shadow: 0 0 18px rgba(95,208,114,.45); font-variant-numeric: tabular-nums; }
.rm-target-k { position: relative; margin-top: 2px; font-size: .5625rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-dim); }

.rms { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.rms-top { grid-area: top; } .rms-bottom { grid-area: bottom; }
.rms-left { grid-area: left; } .rms-right { grid-area: right; }
.rms-left, .rms-right { flex-direction: column; gap: 6px; text-align: center; }
.rms-info { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.rms-left .rms-info, .rms-right .rms-info { align-items: center; max-width: 100%; }
.rms-ava {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-content: center; font-size: 26px;
  background: var(--surface-2); border: 2px solid var(--line-2); box-shadow: var(--shadow-1);
}
.rms.mine .rms-ava { background: var(--brand); border-color: var(--brand); box-shadow: var(--glow); }
.rms.bot .rms-ava { background: var(--brand-soft); border: 1.5px dashed var(--brand); box-shadow: none; }
.rms-dot { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--bg); box-shadow: 0 0 8px rgba(95,208,114,.7); }
.rms-nm { max-width: 120px; font-size: .8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rms-left .rms-nm, .rms-right .rms-nm { max-width: 100%; }
.rms-team { padding: 2px 6px; border-radius: 6px; line-height: 14px; font-size: .5625rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; background: var(--line); color: var(--text-dim); }
.rms-team.us { background: var(--brand); color: var(--brand-ink); }
.rms-off { font-size: .6875rem; font-weight: 700; color: var(--danger); }
.rms-act {
  min-height: 34px; padding: 0 10px; border: 1.5px solid var(--brand); border-radius: 10px; cursor: pointer; white-space: nowrap;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: .6875rem; letter-spacing: .5px; text-transform: uppercase;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.rms-act.ghost { background: var(--brand-soft); color: var(--brand); }
.rms-act:active { transform: scale(.94); }
@media (hover: hover) { .rms-act:hover { box-shadow: var(--glow-sm); } }
.rms-taken { font-size: .6875rem; font-weight: 700; color: var(--text-mut); text-transform: uppercase; letter-spacing: 1px; }

/* Влизане в лобито: масата се появява, после местата „сядат" по ред на раздаването */
.rm-first .rm-oval { animation: zoomIn var(--dur-4) var(--ease-out) both; }
.rm-first .rms { animation: popIn var(--dur-3) var(--ease-spring) both; }
.rm-first .rms-bottom { animation-delay: 80ms; }
.rm-first .rms-right  { animation-delay: 160ms; }
.rm-first .rms-top    { animation-delay: 240ms; }
.rm-first .rms-left   { animation-delay: 320ms; }
.rm-first .rm-target { animation: slam .6s var(--ease-out) .25s both; }
/* Свободните места леко дишат — чакат някого */
.rms.bot .rms-ava { animation: breathe 2.6s ease-in-out infinite; }
/* Някой току-що седна: аватарът изскача и около него минава вълна */
.rms.joined .rms-ava { animation: rsJoin .7s var(--ease-spring) both; }
.rms.joined .rms-ava::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--brand); pointer-events: none;
  animation: ripple .9s var(--ease-out) 2 both;
}
@keyframes rsJoin {
  0%   { transform: scale(.35); opacity: 0; }
  60%  { transform: scale(1.14); opacity: 1; }
  100% { transform: none; }
}

/* Кодът на стаята (Figma „Код на стаята": пунктирана лайм рамка) */
.rm-code { position: relative; padding: 14px 12px 12px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px dashed var(--brand); }
.rm-code-top { display: flex; align-items: center; gap: 10px; }
.rm-code-k { font-size: .6875rem; line-height: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.rm-code-v { font-size: 1.75rem; line-height: 1.2; font-weight: 800; letter-spacing: 2px; color: var(--brand); word-break: break-all; }
.rm-ib { width: 44px; height: 44px; border-radius: var(--r-sm); font-size: 20px; }
.rm-ib.lime { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: var(--glow-sm); }
.rm-ib:active { transform: scale(.92); }
.rm-link { display: block; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
  font-size: .75rem; color: var(--text-dim); word-break: break-all; user-select: all; font-family: ui-monospace, Consolas, monospace; }
.rm-code .hint { margin: 8px 0 0; }

/* Плочките СТАЯ · ДО · ХОД (Figma 34) */
.rm-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rm-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.rm-tile-k { font-size: .6875rem; line-height: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.rm-tile b { font-size: 1.125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Чатът на стаята — балончета като във Figma 29 */
.rm-chat-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; padding: 4px 2px; margin: 4px 0 10px; }
.rm-chat-empty { margin: 4px 0; }
.rm-msg { align-self: flex-start; max-width: 88%; padding: 7px 12px; border-radius: 16px 16px 16px 6px;
  background: var(--surface-2); font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; }
.rm-msg b { display: block; font-size: .6875rem; font-weight: 700; color: var(--brand); }
.rm-msg.new { animation: slideL var(--dur-3) var(--ease-out) both; }
.rm-chat-in { display: flex; gap: 8px; }
.rm-chat-in .input { flex: 1; min-width: 0; }
.rm-chat-in .btn { flex: none; }

/* Долу, винаги под ръка: „Започни играта" */
.rm-start {
  position: sticky; bottom: 0; z-index: 3; display: flex; flex-direction: column; gap: 8px;
  margin: 8px -4px 0; padding: 24px 4px 6px;
  background: linear-gradient(180deg, transparent 0, var(--bg) 22px);
}
.rm-wait { margin: 0; text-align: center; color: var(--text-dim); font-size: .8125rem; }
.rm-start.guest { flex-direction: row; align-items: center; justify-content: center; gap: 10px; padding: 18px 4px 10px; }

/* Край на мача */
.rm-over {
  position: relative; overflow: hidden; isolation: isolate; margin-top: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 34px 20px 24px; border-radius: var(--r-2xl); background: var(--panel-grad); border: 1px solid var(--line-2);
  animation: zoomIn var(--dur-4) var(--ease-out) both;
}
.rm-over.win { border-color: var(--gold); box-shadow: var(--glow-gold); }
.rm-over-art { position: relative; width: 120px; height: 120px; display: grid; place-items: center; margin-bottom: 6px; }
.rm-over-art .rays { z-index: -1; }
.rm-over-ic { width: 96px; height: 96px; border-radius: 50%; display: grid; place-content: center; font-size: 48px;
  color: var(--gold); background: var(--gold-soft); box-shadow: var(--glow-gold);
  animation: popIn .6s var(--ease-spring) both, floatY 4s ease-in-out .7s infinite; }
.rm-over-card { rotate: -10deg; animation: dropIn .6s var(--ease-out) both; }
.rm-over h2 { margin: 0; font-size: 2.5rem; letter-spacing: -.5px; }
.rm-over.win h2 { color: var(--gold); }
.rm-over p { margin: 0; }
.rm-score { display: flex; align-items: baseline; gap: 10px; color: var(--text-dim); font-weight: 700; font-size: .8125rem; text-transform: uppercase; letter-spacing: 1px; }
.rm-score b { font-size: 1.75rem; font-weight: 900; color: var(--text); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.rm-over .btn-row { width: 100%; }
.rm-over .btn-row .btn { padding: 0 14px; white-space: nowrap; }

/* ============================================================
   КЛАСАЦИЯ (#/leaderboard) — Figma 27
   ============================================================ */
.rk-podium {
  list-style: none; margin: 4px 0 14px; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 8px;
  background: radial-gradient(closest-side, rgba(255,200,61,.16), rgba(255,200,61,0)) no-repeat 50% 22% / 240px 240px;
}
.rk-pl { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.rk-pl .ava.sm { --size: 58px; font-size: 26px; }
.rk-p1 .ava { --size: 72px; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft), var(--glow-gold); }
.rk-pn { max-width: 100%; font-size: .9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-pl .rk-val { font-size: .8125rem; color: var(--text-dim); font-weight: 600; }
.rk-p1 .rk-val { color: var(--gold); }
.rk-pl.me .rk-pn { color: var(--brand); }
.rk-crown { display: grid; font-size: 26px; color: var(--gold); margin-bottom: -2px; }
.rk-step { width: 100%; display: grid; justify-content: center; align-content: start; padding-top: 6px;
  border-radius: 16px 16px 0 0; background: var(--surface); transform-origin: 50% 100%; }
.rk-step b { font-size: 2.5rem; line-height: 1.1; font-weight: 800; letter-spacing: -.5px; color: var(--text-dim); }
.rk-p1 .rk-step { height: 86px; background: color-mix(in srgb, var(--gold) 22%, transparent); }
.rk-p1 .rk-step b { color: var(--gold); }
.rk-p2 .rk-step { height: 72px; }
.rk-p3 .rk-step { height: 48px; }
.rk-p3 .rk-step b { font-size: 2rem; }

/* Подиумът се строи отдолу нагоре: 3 → 2 → 1, после хората „скачат" отгоре */
.rk-step { animation: rkStep .6s var(--ease-spring) both; }
.rk-p3 { --d: 0ms; } .rk-p2 { --d: 110ms; } .rk-p1 { --d: 220ms; }
.rk-step { animation-delay: var(--d); }
.rk-pl > .ava, .rk-pn, .rk-pl > .rk-val { animation: dropIn .5s var(--ease-out) both; animation-delay: calc(var(--d) + 280ms); }
.rk-p1 > .ava { animation: dropIn .5s var(--ease-out) calc(var(--d) + 280ms) both, rkHalo 2.6s ease-in-out 1.4s infinite; }
.rk-crown { animation: rkCrown .7s var(--ease-spring) .8s both, floatY 3.6s ease-in-out 1.6s infinite; }
@keyframes rkStep { from { transform: scaleY(0); } }
@keyframes rkCrown { from { opacity: 0; transform: translateY(-18px) rotate(-24deg) scale(.5); } }
@keyframes rkHalo {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold-soft), 0 0 18px rgba(255,200,61,.35); }
  50%      { box-shadow: 0 0 0 6px var(--gold-soft), 0 0 32px rgba(255,200,61,.65); }
}

.rk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rk-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface); }
.rk-row.me { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.rk-rank { flex: none; width: 26px; font-size: 1.25rem; font-weight: 900; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.rk-nm { font-size: .9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-sub { font-size: .8125rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-val { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rk-val .bi { color: var(--gold); }
.rk-row .rk-val { flex: none; font-size: 1.125rem; font-weight: 900; }

/* „Ти" — лаймовата лента, залепена отдолу */
.rk-mine {
  position: sticky; bottom: 8px; z-index: 3; margin-top: 14px;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px;
  background: var(--brand); color: var(--brand-ink); box-shadow: var(--glow), var(--shadow-2);
  animation: rkMine .6s var(--ease-spring) .55s both;
}
@keyframes rkMine { from { opacity: 0; transform: translateY(26px); } }
.rk-mine-pos { flex: none; font-size: 1.25rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.rk-mine .ava { border-color: var(--brand-ink); box-shadow: none; }
.rk-mine-nm { font-size: .9375rem; font-weight: 700; }
.rk-mine-sub { font-size: .75rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-mine .rk-val { flex: none; font-size: 1.25rem; font-weight: 900; }
.rk-mine .rk-val .bi { color: inherit; }
.rk-mine .chip { border-radius: 50%; background: var(--brand-ink); }
.rk-pos { margin: 0; font-size: 1rem; }

/* ============================================================
   ТУРНИРИ (#/tournaments) — Figma 25 и 26
   ============================================================ */
.tn-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--r-xl);
  color: var(--brand-ink); box-shadow: var(--glow-gold);
  background: linear-gradient(145deg, var(--gold) 0%, color-mix(in srgb, var(--gold) 74%, #000) 72%);
}
.tn-enter .tn-hero { animation: riseIn var(--dur-4) var(--ease-out) both; }
.tn-hero::after {
  content: ""; position: absolute; inset: -2px auto -2px 0; width: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.38), transparent);
  animation: shineSweep 5s var(--ease-in) 1s infinite;
}
.tn-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tn-k { min-width: 0; font-size: .6875rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-clock { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 10px;
  background: var(--bg); color: var(--gold); font-size: .8125rem; font-weight: 600; }
.tn-clock .bi { font-size: 14px; }
.tn-hero-mid { display: flex; align-items: center; gap: 10px; }
.tn-trophy { display: grid; font-size: 36px; }
.tn-enter .tn-trophy { animation: popIn .6s var(--ease-spring) .2s both; }
.tn-prize { display: block; font-size: 2.5rem; line-height: 1.1; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tn-prize-k { font-size: .8125rem; font-weight: 500; }
.tn-hero-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: .8125rem; font-weight: 500; }
.tn-hero-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 16px;
  border: 0; border-radius: var(--r-md); background: var(--bg); color: var(--gold); cursor: pointer;
  font-weight: 800; font-size: 1rem; letter-spacing: .5px; text-transform: uppercase;
  transition: transform var(--dur-1) var(--ease-out);
}
.tn-hero-btn:active { transform: scale(.97); }
.tn-hero-btn.in { background: transparent; border: 1.5px solid currentColor; color: var(--brand-ink); font-size: .875rem; }
.tn-dot { opacity: .7; }
.tn-more { align-self: center; padding: 2px 10px; border: 0; background: none; color: inherit; cursor: pointer;
  font-weight: 700; font-size: .8125rem; text-decoration: underline; text-underline-offset: 3px; }

.tn-list { display: flex; flex-direction: column; gap: 10px; }
.tn-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--text);
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.tn-row.in { border-color: var(--brand); }
.tn-row:active { transform: scale(.98); }
@media (hover: hover) { .tn-row:hover { border-color: var(--brand-line); } }
.tn-ic { flex: none; width: 42px; height: 42px; border-radius: var(--r-sm); display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 22px; }
.tn-nm { font-size: .9375rem; font-weight: 700; line-height: 1.45; }
.tn-sub { font-size: .8125rem; color: var(--text-dim); }
.tn-fee { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 10px;
  background: var(--bg); color: var(--brand); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.tn-fee.free { background: var(--brand); color: var(--brand-ink); }
.tn-row .badge { flex: none; }

/* Листът с детайлите (Figma 26) */
.tn-detail { display: flex; flex-direction: column; gap: 14px; }
.tn-detail > p { margin: 0; }
.tn-d-top { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.tn-d-ic { width: 72px; height: 72px; border-radius: 50%; display: grid; place-content: center; font-size: 38px;
  background: var(--gold-soft); color: var(--gold); animation: popIn .5s var(--ease-spring) .1s both; }
.tn-d-prize { font-size: 2rem; line-height: 1.15; font-weight: 800; letter-spacing: -.5px; }
.tn-d-when { color: var(--gold); font-size: .8125rem; font-weight: 600; }
.tn-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tn-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 16px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--line); }
.tn-tile-k { font-size: .6875rem; line-height: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.tn-tile b { font-size: 1.125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   ПРАВИЛА (#/help) — Figma 33
   ============================================================ */
.hp-list { display: flex; flex-direction: column; gap: 10px; }
.acc.hp-acc { margin: 0; border-radius: var(--r-lg); background: var(--surface); border-color: var(--line);
  transition: border-color var(--dur-2) var(--ease-out); }
.acc.hp-acc[open] { border-color: var(--line-2); }
.hp-acc > summary { gap: 12px; justify-content: flex-start; padding: 12px 14px; font-size: 1.0625rem; font-weight: 700; }
.hp-acc > summary::after {
  content: ""; flex: none; width: 18px; height: 18px; background-color: var(--brand);
  -webkit-mask: url(../assets/brand/icons/back.svg) center / contain no-repeat;
          mask: url(../assets/brand/icons/back.svg) center / contain no-repeat;
  transform: rotate(-90deg); transition: transform var(--dur-2) var(--ease-spring);
}
.hp-acc[open] > summary::after { transform: rotate(90deg); }
.hp-ic { flex: none; width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 22px; transition: transform var(--dur-2) var(--ease-spring); }
.hp-ic .chip { width: 22px; height: 22px; }
.hp-acc[open] .hp-ic { transform: rotate(-8deg) scale(1.06); }
.hp-acc[open] > .body { animation: riseIn var(--dur-3) var(--ease-out) both; }
.hp-acc .body { padding: 0 16px 16px; color: var(--text-dim); }
.hp-acc .body h4 { margin: 18px 0 8px; color: var(--text); font-size: 1rem; }
.hp-acc .body p, .hp-acc .body li { font-size: .9375rem; }
.hp-important { padding: 10px 12px; border-radius: 12px; border-left: 3px solid var(--brand); background: var(--brand-soft);
  color: var(--text); font-weight: 700; }

.hp-acc .body table.hp-table { width: 100%; margin: 6px 0 12px; border-collapse: separate; border-spacing: 0;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.hp-table th { padding: 10px 12px 6px; text-align: left; font-size: .6875rem; line-height: 14px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.hp-acc .body .hp-table td { padding: 8px 12px; border-bottom: 0; border-top: 1px solid var(--line); color: var(--text); font-size: .9375rem; }
/* Точките на картите: без линии, числата вдясно, козът — в лайм */
.hp-acc .body .hp-points td { border-top: 0; padding: 5px 12px; }
.hp-acc .body .hp-points tr:last-child td { padding-bottom: 10px; }
.hp-points .num { width: 72px; text-align: right; font-size: 1.25rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.hp-points th.num { width: auto; font-size: .6875rem; white-space: nowrap; }
.hp-points th.trump, .hp-points td.trump.hi { color: var(--brand); }
.hp-acc .body .hp-points td.num:not(.trump) { color: var(--text-dim); }
.hp-card { display: flex; align-items: center; gap: 10px; }
.hp-cards { display: flex; flex: none; }
.hp-cards .mcard + .mcard { margin-left: -16px; rotate: 8deg; }
.hp-acc[open] .hp-cards .mcard { animation: popIn var(--dur-3) var(--ease-spring) both; }
.hp-acc[open] tr:nth-child(2) .mcard { animation-delay: 40ms; }
.hp-acc[open] tr:nth-child(3) .mcard { animation-delay: 80ms; }
.hp-acc[open] tr:nth-child(4) .mcard { animation-delay: 120ms; }
.hp-acc[open] tr:nth-child(5) .mcard { animation-delay: 160ms; }
.hp-acc[open] tr:nth-child(6) .mcard { animation-delay: 200ms; }
.hp-acc[open] tr:nth-child(7) .mcard { animation-delay: 240ms; }
.hp-cur { display: flex; align-items: flex-start; gap: 10px; }
.hp-cur .chip { flex: none; margin-top: 2px; }
.hp-gem { flex: none; width: 20px; text-align: center; color: var(--gem); font-size: 1.1rem; line-height: 1.3; }

/* ============================================================
   СПОДЕЛИ (#/share)
   ============================================================ */
.shr-list { display: flex; flex-direction: column; gap: 12px; }
.shr-card { padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.shr-card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.shr-card-h h3 { margin: 0; font-size: 1.0625rem; }
.shr-ic { flex: none; width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand); font-size: 22px; }
.shr-card p.dim { margin-bottom: 10px; }
.shr-card .hint { margin: 0; font-size: .8125rem; line-height: 1.4; color: var(--text-mut); }
.shr-card .addr-row { margin: 10px 0; }
.shr-addr { position: relative; display: flex; align-items: center; gap: 8px; border-radius: var(--r-md); }
.shr-addr code.addr { min-width: 0; font-size: .95rem; padding: 12px 14px; }
.shr-addr.loading code.addr { animation: breathe 1.6s ease-in-out infinite; }
.shr-copy { width: 46px; height: 46px; border-radius: var(--r-sm); font-size: 20px; }
.shr-copy:active { transform: scale(.92); }
.shr-steps { padding-left: 1.3em; }
.shr-steps li { margin-bottom: 4px; }

/* ============================================================
   Светла тема: лаймовите числа стоят върху тъмно сукно — там и
   остават светли; високият контраст маха сиянията.
   ============================================================ */
html[data-theme="light"] .rm-page, html[data-theme="light"] .rk-podium { background: none; }
html[data-theme="light"] .rm-target { color: var(--card-bg); text-shadow: none; }
html[data-theme="light"] .rm-target-k { color: var(--card-bg); opacity: .75; }
html[data-theme="light"] .rm-oval-in { border-color: rgba(255,255,255,.3); }
html[data-contrast="high"] .rm-oval { box-shadow: none; }
html[data-contrast="high"] .soc-hero, html[data-contrast="high"] .rk-mine { box-shadow: none; }
