/* ============================================================
   New Top System — Premium Mobile UI
   Glass / neon ranking design
   ============================================================ */

:root {
  --bg: #070b14;
  --bg2: #0d1320;
  --surface: rgba(22, 30, 48, 0.72);
  --surface-solid: #161e30;
  --surface2: #1c2640;
  --border: rgba(148, 163, 200, 0.12);
  --border-bright: rgba(148, 163, 200, 0.22);
  --text: #f0f4fc;
  --text-muted: #8b9cb8;
  --primary: #6b9fff;
  --primary-2: #4a7eef;
  --primary-glow: rgba(107, 159, 255, 0.35);
  --accent: #2ee6b8;
  --accent-dim: rgba(46, 230, 184, 0.15);
  --gold: #ffc94a;
  --gold-2: #ff9f1a;
  --gold-glow: rgba(255, 201, 74, 0.4);
  --danger: #ff6b8a;
  --ok: #2ee6b8;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 100% 80% at 50% -30%, rgba(74, 126, 239, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 10%, rgba(46, 230, 184, 0.08), transparent 45%),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(255, 201, 74, 0.05), transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s var(--ease), opacity 0.2s;
}
a:hover { color: #a8c8ff; }
a:active { opacity: 0.85; }

img { max-width: 100%; height: auto; display: block; }

/* ---- Layout ---- */
.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 14px 48px;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  background: rgba(7, 11, 20, 0.78);
  border-bottom: 1px solid var(--border);
  margin: 0 -14px 18px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.topbar-brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #5b8def 0%, #2ee6b8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  justify-content: flex-end;
  font-size: 0.8rem;
  font-weight: 600;
}

.topbar-nav a {
  color: var(--text-muted);
  padding: 4px 2px;
  position: relative;
}
.topbar-nav a:hover,
.topbar-nav a.active {
  color: var(--text);
}
.topbar-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* ---- Titles ---- */
.page-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 2px 0 4px;
  line-height: 1.25;
}

.page-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s;
  font-family: inherit;
  text-align: center;
  line-height: 1.2;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  box-shadow: 0 4px 18px var(--primary-glow);
}
.btn-primary:hover { color: #fff; box-shadow: 0 6px 24px var(--primary-glow); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #1bb894 100%);
  color: #04140f;
  box-shadow: 0 4px 16px rgba(46, 230, 184, 0.3);
}
.btn-accent:hover { color: #04140f; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-bright);
  color: var(--text);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(148, 163, 200, 0.35);
}

.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.card h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

/* ---- Rank list ---- */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s var(--ease), transform 0.2s var(--ease), box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}

.rank-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(107, 159, 255, 0.04), transparent 50%);
  pointer-events: none;
}

.rank-card:active {
  transform: scale(0.99);
}

.rank-card.gold {
  border-color: rgba(255, 201, 74, 0.45);
  background:
    linear-gradient(135deg, rgba(255, 201, 74, 0.12) 0%, rgba(22, 30, 48, 0.85) 45%),
    var(--surface);
  box-shadow: 0 0 0 1px rgba(255, 201, 74, 0.12), 0 8px 28px rgba(255, 201, 74, 0.12);
}

.rank-card.gold::before {
  background: linear-gradient(135deg, rgba(255, 201, 74, 0.15), transparent 55%);
}

