:root {
  --blue: #266BF6;
  --blue-light: #4C83F3;
  --text: #FFFFFF;
  --muted: rgba(255, 255, 255, 0.78);
  --border: rgba(255, 255, 255, 0.18);
  --card: rgba(255, 255, 255, 0.05);
  --red-text: #FFB3BB;
  --red-border: rgba(255, 107, 122, 0.5);
  --red-bg: rgba(255, 107, 122, 0.1);
  --font: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
  background-color: #000000;
  background-image: radial-gradient(ellipse 120% 40% at 50% 108%, #266BF6 0%, rgba(38, 107, 246, 0.3) 45%, #000000 80%);
  background-attachment: fixed;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 430px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 20px calc(env(safe-area-inset-bottom) + 20px);
}

.wordmark { margin: 0; font-weight: 500; font-size: 34px; letter-spacing: -0.8px; line-height: 1.1; }
.wordmark em, .device-name em { font-style: normal; color: var(--blue-light); }
.hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; text-align: center; max-width: 300px; }
.error { margin: 0; font-size: 13px; color: var(--red-text); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-light); }

.logo { display: block; width: 100%; height: 100%; }
.orbit { transform-origin: 50% 50%; animation: orbit 18s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 4px;
}
.login-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding-top: 40px;
  text-align: center;
}
.logo-big { position: relative; width: 136px; height: 136px; }
.logo-big::before {
  content: "";
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(38, 107, 246, 0.55) 0%, rgba(38, 107, 246, 0) 68%);
  animation: glow 4s ease-in-out infinite;
}
.logo-big .logo { position: relative; }
@keyframes glow { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
.tagline { margin: 0; display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, 0.72); }

.login-form { display: flex; flex-direction: column; gap: 16px; padding-bottom: 36px; }
.field { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.72); margin-bottom: -8px; }
.pw { position: relative; display: flex; align-items: center; }
.pw input, .wc-login input {
  width: 100%;
  height: 58px;
  padding: 0 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.pw input { padding-right: 60px; }
.pw input:focus, .wc-login input:focus { outline: 2px solid var(--blue-light); outline-offset: 2px; }
.pw input::placeholder, .wc-login input::placeholder { color: rgba(255, 255, 255, 0.4); }
.eye {
  position: absolute;
  right: 6px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}
.eye svg { width: 22px; height: 22px; }
.eye[aria-pressed="true"] { color: var(--blue-light); }

.hud-button {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #FFFFFF;
  color: #000000;
  font-size: 16px;
  font-weight: 500;
}
.hud-button:active { filter: brightness(0.9); }
.hud-button:disabled { opacity: 0.5; }
.hud-button.hangup {
  width: auto;
  min-width: 200px;
  height: 48px;
  padding: 0 28px;
  font-size: 14px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-text);
}
.pill-outline {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.site { margin: 0; text-align: center; font-size: 12px; color: rgba(255, 255, 255, 0.6); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 72px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-small { display: block; width: 34px; height: 34px; flex-shrink: 0; }
.top .wordmark { font-size: clamp(14px, 4.2vw, 17px); letter-spacing: -0.3px; white-space: nowrap; }
.conn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 11px;
  flex-shrink: 0;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}
.conn .dot { box-shadow: 0 0 8px var(--blue-light); }
.conn.offline { border-color: rgba(255, 107, 122, 0.6); color: #FF8D99; }
.conn.offline .dot { background: #FF6B7A; box-shadow: none; }

.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 0 28px;
}
.stage { position: relative; width: 232px; height: 232px; flex-shrink: 0; }
.wave {
  position: absolute;
  left: 32px;
  top: 32px;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 1.5px solid rgba(76, 131, 243, 0.8);
  background: rgba(38, 107, 246, 0.22);
  animation: wave 2.8s ease-out infinite;
}
.wave-2 { animation-delay: 1.4s; }
.stage:has(.ring.calling) .wave { animation-duration: 1.2s; }
.stage:has(.ring.calling) .wave-2 { animation-delay: 0.6s; }
.stage.offline .wave { display: none; }
@keyframes wave { from { transform: scale(0.86); opacity: 0.7; } to { transform: scale(1.35); opacity: 0; } }

.ring {
  position: absolute;
  left: 32px;
  top: 32px;
  width: 168px;
  height: 168px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #4C83F3 0%, #266BF6 55%, #1B4FBF 100%);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1), 0 20px 70px rgba(38, 107, 246, 0.6);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ring .icon { display: block; width: 64px; height: 64px; }
.ring .icon svg { width: 100%; height: 100%; }
.ring:active .icon { transform: scale(0.94); }
.ring:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 3px; }
.count { font-size: 64px; font-weight: 500; letter-spacing: -2px; line-height: 1; }
.ring:disabled { cursor: default; }
.stage.offline .ring {
  background: radial-gradient(circle at 50% 35%, #3A3F4B 0%, #1B1E26 100%);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08);
}

.device-name { margin: 0; font-size: 30px; font-weight: 500; letter-spacing: -0.8px; line-height: 1.1; text-align: center; }

.tag {
  margin: 0;
  padding: 10px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  max-width: 100%;
}
.tag.ok { border-color: rgba(76, 131, 243, 0.6); }
.tag.error { border-color: var(--red-border); background: var(--red-bg); color: var(--red-text); }
.alert {
  margin: 0;
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--red-border);
  background: var(--red-bg);
  color: var(--red-text);
  font-size: 13px;
  line-height: 1.5;
}

footer { display: grid; gap: 12px; }
.panel {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
}
.panel summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 500;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: "+"; font-size: 22px; font-weight: 400; color: var(--blue-light); line-height: 1; }
.panel[open] summary::after { content: "–"; }
.panel.ko { border-color: var(--red-border); background: var(--red-bg); }
.panel.ko summary { color: var(--red-text); }
.panel.ko summary::after { color: #FF6B7A; }
.panel-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 14px; }

.checks { list-style: none; padding: 0; margin: 0; font-size: 14px; display: grid; gap: 10px; }
.checks li div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.checks b { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.checks b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-light); flex-shrink: 0; }
.checks li.ko b::before { background: #FF6B7A; }
.checks span { font-weight: 500; text-align: right; }
.checks li.ko span { color: var(--red-text); }

.wc-login { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.wc-login .hint { max-width: none; text-align: left; font-size: 13px; }
.wc-login .hud-button { height: 48px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .orbit, .logo-big::before, .wave { animation: none; }
}
