/* catacombs wiki main page styles
   palette: dark stone, torch amber, rune teal n stuff */

:root {
  /* The Firstborn — slate + iridescent aurora (matched to firstborn.game-tech.net). */
  --font-display: "Roboto", system-ui, sans-serif;
  --font-body: "Roboto", system-ui, sans-serif;

  --bg-0: #0f172a;    /* slate-900 */
  --bg-1: #1e293b;    /* slate-800 */
  --stone: #1e293b;   /* panel */
  --stone-2: #273449; /* panel, lighter */
  --line: #334155;    /* slate-700 border */
  --amber: #3b82f6;   /* primary accent = blue (site primary) */
  --amber-soft: #60a5fa;
  --ember: #f97316;   /* orange (today / highlight) */
  --rune: #38bdf8;    /* sky focus accent */
  --rune-soft: #7dd3fc;
  --blood: #ef4444;   /* red */
  --text: #f8fafc;    /* slate-50 */
  --text-dim: #94a3b8; /* slate-400 */
  --gold: #f59e0b;
  --green: #22c55e;
  --green-2: #4ade80;
  --shadow: rgba(2, 6, 18, 0.6);
  --card-radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg-0);
  overflow-x: hidden;
}

/* bg layers ig */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
/* the "переливающийся" iridescent aurora — straight from the site, kept dim so
   content stays readable. big gradient at 600% size, drifting position over 18s. */
.bg-aurora {
  background: radial-gradient(ellipse at 60% 40%, #3b82f6, #9333ea 33%, #fde68a 62%, #06b6d4 80%, #f472b6, #1e293b);
  background-size: 600% 600%;
  opacity: 0.5;
  animation: animatedGradientMove 18s ease-in-out infinite;
}
@keyframes animatedGradientMove {
  0%   { background-position: 30% 40%; }
  25%  { background-position: 70% 80%; }
  50%  { background-position: 90% 20%; }
  75%  { background-position: 20% 70%; }
  100% { background-position: 30% 40%; }
}
/* dark wash so the aurora sits behind the UI without washing out text */
.bg-vignette {
  background:
    radial-gradient(1100px 720px at 50% 36%, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.82) 75%),
    linear-gradient(180deg, rgba(15,23,42,0.35), rgba(15,23,42,0.7));
  box-shadow: inset 0 0 260px 60px rgba(2, 6, 18, 0.7);
}

#dust { z-index: 1; opacity: 0.4; }

/* header — center content full-width, torches floated out so title stays centered */
.site-header {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 54px 24px 18px;
}
.header-center { text-align: center; padding: 0 16px; }

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-display);
  letter-spacing: 0.5em;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--amber);
  opacity: 0;
  animation: rise 0.8s 0.1s forwards ease-out;
}

.site-title {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 6vw, 62px);
  letter-spacing: 0.01em;
  line-height: 1.05;
  color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 55%, #93a4bd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 44px rgba(96, 165, 250, 0.3);
  opacity: 0;
  animation: rise 0.9s 0.25s forwards ease-out;
}
.site-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(147, 197, 253, 0.22);
  filter: blur(0.4px);
  z-index: -1;
}

.subtitle {
  margin: 14px 0 0;
  font-style: italic;
  color: var(--text-dim);
  font-size: clamp(14px, 2vw, 18px);
  opacity: 0;
  animation: rise 0.9s 0.4s forwards ease-out;
}

.header-actions {
  margin-top: 26px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: rise 0.9s 0.55s forwards ease-out;
}

/* torches — pinned to header edges */
.torch {
  position: absolute;
  top: 64px;
  width: 90px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.torch-left { left: 12px; }
.torch-right { right: 12px; }
.torch::before { /* the stick */
  content: "";
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 64px;
  border-radius: 4px;
  background: linear-gradient(180deg, #4a382a, #241a13);
  box-shadow: 0 0 0 1px #15100b;
}
.flame {
  position: relative;
  width: 26px;
  height: 46px;
  margin-bottom: 56px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 75%, #fff2c0 0%, var(--amber) 35%, var(--ember) 70%, transparent 78%);
  filter: blur(0.5px) drop-shadow(0 0 22px rgba(255, 140, 50, 0.75));
  transform-origin: 50% 100%;
  animation: flicker 1.6s ease-in-out infinite;
}
.flame::after {
  content: "";
  position: absolute;
  inset: 6px 7px 10px 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, #fff7da, #ffd070 60%, transparent 75%);
  animation: flicker 1.1s ease-in-out infinite reverse;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) skewX(0deg); opacity: 0.96; }
  25% { transform: scale(1.06, 0.96) skewX(3deg); opacity: 1; }
  50% { transform: scale(0.95, 1.07) skewX(-2deg); opacity: 0.9; }
  75% { transform: scale(1.03, 0.98) skewX(2deg); opacity: 1; }
}

/* btns */
.btn {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--stone-2), var(--stone));
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 13px 26px;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.25s ease, box-shadow 0.3s ease, color 0.25s ease;
}
.btn .btn-label { position: relative; z-index: 2; }
.btn:hover { transform: translateY(-2px); border-color: var(--amber); box-shadow: 0 10px 28px -10px rgba(59,130,246,0.55); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--rune); outline-offset: 3px; }

.btn-primary { color: #ffffff; border-color: var(--amber-soft); text-shadow: 0 1px 2px rgba(2,6,18,0.5); }
.btn-primary .btn-glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, var(--amber-soft), var(--amber) 55%, #1d4ed8);
}
.btn-primary::before { /* shine sweep */
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  z-index: 1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.btn-primary:hover::before { left: 140%; }
.btn-primary:hover { box-shadow: 0 12px 30px -8px rgba(59,130,246,0.6); }

.btn-ghost { color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }

/* search */
.search-wrap {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 28px auto 6px;
  padding: 0 24px;
  opacity: 0;
  animation: rise 0.9s 0.7s forwards ease-out;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  backdrop-filter: blur(6px);
  transition: border-color 0.25s ease, box-shadow 0.3s ease;
}
.search-bar:focus-within {
  border-color: var(--rune);
  box-shadow: 0 0 0 3px rgba(70, 214, 196, 0.12), 0 8px 30px -12px rgba(70,214,196,0.4);
}
.search-ico { width: 20px; height: 20px; fill: none; stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}
.search-bar input::placeholder { color: var(--text-dim); }
.search-bar kbd {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
}

/* ---------- side rail — slim section nav. lives on the SECTION pages, not home.
   hidden by default, slides in when a page opens (sits above the overlay). ---------- */
.side-rail {
  position: fixed;
  left: 14px;
  top: 50%;
  z-index: 110; /* above the page overlay (100) */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(30,41,59,0.85), rgba(15,23,42,0.85));
  backdrop-filter: blur(8px);
  box-shadow: 0 24px 50px -24px rgba(0,0,0,0.9);
  /* hidden until a section page is open */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(-14px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22,1,0.36,1), visibility 0.35s;
}
body.section-open .side-rail {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
  /* tie into the page frame: same accent color + glow so it reads as part of the obvodka */
  border-color: color-mix(in srgb, var(--cur-accent, var(--amber)) 60%, var(--line));
  box-shadow:
    0 0 34px -10px var(--cur-accent, var(--amber)),
    0 24px 50px -24px rgba(0,0,0,0.9);
}
.rail-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);          /* visible outline now */
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease, transform 0.2s ease;
}
.rail-icon {
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  font-size: 22px;
}
.rail-item:hover,
.rail-item:focus-visible {
  outline: none;
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: radial-gradient(120% 120% at 0% 50%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  box-shadow: 0 0 22px -8px var(--accent);
}
/* the section that's open right now — stays lit + a lil accent bar on the left */
.rail-item.active {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: radial-gradient(120% 120% at 0% 50%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%);
  box-shadow: inset 3px 0 0 var(--accent), 0 0 24px -6px var(--accent);
}
/* label flies out on hover */
.rail-label {
  position: absolute;
  left: 54px;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  background: linear-gradient(180deg, var(--stone-2), var(--stone));
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  box-shadow: 0 10px 26px -12px rgba(0,0,0,0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.rail-item:hover .rail-label,
.rail-item:focus-visible .rail-label {
  opacity: 1;
  transform: translateX(0);
}
/* tuck it away on narrow screens so it never covers the page content */
@media (max-width: 760px) {
  .side-rail { display: none; }
}

/* icons (card / rail / page all center their icon, so one rule fits) */
.icon-img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  border-radius: 8px; /* in case the png has a solid bg */
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}
/* inline svg icons — tinted with the section accent (mixed toward white so it stays bright) */
.icon-svg {
  width: 56%;
  height: 56%;
  color: color-mix(in srgb, var(--accent, #8ab4ff) 42%, #ffffff);
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}

/* card grid */
.grid-wrap {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px 10px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* section card */
.card {
  position: relative;
  display: block;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(30,41,59,0.82), rgba(15,23,42,0.92));
  border-radius: var(--card-radius);
  padding: 26px 24px 24px;
  cursor: pointer;
  overflow: hidden;
  color: inherit;
  font: inherit;
  isolation: isolate;
  opacity: 0;
  transform: translateY(24px);
  animation: cardIn 0.6s forwards cubic-bezier(0.22, 1, 0.36, 1);
  transition: transform 0.25s ease, border-color 0.3s ease, box-shadow 0.35s ease;
}
.card::before { /* accent glow */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: radial-gradient(380px 240px at var(--mx, 50%) var(--my, 0%), var(--accent, var(--amber)), transparent 60%);
  transition: opacity 0.35s ease;
  mix-blend-mode: screen;
}
.card::after { /* top rune line */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--amber)), transparent);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}
.card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent, var(--amber)) 60%, var(--line));
  box-shadow: 0 22px 50px -24px rgba(0,0,0,0.9), 0 0 40px -18px var(--accent, var(--amber));
}
.card:hover::before { opacity: 0.16; }
.card:hover::after { transform: scaleX(1); }
.card:focus-visible { outline: 2px solid var(--rune); outline-offset: 4px; }