.rank-card.gold-card {
  border-color: rgba(255, 201, 74, 0.45);
  background:
    linear-gradient(135deg, rgba(255, 201, 74, 0.12) 0%, rgba(22, 30, 48, 0.85) 45%),
    var(--surface);
  box-shadow: 0 0 0 1px rgba(255, 201, 74, 0.12), 0 8px 28px rgba(255, 201, 74, 0.12);
}
.rank-card.top1 {
  border-color: rgba(255, 201, 74, 0.35);
}
.rank-card.top1 .rank-pos {
  background: linear-gradient(145deg, #ffc94a, #ff9f1a);
  color: #1a1200;
  box-shadow: 0 4px 16px var(--gold-glow);
}
.rank-card.top2 .rank-pos {
  background: linear-gradient(145deg, #c8d4e8, #8a9bb5);
  color: #1a2030;
}
.rank-card.top3 .rank-pos {
  background: linear-gradient(145deg, #d4a574, #a66b3a);
  color: #1a1008;
}


.rank-pos {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  background: var(--surface2);
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.rank-card:nth-child(1) .rank-pos,
.rank-pos.top1 {
  background: linear-gradient(145deg, #ffc94a, #ff9f1a);
  color: #1a1200;
  box-shadow: 0 4px 16px var(--gold-glow);
}

.rank-card:nth-child(2) .rank-pos {
  background: linear-gradient(145deg, #c8d4e8, #8a9bb5);
  color: #1a2030;
}

.rank-card:nth-child(3) .rank-pos {
  background: linear-gradient(145deg, #d4a574, #a66b3a);
  color: #1a1008;
}

.rank-body { min-width: 0; position: relative; z-index: 1; }

.rank-url {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.rank-url a { color: inherit; }
.rank-url a:hover { color: var(--primary); }

.rank-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.badge-gold {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(255, 201, 74, 0.25), rgba(255, 159, 26, 0.15));
  color: var(--gold);
  border: 1px solid rgba(255, 201, 74, 0.35);
  margin-left: 6px;
  vertical-align: middle;
}

.rank-stats {
  text-align: right;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-hs {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-shadow: 0 0 20px rgba(46, 230, 184, 0.25);
}

.stat-ht {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.tabs a {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
.tabs a:hover {
  color: var(--text);
  border-color: var(--border-bright);
}
.tabs a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* ---- Metrics (compact) ---- */
.metrics,
.metric-row,
.metric-row-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 420px) {
  .metrics,
  .metric-row,
  .metric-row-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 560px) {
  .metric-row-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.metric::after {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(107, 159, 255, 0.45), transparent);
}

.m-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-val {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}
.m-val.gold { color: var(--gold); }
.m-val.accent { color: var(--accent); }
.m-val.blue { color: var(--primary); }
.metric .text-muted {
  font-size: 0.65rem !important;
  margin-top: 1px !important;
  line-height: 1.2;
}

/* Charts compact */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 8px;
  margin-bottom: 12px;
}
.chart-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.chart-wrap {
  position: relative;
  height: 160px;
  width: 100%;
}
.chart-wrap.tall {
  height: 200px;
}
.chart-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.chart-grid-2 {
  grid-template-columns: 1fr;
}
@media (min-width: 520px) {
  .chart-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .chart-wrap {
    height: 150px;
  }
}

/* ---- Forms ---- */
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
  min-height: 88px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b9cb8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* ---- Alerts ---- */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-ok {
  background: var(--accent-dim);
  border-color: rgba(46, 230, 184, 0.3);
  color: var(--accent);
}
.alert-error {
  background: rgba(255, 107, 138, 0.12);
  border-color: rgba(255, 107, 138, 0.3);
  color: var(--danger);
}

/* ---- Empty ---- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  filter: grayscale(0.2);
  opacity: 0.9;
}

/* ---- Auth ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.auth-box .logo-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #5b8def, #2ee6b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 8px 28px var(--primary-glow);
}
.auth-box h1 {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 18px;
  letter-spacing: -0.03em;
}
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.badge-ok { background: var(--accent-dim); color: var(--accent); }
.badge-mod { background: rgba(255, 201, 74, 0.15); color: var(--gold); }
.badge-ban { background: rgba(255, 107, 138, 0.15); color: var(--danger); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data th,
table.data td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Admin / office nav pills ---- */
.admin-nav,
.office-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  padding-bottom: 4px;
}
.admin-nav a,
.office-nav a {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.admin-nav a.active,
.office-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.act-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.act-btns button,
.act-btns .ok,
.act-btns .danger {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.act-btns .ok { color: var(--accent); border-color: rgba(46, 230, 184, 0.3); }
.act-btns .danger { color: var(--danger); border-color: rgba(255, 107, 138, 0.3); }

/* ---- Charts ---- */
.chart-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 10px 0 16px;
  border: 1px solid var(--border);
}

/* ---- Ads ---- */
.ad-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}
.ad-item {
  display: block;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(107, 159, 255, 0.25);
  background: linear-gradient(135deg, rgba(107, 159, 255, 0.1), rgba(46, 230, 184, 0.05));
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.ad-item::before {
  content: "AD";
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  opacity: 0.6;
}
.ad-item:hover {
  border-color: rgba(46, 230, 184, 0.45);
  transform: translateY(-1px);
}
.ad-name {
  font-weight: 700;
  font-size: 0.92rem;
  display: block;
}
.ad-text {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Footer ---- */
.site-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--primary); }

/* ---- Preview bar ---- */
.preview-bar {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Form row ---- */
.form-row { display: flex; flex-direction: column; gap: 0; }
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .form-row-2 { grid-template-columns: 1fr; }
}

/* ---- Rank link whole card feel ---- */
.rank-card a.rank-main {
  color: inherit;
  display: block;
}

/* ---- Desktop polish ---- */
@media (min-width: 720px) {
  .app { padding: 0 20px 56px; }
  .topbar { margin: 0 -20px 22px; padding: 14px 20px; }
  .page-title { font-size: 1.75rem; }
  .rank-card { padding: 16px 18px; }
}


/* ---- Appear animations ---- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.page-title {
  animation: fadeUp 0.45s var(--ease) both;
}

.page-sub {
  animation: fadeUp 0.5s var(--ease) 0.05s both;
}

.topbar {
  animation: slideDown 0.4s var(--ease) both;
}

.actions {
  animation: fadeUp 0.45s var(--ease) 0.08s both;
}

.tabs {
  animation: fadeUp 0.45s var(--ease) 0.1s both;
}

.card,
.metric,
.empty,
.ad-item,
.auth-box {
  animation: fadeUp 0.5s var(--ease) both;
}

.rank-card {
  animation: fadeUp 0.55s var(--ease) both;
  opacity: 0;
  animation-fill-mode: both;
}

/* Stagger rank list items */
.rank-list .rank-card:nth-child(1) { animation-delay: 0.05s; }
.rank-list .rank-card:nth-child(2) { animation-delay: 0.1s; }
.rank-list .rank-card:nth-child(3) { animation-delay: 0.15s; }
.rank-list .rank-card:nth-child(4) { animation-delay: 0.2s; }
.rank-list .rank-card:nth-child(5) { animation-delay: 0.25s; }
.rank-list .rank-card:nth-child(6) { animation-delay: 0.3s; }
.rank-list .rank-card:nth-child(7) { animation-delay: 0.35s; }
.rank-list .rank-card:nth-child(8) { animation-delay: 0.4s; }
.rank-list .rank-card:nth-child(9) { animation-delay: 0.45s; }
.rank-list .rank-card:nth-child(10) { animation-delay: 0.5s; }
.rank-list .rank-card:nth-child(n+11) { animation-delay: 0.55s; }

.metrics .metric:nth-child(1) { animation-delay: 0.05s; }
.metrics .metric:nth-child(2) { animation-delay: 0.1s; }
.metrics .metric:nth-child(3) { animation-delay: 0.15s; }
.metrics .metric:nth-child(4) { animation-delay: 0.2s; }
.metrics .metric:nth-child(5) { animation-delay: 0.25s; }

.ad-slot .ad-item:nth-child(1) { animation-delay: 0.08s; }
.ad-slot .ad-item:nth-child(2) { animation-delay: 0.14s; }
.ad-slot .ad-item:nth-child(3) { animation-delay: 0.2s; }

.empty {
  animation: scaleIn 0.5s var(--ease) both;
}

.auth-box {
  animation: scaleIn 0.45s var(--ease) both;
}

.alert {
  animation: fadeUp 0.35s var(--ease) both;
}

.site-footer {
  animation: fadeIn 0.6s ease 0.3s both;
}

/* ---- Reviews ---- */
.reviews-section { margin-top: 32px; }

.reviews-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.reviews-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-glow), transparent);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
}

.review-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.review-summary .avg {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.review-summary .count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stars { color: var(--gold); letter-spacing: 2px; font-size: 0.9rem; }
.stars .off { color: var(--border-bright); }

.review-list { display: grid; gap: 10px; }

.review-card {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.review-card:hover { border-color: var(--border-bright); }

.review-card .review-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.review-card .review-author { font-weight: 600; font-size: 0.9rem; }

.review-card .review-date {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.review-card .review-text {
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.9;
  line-height: 1.5;
  word-break: break-word;
}

/* Форма отзыва: выбор оценки звёздами (radio + CSS, без JS) */
.stars-input {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 2px;
}

.stars-input input { position: absolute; opacity: 0; pointer-events: none; }

.stars-input label {
  cursor: pointer;
  font-size: 1.6rem;
  color: var(--border-bright);
  transition: color 0.15s ease, transform 0.15s ease;
  line-height: 1;
}

.stars-input label:hover { transform: scale(1.15); }

/* Подсвечиваем выбранную звезду и все левее (визуально правее из-за row-reverse) */
.stars-input input:checked ~ label,
.stars-input label:hover ~ label { color: var(--gold); }

.review-form .form-group { margin-bottom: 12px; }

.review-login-hint {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .rank-card,
  .card,
  .metric,
  .empty,
  .ad-item {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---- Final layout fixes ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, input, select, textarea { font: inherit; }

main, .main, .content { min-width: 0; }
.card, .rank-card, .metric, .topbar { max-width: 100%; }

.rank-card { min-width: 0; }
.rank-url, .rank-msg { overflow-wrap: anywhere; }
.rank-stats { min-width: 58px; }

.form-row, .form-grid, .filters, .search-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 20, .55);
  color: var(--text);
  padding: 10px 12px;
}
textarea { min-height: 100px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 560px) {
  .app { padding-left: 10px; padding-right: 10px; }
  .topbar { margin-left: -10px; margin-right: -10px; padding: 10px 12px; align-items: flex-start; }
  .topbar-brand { font-size: .88rem; }
  .topbar-brand .logo { width: 32px; height: 32px; }
  .topbar-nav { gap: 3px 8px; font-size: .74rem; }
  .card { padding: 13px; border-radius: 14px; }
  .rank-card { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .rank-pos { width: 36px; height: 36px; border-radius: 10px; font-size: .9rem; }
  .rank-stats { grid-column: 2; display: flex; align-items: baseline; gap: 6px; text-align: left; margin-top: -4px; }
  .stat-hs { font-size: 1rem; }
  .stat-ht { margin-top: 0; }
  .form-row, .form-grid, .filters, .search-form { grid-template-columns: 1fr; }
  .page-title { font-size: 1.2rem; }
}

@media (max-width: 360px) {
  .topbar { display: block; }
  .topbar-nav { justify-content: flex-start; margin-top: 8px; }
  .metrics, .metric-row, .metric-row-4 { grid-template-columns: 1fr 1fr; }
  .rank-meta { gap: 4px; }
  .chip { padding: 3px 7px; }
}
