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

:root {
  --bg:          #0A0A0A;
  --surface:     #111111;
  --raised:      #1A1A1A;
  --elevated:    #222222;
  --border:      rgba(255,255,255,0.10);
  --border-sub:  rgba(255,255,255,0.06);
  --text:        #F0F0F0;
  --text-sub:    #9A9A9A;
  --text-muted:  #5A5A5A;
  --accent:      #1B4FD8;
  --accent-h:    #2563EB;
  --accent-link: #6BA3FF;
  --success:     #10B981;
  --error:       #F87171;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Logo / header ────────────────────────────────────────────────────────── */

.card-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 28px 24px;
  border-bottom: 1px solid var(--border-sub);
}

.card-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.card-logo-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ── Card body ────────────────────────────────────────────────────────────── */

.card-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.card-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: -12px;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field input {
  height: 40px;
  padding: 0 12px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}

.field input::placeholder { color: var(--text-muted); }

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,79,216,0.20);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms, opacity 150ms;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.btn-ghost:hover { border-color: var(--border); color: var(--text); }

.btn-full { width: 100%; }

/* ── Telegram icon button ─────────────────────────────────────────────────── */

.btn-tg {
  background: #229ED9;
  color: #fff;
}
.btn-tg:hover { background: #1e8dc0; }

.btn-tg svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Code display ─────────────────────────────────────────────────────────── */

.code-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.code-digits {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.code-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

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

/* ── Status / spinner ─────────────────────────────────────────────────────── */

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-sub);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-link);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.status-success {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
}

.status-error {
  color: var(--error);
  font-size: 13px;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-sub);
}

/* ── Link ─────────────────────────────────────────────────────────────────── */

.link-row {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
}

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

/* ── Account page ─────────────────────────────────────────────────────────── */

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.plan-badge.free {
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.12);
  color: var(--text-sub);
}

.plan-badge.pro {
  background: rgba(27,79,216,0.15);
  border: 0.5px solid rgba(27,79,216,0.35);
  color: var(--accent-link);
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-value {
  font-size: 14px;
  color: var(--text);
}

.info-value.editable {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.info-value.editable .edit-btn {
  font-size: 11px;
  color: var(--accent-link);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.info-value.editable .edit-btn:hover { text-decoration: underline; }

.edit-field {
  display: none;
  flex-direction: column;
  gap: 8px;
}
.edit-field.visible { display: flex; }

.upgrade-cta {
  padding: 16px;
  background: rgba(27,79,216,0.08);
  border: 1px solid rgba(27,79,216,0.20);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-cta-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-link);
}

.upgrade-cta-sub {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