.card-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 30%, transparent), rgba(0,0,0,0.35));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  font-size: 28px;
  margin-bottom: 18px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover .card-icon {
  transform: translateY(-2px) rotate(-4deg) scale(1.06);
  box-shadow: 0 0 26px -6px var(--accent);
}

.card-title {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 20px;
  letter-spacing: 0.02em;
  color: #f8fafc;
}
.card-desc {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-dim);
}
.card-meta {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-tag {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent, var(--amber));
  opacity: 0.85;
}
.card-arrow {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text-dim);
  transition: transform 0.3s ease, color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.card:hover .card-arrow {
  transform: translateX(4px);
  color: #1a120b;
  background: var(--accent, var(--amber));
  border-color: var(--accent, var(--amber));
}
.card.dimmed { opacity: 0.18 !important; filter: saturate(0.4); }

/* lock glyph (dev arrow) */
.lock-svg { width: 16px; height: 16px; }

/* "в разработке" — locked tiles: dimmed, no hover lift/glow */
.card.dev { cursor: not-allowed; }
.card.dev .card-icon,
.card.dev .card-title,
.card.dev .card-desc { opacity: 0.6; }
.card.dev .card-tag { color: var(--text-dim); }
.card.dev:hover { transform: none; border-color: var(--line); box-shadow: none; }
.card.dev:hover::before { opacity: 0; }
.card.dev:hover::after { transform: scaleX(0); }
.card.dev:hover .card-icon { transform: none; box-shadow: none; }
.card.dev .card-arrow,
.card.dev:hover .card-arrow {
  transform: none;
  color: var(--text-dim);
  background: transparent;
  border-color: var(--line);
}
/* dev rail items */
.rail-item.dev { opacity: 0.5; cursor: not-allowed; }
.rail-item.dev:hover { transform: none; border-color: var(--line); box-shadow: none; background: rgba(0,0,0,0.28); }

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* nothin found */
.empty-state {
  text-align: center;
  font-style: italic;
  color: var(--text-dim);
  padding: 40px 0;
}

/* footer */
.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 4px rgba(10, 35, 80, 0.45);
  padding: 40px 24px 60px;
  font-size: 14px;
}
.rune-divider {
  display: block;
  color: #fff2c8;
  letter-spacing: 0.5em;
  margin-bottom: 14px;
  opacity: 0.85;
}

/* ---------- app-style section page (pops open from the tile) ---------- */
.app-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.app-overlay[hidden] { display: none; }

/* the surface gets clip-path animated from the tile rect -> fullscreen */
.app-surface {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(130% 80% at 50% -15%, color-mix(in srgb, var(--accent, var(--amber)) 26%, #1e293b), #0f172a 72%);
  will-change: clip-path;
}
.app-surface::before { /* lil accent glow up top */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(58% 42% at 50% 16%, color-mix(in srgb, var(--accent, var(--amber)) 28%, transparent), transparent 70%);
}
/* the obvodka — standalone element (sibling of surface, NOT clipped) so it's
   visible the whole time the page grows. JS animates its geometry from the tile. */
.app-frame {
  position: absolute;
  inset: 14px;
  border: 2px solid color-mix(in srgb, var(--cur-accent, var(--amber)) 85%, transparent);
  border-radius: 20px;
  box-shadow:
    0 0 60px -10px var(--cur-accent, var(--amber)),
    inset 0 0 60px -16px var(--cur-accent, var(--amber));
  pointer-events: none;
}

.app-close {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}
.app-close:hover { transform: rotate(90deg); background: rgba(0, 0, 0, 0.6); border-color: var(--accent, var(--amber)); }
.app-close:focus-visible { outline: 2px solid var(--rune); outline-offset: 3px; }

/* content fades up after the panel opens */
.app-content {
  position: relative;
  max-width: 560px;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
}
.app-overlay.open .app-content {
  animation: appContentIn 0.5s 0.14s forwards cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes appContentIn { to { opacity: 1; transform: none; } }

.app-icon-big {
  width: 112px;
  height: 112px;
  margin: 0 auto 26px;
  display: grid;
  place-items: center;
  font-size: 56px;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent, var(--amber)) 45%, transparent), rgba(0,0,0,0.45));
  border: 1px solid color-mix(in srgb, var(--accent, var(--amber)) 55%, var(--line));
  box-shadow: 0 0 50px -8px var(--accent, var(--amber));
}
.app-h-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 46px);
  letter-spacing: 0.04em;
  color: #f8fafc;
}
.app-h-tag {
  margin: 0 0 32px;
  font-family: var(--font-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent, var(--amber));
}
.stub {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  padding: 24px 28px;
}
.stub-emoji { font-size: 34px; }
.stub-big { margin: 0.5em 0 0.2em; font-family: var(--font-body); font-size: 22px; color: var(--text); }
.stub-sub { margin: 0; font-style: italic; color: var(--text-dim); }

/* mobile */
@media (max-width: 640px) {
  .torch { display: none; } /* no room for em lil torches */
  .header-center { padding: 0; } /* torches gone, take the full width */
  .header-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.05ms !important; }
  .card { opacity: 1; transform: none; }
}

