:root {
  --app-bg: #0b1020;
  --app-surface: #11182a;
  --app-surface-2: #151e33;
  --app-surface-3: #1a2440;
  --app-border: #23314d;
  --app-text: #eaf1fb;
  --app-text-muted: #93a4bd;
  --app-live: #35d6ff;
  --app-call: #5aa8ff;
  --app-put: #ffb24c;
  --app-warning: #f6c453;
  --app-danger: #ff6a6a;
  --app-shadow: 0 20px 44px rgba(2, 6, 23, 0.28);
  --app-safe-top: env(safe-area-inset-top);
  --app-safe-right: env(safe-area-inset-right);
  --app-safe-bottom: env(safe-area-inset-bottom);
  --app-safe-left: env(safe-area-inset-left);
}

html {
  color-scheme: dark;
}

body.live-app-body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top, rgba(53, 214, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #0b1020 0%, #0e1426 100%);
  color: var(--app-text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.live-app-body.legal-open {
  overflow: hidden;
}

.live-app-page {
  max-width: 860px;
  margin: 0 auto;
  padding:
    calc(12px + var(--app-safe-top))
    calc(12px + var(--app-safe-right))
    calc(20px + var(--app-safe-bottom))
    calc(12px + var(--app-safe-left));
}

.live-app-page--wide {
  max-width: 1440px;
}

.live-app-topbar {
  position: static;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(90, 168, 255, 0.16);
  border-radius: 16px;
  background: rgba(17, 24, 42, 0.9);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.18);
}

.live-app-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-app-topbar-row + .live-app-topbar-row {
  margin-top: 8px;
}

.live-app-eyebrow {
  color: var(--app-text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-app-title {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.live-app-subtitle {
  margin-top: 2px;
  color: var(--app-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.live-app-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.live-app-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: rgba(21, 30, 51, 0.96);
  color: var(--app-text-muted);
  font-size: 11px;
  font-weight: 700;
}

.live-app-state-pill {
  color: var(--app-text);
}

.live-app-state-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.live-app-state-pill.is-live {
  color: var(--app-live);
  border-color: rgba(53, 214, 255, 0.34);
}

.live-app-state-pill.is-partial,
.live-app-state-pill.is-warm {
  color: var(--app-warning);
  border-color: rgba(246, 196, 83, 0.28);
}

.live-app-state-pill.is-delayed,
.live-app-state-pill.is-stale {
  color: #d6dbe7;
  border-color: rgba(147, 164, 189, 0.28);
}

.live-app-state-pill.is-unavailable {
  color: var(--app-danger);
  border-color: rgba(255, 106, 106, 0.28);
}

.live-app-legal-trigger {
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: rgba(21, 30, 51, 0.96);
  color: var(--app-text);
  min-height: 30px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.live-app-legal-trigger:hover {
  border-color: rgba(90, 168, 255, 0.3);
}

.live-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.live-summary-item {
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(17, 24, 42, 0.82);
}

.live-summary-label {
  color: var(--app-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.live-summary-value {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.live-summary-sub {
  margin-top: 4px;
  color: var(--app-text-muted);
  font-size: 10px;
  line-height: 1.28;
}

.live-app-disclaimer {
  margin: 8px 0 10px;
  color: var(--app-text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.live-app-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--app-safe-bottom));
  z-index: 180;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(90, 168, 255, 0.16);
  border-radius: 18px;
  background: rgba(17, 24, 42, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: var(--app-shadow);
}

.live-app-bottom-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  text-decoration: none;
  color: var(--app-text-muted);
  background: transparent;
}

.live-app-bottom-link strong {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.live-app-bottom-link span {
  font-size: 11px;
  font-weight: 600;
}

.live-app-bottom-link.is-active {
  border-color: rgba(90, 168, 255, 0.3);
  background: rgba(90, 168, 255, 0.12);
  color: var(--app-text);
}

.live-app-modal {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 20px 12px calc(20px + var(--app-safe-bottom));
  background: rgba(2, 6, 23, 0.66);
}

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

.live-app-modal-card {
  width: min(720px, 100%);
  max-height: 85dvh;
  overflow: auto;
  border: 1px solid var(--app-border);
  border-radius: 22px;
  background: linear-gradient(180deg, #11182a 0%, #141d32 100%);
  box-shadow: 0 32px 70px rgba(2, 6, 23, 0.44);
  padding: 18px 16px 16px;
}

.live-app-modal-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.live-app-modal-card p {
  margin: 10px 0 0;
  color: var(--app-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.live-app-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.live-app-modal-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: rgba(21, 30, 51, 0.96);
  color: var(--app-text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.live-app-modal-btn--primary {
  border-color: rgba(53, 214, 255, 0.26);
  background: rgba(53, 214, 255, 0.14);
}

.live-app-grid-2,
.live-app-grid-3 {
  display: grid;
  gap: 10px;
}

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

.live-app-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.live-app-card {
  border: 1px solid var(--app-border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(17, 24, 42, 0.94);
  box-shadow: var(--app-shadow);
}

.live-app-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.live-app-card p,
.live-app-card li {
  color: var(--app-text-muted);
  font-size: 13px;
  line-height: 1.48;
}

.live-app-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.live-app-health-list {
  display: grid;
  gap: 10px;
}

.live-app-health-item {
  border: 1px solid var(--app-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(21, 30, 51, 0.9);
}

.live-app-health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-app-health-title {
  font-size: 14px;
  font-weight: 800;
}

.live-app-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
}

.live-app-status-chip.is-ok {
  color: var(--app-live);
  background: rgba(53, 214, 255, 0.08);
  border-color: rgba(53, 214, 255, 0.24);
}

.live-app-status-chip.is-warn {
  color: var(--app-warning);
  background: rgba(246, 196, 83, 0.08);
  border-color: rgba(246, 196, 83, 0.24);
}

.live-app-status-chip.is-bad {
  color: var(--app-danger);
  background: rgba(255, 106, 106, 0.08);
  border-color: rgba(255, 106, 106, 0.24);
}

.live-app-mini {
  color: var(--app-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.live-app-section-title {
  margin: 18px 0 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.live-app-empty {
  color: var(--app-text-muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .live-summary-strip,
  .live-app-grid-2,
  .live-app-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .live-app-page,
  .live-app-page--wide {
    padding:
      calc(10px + var(--app-safe-top))
      calc(10px + var(--app-safe-right))
      calc(18px + var(--app-safe-bottom))
      calc(10px + var(--app-safe-left));
  }

  .live-app-title {
    font-size: 16px;
  }

  .live-app-topbar-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .live-app-meta-row {
    width: 100%;
  }
}
