/* =========================================================
   Moth Hub — in-page key check dialog
   Uses the site tokens from style.css (Themes.Preset).
   ========================================================= */

.vmodal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 22px;
}
.vmodal[hidden] { display: none; }

.vmodal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: v-fade-in 0.22s ease both;
}

.vcard {
  position: relative;
  width: min(100%, 430px);
  padding: 34px 30px 24px;
  border-radius: 22px;
  border: 1px solid var(--card-border);
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(var(--accent-rgb), 0.14), transparent 60%),
    linear-gradient(180deg, #1b1b1b, #101010);
  box-shadow:
    0 50px 140px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  animation: v-card-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.vcard::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 1px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

@keyframes v-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes v-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.vkey-tile {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.16);
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px -16px var(--accent-glow);
}
.vkey-tile svg { width: 30px; height: 30px; }

.vcard h2 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.vcard .vsub {
  margin: 0 0 22px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.vfield { position: relative; margin: 0 0 12px; }

.vfield .key-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-mute);
  pointer-events: none;
  transition: color 0.2s ease;
}

.vfield input {
  width: 100%;
  height: 54px;
  padding: 0 16px 0 50px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.vfield input::placeholder {
  color: var(--text-mute);
  font-weight: 500;
  font-size: 0.94em;
  letter-spacing: 0.01em;
}
.vfield input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}
.vfield:focus-within .key-icon { color: var(--accent-light); }

.vcheck {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 52px;
  margin-top: 2px;
  border: 0;
  border-radius: 12px;
  font: 600 1rem var(--font);
  color: var(--text);
  background: var(--accent);
  cursor: pointer;
  transition: filter 0.2s ease, box-shadow 0.25s ease, background 0.25s ease,
    transform 0.18s ease, color 0.2s ease;
}
.vcheck svg { width: 19px; height: 19px; }
.vcheck .spin { animation: v-spin 0.9s linear infinite; }
@keyframes v-spin { to { transform: rotate(360deg); } }
.vcheck:hover {
  background: var(--accent-strong);
  box-shadow: 0 12px 30px -18px var(--accent-glow);
}
.vcheck:active { transform: translateY(1px); }
.vcheck[disabled] { cursor: progress; filter: saturate(0.85) brightness(0.95); }

.vcheck[data-state="ok"] {
  background: #17b26a;
  color: #ffffff;
  box-shadow: 0 12px 34px -18px rgba(23, 178, 106, 0.8);
}
.vcheck[data-state="bad"] {
  background: var(--danger);
  color: #170404;
  box-shadow: 0 12px 34px -18px rgba(255, 95, 95, 0.7);
}
.vcheck[data-state="warn"] {
  background: var(--risky);
  color: #191203;
}

.vmsg {
  min-height: 1.35em;
  margin: 14px 2px 0;
  text-align: center;
  font-size: 0.89rem;
  color: var(--text-dim);
}
.vmsg[data-tone="ok"] { color: #8ff0b4; }
.vmsg[data-tone="bad"] { color: #ffb3b3; }
.vmsg[data-tone="warn"] { color: #ffe08a; }

.vmeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
  font-size: 0.76rem;
  color: var(--text-mute);
}

.vstatus { display: inline-flex; align-items: center; gap: 7px; }
.vstatus .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
}
.vstatus[data-state="online"] .dot {
  background: #17b26a;
  box-shadow: 0 0 8px rgba(23, 178, 106, 0.9);
}
.vstatus[data-state="offline"] .dot {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 95, 95, 0.9);
}

.vreload {
  border: 0;
  background: none;
  padding: 0;
  margin-left: 2px;
  font: inherit;
  font-size: 0.76rem;
  color: var(--accent-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.vreload[hidden] { display: none; }
.vreload:hover { color: var(--accent-pale); }

.vhwid { font-variant-numeric: tabular-nums; }

.vclose {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.vclose:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.vclose svg { width: 18px; height: 18px; }

.vmodal :where(a, button, input):focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

body.modal-open { overflow: hidden; }

@media (max-width: 720px) {
  .vcard { padding: 28px 20px 20px; }
  .vfield input { font-size: 0.78rem; letter-spacing: 0.01em; padding-left: 44px; }
  .vfield .key-icon { left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .vmodal-backdrop, .vcard { animation: none; }
  .vcheck .spin { animation-duration: 2s; }
}
