:root {
  --ink: #12202c;
  --muted: #5b6b78;
  --line: #e6ebea;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --accent: #0e7490;
  --accent-2: #115e76;
  --gold: #c4a35a;
  --radius: 12px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body.orb-app, body.orb-auth {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 0.95rem;
}

.orb-wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.orb-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.orb-nav .navbar-brand { color: var(--ink); }
.orb-brand-text { font-weight: 700; letter-spacing: 0.04em; }
.orb-brand-badge {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  color: var(--accent);
}
.orb-nav .nav-link { color: var(--muted); }
.orb-nav .nav-link.active, .orb-nav .nav-link:hover { color: var(--ink); }
.orb-dropdown { border: 1px solid var(--line); border-radius: 10px; }
.orb-user { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orb-main { min-height: calc(100vh - 140px); }
.orb-footer, .orb-auth-foot {
  border-top: 1px solid var(--line);
  padding: 1.1rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  background: var(--surface);
}
.orb-footer a, .orb-auth-foot a { color: var(--accent); text-decoration: none; }
.orb-foot-muted { font-size: 0.78rem; color: #8a97a0; }

.orb-h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.25rem; }
.orb-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.orb-lead { color: var(--muted); max-width: 42rem; }
.orb-muted { color: var(--muted); }
.orb-mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; font-size: 0.82rem; }

.orb-btn-primary {
  background: var(--accent);
  border: 0;
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-weight: 600;
}
.orb-btn-primary:hover { background: var(--accent-2); color: #fff; }

.orb-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: end;
}
.orb-hero-meta { color: var(--muted); font-size: 0.85rem; display: flex; flex-direction: column; align-items: flex-end; }
.orb-game-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  color: inherit;
  text-decoration: none;
  height: 100%;
}
.orb-game-card:hover { border-color: var(--accent); color: inherit; }
.orb-count { font-size: 0.78rem; color: var(--muted); }
.orb-next { color: var(--accent); font-weight: 600; font-size: 0.88rem; }
.orb-next-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
}

.orb-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.orb-kpi-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.orb-kpi-value { font-size: 1.25rem; font-weight: 700; }

.orb-mini-balls, .orb-tv-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.orb-mini-balls span, .orb-tv-balls span, .tv-ball {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #d9ddd9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink);
}

.orb-stage-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.1rem 1.25rem;
}
.orb-stage-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.35rem; }
.orb-stage {
  background: #0f2740;
  border-radius: 14px;
  padding: 1.25rem 1rem 1rem;
  color: #fff;
}
.orb-globes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem 1rem;
  min-height: 140px;
}
.globe {
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.globe-sphere {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,.55), rgba(255,255,255,.08) 38%, rgba(8, 47, 73, .35));
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(255,255,255,.18);
}
.globe-sphere::after {
  content: "";
  position: absolute;
  inset: 8px auto auto 12px;
  width: 22px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
}
.globe-inner {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
}
.globe-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e8c36a;
  border: 1px solid rgba(255,255,255,.5);
}
.globe.spinning .globe-inner {
  animation: spin 0.55s linear infinite;
}
.globe-stand {
  width: 54px;
  height: 16px;
  margin-top: -4px;
  background: #16375a;
  border-radius: 0 0 8px 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-top: 0;
}
.globe-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,.7);
  margin-top: 0.2rem;
}

