@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/libs/fonts/PlusJakartaSans-latin-wght.woff2") format("woff2");
  unicode-range:
    U+0000-00FF,
    U+0131,
    U+0152-0153,
    U+02BB-02BC,
    U+02C6,
    U+02DA,
    U+02DC,
    U+0304,
    U+0308,
    U+0329,
    U+2000-206F,
    U+20AC,
    U+2122,
    U+2191,
    U+2193,
    U+2212,
    U+2215,
    U+FEFF,
    U+FFFD;
}

:root {
  color-scheme: light;

  --primary: #fbbf24;
  --bg: #f3f4f6;
  --bg-dark: #064e3b;

  --text: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, 0.78);
  --text-tertiary: rgba(100, 116, 139, 0.96);
  --text-muted: rgba(15, 23, 42, 0.68);
  --text-inverse: #ffffff;
  --text-inverse-muted: rgba(255, 255, 255, 0.7);
  --text-on-accent: #0f172a;
  --text-info: #1d4ed8;
  --text-success: #065f46;
  --text-warn: #92400e;
  --text-danger: #991b1b;

  --card: #ffffff;
  --card-hero: #ffffff;
  --card-glass: rgba(255, 255, 255, 0.82);
  --card-glass-dark: rgba(255, 255, 255, 0.1);
  --modal-bg: rgba(255, 255, 255, 0.97);

  --surface-1: rgba(2, 6, 23, 0.03);
  --surface-2: rgba(2, 6, 23, 0.05);
  --surface-3: rgba(2, 6, 23, 0.08);
  --surface-accent: rgba(251, 191, 36, 0.15);
  --surface-info: rgba(59, 130, 246, 0.12);
  --surface-success: rgba(16, 185, 129, 0.14);
  --surface-warn: rgba(245, 158, 11, 0.16);
  --surface-danger: rgba(239, 68, 68, 0.14);

  --border: rgba(148, 163, 184, 0.45);
  --border-strong: rgba(148, 163, 184, 0.45);
  --border-soft: rgba(148, 163, 184, 0.25);
  --border-dark: rgba(255, 255, 255, 0.12);
  --focus-ring: rgba(251, 191, 36, 0.9);

  --chip-neutral-bg: rgba(15, 23, 42, 0.08);
  --chip-neutral-border: rgba(148, 163, 184, 0.3);
  --chip-neutral-text: rgba(15, 23, 42, 0.9);

  --table-head-bg: rgba(2, 6, 23, 0.03);
  --table-head-text: rgba(100, 116, 139, 0.95);
  --table-row-border: rgba(148, 163, 184, 0.17);

  --overlay-bg: rgba(2, 6, 23, 0.6);

  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.16);
  --shadow-md: 0 10px 22px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 6px 14px rgba(15, 23, 42, 0.08);

  --radius-xl: 2rem;
  --radius-lg: 1.5rem;
  --radius-md: 1.1rem;
  --radius-sm: 0.9rem;
  --bottom-bar-space: 120px;
}

html.dark {
  color-scheme: dark;
  --bg-dark: #0b1220;

  --text: rgba(248, 250, 252, 0.98);
  --text-primary: rgba(248, 250, 252, 0.98);
  --text-secondary: rgba(226, 232, 240, 0.9);
  --text-tertiary: rgba(203, 213, 225, 0.86);
  --text-muted: rgba(226, 232, 240, 0.82);
  --text-on-accent: #0f172a;
  --text-info: rgba(219, 234, 254, 0.96);
  --text-success: rgba(220, 252, 231, 0.96);
  --text-warn: rgba(254, 243, 199, 0.96);
  --text-danger: rgba(254, 202, 202, 0.97);

  --card: #0f172a;
  --card-hero: #111b31;
  --card-glass: rgba(15, 23, 42, 0.84);
  --card-glass-dark: rgba(255, 255, 255, 0.08);

  --surface-1: rgba(255, 255, 255, 0.08);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-3: rgba(255, 255, 255, 0.14);
  --surface-accent: rgba(251, 191, 36, 0.2);
  --surface-info: rgba(96, 165, 250, 0.24);
  --surface-success: rgba(16, 185, 129, 0.2);
  --surface-warn: rgba(245, 158, 11, 0.23);
  --surface-danger: rgba(239, 68, 68, 0.24);

  --border-strong: rgba(255, 255, 255, 0.24);
  --border-soft: rgba(255, 255, 255, 0.16);
  --focus-ring: rgba(251, 191, 36, 0.95);

  --chip-neutral-bg: rgba(255, 255, 255, 0.12);
  --chip-neutral-border: rgba(255, 255, 255, 0.22);
  --chip-neutral-text: rgba(248, 250, 252, 0.96);

  --table-head-bg: rgba(255, 255, 255, 0.08);
  --table-head-text: rgba(226, 232, 240, 0.78);
  --table-row-border: rgba(255, 255, 255, 0.14);

  --overlay-bg: rgba(2, 6, 23, 0.72);
  --modal-bg: rgba(15, 23, 42, 0.94);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  min-height: max(884px, 100dvh);
  transition: background-color 220ms ease, color 220ms ease;
}

