/* ============================================================
   Вход по коду сертификата.

   Блок и окно стоят на двух разных страницах с разными наборами токенов:
   на главной свои (--gold, --text), на подстраницах свои (--accent,
   --night-text). Поэтому цвета берутся через цепочку запасных значений,
   а не привязаны к одному дизайну.
   ============================================================ */

.vch {
  --vch-accent: var(--gold, var(--accent, #f7a15c));
  --vch-text: var(--text, var(--night-text, #f2f0e9));
  --vch-line: rgba(247, 161, 92, 0.32);

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.75rem;
  padding: 1.15rem clamp(1.1rem, 3vw, 1.75rem);
  border: 1px solid var(--vch-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.vch__body { min-width: 0; }
.vch__title {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--vch-text);
}
.vch__text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: color-mix(in srgb, var(--vch-text) 84%, transparent);
  max-width: 46ch;
}
.vch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  padding: 0.78rem 1.35rem;
  border: 1px solid var(--vch-accent);
  border-radius: 999px;
  background: rgba(9, 13, 28, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--vch-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.18s ease;
}
.vch__btn i { font-size: 1.15rem; }
.vch__btn:hover { background: var(--vch-accent); color: #17110a; }
.vch__btn:active { transform: translateY(1px); }
.vch__btn:focus-visible { outline: 2px solid var(--vch-accent); outline-offset: 3px; }

/* ---------- Окно ввода ---------- */
.vch-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: clamp(1.5rem, 4vw, 2.2rem);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: linear-gradient(160deg, #141a35, #0c1024);
  color: #f2f0e9;
  box-shadow: 0 30px 80px rgba(4, 7, 18, 0.6);
}
.vch-dialog::backdrop { background: rgba(4, 7, 18, 0.72); backdrop-filter: blur(3px); }
.vch-dialog h3 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.vch-dialog__hint b {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  color: rgba(242, 240, 233, 0.92);
  white-space: nowrap;
}
.vch-dialog__hint {
  margin: 0 0 1.3rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: rgba(242, 240, 233, 0.72);
}
.vch-dialog__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #f2f0e9;
  font-size: 1.1rem;
  cursor: pointer;
}
.vch-dialog__close:hover { background: rgba(255, 255, 255, 0.16); }

.vch-field { display: block; }
.vch-field span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Код набирают по знакам, поэтому моноширинный и с разрядкой: так видно,
   где дефис, и не путаются похожие символы */
.vch-field input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #f2f0e9;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.vch-field input::placeholder { color: rgba(242, 240, 233, 0.32); letter-spacing: 0.06em; }
.vch-field input:focus-visible {
  outline: none;
  border-color: #f7a15c;
  background: rgba(255, 255, 255, 0.1);
}

.vch-msg {
  min-height: 1.2em;
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(242, 240, 233, 0.72);
}
.vch-msg.is-bad { color: #ffb38a; }
.vch-msg.is-wait { color: #f7a15c; }

.vch-submit {
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.95rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: #f7a15c;
  color: #17110a;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.25s ease;
}
.vch-submit:hover:not(:disabled) { background: #e9853b; }
.vch-submit:disabled { opacity: 0.6; cursor: default; }
.vch-submit:focus-visible { outline: 2px solid #f7a15c; outline-offset: 3px; }

@media (max-width: 640px) {
  .vch { flex-direction: column; align-items: stretch; }
  .vch__btn { justify-content: center; }
}