/* ============================================================
   Login / register modal (The Firstborn skin)
   ============================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth-overlay[hidden] { display: none; }
.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 12, 30, 0.74);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.auth-overlay.open .auth-backdrop { opacity: 1; }

.auth-card {
  position: relative;
  width: min(420px, 100%);
  padding: 30px 28px 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(59,130,246,0.20), transparent 60%),
    linear-gradient(180deg, var(--stone-2), var(--stone));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 30px 70px -28px rgba(0,0,0,0.9);
  text-align: center;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22,1,0.36,1);
}
.auth-overlay.open .auth-card { opacity: 1; transform: none; }

.auth-x {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.auth-x:hover { transform: rotate(90deg); border-color: var(--blood); background: rgba(0,0,0,0.5); }

.auth-logo {
  width: 54px; height: 54px;
  margin: 4px auto 10px;
  display: grid; place-items: center;
  font-size: 26px;
  color: #1a120b;
  border-radius: 15px;
  background: radial-gradient(circle at 50% 30%, var(--gold), #c0872b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 0 26px -6px var(--gold);
}
.auth-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #f8fafc;
}

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--line);
}
.auth-tab {
  position: relative;
  z-index: 2;
  padding: 10px 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  transition: color 0.2s ease;
}
.auth-tab.is-active { color: #1a120b; }
.auth-tab-ind {
  position: absolute;
  z-index: 1;
  top: 5px; left: 5px;
  width: calc(50% - 7px);
  height: calc(100% - 10px);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--amber-soft), var(--gold));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 4px 14px -6px var(--gold);
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
}
.auth-tabs[data-mode="register"] .auth-tab-ind { transform: translateX(calc(100% + 4px)); }

.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field[hidden] { display: none; } /* author rule beats UA [hidden] over .auth-field */
.auth-field > span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  padding-left: 2px;
}
.auth-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 30, 0.55);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}
.auth-field input::placeholder { color: #6f8cb8; }
.auth-field input:focus {
  outline: none;
  border-color: var(--rune);
  box-shadow: 0 0 0 3px rgba(54,200,224,0.16);
}
.auth-submit { width: 100%; margin-top: 6px; justify-content: center; }
.auth-field span em { font-style: normal; font-weight: 400; opacity: 0.65; }
.auth-note {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12px;
  min-height: 1em;
  color: var(--text-dim);
}
.auth-note[data-kind="err"] { color: #ff9b8e; }
.auth-note[data-kind="ok"]  { color: #7fe06a; }

/* ---- profile: corner gear + panel ---- */
.profile-fab {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 95;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: radial-gradient(circle at 50% 30%, #ffe08a, var(--gold) 55%, #c0872b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 8px 22px -8px rgba(0,0,0,0.6);
  color: #4a2f06;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), box-shadow 0.25s ease;
}
.profile-fab[hidden] { display: none; }
.profile-fab:hover { transform: rotate(40deg) scale(1.07); box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 0 26px -4px var(--gold); }
.profile-fab:focus-visible { outline: 2px solid var(--rune); outline-offset: 3px; }
.profile-fab .icon-svg { width: 56%; height: 56%; color: #4a2f06; filter: none; }

.profile-email {
  margin: -6px 0 16px;
  font-size: 13px;
  color: var(--text-dim);
  word-break: break-all;
}

/* avatar */
.profile-avatar-wrap {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 2px auto 12px;
}
.profile-initial,
.profile-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 26px -8px var(--gold), inset 0 1px 0 rgba(255,255,255,0.3);
}
.profile-avatar { object-fit: cover; background: #1e293b; }
.profile-avatar[hidden] { display: none; }
.profile-initial {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 38px;
  color: #fff;
  text-transform: uppercase;
  background: radial-gradient(circle at 50% 30%, #334155, #1e293b);
}
.profile-avatar-edit {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--green-2);
  background: linear-gradient(180deg, var(--green-2), var(--green));
  color: #06320a;
  font-size: 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 4px 12px -4px rgba(0,0,0,0.6);
  transition: transform 0.2s ease;
}
.profile-avatar-edit:hover { transform: scale(1.12); }

/* bio textarea — matches the inputs */
.auth-field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 30, 0.55);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
  min-height: 62px;
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}
.auth-field textarea::placeholder { color: #6f8cb8; }
.auth-field textarea:focus {
  outline: none;
  border-color: var(--rune);
  box-shadow: 0 0 0 3px rgba(54, 200, 224, 0.16);
}

/* change-password + logout row */
.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.profile-actions .btn { justify-content: center; }
.profile-logout {
  border-color: rgba(230,68,58,0.55);
  color: #ffb3aa;
}
.profile-logout:hover {
  border-color: var(--blood);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 8px 22px -10px rgba(230,68,58,0.7);
}

/* ============================================================
   Top bar (modeled on firstborn.game-tech.net, no logo)
   ============================================================ */
body { padding-top: 60px; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  background: rgba(7, 11, 20, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.tb-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tb-nav::-webkit-scrollbar { display: none; }
.tb-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.tb-link:hover { color: var(--text); }
.tb-link.is-active { color: var(--text); }
.tb-link.dev { opacity: 0.4; cursor: not-allowed; }
.tb-link.dev:hover { color: var(--text-dim); }

.tb-right { display: flex; align-items: center; gap: 10px; flex: none; }

/* locked (read-only) input — username */
.auth-field input[readonly] {
  color: var(--text-dim);
  cursor: default;
  opacity: 0.85;
}
.auth-field input[readonly]:focus { border-color: var(--line); box-shadow: none; }
.tb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.85);
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}
.tb-search:focus-within { border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.tb-search-ico { width: 16px; height: 16px; fill: none; stroke: #64748b; stroke-width: 2; stroke-linecap: round; flex: none; }
.tb-search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-body); font-size: 14px; }
.tb-search input::placeholder { color: #64748b; }

.tb-icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tb-icon-btn svg { width: 18px; height: 18px; }
.tb-icon-btn:hover { color: var(--text); border-color: var(--rune); }

.tb-login {
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #042b33;
  background: linear-gradient(180deg, #22d3ee, #06b6d4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 6px 16px -8px rgba(6,182,212,0.8);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease;
}
.tb-login:hover { filter: brightness(1.1); transform: translateY(-1px); }
.tb-login:active { transform: translateY(0); }

.tb-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.tb-profile[hidden] { display: none; }
.tb-profile:hover { border-color: var(--rune); }
.tb-ava {
  width: 30px; height: 30px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #334155, #1e293b);
  border: 1px solid var(--line);
}
.tb-ava img { width: 100%; height: 100%; object-fit: cover; }
.tb-ava-initial { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #fff; text-transform: uppercase; }
.tb-name { font-size: 14px; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tb-lang {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tb-lang:hover { color: var(--text); border-color: var(--rune); }
.tb-caret { font-size: 10px; opacity: 0.8; }

@media (max-width: 900px) {
  .tb-nav { display: none; }
  .tb-search { width: 150px; }
  .tb-name { display: none; }
}
@media (max-width: 520px) {
  .tb-search { display: none; }
  .tb-saved { display: none; }
}

/* ============================================================
   Weekly event calendar (between search and the cards)
   ============================================================ */
.cal-wrap {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 24px 0;
  opacity: 0;
  animation: rise 0.9s 0.6s forwards ease-out;
}
.calendar {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 18px 40px -28px rgba(0,0,0,0.9);
  padding: 18px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-arrow {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.cal-arrow:hover { color: var(--text); border-color: var(--rune); background: rgba(30,41,59,0.95); }
.cal-month { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text); }
.cal-range { font-size: 13px; color: var(--text-dim); margin-top: 1px; }
.cal-server {
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-dim);
  border-radius: 9px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.cal-server:hover { color: var(--text); border-color: var(--rune); }
.cal-head-actions { display: flex; align-items: center; gap: 10px; }
.cal-add {
  border: 1px solid var(--amber-soft, #f59e0b);
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.cal-add:hover { color: #fff; background: rgba(245, 158, 11, 0.26); }
.cal-bar-edit { cursor: pointer; border: 0; font: inherit; text-align: left; transition: filter 0.18s ease, transform 0.18s ease; }
.cal-bar-edit:hover { filter: brightness(1.12); transform: translateY(-1px); }
.cal-empty {
  align-self: center;
  padding: 14px 6px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  column-gap: 6px;
  row-gap: 8px;
  align-items: stretch;
}
.cal-day {
  grid-row: 1;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, 0.55);
  padding: 10px 4px;
  text-align: center;
}
.cal-dow { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.cal-date { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); margin-top: 3px; white-space: nowrap; }
.cal-day.today {
  background: linear-gradient(180deg, #fb923c, #f97316);
  border-color: #fdba74;
  box-shadow: 0 0 22px -6px #f97316;
}
.cal-day.today .cal-dow,
.cal-day.today .cal-date { color: #3a1a05; }

.cal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.cal-bar-name { overflow: hidden; text-overflow: ellipsis; }
.cal-bar-ico { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px; background: rgba(0,0,0,0.28); }
.cal-bar-ico svg { width: 12px; height: 12px; color: #fff; }
.cal-bar-league { background: linear-gradient(180deg, #1e40af, #1d4ed8); border: 1px solid #3b82f6; }
.cal-bar-lair { background: linear-gradient(180deg, #166534, #15803d); border: 1px solid #22c55e; }
.cal-bar-event { background: linear-gradient(180deg, #7f1d1d, #991b1b); border: 1px solid #b91c1c; }

.cal-note { margin: 14px 0 0; font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.cal-note b { color: var(--blood); }

@media (max-width: 720px) {
  .cal-date { font-size: 12px; }
  .cal-bar { font-size: 11px; padding: 6px 7px; gap: 5px; }
  .cal-bar-ico { width: 15px; height: 15px; }
}

/* ============================================================
   Roles + Heroes content page
   ============================================================ */
.role-badge {
  display: inline-block;
  margin: -8px 0 14px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.role-badge[hidden] { display: none; }
.role-badge[data-role="admin"]      { color: #fde68a; background: rgba(245,158,11,0.18); border: 1px solid #f59e0b; }
.role-badge[data-role="moderator"]  { color: #93c5fd; background: rgba(59,130,246,0.18); border: 1px solid #3b82f6; }
.role-badge[data-role="junior_mod"] { color: #a7f3d0; background: rgba(16,185,129,0.18); border: 1px solid #10b981; }

/* page shell */
.heroes-page {
  position: fixed;
  top: 60px; left: 0; right: 0; bottom: 0;
  z-index: 70;
  overflow-y: auto;
  background: linear-gradient(180deg, #0b1120 0%, #0f172a 100%);
}
.heroes-page[hidden] { display: none; }
.hp-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: rgba(8, 12, 22, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.hp-spacer { flex: 1; }
.hp-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--text); }
.hp-back {
  border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text-dim);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.hp-back[hidden] { display: none; }
.hp-back:hover { color: var(--text); border-color: var(--rune); }
.hp-add { padding: 9px 18px; font-size: 13px; }
.hp-add[hidden] { display: none; }
.hp-close {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line); background: rgba(30,41,59,0.7);
  color: var(--text); font-size: 18px; cursor: pointer;
}
.hp-close:hover { border-color: var(--blood); color: #fff; }
.hp-body { max-width: 1180px; margin: 0 auto; padding: 26px 24px 80px; }

/* hero list */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.hero-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(30,41,59,0.55);
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.25s ease, box-shadow 0.3s ease;
}
.hero-card:hover { transform: translateY(-4px); border-color: var(--rune); box-shadow: 0 18px 40px -22px #000; }
.hero-card-art { aspect-ratio: 3 / 4; background: #1e293b; width: 100%; object-fit: cover; display: block; }
.hero-card-art.placeholder { display: grid; place-items: center; color: #475569; font-size: 30px; }
.hero-card-meta { padding: 10px 12px; }
.hero-card-name { font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-card-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.hero-card-tier { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: rgba(2,6,18,0.7); border: 1px solid var(--line); color: var(--rune-soft); }
.hero-empty { color: var(--text-dim); text-align: center; padding: 50px 0; }

/* hero detail */
.hero-detail { display: flex; flex-direction: column; gap: 22px; }
.hd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.hd-name { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: clamp(28px, 5vw, 46px); color: var(--text); }
.hd-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.hd-badge { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: rgba(30,41,59,0.6); }
.hd-badge .k { display: block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.hd-badge .v { display: block; font-size: 14px; font-weight: 700; color: var(--text); }
.hd-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.hd-portrait { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: #1e293b; aspect-ratio: 3 / 4; object-fit: cover; }
.hd-portrait.placeholder { display: grid; place-items: center; color: #475569; font-size: 40px; }
.hd-right { display: flex; flex-direction: column; gap: 16px; }
.hd-panel { border: 1px solid var(--line); border-radius: 14px; background: rgba(30,41,59,0.45); padding: 16px 18px; }
.hd-panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--text); font-weight: 700; }
.hd-used-crafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.hd-used-craft { background: rgba(30,41,59,0.3); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.hd-used-craft-title { font-weight: 600; margin-bottom: 8px; color: var(--gold); font-size: 13px; }
.hd-stats { width: 100%; border-collapse: collapse; }
.hd-stats th { text-align: right; font-size: 12px; color: var(--text-dim); font-weight: 600; padding: 6px 8px; }
.hd-stats th:first-child { text-align: left; }
.hd-stats td { padding: 8px; border-top: 1px solid rgba(51,65,85,0.5); font-weight: 700; }
.hd-stats td:first-child { color: var(--text); font-weight: 500; }
.hd-stats td.base { text-align: right; color: var(--text); }
.hd-stats td.max { text-align: right; color: var(--rune-soft); }
.hd-ability { display: flex; gap: 12px; }
.hd-ability-ico { width: 46px; height: 46px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: #1e293b center/cover; }
.hd-ability-body { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.hd-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: rgba(56,189,248,0.18); color: var(--rune-soft); border: 1px solid var(--rune); margin-right: 6px; }
.hd-chance { color: var(--ember); font-weight: 700; }
.hd-calc { position: relative; }
.hd-calc-lock { position: absolute; inset: 0; display: grid; place-items: center; gap: 6px; background: rgba(15,23,42,0.78); backdrop-filter: blur(2px); border-radius: 14px; color: var(--text-dim); font-size: 14px; z-index: 2; }
.hd-actions { display: flex; gap: 10px; }
.hd-del { border-color: rgba(239,68,68,0.6); color: #fca5a5; }
.hd-del:hover { border-color: var(--blood); color: #fff; box-shadow: 0 8px 20px -10px rgba(239,68,68,0.7); }

/* hero form */
.hero-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; max-width: 820px; }
.hero-form .full { grid-column: 1 / -1; }
.hf-field { display: flex; flex-direction: column; gap: 6px; }
.hf-field > span { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.hf-field input, .hf-field select, .hf-field textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(10,15,30,0.6);
  color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.hf-field textarea { min-height: 70px; resize: vertical; }
.hf-field input:focus, .hf-field select:focus, .hf-field textarea:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.hf-row4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.hf-imgrow { display: flex; align-items: center; gap: 12px; }
.hf-imgprev { width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--line); background: #1e293b center/cover; flex: none; }
.hf-note { font-size: 13px; }
.hf-actions { display: flex; gap: 10px; margin-top: 4px; }

@media (max-width: 760px) {
  .hd-grid { grid-template-columns: 1fr; }
  .hero-form { grid-template-columns: 1fr; }
  .hf-row4 { grid-template-columns: 1fr 1fr; }
}

/* heroes page open animation */
.heroes-page { animation: heroesPageIn 0.3s ease; }
.heroes-page .hp-body { animation: heroesBodyIn 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes heroesPageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes heroesBodyIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* clearer stat inputs in the hero form (labeled База / Макс per stat) */
.hf-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.hf-stat { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 10px; align-items: end; }
.hf-stat-name { font-size: 14px; font-weight: 600; color: var(--text); padding-bottom: 9px; }
.hf-mini { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-dim); }
.hf-stat input {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(10, 15, 30, 0.6);
  color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.hf-stat input:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14); }
@media (max-width: 560px) {
  .hf-stat { grid-template-columns: 1fr; gap: 4px; }
  .hf-stat-name { padding-bottom: 0; }
}

/* ---- heroes: filter toolbar (search + race chips) ---- */
.hero-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.hero-search-wrap { display: flex; align-items: center; gap: 8px; max-width: 440px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(15, 23, 42, 0.6); transition: border-color 0.2s ease, box-shadow 0.25s ease; }
.hero-search-wrap:focus-within { border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14); }
.hero-search-ico { width: 18px; height: 18px; color: #64748b; flex: none; }
.hero-search-wrap input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font-body); font-size: 15px; }
.hero-search-wrap input::placeholder { color: #64748b; }
.hero-races { display: flex; flex-wrap: wrap; gap: 8px; }
.race-chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(30, 41, 59, 0.5); color: var(--text-dim); font-size: 13px; cursor: pointer; transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease; }
.race-chip:hover { color: var(--text); }
.race-chip.is-active { color: #fff; border-color: var(--c, var(--rune)); background: color-mix(in srgb, var(--c, var(--rune)) 28%, transparent); }

/* ---- heroes: richer card, glow by source color ---- */
.hero-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.hero-card { --src: #64748b; border: 1px solid color-mix(in srgb, var(--src) 45%, var(--line)); box-shadow: 0 14px 30px -24px #000, inset 0 0 38px -26px var(--src); }
.hero-card:hover { transform: translateY(-4px); border-color: var(--src); box-shadow: 0 18px 40px -20px #000, 0 0 26px -8px var(--src); }
.hero-card-art { aspect-ratio: 1 / 1; }
.hero-card-body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.hero-card-body .hero-card-name { font-weight: 700; font-size: 16px; color: var(--text); white-space: normal; }
.hero-card-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.cbadge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 1.45; }
.hero-card-stats { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-top: 2px; color: var(--text-dim); font-size: 13px; }
.hc-stat { display: inline-flex; align-items: center; gap: 4px; }
.hc-stat svg { width: 14px; height: 14px; }
.hc-hp svg { color: #f87171; } .hc-atk svg { color: #e2e8f0; } .hc-def svg { color: #93c5fd; } .hc-spd svg { color: #fbbf24; }

/* ---- items: grouped list, type-glow cards, rarity icon border ---- */
.item-group { margin-bottom: 26px; }
.item-group-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.item-group-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text); }
.item-group-count { color: var(--text-dim); font-size: 14px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.item-card {
  --type: #64748b; --rar: #64748b;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; text-align: left; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--type) 45%, var(--line));
  border-radius: 12px; background: rgba(30, 41, 59, 0.5);
  box-shadow: inset 0 0 32px -24px var(--type);
  color: inherit;
  transition: transform 0.18s ease, border-color 0.25s ease, box-shadow 0.3s ease;
}
.item-card:hover { transform: translateY(-2px); border-color: var(--type); box-shadow: 0 14px 30px -22px #000, 0 0 22px -10px var(--type); }
.item-icon { width: 54px; height: 54px; flex: none; border-radius: 11px; border: 2px solid var(--rar); background: #1e293b center / cover no-repeat; display: grid; place-items: center; color: #475569; font-weight: 700; }
.item-card-body { min-width: 0; flex: 1; }
.item-card-name { font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card-badges { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.hd-obtain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 320px)); gap: 14px; }

/* item detail */
.item-detail { display: flex; flex-direction: column; gap: 22px; }
.id-head { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.id-icon { width: 100%; aspect-ratio: 1 / 1; border-radius: 16px; border: 3px solid var(--rar, #64748b); background: #1e293b center / cover no-repeat; box-shadow: 0 0 40px -12px var(--rar); display: grid; place-items: center; color: #475569; font-size: 40px; font-weight: 700; }
.id-info { display: flex; flex-direction: column; gap: 14px; }
.id-name { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: clamp(26px, 4.5vw, 42px); color: var(--text); }
@media (max-width: 640px) { .id-head { grid-template-columns: 1fr; } }

/* toggle (recipe sections) in the item form */
.hf-toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; color: var(--text); }
.hf-toggle input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: rgba(15,23,42,0.8); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; flex: none; }
.hf-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #64748b; transition: transform 0.2s ease, background 0.2s ease; }
.hf-toggle input:checked { background: color-mix(in srgb, var(--green) 35%, transparent); border-color: var(--green); }
.hf-toggle input:checked::after { transform: translateX(18px); background: var(--green-2); }

/* ============================================================
   Розыгрыши — динамически подсвеченная карточка + страница рулеток
   ============================================================ */
/* dynamic highlight on the section card (compose w/ the entrance anim) */
.card-glow {
  animation: cardIn 0.6s forwards cubic-bezier(0.22,1,0.36,1), cardGlow 2.6s ease-in-out infinite;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
.card-glow::after { transform: scaleX(1); } /* keep the accent rune-line lit */
@keyframes cardGlow {
  0%, 100% { box-shadow: 0 0 20px -8px var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
  50%      { box-shadow: 0 0 48px -6px var(--accent), 0 0 16px -4px var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 75%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .card-glow { animation: cardIn 0.6s forwards cubic-bezier(0.22,1,0.36,1); box-shadow: 0 0 30px -8px var(--accent); }
}

.ga-grid { display: flex; flex-direction: column; gap: 18px; }
.ga-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  background: rgba(15,23,42,0.55); display: flex; flex-direction: column; gap: 14px;
}
.ga-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ga-head h3 { margin: 0; font-family: var(--font-display); font-size: 18px; color: var(--text); }
.ga-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fcd34d; border: 1px solid rgba(245,158,11,0.5); background: rgba(245,158,11,0.12);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.ga-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: auto; }
.ga-spin { min-width: 150px; }
.ga-result { font-weight: 700; font-size: 15px; color: var(--text-dim); }

/* 1. wheel */
.gw-stage { position: relative; display: grid; place-items: center; padding-top: 12px; }
.gw-pointer {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%); z-index: 3;
  width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-top: 20px solid #fff; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}
.gw-wheel {
  position: relative; width: 240px; height: 240px; border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.4), 0 18px 40px -16px #000, inset 0 0 30px rgba(0,0,0,0.35);
  transform: rotate(0deg);
}
.gw-label {
  position: absolute; top: 50%; left: 50%; width: 80px; margin: 0;
  text-align: center; font-size: 11px; font-weight: 700; color: #0b1220;
  text-shadow: 0 1px 1px rgba(255,255,255,0.35); pointer-events: none; line-height: 1.1;
}
.gw-hub {
  position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%,-50%);
  border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f8fafc, #94a3b8);
  border: 3px solid #1e293b; box-shadow: 0 4px 10px -2px rgba(0,0,0,0.7); z-index: 2;
}

/* 2. case roulette */
.gc-stage {
  position: relative; overflow: hidden; height: 92px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(2,6,18,0.5);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.gc-marker {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; transform: translateX(-50%); z-index: 3;
  background: #f43f5e; box-shadow: 0 0 12px 1px #f43f5e;
}
.gc-track { position: absolute; top: 8px; left: 0; display: flex; gap: 8px; padding: 0 4px; will-change: transform; }
.gc-tile {
  flex: none; width: 96px; height: 76px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text); text-align: center;
  border: 1px solid color-mix(in srgb, var(--c) 55%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, #0b1220), #0b1220);
}
.gc-tile-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px -1px var(--c); }
.gc-tile.is-win { box-shadow: 0 0 0 2px var(--c), 0 0 20px -2px var(--c); }

/* 3. slot machine */
.gs-reels { display: flex; gap: 10px; justify-content: center; }
.gs-reel {
  width: 84px; height: 88px; overflow: hidden; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(2,6,18,0.6);
  box-shadow: inset 0 8px 14px -10px #000, inset 0 -8px 14px -10px #000;
}
.gs-strip { display: flex; flex-direction: column; will-change: transform; }
.gs-cell { height: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 4px; font-size: 11px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.05; }
.gs-cell::before { content: ""; width: 28px; height: 28px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px -1px var(--c); flex: none; }

/* 4. mystery chests */
.gb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gb-box {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; cursor: pointer; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--c) 40%, var(--line));
  background: linear-gradient(180deg, rgba(30,41,59,0.85), rgba(15,23,42,0.95));
  transition: transform 0.18s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}
.gb-box:hover { transform: translateY(-3px); box-shadow: 0 12px 26px -16px #000, 0 0 22px -8px var(--c); }
.gb-lid, .gb-prize {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; text-align: center;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.22,1,0.36,1);
}
.gb-lid { font-size: 40px; }
.gb-prize { font-size: 13px; font-weight: 700; color: var(--text); opacity: 0; transform: scale(0.6) rotate(-8deg); }
.gb-box.is-open .gb-lid { opacity: 0; transform: scale(1.6); }
.gb-box.is-open .gb-prize { opacity: 1; transform: none; }
.gb-box.is-win { border-color: var(--c); box-shadow: 0 0 0 2px var(--c), 0 0 26px -4px var(--c); }
.gb-box.is-dim { opacity: 0.4; }

@media (max-width: 560px) {
  .gw-wheel { width: 200px; height: 200px; }
}

/* --- Розыгрыши: оформление страницы (хаб) --- */
.ga-hero {
  position: relative; overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px;
  padding: 26px 28px; margin-bottom: 22px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, #f43f5e 35%, var(--line));
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(244,63,94,0.22), transparent 55%),
    radial-gradient(120% 160% at 0% 100%, rgba(168,85,247,0.18), transparent 55%),
    linear-gradient(180deg, rgba(30,41,59,0.7), rgba(15,23,42,0.85));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 22px 50px -34px #000;
}
.ga-hero::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(244,63,94,0.25), transparent 70%); pointer-events: none;
}
.ga-hero-text { position: relative; z-index: 1; max-width: 560px; }
.ga-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #fb7185; }
.ga-hero-title { margin: 6px 0 8px; font-family: var(--font-display); font-weight: 900; font-size: clamp(30px, 5vw, 46px); color: var(--text); line-height: 1; }
.ga-hero-sub { margin: 0; color: var(--text-dim); font-size: 15px; line-height: 1.55; }
/* участник: блок «Участвовать» */
.ga-join {
  position: relative; overflow: hidden; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 54px 24px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, #f43f5e 30%, var(--line));
  background:
    radial-gradient(120% 130% at 50% 0%, rgba(244,63,94,0.16), transparent 60%),
    linear-gradient(180deg, rgba(30,41,59,0.55), rgba(15,23,42,0.8));
}
.ga-join-ico {
  width: 74px; height: 74px; display: grid; place-items: center; font-size: 38px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, #f43f5e 45%, var(--line));
  background: radial-gradient(circle at 50% 35%, rgba(244,63,94,0.3), rgba(0,0,0,0.35));
  animation: gaJoinPulse 2.4s ease-in-out infinite;
}
@keyframes gaJoinPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(244,63,94,0.45); } 50% { box-shadow: 0 0 30px -2px rgba(244,63,94,0.7); } }
.ga-join-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: clamp(22px, 4vw, 32px); color: var(--text); }
.ga-join-state { margin: 0; max-width: 520px; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.ga-join-btn { min-width: 220px; margin-top: 4px; }

/* стафф: три колонки — участники | рулетки | победители */
.ga-admin { display: grid; grid-template-columns: 250px minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.ga-roulettes { min-width: 0; }
.ga-col {
  position: sticky; top: 14px; max-height: calc(100vh - 132px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: rgba(15,23,42,0.55);
}
.ga-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-family: var(--font-display); font-size: 16px; color: var(--text); }
.ga-col-head b { color: #fb7185; font-weight: 800; }
.ga-col-refresh { width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); color: var(--text-dim); font-size: 16px; cursor: pointer; transition: color 0.2s, border-color 0.2s, transform 0.4s; }
.ga-col-refresh:hover { color: var(--text); border-color: var(--rune); transform: rotate(180deg); }
.ga-col-list { list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 7px; overflow: auto; }
.ga-empty { color: var(--text-dim); font-size: 13px; padding: 12px 4px; text-align: center; }

.ga-part { display: flex; align-items: center; gap: 6px; }
.ga-part-pick { flex: 1; min-width: 0; text-align: left; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); color: var(--text); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: border-color 0.2s, color 0.2s; }
.ga-part-pick:hover { border-color: var(--rune); color: #fff; }
.ga-part-del, .ga-win-del { width: 28px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text-dim); cursor: pointer; font-size: 13px; transition: border-color 0.2s, color 0.2s; }
.ga-part-del:hover, .ga-win-del:hover { border-color: var(--blood); color: #fca5a5; }

.ga-winrow { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); font-size: 13px; }
.ga-winrow-nick { font-weight: 700; color: var(--text); max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ga-winrow-prize { flex: 1; min-width: 0; text-align: right; font-weight: 600; color: #fcd34d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* поле ника возле рулетки */
.ga-nick { flex: 1 1 150px; min-width: 120px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; }
.ga-nick::placeholder { color: #6f8cb8; }
.ga-nick:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }

.ga-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.ga-rule { display: flex; gap: 12px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(15,23,42,0.45); }
.ga-rule-ico { font-size: 22px; flex: none; }
.ga-rule div { display: flex; flex-direction: column; gap: 3px; }
.ga-rule b { color: var(--text); font-size: 14px; }
.ga-rule span { color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }

@media (max-width: 1080px) {
  .ga-admin { grid-template-columns: 1fr; }
  .ga-col { position: static; max-height: 340px; }
}
@media (max-width: 720px) {
  .ga-rules { grid-template-columns: 1fr; }
}

/* --- Розыгрыши: тулбар настройки призов + менеджер призов --- */
.ga-head-tools { display: flex; align-items: center; gap: 8px; }
.ga-cog { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); color: var(--text-dim); font-size: 14px; cursor: pointer; transition: color 0.2s, border-color 0.2s, transform 0.4s; }
.ga-cog:hover { color: var(--text); border-color: var(--rune); transform: rotate(90deg); }

.pm-card { width: min(600px, 100%); text-align: left; }
.pm-hint { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.pm-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.pm-tab { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); color: var(--text-dim); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.pm-tab:hover { color: var(--text); }
.pm-tab.is-active { color: #fff; border-color: color-mix(in srgb, #f43f5e 60%, var(--line)); background: rgba(244,63,94,0.16); }
.pm-head, .pm-row { display: grid; grid-template-columns: 44px minmax(0,1fr) 74px 60px 32px; gap: 8px; align-items: center; }
.pm-head { padding: 0 2px 6px; font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-dim); }
.pm-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; padding: 2px; }
.pm-color { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: rgba(2,6,18,0.5); cursor: pointer; }
.pm-label, .pm-weight { padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; min-width: 0; }
.pm-label:focus, .pm-weight:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.pm-pct { font-size: 13px; font-weight: 700; color: #fcd34d; text-align: right; }
.pm-del { width: 32px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text-dim); cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.pm-del:hover { border-color: var(--blood); color: #fca5a5; }
.pm-add { width: 100%; margin: 12px 0 4px; }

/* ============================================================
   Крафты (craft tracker: стол / история / публичные)
   ============================================================ */
.cp-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.cp-tab { padding: 10px 18px; border-radius: 11px; border: 1px solid var(--line); background: rgba(15,23,42,0.5); color: var(--text-dim); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.cp-tab:hover { color: var(--text); }
.cp-tab.is-active { color: #fff; border-color: color-mix(in srgb, #f59e0b 60%, var(--line)); background: rgba(245,158,11,0.14); }

.cp-craft { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.cp-table { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 16px; }

.cp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cp-slot {
  aspect-ratio: 1/1; position: relative; border-radius: 14px; cursor: pointer; overflow: hidden;
  border: 1px solid var(--line); background: rgba(30,41,59,0.55);
  display: grid; place-items: center; color: var(--text-dim); font: inherit;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.cp-slot:hover { border-color: color-mix(in srgb, #f59e0b 55%, var(--line)); }
.cp-slot.is-filled { border-color: var(--rar, color-mix(in srgb, #f59e0b 45%, var(--line))); background: rgba(15,23,42,0.7); box-shadow: inset 0 0 30px -22px #f59e0b; }
.cp-slot.is-filled:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -18px #000, 0 0 20px -10px #f59e0b; }
.cp-slot-plus { font-size: 30px; font-weight: 300; color: #475569; }
.cp-slot-img { position: absolute; inset: 6px; border-radius: 10px; background: #1e293b center/cover no-repeat; }
.cp-slot-name { padding: 4px; font-size: 11px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.1; }
.cp-slot-qty { position: absolute; right: 4px; bottom: 4px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; background: rgba(2,6,18,0.8); border: 1px solid rgba(255,255,255,0.15); }

.cp-controls { display: flex; flex-direction: column; gap: 10px; }
.cp-controls-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cp-controls-row:empty { display: none; }
.cp-btn { flex: 1; min-width: 110px; padding: 13px 14px; border-radius: 11px; border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text); font: inherit; font-weight: 800; font-size: 14px; letter-spacing: 0.02em; cursor: pointer; transition: transform 0.15s, box-shadow 0.25s, filter 0.2s; }
.cp-btn:hover { transform: translateY(-1px); }
.cp-success { background: linear-gradient(180deg, #16a34a, #15803d); border-color: #22c55e; color: #fff; }
.cp-fail { background: linear-gradient(180deg, #b91c1c, #991b1b); border-color: #ef4444; color: #fff; }
.cp-success:hover, .cp-fail:hover { filter: brightness(1.1); box-shadow: 0 12px 26px -16px #000; }
.cp-known { background: rgba(30,41,59,0.6); color: var(--text-dim); cursor: default; }
.cp-known:hover { transform: none; }
.cp-login { background: linear-gradient(180deg, #2563eb, #1d4ed8); border-color: #3b82f6; color: #fff; flex: 1; }
.cp-publish { background: rgba(245,158,11,0.14); border-color: rgba(245,158,11,0.5); color: #fcd34d; }
.cp-publish:hover { background: rgba(245,158,11,0.24); color: #fff; }
.cp-clear { flex: 0 0 auto; min-width: 0; color: var(--text-dim); }
.cp-clear:hover { color: var(--text); border-color: var(--blood); }
.cp-hint { color: var(--text-dim); font-size: 13px; padding: 10px 2px; }

.cp-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cp-cat-head h3 { margin: 0; font-family: var(--font-display); font-size: 18px; color: var(--text); }
.cp-mini-btn { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); color: var(--text-dim); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.cp-mini-btn:hover { color: var(--text); border-color: var(--rune); }
.cp-mini-btn.is-on { color: #fca5a5; border-color: var(--blood); background: rgba(239,68,68,0.12); }

.cp-filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.cp-chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(30,41,59,0.5); color: var(--text-dim); font: inherit; font-size: 13px; cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.cp-chip:hover { color: var(--text); }
.cp-chip.is-active { color: #0b1220; background: #f59e0b; border-color: #f59e0b; font-weight: 700; }

.cp-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; }
.cp-item { aspect-ratio: 1/1; position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; border: 1px solid var(--rar, var(--line)); background: rgba(30,41,59,0.55); display: grid; place-items: center; transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.cp-item:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -18px #000, 0 0 18px -10px var(--rar, #f59e0b); }
.cp-item-img { position: absolute; inset: 5px; border-radius: 9px; background: #1e293b center/cover no-repeat; }
.cp-item-name { padding: 4px; font-size: 11px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.1; }
.cp-item.is-local { border-style: dashed; }
.cp-item-local-tag { position: absolute; left: 3px; top: 3px; padding: 1px 5px; border-radius: 999px; font-size: 9px; font-weight: 800; color: #0b1220; background: #38bdf8; line-height: 1.4; }

.cp-empty { color: var(--text-dim); font-size: 14px; padding: 16px 4px; }
.cp-empty-lg { text-align: center; padding: 48px 20px; }
.cp-empty-lg .cp-login { display: inline-block; margin-top: 14px; padding: 10px 22px; }

/* история / публичные */
.cp-pubhint { margin: 0 0 18px; padding: 11px 15px; border-radius: 11px; border: 1px dashed color-mix(in srgb, #f59e0b 45%, var(--line)); background: rgba(245,158,11,0.08); color: var(--text-dim); font-size: 13px; }
.cp-histsec { margin-bottom: 28px; }
.cp-histhead { margin: 0 0 16px; padding-bottom: 10px; font-family: var(--font-display); font-size: 18px; border-bottom: 2px solid var(--line); }
.cp-histhead span { color: var(--text-dim); font-size: 14px; }
.cp-histhead.cp-ok { color: #4ade80; border-color: rgba(34,197,94,0.4); }
.cp-histhead.cp-fail { color: #f87171; border-color: rgba(239,68,68,0.4); }
.cp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.cp-card { position: relative; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(15,23,42,0.55); }
.cp-card.ok { border-color: rgba(34,197,94,0.35); }
.cp-card.fail { border-color: rgba(239,68,68,0.35); }
.cp-card-del { position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(2,6,18,0.6); color: var(--text-dim); cursor: pointer; font-size: 13px; transition: color 0.2s, border-color 0.2s; }
.cp-card-del:hover { color: #fca5a5; border-color: var(--blood); }
.cp-card-title { margin-bottom: 10px; font-weight: 700; color: var(--text); font-size: 14px; padding-right: 30px; }

.cp-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cp-mini-slot { aspect-ratio: 1/1; position: relative; border-radius: 9px; border: 1px solid var(--line); background: rgba(30,41,59,0.4); overflow: hidden; }
.cp-mini-slot.is-filled { border-color: var(--rar, color-mix(in srgb, #f59e0b 35%, var(--line))); background: rgba(2,6,18,0.5); }
.cp-mini-img { position: absolute; inset: 4px; border-radius: 6px; background: #1e293b center/cover no-repeat; }
.cp-mini-name { position: absolute; inset: 0; display: grid; place-items: center; padding: 3px; font-size: 9px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.05; }
.cp-mini-qty { position: absolute; right: 2px; bottom: 2px; padding: 0 5px; border-radius: 999px; font-size: 10px; font-weight: 800; color: #fff; background: rgba(2,6,18,0.85); }

.cp-card-result { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); cursor: pointer; text-align: left; transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.cp-card-result:hover { transform: translateY(-2px); border-color: color-mix(in srgb, #f59e0b 55%, var(--line)); box-shadow: 0 10px 20px -16px #000, 0 0 16px -10px #f59e0b; }
.cp-card-result-img { flex: none; width: 32px; height: 32px; border-radius: 8px; background: #1e293b center/cover no-repeat; display: grid; place-items: center; color: #475569; font-weight: 700; font-size: 13px; }
.cp-card-result-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* модалки крафта */
.cp-modal { width: min(440px, 100%); text-align: left; }
.cp-qty { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0; }
.cp-qty button { width: 44px; height: 44px; border-radius: 11px; border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text); font-size: 22px; cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.cp-qty button:hover { border-color: var(--rune); color: #fff; }
.cp-qty input { width: 120px; padding: 11px; text-align: center; border-radius: 11px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; font-size: 18px; font-weight: 700; }
.cp-qty input:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.cp-qm-img { width: 96px; height: 96px; margin: 0 auto; border-radius: 16px; border: 2px solid color-mix(in srgb, #f59e0b 45%, var(--line)); background: #1e293b center/cover no-repeat; box-shadow: 0 0 34px -12px #f59e0b; display: grid; place-items: center; }
.cp-qm-noimg { color: #475569; font-size: 38px; font-weight: 800; }
.cp-qm-meta { margin: 4px 0 14px; }
.cp-qm-tags { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cp-tag { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--text-dim); border: 1px solid var(--line); background: rgba(2,6,18,0.4); }
.cp-tag-type { color: #fcd34d; border-color: rgba(245,158,11,0.4); }
.cp-qm-desc { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-dim); }

@media (max-width: 820px) {
  .cp-craft { grid-template-columns: 1fr; }
  .cp-table { position: static; }
  .cp-grid { max-width: 300px; }
}

/* ============================================================
   Магазин (барахолка + чат)
   ============================================================ */
.sp-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.sp-search { flex: 1 1 240px; }
.sp-search input { width: 100%; padding: 11px 15px; border-radius: 11px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; }
.sp-search input:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }

.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.sp-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(15,23,42,0.55); transition: border-color 0.2s, box-shadow 0.25s, transform 0.15s; }
.sp-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, #fbbf24 45%, var(--line)); box-shadow: 0 18px 40px -28px #000, 0 0 24px -14px #fbbf24; }
.sp-card.is-closed { opacity: 0.6; }
.sp-card-img { height: 150px; background: #1e293b center/cover no-repeat; display: grid; place-items: center; }
.sp-noimg { color: #475569; font-size: 44px; font-weight: 800; font-family: var(--font-display); }
.sp-card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px; flex: 1; }
.sp-card-top { display: flex; align-items: center; gap: 8px; }
.sp-kind { padding: 3px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.sp-kind-item { color: #fcd34d; background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.45); }
.sp-kind-service { color: #7dd3fc; background: rgba(56,189,248,0.14); border: 1px solid rgba(56,189,248,0.45); }
.sp-closed-tag { font-size: 11px; color: var(--text-dim); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.sp-card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.sp-card-desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sp-card-want { margin: 0; font-size: 13px; color: var(--text); }
.sp-card-want span { color: var(--text-dim); }
.sp-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 6px; }
.sp-card-owner { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-card-by { font-size: 12px; color: #fcd34d; font-weight: 600; }
.sp-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-write { padding: 8px 16px; }
.sp-del:hover { color: #fca5a5; border-color: var(--blood); }

/* переписки */
.sp-threads { display: flex; flex-direction: column; gap: 8px; max-width: 620px; }
.sp-thread { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); cursor: pointer; text-align: left; transition: border-color 0.2s, background 0.2s; }
.sp-thread:hover { border-color: var(--rune); background: rgba(30,41,59,0.6); }
.sp-thread-ava { width: 42px; height: 42px; font-size: 16px; }
.sp-thread-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sp-thread-name { font-weight: 700; color: var(--text); }
.sp-thread-last { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* чат */
.sp-chat { display: flex; flex-direction: column; height: min(66vh, 640px); max-width: 720px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(15,23,42,0.5); }
.sp-chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: rgba(2,6,18,0.45); }
.sp-back { width: 34px; height: 34px; flex: none; border-radius: 9px; border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text-dim); font-size: 18px; cursor: pointer; }
.sp-back:hover { color: var(--text); border-color: var(--rune); }
.sp-chat-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sp-chat-title b { color: var(--text); }
.sp-chat-title span { font-size: 12px; color: var(--text-dim); }
.sp-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.sp-msg { display: flex; }
.sp-msg.mine { justify-content: flex-end; }
.sp-msg-body { max-width: 76%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4; border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text); border-bottom-left-radius: 4px; word-break: break-word; }
.sp-msg.mine .sp-msg-body { background: linear-gradient(180deg, #f59e0b, #d97706); border-color: #f59e0b; color: #1a1206; border-radius: 14px; border-bottom-right-radius: 4px; }
.sp-composer { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); background: rgba(2,6,18,0.4); }
.sp-composer input { flex: 1; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: rgba(2,6,18,0.55); color: var(--text); font: inherit; }
.sp-composer input:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.sp-composer button { flex: none; min-width: 54px; }

/* ============================================================
   Чат (общий + группы + сделки), бейдж, модерация
   ============================================================ */
.tb-chat { position: relative; }
.tb-badge { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #0b1220; }
.tb-badge[hidden] { display: none; }

.ch-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: min(70vh, 680px); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(15,23,42,0.5); }
.ch-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 4px; background: rgba(2,6,18,0.35); }
.ch-sec { padding: 10px 8px 4px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); font-weight: 700; }
.ch-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; color: var(--text); transition: background 0.15s, border-color 0.15s; }
.ch-item:hover { background: rgba(30,41,59,0.6); }
.ch-item.is-active { background: rgba(56,189,248,0.14); border-color: color-mix(in srgb, #38bdf8 55%, var(--line)); }
.ch-item-ico { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 17px; background: rgba(56,189,248,0.14); }
.ch-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ch-item-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.ch-item-sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-no { flex: none; font-size: 10px; font-weight: 700; color: var(--text-dim); background: rgba(2,6,18,0.5); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.ch-item-admin { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.ch-item:hover .ch-item-admin { opacity: 1; }
.ch-adm { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; font-size: 12px; color: var(--text-dim); }
.ch-adm:hover { color: #fff; background: rgba(255,255,255,0.08); }
.ch-add-group { margin: 4px 4px 8px; padding: 8px; border-radius: 9px; border: 1px dashed var(--line); background: transparent; color: var(--text-dim); cursor: pointer; font: inherit; font-size: 13px; }
.ch-add-group:hover { color: var(--text); border-color: var(--rune); }
.ch-list-empty { padding: 8px; font-size: 12px; color: var(--text-dim); }

.ch-main { display: flex; flex-direction: column; min-width: 0; }
.ch-placeholder { flex: 1; display: grid; place-items: center; color: var(--text-dim); font-size: 15px; }
.ch-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(2,6,18,0.45); }
.ch-back { display: none; width: 34px; height: 34px; flex: none; border-radius: 9px; border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text-dim); font-size: 18px; cursor: pointer; }
.ch-back:hover { color: var(--text); border-color: var(--rune); }
.ch-head-title { display: flex; flex-direction: column; min-width: 0; }
.ch-head-title b { color: var(--text); display: flex; align-items: center; gap: 8px; }
.ch-head-title span { font-size: 12px; color: var(--text-dim); }
.ch-head-actions { margin-left: auto; display: flex; gap: 8px; }

.ch-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ch-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 82%; }
.ch-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.ch-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #1e293b center/cover no-repeat; display: grid; place-items: center; overflow: hidden; }
.ch-ava-init { color: #0b1220; font-weight: 800; background: linear-gradient(180deg, #7dd3fc, #38bdf8); }
.ch-ava-sm { width: 34px; height: 34px; font-size: 14px; }
.ch-bubble-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ch-msg-name { font-size: 12px; font-weight: 700; color: #7dd3fc; padding-left: 4px; }
.ch-bubble { position: relative; padding: 9px 13px; border-radius: 14px; border: 1px solid var(--line); background: rgba(30,41,59,0.7); color: var(--text); font-size: 14px; line-height: 1.4; border-bottom-left-radius: 4px; word-break: break-word; }
.ch-msg.mine .ch-bubble { background: linear-gradient(180deg, #0284c7, #0369a1); border-color: #0ea5e9; color: #eaf6ff; border-radius: 14px; border-bottom-right-radius: 4px; }
.ch-msg-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: rgba(2,6,18,0.9); color: var(--text-dim); font-size: 10px; cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s; }
.ch-msg:hover .ch-msg-del { opacity: 1; }
.ch-msg-del:hover { color: #fca5a5; border-color: var(--blood); }
.ch-mod { position: absolute; top: -8px; right: 18px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: rgba(2,6,18,0.9); color: var(--text-dim); font-size: 10px; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.ch-msg:hover .ch-mod { opacity: 1; }
.ch-mod:hover { color: #fcd34d; border-color: #f59e0b; }

.ch-composer { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); background: rgba(2,6,18,0.4); }
.ch-composer input { flex: 1; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: rgba(2,6,18,0.55); color: var(--text); font: inherit; }
.ch-composer input:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.ch-composer button { flex: none; min-width: 54px; }
.ch-banned { padding: 14px; text-align: center; font-size: 13px; color: #fca5a5; border-top: 1px solid var(--line); background: rgba(239,68,68,0.08); }

/* стафф админ-панель */
.ap-block { margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(2,6,18,0.35); }
.ap-block h3 { margin: 0 0 10px; font-size: 15px; font-family: var(--font-display); color: var(--text); }
.ap-row { display: flex; gap: 10px; align-items: center; }
.ap-row input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; }
.ap-toggle-state { font-weight: 800; }
.ap-on { color: #4ade80; }
.ap-off { color: #f87171; }
.ap-modrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(2,6,18,0.4); font-size: 13px; margin-bottom: 6px; }
.ap-modrow .ap-modnick { font-weight: 700; color: var(--text); flex: 1; }
.ap-modtag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ap-tag-ban { color: #fca5a5; background: rgba(239,68,68,0.14); border: 1px solid rgba(239,68,68,0.4); }
.ap-tag-mute { color: #fcd34d; background: rgba(245,158,11,0.14); border: 1px solid rgba(245,158,11,0.4); }

.ch-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none; }
.ch-tag-open { color: #4ade80; background: rgba(34,197,94,0.14); border: 1px solid rgba(34,197,94,0.4); }
.ch-tag-closed { color: var(--text-dim); background: rgba(100,116,139,0.14); border: 1px solid var(--line); }

/* окно модерации игрока */
.mod-status { margin: 0 0 14px; text-align: center; font-size: 13px; color: var(--text-dim); }
.mod-status b { color: var(--text); }
.mod-dur { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(2,6,18,0.35); margin-bottom: 14px; }
.mod-dur-lbl { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); font-weight: 700; margin-bottom: 8px; }
.mod-dur-row { display: flex; gap: 8px; }
.mod-dur-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; }
.mod-dur-row select { flex: 0 0 auto; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2,6,18,0.5); color: var(--text); font: inherit; cursor: pointer; }
.mod-dur-row input:focus, .mod-dur-row select:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(56,189,248,0.14); }
.mod-dur-row input:disabled, .mod-dur-row select:disabled { opacity: 0.4; cursor: not-allowed; }
.mod-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mod-chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(2,6,18,0.4); color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.mod-chip:hover { color: var(--text); border-color: var(--rune); }
.mod-chip.is-on { color: #7dd3fc; border-color: var(--rune); background: rgba(56,189,248,0.14); }
.mod-perma { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.mod-perma input { width: 16px; height: 16px; accent-color: #ef4444; cursor: pointer; }
.mod-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mod-actions .cp-btn { flex: 0 0 auto; }
.mod-actions .cp-success { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .ch-wrap { grid-template-columns: 1fr; }
  .ch-wrap .ch-main { display: none; }
  .ch-wrap.has-active .ch-list { display: none; }
  .ch-wrap.has-active .ch-main { display: flex; }
  .ch-back { display: grid; }
}

/* ============================================================
   Player profiles, ratings, glowing avatars, and badges
   ============================================================ */
.stars-rating span {
  transition: color 0.15s;
}
.stars-rating span.active {
  color: #f59e0b !important;
}

.vp-review-item {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.vp-review-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.vp-review-stars {
  color: #f59e0b;
  font-weight: bold;
}
.vp-review-author {
  font-weight: 600;
  color: #7dd3fc;
  cursor: pointer;
}
.vp-review-author:hover {
  text-decoration: underline;
}
.vp-review-comment {
  color: var(--text);
  word-break: break-word;
}
.vp-review-date {
  font-size: 11px;
  color: var(--text-dim);
}

.vp-badges-inline {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.vp-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  box-shadow: 0 0 8px var(--glow-color);
  animation: vp-badge-pulse 2s infinite alternate;
  position: relative;
}
.vp-badge-chip-icon {
  font-size: 14px;
  display: inline-block;
}
.vp-badge-chip-icon img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
}
.vp-badge-chip-del {
  margin-left: 6px;
  cursor: pointer;
  color: #ef4444;
  font-weight: bold;
  border: none;
  background: none;
  padding: 0;
  font-size: 10px;
}
.vp-badge-chip-del:hover {
  color: #f87171;
}

@keyframes vp-badge-pulse {
  from { filter: drop-shadow(0 0 1px var(--glow-color)); box-shadow: 0 0 4px var(--glow-color); }
  to { filter: drop-shadow(0 0 6px var(--glow-color)); box-shadow: 0 0 10px var(--glow-color); }
}

/* Avatar badge overlay wrapper in chats */
.ch-ava-wrapper {
  position: relative;
  display: inline-block;
  flex: none;
}
.ch-ava-badges {
  position: absolute;
  top: -4px;
  right: -4px;
  display: flex;
  gap: 2px;
  z-index: 2;
}
.ch-ava-badge {
  width: 16px;
  height: 16px;
  font-size: 11px;
  display: grid;
  place-items: center;
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--glow-color);
  animation: vp-badge-pulse-micro 2s infinite alternate;
}
.ch-ava-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes vp-badge-pulse-micro {
  from { filter: drop-shadow(0 0 1px var(--glow-color)); }
  to { filter: drop-shadow(0 0 4px var(--glow-color)); }
}

.ch-ava.has-glow {
  box-shadow: 0 0 10px 2px var(--glow-color) !important;
  border-color: var(--glow-color) !important;
}

/* Extra alignment helper for listing owner */
.sp-card-owner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sp-card-owner:hover .sp-owner-name {
  text-decoration: underline;
  color: #7dd3fc;
}
.sp-card-rating {
  font-size: 12px;
  font-weight: bold;
  color: #f59e0b;
  margin-left: 4px;
}
.ch-ava-xs {
  width: 22px;
  height: 22px;
  font-size: 10px;
}
.ch-msg-name {
  cursor: pointer;
}
.ch-msg-name:hover {
  text-decoration: underline;
}


