:root {
  --bg: #1b262c;
  --bg-deep: #141c21;
  --surface: #21303a;
  --surface-2: #263844;
  --line: #2f4553;
  --deep: #0f4c75;
  --accent: #3282b8;
  --accent-soft: rgba(50, 130, 184, 0.16);
  --text: #bbe1fa;
  --text-dim: #7fa3b8;
  --text-mute: #5b7688;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(50, 130, 184, 0.18), transparent 70%),
    radial-gradient(700px 380px at 92% 4%, rgba(15, 76, 117, 0.22), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(20, 28, 33, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark svg { width: 28px; height: 28px; display: block; border-radius: 8px; }
.brand-text { font-size: 15px; letter-spacing: -0.01em; color: var(--text-dim); }
.brand-text b { color: var(--text); font-weight: 650; }

.topnav { display: flex; align-items: center; gap: 14px; }
.nav-link { color: var(--text-dim); font-size: 13.5px; font-weight: 500; }
.nav-link:hover { color: var(--text); text-decoration: none; }

.pill {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text-mute); background: var(--surface);
}
.pill-live { color: var(--ok); border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.1); }
.pill-down { color: var(--err); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }

/* ---------- layout ---------- */

.wrap {
  position: relative; z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  padding: 22px 16px 64px;
}

.hero { margin: 8px 0 22px; }
.hero h1 {
  font-size: clamp(22px, 5.2vw, 31px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin: 0 0 10px;
  font-weight: 680;
}
.hero p { margin: 0; color: var(--text-dim); font-size: 14.5px; max-width: 62ch; }
.hero code { background: var(--surface); padding: 2px 6px; border-radius: 6px; color: var(--accent); }

/* ---------- tabs ---------- */

.tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 4px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 15;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; white-space: nowrap;
  appearance: none; border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 9px 14px; border-radius: 9px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--deep); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset; }

.panel { display: none; }
.panel.is-active { display: block; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card h2 { font-size: 16.5px; margin: 0; letter-spacing: -0.01em; font-weight: 640; }
.card h3 { font-size: 14.5px; margin: 0 0 8px; font-weight: 620; }
.hint { color: var(--text-mute); font-size: 12.5px; }

.note { background: var(--bg-deep); }
.note p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.65; }
.note b { color: var(--text); }

/* ---------- inputs ---------- */

.input, select, textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
textarea.mono, .input.mono { font-family: var(--mono); font-size: 12.6px; }
.input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.grow { flex: 1; }
.field label { font-size: 11.5px; color: var(--text-mute); font-weight: 550; letter-spacing: 0.02em; text-transform: uppercase; }
.field select, .field input { min-width: 108px; }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); cursor: pointer; padding-bottom: 11px; }
.switch input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- buttons ---------- */

.btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 580;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: #2c4152; border-color: #3b5766; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #04121c; font-weight: 650; }
.btn-primary:hover { background: #3f95cd; border-color: #3f95cd; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------- output ---------- */

.out {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 12.4px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
  min-height: 44px;
}
.out.big { max-height: 340px; color: var(--text); }
.out:empty { display: none; }

.code-block {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.3px;
  line-height: 1.65;
  color: var(--text-dim);
  margin: 8px 0 12px;
}
.code-block .host { color: var(--accent); }

.meta-line { color: var(--text-mute); font-size: 12.5px; margin-top: 10px; min-height: 18px; }
.meta-line.err { color: var(--err); }
.meta-line.ok { color: var(--ok); }

/* ---------- progress ---------- */

.progress { height: 3px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress .bar { height: 100%; width: 30%; background: var(--accent); border-radius: 999px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.hidden { display: none !important; }

/* ---------- results ---------- */

.results { display: flex; flex-direction: column; gap: 12px; }

.acct {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.acct-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(50,130,184,0.06), transparent);
}
.acct-email { font-family: var(--mono); font-size: 13px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.badge-live { color: var(--ok); background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); }
.badge-fail { color: var(--err); background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); }
.badge-mode { color: var(--text-mute); background: var(--bg-deep); border: 1px solid var(--line); }

.otp-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  background: rgba(34,197,94,0.07);
  border-bottom: 1px solid rgba(34,197,94,0.18);
  flex-wrap: wrap;
}
.otp-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-mute); }
.otp-code {
  font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--ok); cursor: pointer; user-select: all;
}
.otp-code:active { opacity: 0.7; }
.otp-src { font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.otp-none { padding: 10px 15px; font-size: 12.5px; color: var(--text-mute); border-bottom: 1px solid var(--line); }

.mail-list { max-height: 380px; overflow: auto; }
.mail {
  border-bottom: 1px solid rgba(47,69,83,0.55);
  padding: 10px 15px;
  cursor: pointer;
}
.mail:last-child { border-bottom: 0; }
.mail:hover { background: rgba(50,130,184,0.05); }
.mail-top { display: flex; align-items: baseline; gap: 9px; }
.mail-subj { font-size: 13.2px; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { font-size: 11px; color: #8fa9ba; white-space: nowrap; flex: 0 0 auto; }
.mail-from { font-size: 11.5px; color: #8fa9ba; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-prev { font-size: 12.2px; color: var(--text-dim); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail-body {
  margin-top: 8px; font-size: 12.4px; color: var(--text-dim); white-space: pre-wrap;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; max-height: 240px; overflow: auto; display: none;
}
.mail.open .mail-body { display: block; }
.mail-otp {
  display: inline-block; font-family: var(--mono); font-weight: 700; color: var(--ok);
  font-variant-numeric: tabular-nums; vertical-align: 1px;
  background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3);
  padding: 1px 6px; border-radius: 5px; font-size: 11.5px; margin-left: 6px;
}
.acct-err { padding: 13px 15px; font-size: 12.6px; color: #fca5a5; background: rgba(239,68,68,0.06); }
.acct-foot { display: flex; gap: 8px; padding: 10px 15px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- check grid ---------- */

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .grid3 { grid-template-columns: 1fr; } }
.card.mini { padding: 13px; margin-bottom: 0; }
.mini-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.count { margin-left: auto; color: var(--text); font-family: var(--mono); font-size: 12.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--ok); }
.dot-die { background: var(--err); }
.dot-unknown { background: var(--warn); }
.card.mini .out { max-height: 200px; font-size: 11.6px; }

/* ---------- dropzone ---------- */

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: 0 0 4px; font-size: 13.5px; color: var(--text-dim); }
.dropzone p b { color: var(--text); }
.dropzone .link { color: var(--accent); text-decoration: underline; }

.linkout { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.linkout .input { flex: 1; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  background: var(--deep); color: #fff; border: 1px solid var(--accent);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 550;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 60; max-width: calc(100vw - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */

.foot {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 7px; justify-content: center;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  font-size: 12px; color: var(--text-mute);
  border-top: 1px solid var(--line);
  max-width: 940px; margin: 0 auto;
}
.foot .sep { opacity: 0.4; }

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .wrap { padding: 16px 13px 56px; }
  .card { padding: 14px; }
  .row { flex-wrap: wrap; }
  .row .btn { flex: 1; }
  .field { flex: 1 1 45%; }
  .field.grow { display: none; }
  .brand-text { font-size: 14px; }
  .topnav { gap: 10px; }
  .nav-link { font-size: 12.5px; }
  /* 6 tabs wrap into 2 rows of 3 instead of scrolling off-screen */
  .tabs { flex-wrap: wrap; position: static; }
  .tab { flex: 1 1 calc(33.333% - 4px); padding: 9px 6px; font-size: 12.2px; text-align: center; }
  .otp-code { font-size: 18px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* bigger tap targets */
  .switch { padding-bottom: 0; min-height: 44px; }
  .switch input { width: 19px; height: 19px; }
  .mail { padding: 12px 14px; }
  .btn { min-height: 42px; }
  .input, select, textarea { font-size: 16px; } /* stops iOS zoom-on-focus */
  textarea.mono, .input.mono { font-size: 12.4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