html.dark body {
  background: var(--bg-dark);
  color: var(--text-primary);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  padding: 38px 86px 22px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.badge {
  background: var(--primary);
  color: #0f172a;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(251, 191, 36, 0.25);
  white-space: nowrap;
  max-width: min(220px, calc(100vw - 154px));
  overflow: hidden;
  text-overflow: ellipsis;
}

.page {
  padding: 0 18px;
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

body.has-bottom-bar .page {
  padding-bottom: calc(var(--bottom-bar-space, 120px) + env(safe-area-inset-bottom));
}

.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
}

html.dark .card {
  border-color: var(--border-soft);
}

.card.hero {
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xl);
  background: var(--card-hero);
}

.card.hero::before {
  content: "";
  position: absolute;
  top: -42px;
  right: -42px;
  width: 180px;
  height: 180px;
  background: rgba(251, 191, 36, 0.22);
  border-radius: 999px;
  filter: blur(24px);
}

.card.hero > * {
  position: relative;
  z-index: 1;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 600;
}

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

.step-list {
  display: grid;
  gap: 10px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--card-glass);
}

html.dark .step-item {
  background: var(--card-glass-dark);
  border-color: var(--border-dark);
}

.step-num {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #064e3b;
  color: #ffffff;
  font-weight: 800;
}

html.dark .step-num {
  background: rgba(6, 95, 70, 0.95);
}

.step-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.step-sub {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.75;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.65;
}

.input {
  width: 100%;
  border: none;
  border-radius: var(--radius-lg);
  padding: 16px 16px;
  font-size: 16px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-primary);
  outline: none;
  box-shadow: inset 0 0 0 1px var(--border-soft);
  transition: box-shadow 180ms ease, transform 180ms ease, background-color 180ms ease;
}

html.dark .input {
  background: var(--surface-2);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-soft);
}

.input::placeholder {
  color: var(--text-tertiary);
  font-weight: 700;
}

html.dark .input::placeholder {
  color: var(--text-tertiary);
}

.input:focus {
  box-shadow: inset 0 0 0 2px var(--focus-ring), 0 0 0 4px rgba(251, 191, 36, 0.25);
  transform: translateY(-1px);
}

.input-group {
  position: relative;
}

.input-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: var(--text-tertiary);
}

.input.with-prefix {
  padding-left: 64px;
  letter-spacing: 0.12em;
}

.input.code {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  text-align: center;
  font-size: 18px;
}

.btn {
  border: none;
  border-radius: 20px;
  padding: 18px 18px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, filter 180ms ease, box-shadow 180ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--text-on-accent);
  box-shadow: 0 18px 34px rgba(251, 191, 36, 0.3);
}

.btn-primary:hover {
  filter: saturate(1.04) brightness(0.98);
}

.btn-ghost {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

html.dark .btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  padding-top: 46px;
  background: linear-gradient(to top, rgba(243, 244, 246, 1), rgba(243, 244, 246, 0.84), transparent);
}

html.dark .bottom-bar {
  background: linear-gradient(to top, rgba(11, 18, 32, 1), rgba(11, 18, 32, 0.84), transparent);
}

.bottom-inner {
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
  pointer-events: auto;
}

.alert {
  display: none;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: var(--surface-danger);
  color: var(--text-danger);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
}

html.dark .alert {
  background: var(--surface-danger);
  border-color: rgba(239, 68, 68, 0.44);
  color: var(--text-danger);
}

.alert.success {
  border-color: rgba(34, 197, 94, 0.3);
  background: var(--surface-success);
  color: var(--text-success);
}

html.dark .alert.success {
  border-color: rgba(34, 197, 94, 0.42);
  background: var(--surface-success);
  color: var(--text-success);
}

.theme-toggle {
  position: fixed;
  top: 28px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.18);
  background: #ffffff;
  display: grid;
  place-items: center;
  padding: 0;
  color: #1e293b;
  cursor: pointer;
  z-index: 100;
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.12),
    0 1px 3px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 180ms ease, background 200ms ease, border-color 200ms ease;
}

.theme-toggle:hover {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.28);
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.16),
    0 2px 4px rgba(15, 23, 42, 0.1);
  transform: scale(1.06);
}

.theme-toggle:active {
  transform: scale(0.92);
}

html.dark .theme-toggle {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.35);
  color: #fbbf24;
  box-shadow:
    0 4px 14px rgba(2, 6, 23, 0.4),
    0 1px 3px rgba(2, 6, 23, 0.2);
}

html.dark .theme-toggle:hover {
  background: #273548;
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow:
    0 6px 18px rgba(2, 6, 23, 0.5),
    0 0 12px rgba(251, 191, 36, 0.12);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* ── Theme toggle icons (SVG) ── */
.theme-icon {
  width: 22px;
  height: 22px;
  color: inherit;
  stroke: currentColor;
  fill: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

/* Light mode: show sun, hide moon */
.theme-icon-sun { opacity: 1; transform: rotate(0deg); }
.theme-icon-moon { display: none; }

/* Dark mode: show moon, hide sun */
html.dark .theme-icon-sun { display: none; }
html.dark .theme-icon-moon { display: block; opacity: 1; }

/* Legacy img fallback */
.theme-toggle img {
  width: 18px;
  height: 18px;
  opacity: 0.95;
}

@media (min-width: 820px) {
  .app-header {
    padding-right: 100px;
  }

  .page {
    max-width: 720px;
  }

  .bottom-inner {
    max-width: 720px;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .btn {
    width: auto;
  }

  .theme-toggle {
    top: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .btn,
  .input {
    transition: none;
  }
}
