:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #0c1a28;
  --panel-border: rgba(173, 205, 229, 0.13);
  --text: #f4f8fb;
  --muted: #8fa7b9;
  --checking: #f3b84b;
  --checking-rgb: 243, 184, 75;
  --not-ready: #ff645f;
  --not-ready-rgb: 255, 100, 95;
  --ready: #47df8b;
  --ready-rgb: 71, 223, 139;
  --state: var(--checking);
  --state-rgb: var(--checking-rgb);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 12%, rgba(31, 87, 125, 0.21), transparent 38%),
    linear-gradient(160deg, #081522 0%, var(--bg) 56%, #050c13 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(100% - 32px, 540px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.brand-mark span {
  width: 12px;
  height: 20px;
  border: solid #f7b846;
  border-width: 0 4px 4px 0;
  transform: rotate(-45deg) skew(-7deg, -7deg);
}

.eyebrow,
.status-kicker,
.network-note,
.next-check {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

h1 {
  font-size: clamp(1.55rem, 7vw, 2rem);
  line-height: 1.05;
}

.status-card {
  --state: var(--checking);
  --state-rgb: var(--checking-rgb);
  position: relative;
  isolation: isolate;
  align-self: center;
  overflow: hidden;
  padding: clamp(27px, 7vw, 42px);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: linear-gradient(155deg, rgba(17, 38, 55, 0.96), rgba(8, 22, 34, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), inset 0 1px rgba(255, 255, 255, 0.04);
  text-align: center;
}

.status-card[data-state="not-ready"] {
  --state: var(--not-ready);
  --state-rgb: var(--not-ready-rgb);
}

.status-card[data-state="ready"] {
  --state: var(--ready);
  --state-rgb: var(--ready-rgb);
}

.ambient-glow {
  position: absolute;
  z-index: -1;
  top: -170px;
  left: 50%;
  width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--state-rgb), 0.2), transparent 68%);
  transform: translateX(-50%);
  transition: background 450ms ease;
}

.status-orb-wrap {
  width: 150px;
  aspect-ratio: 1;
  margin: 0 auto 26px;
  padding: 12px;
  border: 1px solid rgba(var(--state-rgb), 0.25);
  border-radius: 50%;
  background: rgba(var(--state-rgb), 0.035);
  box-shadow: 0 0 60px rgba(var(--state-rgb), 0.13);
  transition: border-color 400ms ease, background 400ms ease, box-shadow 400ms ease;
}

.status-orb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--state);
  background: radial-gradient(circle at 38% 32%, rgba(var(--state-rgb), 0.31), rgba(var(--state-rgb), 0.11) 54%, rgba(var(--state-rgb), 0.05));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.14), 0 14px 38px rgba(0, 0, 0, 0.28);
  transition: color 400ms ease, background 400ms ease;
}

.status-icon {
  display: none;
  width: 62px;
  height: 62px;
}

[data-state="checking"] .icon-checking,
[data-state="not-ready"] .icon-not-ready,
[data-state="ready"] .icon-ready {
  display: block;
}

[data-state="checking"] .icon-checking {
  animation: spin 1.2s linear infinite;
}

[data-state="ready"] .status-orb-wrap {
  animation: ready-pop 560ms cubic-bezier(0.16, 1, 0.3, 1);
}

.status-kicker {
  margin-bottom: 7px;
  color: var(--state);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  transition: color 400ms ease;
}

h2 {
  font-size: clamp(2.2rem, 10vw, 3.45rem);
  line-height: 1.02;
}

.status-message {
  min-height: 3em;
  margin: 13px auto 0;
  color: #b7c8d4;
  font-size: 1rem;
  line-height: 1.5;
}

.status-estimate {
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.45;
}

.status-details {
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 17px;
  background: rgba(0, 0, 0, 0.14);
  text-align: left;
}

.status-details div {
  min-width: 0;
  padding: 14px 15px;
}

.status-details div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.status-details dt {
  margin-bottom: 4px;
  color: #728a9c;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-details dd {
  overflow: hidden;
  margin: 0;
  color: #dce7ee;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.actions button {
  min-height: 52px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.actions button:active {
  transform: scale(0.975);
}

.actions button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

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

.actions svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
}

.primary-button {
  color: #0a151e;
  background: #f0f5f7;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.primary-button:not(:disabled):hover {
  background: #ffffff;
}

.sound-button {
  padding: 0 15px;
  color: #bed0dc;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
}

.sound-button:hover {
  background: rgba(255, 255, 255, 0.11);
}

.sound-button[aria-pressed="true"] {
  color: #9af0bc;
  border-color: rgba(var(--ready-rgb), 0.24) !important;
  background: rgba(var(--ready-rgb), 0.1);
}

.next-check {
  min-height: 1.2em;
  margin-top: 14px;
  font-size: 0.8rem;
}

.network-note {
  align-self: end;
  text-align: center;
  font-size: 0.82rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ready-pop {
  0% { transform: scale(0.82); opacity: 0.5; }
  55% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 430px) {
  .app-shell {
    width: min(100% - 24px, 540px);
    gap: 16px;
  }

  .status-card {
    padding: 25px 20px 23px;
    border-radius: 24px;
  }

  .status-orb-wrap {
    width: 132px;
    margin-bottom: 23px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .sound-button {
    min-height: 46px !important;
  }
}

@media (max-height: 720px) {
  .app-shell {
    padding-top: max(18px, env(safe-area-inset-top));
    gap: 13px;
  }

  .brand-mark {
    width: 37px;
  }

  .status-card {
    padding-top: 22px;
    padding-bottom: 20px;
  }

  .status-orb-wrap {
    width: 112px;
    margin-bottom: 18px;
  }

  .status-icon {
    width: 50px;
    height: 50px;
  }

  .status-details {
    margin-top: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
