:root {
  color-scheme: light;
  --bg-top: #f6efe2;
  --bg-bottom: #efe6d2;
  --ink-strong: #17212b;
  --ink-muted: #5f6a70;
  --panel: rgba(255, 250, 241, 0.88);
  --panel-strong: rgba(255, 252, 247, 0.96);
  --line: rgba(23, 33, 43, 0.1);
  --shadow: 0 22px 60px rgba(25, 43, 54, 0.12);
  --teal: #0f766e;
  --teal-deep: #0b4f4a;
  --amber: #d97706;
  --amber-soft: #fff1dd;
  --success-bg: #ddf8ef;
  --danger: #b45309;
  --danger-bg: #fde8dc;
  --neutral-bg: rgba(23, 33, 43, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink-strong);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(255, 241, 221, 0.9), transparent 34%),
    linear-gradient(145deg, rgba(255, 252, 247, 0.96), rgba(244, 236, 223, 0.92));
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.22), transparent 72%);
  pointer-events: none;
}

.eyebrow,
.panel-kicker,
.panel-note,
.field-label,
.status-copy,
.leaderboard-caption,
.metric-label,
.detail-list dt {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow,
.panel-kicker,
.field-label,
.leaderboard-caption,
.metric-label,
.detail-list dt {
  color: var(--ink-muted);
}

.display-title,
.panel h2,
.metric-card strong,
.detail-list dd,
.leaderboard-name,
.leaderboard-metric strong {
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
}

.display-title {
  margin: 10px 0 12px;
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lead-copy {
  max-width: 62ch;
  margin: 0;
  color: var(--ink-muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.connection-form,
.viewer-form {
  margin-top: 28px;
}

.field,
.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink-strong);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.field input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.65);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.field input[readonly] {
  cursor: default;
  color: rgba(23, 33, 43, 0.72);
  background:
    linear-gradient(135deg, rgba(228, 244, 241, 0.92), rgba(255, 247, 232, 0.88));
  border-style: dashed;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  color: #fffdf8;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.secondary-button {
  color: var(--ink-strong);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  border: 1px solid rgba(23, 33, 43, 0.08);
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.status-chip,
.badge,
.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-chip,
.badge {
  min-height: 34px;
  padding: 0 12px;
}

.status-chip.is-syncing,
.badge.tone-neutral {
  color: var(--ink-strong);
  background: var(--neutral-bg);
}

.status-chip.is-live,
.badge.tone-success {
  color: var(--teal-deep);
  background: var(--success-bg);
}

.status-chip.is-offline,
.badge.tone-danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.badge.tone-accent {
  color: #855000;
  background: var(--amber-soft);
}

.badge.tone-warning {
  color: #855000;
  background: rgba(255, 227, 186, 0.9);
}

.status-copy,
.panel-note {
  margin: 0;
  color: var(--ink-muted);
  line-height: 1.5;
}

.panel-player,
.panel-leaderboard {
  margin-top: 18px;
}

.viewer-note {
  margin-top: 18px;
}

.viewer-auth-hint {
  margin-top: 16px;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.identity-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(23, 33, 43, 0.08);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 239, 226, 0.88));
}

.identity-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.identity-card h3 {
  margin: 6px 0 0;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.identity-note {
  min-height: 3.3em;
}

.identity-meta {
  margin: 0;
  font-size: 0.92rem;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink-strong);
}

.identity-meta-subtle {
  color: var(--ink-muted);
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 22px;
  background: var(--panel-strong);
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid rgba(23, 33, 43, 0.08);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 240, 229, 0.94));
}

.metric-card strong {
  font-size: 1.1rem;
  line-height: 1.35;
}

.detail-list {
  display: grid;
  gap: 16px;
  margin: 0;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list div {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(23, 33, 43, 0.08);
}

.detail-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-list dd {
  margin: 8px 0 0;
  font-size: 1.05rem;
}

.leaderboard-header {
  align-items: end;
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(23, 33, 43, 0.14);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.56);
}

.leaderboard-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(23, 33, 43, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.leaderboard-row.is-leader {
  background:
    linear-gradient(135deg, rgba(255, 248, 234, 0.98), rgba(227, 248, 244, 0.96));
  border-color: rgba(15, 118, 110, 0.18);
}

.rank-pill {
  min-width: 58px;
  min-height: 42px;
  padding: 0 14px;
  color: #855000;
  background: rgba(255, 227, 186, 0.92);
}

.leaderboard-name-block,
.leaderboard-metric {
  display: grid;
  gap: 6px;
}

.leaderboard-name {
  font-size: 1.1rem;
}

.leaderboard-metric strong {
  font-size: 1.05rem;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel-payout {
    order: 2;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1120px);
    padding: 16px 0 42px;
  }

  .hero-card,
  .panel {
    border-radius: 24px;
  }

  .field-grid,
  .metric-grid,
  .detail-grid,
  .identity-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-name-block {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .hero-card,
  .panel {
    padding: 18px;
  }

  .hero-actions,
  .status-strip,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .leaderboard-row {
    grid-template-columns: 1fr;
  }

  .rank-pill {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-card,
  .panel,
  .leaderboard-row {
    animation: rise-in 420ms ease both;
  }
}

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