/* ===== Крысиные бега 101 — CSS ===== */

/* ---- Сброс и базовые ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; line-height: 1.5; }

/* ============================================================
   ГЛАВНАЯ СТРАНИЦА (index)
   ============================================================ */
body.index-page {
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.index-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.logo-block {
  text-align: center;
  padding: 2rem 0 1rem;
}
.logo-icon { font-size: 3.5rem; }
.logo-title {
  font-size: 2rem;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 0.5rem;
}
.logo-title span { color: #22c55e; }
.logo-sub { color: #64748b; font-size: 0.95rem; margin-top: 0.25rem; }

.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 1.75rem;
}
.card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 1.25rem;
}

.card-result {
  background: #0f2a1a;
  border-color: #22c55e;
  text-align: center;
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  border-color: #22c55e;
}
.form-group input::placeholder { color: #475569; }

.radio-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.radio-opt {
  flex: 1;
  min-width: 44px;
  text-align: center;
  padding: 0.6rem 0.5rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #94a3b8;
  transition: all 0.15s;
}
.radio-opt.selected, .radio-opt:has(input:checked) {
  background: #14532d;
  border-color: #22c55e;
  color: #22c55e;
  font-weight: 700;
}
.radio-opt input { display: none; }

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #475569;
  font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #334155;
}

.result-code-label { font-size: 0.85rem; color: #64748b; margin-bottom: 0.5rem; }
.result-code {
  font-size: 2.5rem;
  font-weight: 900;
  color: #22c55e;
  letter-spacing: 4px;
  margin-bottom: 0.75rem;
}
.result-hint { font-size: 0.9rem; color: #94a3b8; margin-bottom: 1rem; }
.result-links { margin-bottom: 1rem; }

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #22c55e; color: #0f172a; }
.btn-primary:hover:not(:disabled) { background: #16a34a; }
.btn-secondary { background: #3b82f6; color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #2563eb; }
.btn-success { background: #22c55e; color: #0f172a; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-outline {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
}
.btn-outline:hover { border-color: #22c55e; color: #22c55e; }
.btn-block { width: 100%; }

/* ============================================================
   ДАШБОРД (тёмная тема, ТВ)
   ============================================================ */
body.dashboard-page {
  background: #020617;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}
.dash-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dash-rat { font-size: 1.6rem; }
.dash-code {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: #22c55e;
  background: #0f2a1a;
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
}
.dash-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #94a3b8;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-green { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.dot-yellow { background: #eab308; }
.dot-red { background: #ef4444; }

.dash-main {
  flex: 1;
  padding: 1.5rem 2rem 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dash-loading, .dash-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: #475569;
}
.dash-empty-code { font-size: 2rem; color: #22c55e; margin-top: 1rem; font-weight: 700; letter-spacing: 3px; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #1e293b;
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dash-section {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 16px;
  overflow: hidden;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #1e293b;
}
.rat-title { background: #0f172a; color: #f1f5f9; }
.ft-title { background: #1c1400; color: #fbbf24; }
.ft-section { border-color: #44320a; }

.section-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
}

@media (max-width: 1100px) {
  .section-body { grid-template-columns: 1fr; }
}

.players-table-wrap { overflow-x: auto; }

.players-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
.players-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #0a0f1a;
  border-bottom: 1px solid #1e293b;
}
.players-table td {
  padding: 1rem 1rem;
  border-bottom: 1px solid #0f172a;
  vertical-align: middle;
}
.players-table tr:hover td { background: #0f172a; }

.player-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}
.player-badge-ft { font-size: 0.9rem; }

.td-profession { color: #94a3b8; font-size: 0.9rem; }
.td-positive { color: #22c55e; font-weight: 700; font-size: 1.05rem; }
.td-expense { color: #f87171; font-weight: 700; font-size: 1.05rem; }
.td-passive { color: #60a5fa; font-weight: 700; font-size: 1.05rem; }

.td-progress { min-width: 140px; }
.progress-bar-wrap {
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.progress-pct { font-size: 0.75rem; color: #64748b; }

.chart-wrap {
  padding: 1rem;
  height: 260px;
  border-left: 1px solid #1e293b;
}

.winner { color: #fbbf24; font-weight: 700; }

/* ============================================================
   ЛИСТ ИГРОКА (мобильная)
   ============================================================ */
body.player-page {
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 540px;
  margin: 0 auto;
}

.player-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s;
}
.player-name-display {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}
.player-profession-display {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 2px;
}
.player-phase-badge {
  background: rgba(255,255,255,0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.ft-badge { background: #fef3c7; color: #92400e; }

.player-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.stat-card {
  padding: 0.9rem 1rem;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.stat-card:nth-child(2n) { border-right: none; }
.stat-card:nth-child(3), .stat-card:nth-child(4) { border-bottom: none; }
.stat-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1e293b;
  margin-top: 2px;
}
.stat-value.positive { color: #16a34a; }
.stat-value.expense { color: #dc2626; }

.player-progress-section {
  padding: 0.75rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.progress-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.progress-bar-full {
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
  background: #22c55e;
}
.progress-text {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  margin-top: 2px;
}

.player-tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tab-btn {
  flex: 1;
  padding: 0.85rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.active {
  color: #1e293b;
  border-bottom-color: #22c55e;
}

.tab-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.section-block {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
}
.section-block h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.full-select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  color: #1e293b;
  outline: none;
}
.full-select:focus { border-color: #22c55e; }

.children-counter {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.counter-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  color: #1e293b;
}
.counter-btn:active { background: #cbd5e1; }
.counter-val {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  min-width: 2.5rem;
  text-align: center;
}

.exit-alert {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 1rem;
  color: #14532d;
  font-size: 0.95rem;
  font-weight: 500;
}
.exit-alert .btn { margin-top: 0.75rem; }

/* Активы */
.assets-section { margin-bottom: 1rem; }
.assets-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  padding: 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.assets-list { display: flex; flex-direction: column; gap: 0.5rem; }
.empty-list { color: #94a3b8; font-size: 0.9rem; padding: 0.5rem 0; }

.asset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
}
.asset-name { font-weight: 600; font-size: 0.95rem; color: #1e293b; }
.asset-detail { font-size: 0.8rem; color: #64748b; margin-top: 2px; }
.asset-del {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s;
}
.asset-del:hover { color: #ef4444; background: #fef2f2; }

/* Добавление активов */
.add-type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.type-btn {
  padding: 0.7rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.type-btn.active {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #16a34a;
}

.add-form {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Поля в мобильной части */
body.player-page .form-group input,
body.player-page .form-group select {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  width: 100%;
  outline: none;
}
body.player-page .form-group input:focus,
body.player-page .form-group select:focus {
  border-color: #22c55e;
}
body.player-page .form-group input::placeholder { color: #94a3b8; }
body.player-page .form-group label {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 0.35rem;
}
body.player-page .form-group { margin-bottom: 0.75rem; }

body.player-page .btn-primary { background: #22c55e; color: #fff; }
body.player-page .btn-primary:hover { background: #16a34a; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
  animation: fadeInUp 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.toast.success { background: #22c55e; color: #fff; }
.toast.error { background: #ef4444; color: #fff; }
.toast.info { background: #3b82f6; color: #fff; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================================
   УТИЛИТЫ
   ============================================================ */
.hidden { display: none !important; }