.orb-tvbar {
  margin-top: 1.1rem;
  background: var(--gold);
  color: #1a1408;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.orb-tv-meta span { display: block; font-size: 0.65rem; letter-spacing: 0.12em; }
.orb-tv-meta strong { font-size: 1.15rem; }
.orb-tv-balls span, .orb-tv-balls .tv-ball {
  background: #fff;
  border-color: rgba(0,0,0,.08);
}
.tv-ball.pop { animation: pop 0.35s ease; }

.orb-scoreline {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.orb-table { background: var(--surface); }
.orb-table th { font-size: 0.78rem; color: var(--muted); font-weight: 600; }

body.orb-auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.orb-auth-card {
  width: min(420px, calc(100% - 2rem));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.6rem 1.5rem 1.4rem;
}
.orb-auth-title { font-size: 1.45rem; font-weight: 700; margin: 0.6rem 0 0.2rem; }
.orb-auth-sub, .orb-auth-hint { color: var(--muted); font-size: 0.86rem; }
.orb-auth-foot { width: 100%; margin-top: 1.5rem; text-align: center; background: transparent; border: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
  .globe { width: 72px; }
  .globe-sphere { width: 64px; height: 64px; }
}

.orb-sync {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
}
.orb-sync-stage {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  margin-bottom: 1.2rem;
}
.orb-sync-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--line);
  position: relative;
  flex-shrink: 0;
}
.orb-sync-orb span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  top: 12px;
  left: 31px;
  transform-origin: 5px 24px;
}
.orb-sync-orb span:nth-child(2) { transform: rotate(120deg); background: var(--ink); }
.orb-sync-orb span:nth-child(3) { transform: rotate(240deg); background: var(--gold); }
.orb-sync-orb.is-spinning { animation: spin 1.1s linear infinite; }
.orb-sync-copy { flex: 1; min-width: 0; }
.orb-sync-status { margin: 0 0 0.55rem; font-weight: 600; }
.orb-sync-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.orb-sync-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.35s ease;
}
.orb-sync-pct { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--muted); }
.orb-sync-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.orb-sync-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.orb-sync-item-top { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; }
.orb-sync-badge {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.orb-sync-item[data-state="running"] .orb-sync-badge { color: var(--accent); }
.orb-sync-item[data-state="ok"] .orb-sync-badge { color: #0f766e; }
.orb-sync-item[data-state="error"] .orb-sync-badge { color: #b45309; }
.orb-sync-detail { margin: 0; font-size: 0.88rem; }

.orb-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.orb-filter-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.orb-data-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(18, 32, 44, 0.04);
}
.orb-data-table { font-size: 0.84rem; }
.orb-data-table thead th {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.orb-data-table tbody tr:hover { background: rgba(14, 116, 144, 0.04); }
.orb-users-name { font-weight: 600; }
.orb-users-muted { color: var(--muted); font-variant-numeric: tabular-nums; }
.orb-users-email { font-size: 0.8rem; color: #3b4a56; word-break: break-all; }
.orb-role {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  background: #eef6f7;
  color: var(--accent-2);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}
.orb-badge-ok { background: #d1fae5; color: #065f46; }
.orb-badge-warn { background: #fef3c7; color: #92400e; }
.orb-badge-muted { background: #e5e7eb; color: #4b5563; }
.orb-row-blocked { opacity: 0.72; }
.orb-action-icons .btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.orb-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  height: 100%;
}

.orb-stage {
  background:
    radial-gradient(circle at 50% 0%, #1a3f63 0%, #0b1d33 58%, #081526 100%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.globe-sphere {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.7), rgba(255,255,255,.12) 28%, rgba(12, 48, 78, .2) 62%, rgba(6, 22, 40, .55));
  border: 2px solid rgba(232, 195, 106, .45);
  box-shadow:
    inset 0 0 22px rgba(255,255,255,.16),
    0 10px 18px rgba(0,0,0,.28);
}
.globe-result {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: #1a1408;
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
  opacity: 0;
  z-index: 2;
}
.globe.drawn .globe-result {
  opacity: 1;
}
.globe.drawn .globe-sphere {
  background:
    radial-gradient(circle at 30% 28%, #fff7df, #e8c36a 55%, #b8862c);
  border-color: #f3e0a8;
}
.globe.drawn .globe-inner { display: none; }
.globe.waiting { opacity: 0.55; }
.globe.spinning { opacity: 1; }
.globe.spinning .globe-sphere {
  box-shadow: 0 0 0 4px rgba(232, 195, 106, .18), 0 10px 18px rgba(0,0,0,.28);
}
.tv-ball.is-empty {
  background: rgba(255,255,255,.35);
  color: transparent;
  border-style: dashed;
}
.tv-ball.is-drawn {
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

.orb-game-card {
  box-shadow: 0 8px 24px rgba(18, 32, 44, 0.04);
  transition: border-color .15s ease, transform .15s ease;
}
.orb-game-card:hover { transform: translateY(-2px); }

.orb-auth-card {
  box-shadow: 0 16px 40px rgba(18, 32, 44, 0.08);
}
