:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7faf9;
  color: #12211f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), transparent 38%),
    #f7faf9;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}

.status-panel {
  width: min(100%, 560px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(18, 33, 31, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: #12211f;
  font-size: 24px;
  display: grid;
  place-items: center;
}

.icon-button:active {
  transform: translateY(1px);
}

.summary {
  min-height: 64px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
  background: #ffffff;
  border: 1px solid rgba(18, 33, 31, 0.12);
  box-shadow: 0 12px 30px rgba(18, 33, 31, 0.08);
  font-weight: 700;
}

.summary-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #94a3b8;
}

.summary.is-ok .summary-dot {
  background: #16a34a;
}

.summary.is-warn .summary-dot {
  background: #dc2626;
}

.summary.is-loading .summary-dot {
  background: #f59e0b;
  animation: pulse 1s infinite ease-in-out;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-row {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(18, 33, 31, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.server-main {
  min-width: 0;
}

.server-name {
  font-weight: 800;
  margin-bottom: 5px;
}

.server-url {
  color: #52615f;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.server-result {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 6px;
}

.badge {
  min-width: 74px;
  text-align: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #e2e8f0;
  color: #334155;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.down {
  background: #fee2e2;
  color: #991b1b;
}

.badge.checking {
  background: #fef3c7;
  color: #92400e;
}

.latency {
  color: #52615f;
  font-size: 12px;
  min-height: 15px;
}

.last-checked {
  margin: 16px 0 0;
  color: #52615f;
  font-size: 13px;
  text-align: center;
}

.password-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(247, 250, 249, 0.94);
  backdrop-filter: blur(16px);
}

.password-gate.is-hidden {
  display: none;
}

.password-box {
  width: min(100%, 360px);
  padding: 22px;
  border: 1px solid rgba(18, 33, 31, 0.12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(18, 33, 31, 0.12);
}

.password-box h2 {
  margin: 0 0 16px;
  font-size: 24px;
  letter-spacing: 0;
}

.password-input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(18, 33, 31, 0.2);
  border-radius: 8px;
  background: #ffffff;
  color: #12211f;
  font: inherit;
  font-size: 16px;
}

.password-input:focus {
  border-color: #0f766e;
  outline: 3px solid rgba(15, 118, 110, 0.18);
}

.primary-button {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 800;
}

.primary-button:active {
  transform: translateY(1px);
}

.password-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: #dc2626;
  font-size: 13px;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 430px) {
  .app-shell {
    align-items: start;
  }

  h1 {
    font-size: 30px;
  }

  .server-row {
    align-items: stretch;
    flex-direction: column;
  }

  .server-result {
    grid-template-columns: auto 1fr;
    justify-items: start;
    align-items: center;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    background: #111817;
    color: #ecfdf5;
  }

  body {
    background:
      linear-gradient(180deg, rgba(20, 184, 166, 0.16), transparent 42%),
      #111817;
  }

  .icon-button,
  .summary,
  .server-row,
  .password-box {
    background: rgba(23, 32, 31, 0.9);
    border-color: rgba(236, 253, 245, 0.14);
    color: #ecfdf5;
  }

  .password-gate {
    background: rgba(17, 24, 23, 0.94);
  }

  .password-input {
    background: #111817;
    border-color: rgba(236, 253, 245, 0.2);
    color: #ecfdf5;
  }

  .server-url,
  .latency,
  .last-checked {
    color: #a7b8b4;
  }
}
