:root {
  /* Exact VPNCHIK logo palette (sampled from logo.png) */
  --bg: #141414;
  --bg-elevated: #1c1c1c;
  --ink: #d66f12;
  --ink-soft: #f5f5f5;
  --muted: #a3a3a3;
  --panel: #181818;
  --line: rgba(214, 111, 18, 0.28);
  --accent: #d66f12;
  --accent-hot: #e17f2b;
  --accent-dim: rgba(214, 111, 18, 0.16);
  --bad: #ff5a5a;
  --ok: #3ecf6a;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  --radius: 10px;
  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink-soft);
  background: var(--bg);
}

body { position: relative; }

a {
  color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}

.shell {
  width: min(880px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  width: auto;
  height: 56px;
  display: block;
  border-radius: 18%;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: min(280px, 72vw);
  height: auto;
  margin: 0 auto 0.5rem;
  border-radius: 18%;
  overflow: hidden;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar-meta form { margin: 0; }

h1 {
  font-weight: 800;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  margin: 0 0 0.55rem;
  color: var(--muted);
}

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--muted);
}

.lede {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.muted { color: var(--muted); }

.page-head { margin-bottom: 1.75rem; }

.login-hero {
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.login-hero .lede {
  margin-left: auto;
  margin-right: auto;
}

.login-hero h1 {
  /* Logo already carries the brand name — keep title quiet */
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.auth-panel {
  width: min(400px, 100%);
  margin-top: 1.75rem;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
}

.google-login {
  width: 100%;
  text-decoration: none;
}

.login-divider {
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.block,
.key-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.block {
  padding: 1.25rem 1.35rem 1.4rem;
  margin-bottom: 1rem;
}

.telegram-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(214, 111, 18, 0.5);
  border-radius: var(--radius);
  background: var(--accent-dim);
}

.telegram-link h2 { margin: 0 0 0.35rem; }
.telegram-link p { margin: 0; }
.telegram-link .btn { flex: none; }

@media (max-width: 640px) {
  .telegram-link { flex-direction: column; align-items: stretch; text-align: left; }
}

.stack {
  display: grid;
  gap: 0.85rem;
  margin-top: 0;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input {
  width: 100%;
  border: 1px solid rgba(214, 111, 18, 0.22);
  border-radius: 8px;
  padding: 0.8rem 0.95rem;
  font: inherit;
  background: var(--bg-elevated);
  color: var(--ink-soft);
}

input::placeholder { color: #666; }

input:focus {
  outline: 2px solid rgba(214, 111, 18, 0.45);
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 8px;
  padding: 0.85rem 1.2rem;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent-dim);
  border: 1px solid rgba(214, 111, 18, 0.35);
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.btn.primary:hover {
  background: rgba(214, 111, 18, 0.26);
  border-color: var(--accent);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(214, 111, 18, 0.35);
  color: var(--accent);
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.btn.ghost.copied,
.btn.ghost.copied:hover {
  border-color: rgba(62, 207, 106, 0.65);
  background: rgba(62, 207, 106, 0.14);
  color: var(--ok);
}

.linkish {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

.linkish:hover { color: var(--accent); }

.tag {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #666;
  font-size: 0.72rem;
  color: var(--muted);
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

.hint {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.account-card {
  padding: 0;
  overflow: hidden;
}

.account-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  cursor: pointer;
  padding: 1.15rem 1.25rem;
  user-select: none;
}

.account-card-head::-webkit-details-marker { display: none; }
.account-card-head::marker { content: ""; }

.account-card-head:hover {
  background: rgba(214, 111, 18, 0.06);
}

.account-card-title {
  min-width: 0;
}

.account-card-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.account-card-head .muted {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}

.account-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.account-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  margin-top: -0.2rem;
}

.account-card[open] .account-chevron {
  transform: rotate(225deg);
  margin-top: 0.15rem;
}

.account-card[open] .account-card-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.account-card-body {
  display: grid;
  gap: 1.25rem;
  padding: 1.15rem 1.25rem 1.35rem;
}

.account-card-body h3 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.key-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  margin-top: 0.75rem;
}

.key-box code {
  flex: 1;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  color: #e8e8e8;
}

.tariffs-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 4.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tariffs-spinner {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  border: 2px solid var(--accent-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tariffs-spin 0.75s linear infinite;
}

@keyframes tariffs-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tariffs-spinner {
    animation-duration: 1.5s;
  }
}

.tariff-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.payment-dialog {
  width: min(420px, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

/* Keeps the dialog centred where it is shown via the open attribute (Safari < 15.4 has no showModal). */
.payment-dialog[open] {
  position: fixed;
  inset: 0;
  z-index: 100;
  height: fit-content;
  margin: auto;
}

.payment-dialog.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.payment-dialog::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.16s ease;
}

.payment-dialog.is-open::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  .payment-dialog {
    transition: none;
    transform: none;
  }
}

.payment-dialog-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.payment-dialog-options {
  margin-top: 0;
}

.payment-dialog-cancel {
  width: 100%;
  margin-top: 0.85rem;
}

.tariff-btn {
  width: 100%;
  background: var(--accent-dim);
  border: 1px solid rgba(214, 111, 18, 0.35);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  text-align: left;
}

.tariff-btn:hover:not(:disabled) {
  background: rgba(214, 111, 18, 0.26);
  border-color: var(--accent);
}

.tariff-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.danger-block {
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 90, 90, 0.25);
  margin-top: 0.25rem;
}

.btn.danger {
  margin-top: 0.75rem;
  background: transparent;
  border: 1px solid rgba(255, 90, 90, 0.55);
  color: #ff6b5a;
  text-transform: none;
  letter-spacing: normal;
}

.btn.danger:hover:not(:disabled) {
  background: rgba(255, 90, 90, 0.12);
  border-color: #ff6b5a;
}

.btn.danger:disabled {
  opacity: 0.6;
  cursor: wait;
}

.create-account {
  margin-bottom: 1.25rem;
}

.create-account h2 {
  margin: 0 0 0.35rem;
}

.create-account-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

@media (min-width: 640px) {
  .create-account-form {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

.create-account-error {
  color: #ff6b5a;
  margin-top: 0.75rem;
}

.flash {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(214, 111, 18, 0.4);
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .key-box { flex-direction: column; align-items: stretch; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .account-card-head { align-items: flex-start; }
}

/* ---------- Guides nav ---------- */

.guides-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: -1rem 0 2rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.guides-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.guides-nav a {
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.guides-nav a:hover { border-color: var(--line); }

.guides-nav a.active {
  border-color: rgba(214, 111, 18, 0.5);
  background: var(--accent-dim);
  color: var(--accent);
}

.guides-nav-menu summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.guides-nav-menu summary:hover { border-color: var(--line); }

.guides-nav-menu summary::-webkit-details-marker { display: none; }

.guides-nav-menu summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.guides-nav-menu[open] summary::after { transform: rotate(-135deg); margin-top: 0.2rem; }

.guides-nav-menu-list {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.4rem);
  right: 0;
  display: grid;
  min-width: 12rem;
  padding: 0.4rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.guides-nav-menu-list a {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
}

/* ---------- Install guide ---------- */

.guide-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.guide-hero {
  text-align: center;
  margin: 0 auto 2.5rem;
  max-width: 34rem;
}

.guide-hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.guide-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 0.75rem;
}

.guide-hero .lede {
  margin: 0 auto;
}

.guide-download {
  margin: 1.5rem auto 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.guide-step .guide-download {
  margin: 0;
  align-items: flex-start;
}

/* Plain <a> on purpose: Chrome's print-to-pdf keeps it as a clickable
   link annotation in the exported PDF, so no JS here. */
.guide-download-link {
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: underline;
}

.guide-download-link:hover { color: var(--accent-hot); }

.guide-steps {
  position: relative;
  display: grid;
  gap: 0;
}

.guide-steps::before {
  content: "";
  position: absolute;
  left: 27px;
  top: 30px;
  bottom: 30px;
  width: 1px;
  background: var(--line);
}

.guide-step {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 1.25rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
}

.guide-step:last-child { border-bottom: none; }

.guide-step-num {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--bg);
  flex: none;
}

.guide-step-body {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.guide-step-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.guide-step h2 {
  font-size: 1.15rem;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  margin: 0.15rem 0 0;
}

.guide-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  max-width: 52ch;
}

.guide-step p strong { color: var(--ink-soft); }

.guide-callout {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  max-width: 52ch;
  font-size: 0.9rem;
  color: var(--muted);
}

.guide-callout.warn {
  border-color: rgba(255, 90, 90, 0.35);
  background: rgba(255, 90, 90, 0.08);
}

.guide-prep {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.75rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.guide-prep h2 {
  font-size: 1.15rem;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

.guide-prep p,
.guide-prep-list {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.guide-prep-list {
  padding-left: 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.guide-prep strong { color: var(--ink-soft); }

.guide-prep .guide-callout { max-width: none; }

.guide-callout ul {
  margin: 0.4rem 0;
  padding-left: 1.1rem;
}

.guide-callout .guide-code { margin-top: 0.5rem; }

.guide-code {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
}

.guide-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.guide-phone {
  width: 180px;
  flex: none;
  border-radius: 18px;
  border: 4px solid #0c0a08;
  background: #0c0a08;
  overflow: hidden;
  box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.55);
}

.guide-phone img {
  display: block;
  width: 100%;
  height: auto;
}

.guide-window {
  width: 320px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.55);
}

/* Mac screenshots are full desktop windows, unreadable at the default width. */
.guide-window.wide { width: min(640px, 100%); }

.guide-window img {
  display: block;
  width: 100%;
  height: auto;
}

.guide-final {
  margin-top: 2.5rem;
  padding: 2rem 1.75rem;
  border-radius: var(--radius);
  background: var(--accent-dim);
  border: 1px solid rgba(214, 111, 18, 0.4);
  text-align: center;
}

.guide-final h2 {
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 0.5rem;
}

.guide-final p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .shell { padding-top: 1rem; }
  .guide-topbar { margin-bottom: 1.25rem; }

  .guides-nav { flex-wrap: nowrap; gap: 0.25rem; margin: 0 0 1.5rem; padding: 0.4rem; }
  .guides-nav a, .guides-nav-menu summary { padding: 0.35rem 0.55rem; font-size: 0.85rem; }
  .guides-nav-actions { gap: 0.15rem; }

  .guide-hero { margin-bottom: 1.5rem; }
  .guide-hero h1 { font-size: 1.45rem; }

  /* The number moves above the content, so text and screenshots get the full width. */
  .guide-steps::before { display: none; }
  .guide-step { grid-template-columns: 1fr; gap: 0.75rem; padding: 1.5rem 0; }
  .guide-step-num { width: 36px; height: 36px; font-size: 1rem; }
  .guide-step p, .guide-callout { max-width: none; }

  /* Screenshots stay readable: a swipeable row of large phones. */
  .guide-shots {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -1rem;
    padding: 0 1rem 0.5rem;
    scrollbar-width: none;
  }
  .guide-shots::-webkit-scrollbar { display: none; }
  .guide-phone { width: min(260px, 72vw); scroll-snap-align: center; }
  .guide-phone:only-child { margin: 0 auto; }
  .guide-window { width: 88%; flex: none; scroll-snap-align: center; }
  .guide-window:only-child { width: 100%; }
}

/* ---------- Print / PDF export ---------- */
/* Chrome (and --headless --print-to-pdf) strips backgrounds and colors
   from the print output unless the page opts in with color-adjust: exact,
   so the dark VPNCHIK theme is preserved here the same way it renders
   on screen. Layout-only tweaks (no shadows/animations) keep the export
   crisp on paper. */

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color-adjust: exact;
  }

  html, body {
    background: var(--bg) !important;
  }

  .no-print { display: none !important; }

  .shell {
    width: 100%;
    padding: 0;
  }

  .guide-hero { margin-bottom: 1.5rem; }

  .guide-step {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 1rem 0;
  }

  .guide-steps::before { display: none; }

  .guide-phone {
    box-shadow: none;
    width: 150px;
  }

  .guide-window {
    box-shadow: none;
    width: 260px;
  }

  .payment-dialog,
  .tariffs-loader { display: none !important; }
}

