/* Shared look of the app pages (cabinet, success).
   The landing page keeps its own inline styles built on the same tokens. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #06080d;
  --panel:      #0c111a;
  --panel-2:    #111826;
  --line:       rgba(255, 255, 255, 0.09);
  --text:       #eef1f6;
  --text-muted: #8a93a6;
  --lime:       #c8ff2e;
  --cyan:       #45e3ff;
  --violet:     #8b7bff;
  --amber:      #ffc94d;
  --danger:     #ff7a7a;
  /* used by the shared tariff picker (tariffs.js) */
  --accent:     var(--lime);
  --accent2:    var(--cyan);
  --border:     var(--line);
  --radius:     20px;
  --font-display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

html { scroll-behavior: smooth; }

body {
  position: relative;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Moving background: signal chart + measuring grid ── */
#signal, .grid-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 460px;
  z-index: 0;
  pointer-events: none;
}
#signal {
  opacity: 0.6;
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent);
          mask-image: linear-gradient(to bottom, #000 35%, transparent);
}
.grid-bg {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.4;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, #000 20%, transparent 75%);
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 64px;
}
.wrap.narrow { max-width: 560px; }

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}
.brand svg { width: 34px; height: 34px; }
.brand-wave { stroke-dasharray: 60; animation: brand-wave 2.6s ease-in-out infinite; }
@keyframes brand-wave {
  0%   { stroke-dashoffset: 60; }
  55%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -60; }
}
.nav-right { display: flex; align-items: center; gap: 14px; min-width: 0; font-size: 0.86rem; color: var(--text-muted); }
.nav-right .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Typography ── */
.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 4.6vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.page-title em { font-style: normal; color: var(--lime); text-shadow: 0 0 36px rgba(200, 255, 46, 0.35); }
.label, .card-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
}
.card-title { margin-bottom: 18px; }
.card-title::before { content: '// '; opacity: 0.6; }
.muted { color: var(--text-muted); }

/* ── Cards ── */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
/* corner ticks, like on a measuring instrument */
.card::before, .card::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--lime);
  opacity: 0.7;
  pointer-events: none;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius); }
.card::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--radius); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--lime);
  color: #0a0d05;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
  box-shadow: 0 10px 30px rgba(200, 255, 46, 0.2);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(200, 255, 46, 0.3); }
.btn:active { transform: none; }
.btn:disabled { filter: saturate(0.4); opacity: 0.7; cursor: wait; transform: none; }
.btn.block { display: flex; width: 100%; white-space: normal; text-align: center; }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.btn-ghost:hover { border-color: var(--cyan); background: rgba(69, 227, 255, 0.05); transform: translateY(-2px); }
.btn-ghost svg { width: 18px; height: 18px; flex: none; color: var(--cyan); }
.link-btn {
  background: none; border: 0;
  color: var(--text-muted);
  font: inherit; font-size: 0.86rem;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--danger); }

/* ── Key box ── */
.key-box {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 10px 10px 14px;
}
.key-text {
  flex: 1;
  min-width: 0;
  height: 58px;
  background: none;
  border: 0;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--cyan);
  word-break: break-all;
  cursor: text;
}
.copy-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--lime);
  color: #0a0d05;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:active { transform: scale(0.96); }
.copy-btn:disabled { opacity: 0.4; cursor: default; }
.copy-btn.copied { background: var(--cyan); }

/* ── QR ── */
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 20px; }
.qr-frame { position: relative; padding: 10px; border-radius: 16px; background: #fff; overflow: hidden; }
.qr-frame img, .qr-frame canvas { display: block; }
/* scanning line moving over the QR code */
.qr-frame::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 22%;
  background: linear-gradient(to bottom, transparent, rgba(69, 227, 255, 0.35));
  border-bottom: 2px solid var(--cyan);
  animation: scan 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes scan {
  0%, 100% { transform: translateY(-110%); }
  50%      { transform: translateY(460%); }
}
.qr-hint { font-size: 0.78rem; color: var(--text-muted); text-align: center; max-width: 26em; }

/* ── Lists ── */
.steps { list-style: none; counter-reset: steps; }
.steps li {
  counter-increment: steps;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.steps li::before {
  content: '0' counter(steps);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--lime);
  padding-top: 3px;
}
.steps li b, .steps li strong { color: var(--text); }

.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dl-grid .btn-ghost { justify-content: flex-start; font-size: 0.84rem; padding: 12px 14px; }
.dl-icon { font-size: 1.15rem; }

/* ── Form fields ── */
.field {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  resize: none;
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: #566074; }
.field:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(200, 255, 46, 0.12); }
.err { display: none; margin-top: 10px; color: var(--danger); font-size: 0.84rem; }

/* ── Status badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
}
.badge-active { color: var(--lime); background: rgba(200, 255, 46, 0.08); border: 1px solid rgba(200, 255, 46, 0.3); }
.dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot::after {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping {
  from { transform: scale(0.5); opacity: 0.9; }
  to   { transform: scale(1.9); opacity: 0; }
}

/* ── Loading ── */
.spinner-big {
  width: 44px; height: 44px;
  border: 3px solid rgba(200, 255, 46, 0.15);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tariff picker (markup and base styles come from tariffs.js) ── */
[data-tariff-picker] .tp-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
[data-tariff-picker] .tp-label:first-child { margin-top: 0; }
[data-tariff-picker] .tp-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 6px;
  transition: border-color .15s, background .15s, transform .15s;
}
[data-tariff-picker] .tp-btn:hover { border-color: rgba(200, 255, 46, 0.5); transform: translateY(-1px); }
[data-tariff-picker] .tp-btn.active {
  border-color: var(--lime);
  background: rgba(200, 255, 46, 0.08);
  box-shadow: 0 0 0 1px var(--lime) inset, 0 0 26px rgba(200, 255, 46, 0.14);
}
[data-tariff-picker] .tp-btn.active span:not(.tp-sub) { color: var(--lime); }
[data-tariff-picker] .tp-sub { font-family: var(--font-mono); font-size: 0.66rem; }

/* ── Entrance animation ── */
.rise { animation: rise .6s ease both; }
.rise:nth-child(2) { animation-delay: .08s; }
.rise:nth-child(3) { animation-delay: .16s; }
.rise:nth-child(4) { animation-delay: .24s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 16px 48px; }
  .card { padding: 20px 16px; }
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  [data-tariff-picker] .tp-sub { font-size: 0.6rem; white-space: nowrap; }
  [data-tariff-picker] .tp-row:last-child { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
