:root {
  font-family: "Unbounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
  color: var(--text);
  --bg: #05060d;
  --bg-soft: rgba(13, 16, 35, 0.7);
  --glass: rgba(255, 255, 255, 0.08);
  --text: #f5f6fb;
  --text-muted: rgba(245, 246, 251, 0.65);
  --primary: #7f5dff;
  --primary-strong: #b367ff;
  --accent: #ff7b5d;
  --accent-strong: #ffb65d;
  --warning: #ffbe5d;
  --success: #4be1a0;
  --border: rgba(255, 255, 255, 0.12);
}

html {
  background-color: #05060d;
  color: #f5f6fb;
}

* {
  box-sizing: border-box;
}

/* Принудительная тёмная тема для iOS и других устройств */
input, button, select, textarea {
  color: inherit;
  background-color: inherit;
  font-family: inherit;
}

/* Отключаем автоматическую подстройку цвета в iOS Safari */
@media (prefers-color-scheme: light) {
  html, body {
    background-color: #05060d !important;
    color: #f5f6fb !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 20% 20%, #211f3a, #05060d 55%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.content-shell {
  width: min(1100px, 100%);
  margin: 20px auto 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bg-grid,
.orb {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.4;
}

.orb {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
}

.orb-one {
  background: var(--primary);
  top: -60px;
  right: 10%;
}

.orb-two {
  background: var(--accent);
  bottom: -120px;
  left: 5%;
}

.orb-three {
  background: #4be1a0;
  top: 40%;
  left: 70%;
}

.glass {
  position: relative;
  z-index: 1;
  background: rgba(12, 12, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 20px;
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.45);
}

.app-header,
.app-footer {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header {
  padding: 12px 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  box-shadow: 0 0 20px var(--accent);
}

.primary-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: 0.2s;
  font-size: 0.85rem;
  white-space: nowrap;
}

.primary-nav a.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.primary-nav a.admin-link {
  color: #ff7b5d;
  border-color: rgba(255, 123, 93, 0.3);
  background: rgba(255, 123, 93, 0.1);
}

.primary-nav a.admin-link:hover,
.primary-nav a.admin-link.active {
  color: #ffbe5d;
  border-color: rgba(255, 190, 93, 0.4);
  background: rgba(255, 123, 93, 0.2);
}

.btn {
  font-family: inherit;
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn.primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 10px 25px rgba(127, 93, 255, 0.35);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn.accent {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #220900;
  box-shadow: 0 10px 25px rgba(255, 123, 93, 0.4);
}

.btn.warning {
  background: linear-gradient(120deg, #ff6b6b, #ee5a5a);
  color: #fff;
  box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
}

.btn.warning:hover:not(:disabled) {
  background: linear-gradient(120deg, #ee5a5a, #dd4a4a);
  box-shadow: 0 12px 30px rgba(255, 107, 107, 0.5);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn.subtle {
  padding: 10px 14px;
}

.btn.icon-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-2px);
}

.app-footer {
  padding: 18px 24px;
  justify-content: space-between;
  margin-bottom: 30px;
}

.footer-badges {
  display: flex;
  gap: 8px;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: linear-gradient(135deg, rgba(127, 93, 255, 0.08), rgba(5, 6, 13, 0.8));
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-top-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-top-row .avatar-stack {
  flex-shrink: 0;
}

.hero-top-row .bonus-card {
  flex-shrink: 0;
  margin-left: auto;
  min-width: 160px;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.avatar-stack {
  position: relative;
}

.avatar-stack img {
  width: 86px;
  height: 86px;
  border-radius: 22px;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.25);
}

.avatar-stack {
  height: 86px;
}

.avatar-stack .pulse {
  position: absolute;
  inset: -8px;
  border-radius: 30px;
  border: 2px solid rgba(127, 93, 255, 0.5);
  animation: pulse 2.8s infinite;
}

.gradient-text {
  background: linear-gradient(120deg, #ffffff, var(--primary-strong));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Bonus Card */
.bonus-card {
  position: relative;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, #ff7b5d, #ffbe5d, #7f5dff, #ff7b5d);
  background-size: 300% 300%;
  animation: gradient-shift 4s ease infinite;
  overflow: hidden;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.bonus-card-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(255, 123, 93, 0.3) 0%, transparent 60%);
  pointer-events: none;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.bonus-card-content {
  background: linear-gradient(135deg, rgba(20, 15, 35, 0.95), rgba(10, 8, 20, 0.98));
  border-radius: 18px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 86px;
  box-sizing: border-box;
  min-width: 160px;
  width: auto;
}

.bonus-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bonus-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 123, 93, 0.2), rgba(255, 190, 93, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  animation: icon-bounce 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.bonus-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}

.bonus-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.bonus-percent {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ff7b5d, #ffbe5d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  white-space: nowrap;
}

.bonus-stats {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.bonus-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.bonus-stat-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.bonus-stat-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.bonus-stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.bonus-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 640px) {
  .bonus-card-content {
    padding: 8px 10px;
    gap: 8px;
    height: 86px;
  }
  
  .bonus-main {
    gap: 8px;
  }
  
  .bonus-icon-wrap {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  
  .bonus-title {
    font-size: 0.65rem;
  }
  
  .bonus-percent {
    font-size: 1rem;
  }
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill.glow {
  background: rgba(127, 93, 255, 0.2);
  border: 1px solid rgba(127, 93, 255, 0.4);
  box-shadow: 0 0 10px rgba(127, 93, 255, 0.5);
}

.pill.success {
  color: var(--success);
}

.pill.warning {
  background: rgba(255, 190, 93, 0.18);
  color: var(--warning);
}

.pill.linkish {
  border: 1px dashed rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-chip {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.stat-chip h3 {
  margin: 8px 0;
  font-size: 22px;
}

.capacity-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.capacity-bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.popularity-chip {
  background: linear-gradient(135deg, rgba(255, 123, 93, 0.15), rgba(127, 93, 255, 0.15));
  border-color: rgba(255, 123, 93, 0.3);
}

.popularity-chip h3 {
  color: var(--accent);
}

.popularity-chip small {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Стили для блока владельца */
.ownership-alert {
  padding: 1rem;
  margin-bottom: 1rem;
  background: rgba(255, 107, 107, 0.15) !important;
  border: 1px solid rgba(255, 107, 107, 0.3) !important;
}

.ownership-alert > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ownership-alert > div > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.owner-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.owner-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.owner-link:hover {
  opacity: 0.8;
  color: var(--accent);
}

.owner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 107, 107, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  display: block;
}

.owner-link:hover .owner-avatar {
  transform: scale(1.05);
  border-color: rgba(255, 107, 107, 0.5);
}

.ownership-alert p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.ownership-alert .muted {
  margin: 4px 0 0 0;
  font-size: 0.8rem;
  line-height: 1.3;
}

.ownership-alert .chained-info {
  color: #ffc107;
}

.ownership-alert button {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .ownership-alert {
    padding: 0.75rem;
  }
  
  .ownership-alert > div {
    flex-direction: column;
    align-items: stretch;
  }
  
  .ownership-alert > div > div:first-child {
    width: 100%;
  }
  
  .ownership-alert button {
    width: 100%;
  }
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title.compact {
  margin-bottom: 0;
}

.chart-line {
  margin-top: 20px;
  height: 130px;
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
  border-radius: 18px;
  overflow: hidden;
}

.chart-line span {
  position: absolute;
  inset: 10px 10px 10px 10px;
  background: url("data:image/svg+xml,%3Csvg width='240' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 70 Q60 20 120 40 T238 10' stroke='%23ff7b5d' stroke-width='4' fill='transparent' stroke-linecap='round'/%3E%3C/svg%3E")
    center/cover no-repeat;
  opacity: 0.8;
}

.legend {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.legend .dot.primary {
  background: var(--primary);
}

.legend .dot.accent {
  background: var(--accent);
}

.status-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-list li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-list strong {
  font-size: 26px;
}

.ref-card {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.mechanics-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mechanics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.mechanic-card {
  min-height: 140px;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s, border-color 0.2s;
}

.mechanic-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.25);
}

.layout-split {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.character-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.25s;
}

.character-card:hover {
  transform: translateY(-6px);
}

/* Компактные карточки рабов */
.slaves-carousel {
  width: 100%;
}

.card-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
}

.character-card-mini {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.character-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(127, 93, 255, 0.2);
}

.card-header-mini {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-header-mini img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.card-info-mini {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.card-info-mini h4 {
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.stats-mini {
  display: flex;
  gap: 8px;
  align-items: center;
}

.price-mini {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 500;
}

.income-mini {
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 500;
}

.card-footer-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.price-mini {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.label-mini {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.status-mini {
  font-size: 0.7rem;
}

.status-mini.chained {
  opacity: 0.8;
}

.slave-count {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.no-slaves {
  grid-column: 1 / -1;
  padding: 1.5rem;
  text-align: center;
}

.no-slaves .btn {
  margin-top: 0.75rem;
}

/* Навигация карусели */
.carousel-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.carousel-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-default);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn:hover:not(:disabled) {
  background: rgba(127, 93, 255, 0.2);
  border-color: var(--primary);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 50px;
  text-align: center;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrades {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.characters footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chip-list li {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.attack-panel {
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 14px;
}

.attack-actions {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 1.5rem;
}

.page-hero > div:first-child {
  flex: 1;
  min-width: 0;
}

.page-hero .eyebrow {
  margin-bottom: 0.5rem;
}

.page-hero h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.page-hero > div:first-child > p:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.market-refresh-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(127, 93, 255, 0.15);
  border: 1px solid rgba(127, 93, 255, 0.3);
  border-radius: 12px;
  flex-shrink: 0;
}

.market-refresh-timer .refresh-icon {
  font-size: 1.2rem;
}

.market-refresh-timer .refresh-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.market-refresh-timer .refresh-text strong {
  color: var(--primary-strong);
}

.hero-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.hero-controls .btn {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 10px 16px;
}

.leader-highlight {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.highlight-card {
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(7, 8, 20, 0.7));
}

.highlight-card .income {
  font-size: 20px;
  color: var(--accent);
}

.rating-board {
  padding: 0;
  overflow: hidden;
}

.rating-row {
  display: grid;
  grid-template-columns: 50px 1fr 100px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: none;
  font: inherit;
}

.rating-row:last-child {
  border-bottom: none;
}

.rating-row.head {
  color: var(--text-muted);
  font-size: 13px;
}

.rating-row:not(.head) {
  cursor: pointer;
  transition: background 0.2s;
}

.rating-row:not(.head):hover {
  background: rgba(255, 255, 255, 0.03);
}

.rating-row .player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.rating-row .player p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating-row .income {
  text-align: right;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
  white-space: nowrap;
}

.rating-row.head span:last-child {
  text-align: right;
}

.rating-row.current-user {
  background: rgba(127, 93, 255, 0.15);
  border-left: 3px solid var(--primary);
}

.rating-row.separator {
  padding: 8px 20px;
  pointer-events: none;
}

.rating-row.separator .dots {
  color: var(--text-muted);
  font-size: 1.2rem;
  letter-spacing: 4px;
}

.you-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
  font-weight: 600;
  vertical-align: middle;
}

.avatar-s {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-s.avatar-img {
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.leader-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.donate-card {
  text-align: center;
  background: linear-gradient(180deg, rgba(127, 93, 255, 0.08), rgba(5, 6, 13, 0.9));
}

.donate-card h2 {
  margin: 8px 0 4px;
}

.perks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.perk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perk-list li::before {
  content: "✦";
  margin-right: 8px;
  color: var(--accent);
}

dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  width: min(420px, 90vw);
}

.modal-content header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.icon {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 12px;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 8px 12px;
}

.icon.close {
  font-size: 22px;
  line-height: 1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.muted {
  color: var(--text-muted);
  margin: 0;
}

.ref-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.ref-link code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.ref-link button {
  flex-shrink: 0;
  background: rgba(127, 93, 255, 0.2);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.ref-link button:hover {
  background: rgba(127, 93, 255, 0.4);
}

code {
  font-family: "JetBrains Mono", monospace;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  animation: fade 2.2s ease forwards;
  z-index: 10;
}

[data-animate] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fade {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  15%,
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.25);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@media (max-width: 900px) {
  .app-header,
  .app-footer,
  .content-shell {
    width: 100%;
  }

  .layout-split {
    grid-template-columns: 1fr;
  }

  .page-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.25rem;
  }

  .page-hero h1 {
    font-size: 1.3rem;
  }

  .hero-controls .btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 640px) {
  body {
    padding: 16px;
  }

  .app-header,
  .app-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .app-header .logo {
    margin-bottom: 8px;
  }

  .primary-nav {
    width: 100%;
    justify-content: center;
    gap: 4px;
  }

  .primary-nav a {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .hero-meta {
    gap: 12px;
  }
  
  .hero-top-row {
    gap: 10px;
  }
  
  .hero-top-row .bonus-card {
    margin-left: auto;
    max-width: calc(50% - 5px);
    flex: 0 0 auto;
    min-width: 140px;
  }
  
  .bonus-card-content {
    min-width: 140px;
    padding: 8px 16px;
  }

  .quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .rating-row {
    grid-template-columns: 30px 1fr 90px;
  }

  .section-title h1,
  .section-title h2 {
    font-size: 1.3rem;
  }

  .section-title p {
    font-size: 0.85rem;
  }

  .hero-panel {
    padding: 1rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-chip {
    padding: 0.75rem;
  }

  .stat-chip h3 {
    font-size: 1.1rem;
  }

  .mechanics-grid {
    grid-template-columns: 1fr;
  }

  .mechanic-card {
    padding: 1rem;
  }

  .btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

/* ===== AUTH FORMS ===== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-group {
  position: relative;
  overflow: visible;
}

.input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.input-group input:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.input-group input:focus {
  background: rgba(127, 93, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(127, 93, 255, 0.15), 0 4px 20px rgba(127, 93, 255, 0.1);
}

.input-group .input-icon {
  position: absolute;
  right: 1rem;
  top: 2.4rem;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.3s;
}

.input-group input:focus + .input-icon {
  opacity: 0.7;
}

.auth-error {
  background: rgba(255, 107, 129, 0.1);
  border: 1px solid rgba(255, 107, 129, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #ff6b81;
  font-size: 0.875rem;
  text-align: center;
}

.auth-success {
  background: rgba(75, 225, 160, 0.1);
  border: 1px solid rgba(75, 225, 160, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--success);
  font-size: 0.875rem;
  text-align: center;
}

.auth-submit {
  margin-top: 0.5rem;
  padding: 1rem 2rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(127, 93, 255, 0.3);
}

.auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(127, 93, 255, 0.4);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-link a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.input-status {
  font-size: 0.8rem;
  margin-top: 0.4rem;
  min-height: 1.4rem;
  line-height: 1.4;
  overflow: visible;
  transition: all 0.2s ease;
}

.input-status.checking {
  color: var(--text-muted);
}

.input-status.success {
  color: var(--success);
}

.input-status.error {
  color: #ff6b81;
}

.input-group input.input-valid {
  border-color: var(--success);
}

.input-group input.input-invalid {
  border-color: #ff6b81;
}