@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #070b12;
  --bg-elevated: #0d1320;
  --surface: #131c2e;
  --surface-hover: #182438;
  --border: #243049;
  --text: #eef2f8;
  --muted: #8b9cb8;
  --accent: #3b9eff;
  --accent-dim: #2563eb;
  --accent-glow: rgba(59, 158, 255, 0.28);
  --gold: #f5b942;
  --danger: #f87171;
  --success: #60a5fa;
  --warn: #fbbf24;
  --orange: #fb923c;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 158, 255, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(245, 185, 66, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: #93c5fd;
}

.container,
.auth-wrap {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
}

.logo:hover {
  text-decoration: none;
  color: var(--text);
}

.logo-x {
  color: var(--accent);
  font-size: 1em;
  line-height: 1;
  text-shadow: 0 0 24px var(--accent-glow);
}

.logo-rest {
  color: var(--text);
}

.logo-tagline {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav {
  display: flex;
  gap: 12px 20px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-user {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav-user strong {
  color: var(--text);
}

.balance-badge {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gold);
  background: rgba(245, 185, 66, 0.12);
  border: 1px solid rgba(245, 185, 66, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.balance-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 8px;
  font-variant-numeric: tabular-nums;
}

.nav a.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
}

.lang-switcher {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--bg-elevated);
  color: var(--muted);
  border: none;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  min-width: 40px;
}

.lang-btn:hover {
  transform: none;
  color: var(--text);
  background: var(--surface-hover);
  box-shadow: none;
}

.lang-btn.is-active {
  background: var(--accent);
  color: #061528;
}

body.auth-page {
  position: relative;
}

.auth-lang {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.card-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border-color: rgba(59, 158, 255, 0.22);
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 28px;
}

.auth-brand {
  text-align: center;
}

.auth-brand .logo {
  justify-content: center;
  font-size: 2rem;
}

.auth-brand .logo-x {
  font-size: 1em;
}

.auth-brand p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 320px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 600;
}

.page-lead {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

button,
.btn {
  display: inline-block;
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #061528;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 16px var(--accent-glow);
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--border);
  box-shadow: none;
}

.error {
  color: var(--danger);
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.success-msg {
  color: var(--success);
  font-size: 0.9rem;
}

.deposit-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0c2447 0%, #1a3d6b 100%);
  border-bottom: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.deposit-banner-text {
  flex: 1;
  text-align: center;
  max-width: 640px;
}

.deposit-banner-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #93c5fd;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.85;
}

.deposit-banner-close:hover {
  opacity: 1;
  color: #fff;
}

body.has-deposit-banner {
  padding-top: 52px;
}

.check-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.check-form input {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .check-form {
    flex-direction: column;
    align-items: stretch;
  }

  .check-form input {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .check-form button {
    width: 100%;
  }
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.score-card {
  text-align: center;
  padding: 24px 16px 28px;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.score-card h3 {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-value {
  font-size: 2.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  transition: color 0.2s;
}

.score-value.score-empty {
  color: var(--muted);
  font-size: 2rem;
}

.score-value.score-low {
  color: var(--success);
}

.score-value.score-mid {
  color: var(--warn);
}

.score-value.score-high {
  color: var(--orange);
}

.score-value.score-critical {
  color: var(--danger);
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.35);
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

.api-key-box {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  word-break: break-all;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 12px 0 16px;
  font-size: 0.9rem;
  color: var(--accent);
}

code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.88rem;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
}

.history-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.history-pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.history-page-label {
  min-width: 90px;
  text-align: center;
  margin: 0;
}

.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer span {
  color: var(--accent);
  font-weight: 600;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Legal pages */
.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.legal-top {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px 0;
}

.legal-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
}

.legal-doc {
  padding: 32px 36px;
}

.legal-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.legal-header h1 {
  margin: 0 0 12px;
  font-size: 1.75rem;
}

.legal-meta {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-section {
  margin-bottom: 24px;
}

.legal-section h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--text);
}

.legal-section p {
  margin: 0 0 10px;
  line-height: 1.65;
  color: var(--muted);
  font-size: 0.92rem;
}

.legal-section a {
  color: var(--accent);
}

.terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 4px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}

.terms-accept input {
  margin-top: 3px;
  flex-shrink: 0;
}

.terms-accept a {
  color: var(--accent);
}

.auth-legal {
  margin-top: 12px;
  text-align: center;
}

.auth-legal a {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.auth-legal a:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  .legal-doc {
    padding: 22px 18px;
  }
}

/* Landing */
.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.landing-header {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.landing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0 32px;
}

.landing-title {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 20px;
  line-height: 1.1;
}

.landing-title .logo-x {
  font-size: 1em;
  vertical-align: baseline;
}

.landing-subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 0 36px;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 48px;
}

.landing-actions .btn {
  min-width: 160px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 720px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feature-card strong {
  color: var(--text);
  font-size: 0.95rem;
}

.feature-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Admin */
body.admin-denied {
  min-height: 100vh;
  background: var(--bg);
}

.admin-app[hidden] {
  display: none !important;
}

.admin-container {
  max-width: 1100px;
}

.admin-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  padding: 6px 10px;
  border-radius: 6px;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.admin-filters > div {
  min-width: 140px;
}

.admin-filters .search-grow {
  flex: 1;
  min-width: 200px;
}

.admin-filters label {
  margin-bottom: 4px;
}

.admin-filters input {
  margin-bottom: 0;
}

.admin-filters button {
  margin-bottom: 0;
}

.stats-total {
  font-size: 1.1rem;
  margin: 0 0 16px;
}

.stats-total strong {
  color: var(--accent);
  font-size: 1.4rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.user-detail-grid {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.api-key-inline {
  word-break: break-all;
  font-size: 0.85rem;
}

.admin-user-panel {
  margin-top: 20px;
  border-color: rgba(168, 85, 247, 0.35);
}

.balance-badge {
  cursor: pointer;
}

.balance-display {
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  box-shadow: none;
}

.modal-close:hover {
  color: var(--text);
  transform: none;
}

.deposit-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.deposit-presets .preset-btn {
  flex: 1;
  min-width: 60px;
}

.btn-block {
  width: 100%;
}
