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

:root {
  --bg: #F0EEE6;
  --text: #000;
  --card-bg: #fff;
  --card-border: #E0DDD5;
  --selected-bg: #000;
  --selected-text: #fff;
  --cta-active: #000;
  --cta-disabled: #C5C3BB;
  --cta-text: #fff;
  --radius: 12px;
  --progress-h: 3px;
  --cta-h: 56px;
  --header-h: 48px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ── Хедер ── */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  background: var(--bg);
  z-index: 50;
  border-bottom: 1px solid var(--card-border);
}

#back-btn {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#header-title {
  font-size: 17px;
  font-weight: 700;
}

body.has-header #screen {
  padding-top: calc(var(--header-h) + 20px);
}

/* ── Прогресс ── */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--progress-h);
  background: rgba(0,0,0,0.1);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s;
}

#progress-bar.visible { opacity: 1; }

#progress-fill {
  height: 100%;
  background: var(--text);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

/* ── Экран ── */
#screen {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 0;
  padding-bottom: calc(var(--cta-h) + 32px + env(safe-area-inset-bottom, 0px));
}

/* ── CTA ── */
#cta-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom, 0px)));
  background: var(--bg);
}

#cta-btn {
  width: 100%;
  height: var(--cta-h);
  border: none;
  border-radius: var(--radius);
  background: var(--cta-active);
  color: var(--cta-text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#cta-btn:disabled { background: var(--cta-disabled); cursor: not-allowed; }
#cta-btn:not(:disabled):active { opacity: 0.85; }

/* ── Типографика ── */
.page-title {
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.page-subtitle {
  font-size: 17px;
  color: #555;
  line-height: 1.55;
  margin-top: 10px;
}

.question-title {
  font-size: clamp(26px, 8vw, 36px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 24px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

/* ── Приветствие ── */
.welcome-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--cta-h) - 80px);
  justify-content: center;
}

/* ── Grid-опции ── */
.grid-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grid-option {
  padding: 10px 16px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.grid-option.selected {
  background: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
}

/* ── List-опции ── */
.list-options { display: flex; flex-direction: column; gap: 8px; }

.list-option {
  padding: 16px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.list-option.selected {
  background: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
}

/* ── Free text ── */
.free-text-wrap textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.free-text-wrap textarea:focus { border-color: var(--text); }

/* ── Done ── */
.done-wrap { display: flex; flex-direction: column; gap: 24px; }

.done-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--card-border);
  background: var(--card-bg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s;
}

.done-card:active { opacity: 0.75; }
.done-card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.done-card-caption { padding: 12px 16px; font-size: 15px; font-weight: 600; }

/* ── Home ── */
.home-header { margin-bottom: 24px; }

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.home-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  min-height: 90px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.home-card:active { background: #E8E6DC; }

.home-card--wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  min-height: auto;
  padding: 16px;
  gap: 12px;
}

.home-card-icon { font-size: 26px; line-height: 1; }
.home-card-label { font-size: 15px; font-weight: 600; }

/* ── Алерты ── */
.alert-form {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
}

.alert-row { display: flex; gap: 8px; margin-bottom: 10px; }

.alert-select, .alert-price {
  padding: 12px 14px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.alert-select { flex: 0 0 40%; }
.alert-price { flex: 1; min-width: 0; }

.alert-add-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius);
  background: var(--cta-active);
  color: var(--cta-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.alert-add-btn:disabled { background: var(--cta-disabled); }

.alerts-list { display: flex; flex-direction: column; gap: 8px; }

.alert-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.alert-info { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.coin-logo { width: 24px; height: 24px; vertical-align: middle; }
.coin-emoji { font-size: 20px; width: 24px; text-align: center; }
.alert-del {
  background: none;
  border: none;
  color: #c00;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}
.alert-empty { color: #888; font-size: 15px; padding: 12px 4px; }

/* ── Сигналы ── */
.signals-list { display: flex; flex-direction: column; gap: 10px; }

.signal-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.signal-card:active { background: #E8E6DC; }

.signal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.signal-ticker {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.signal-date {
  font-size: 12px;
  color: #888;
}

.signal-text {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticker-group { margin-bottom: 16px; }

.ticker-group-header {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-left: 4px;
}

.signal-photo {
  width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 10px;
  object-fit: cover;
  max-height: 260px;
}

.signal-text {
  font-size: 14px;
  line-height: 1.5;
  color: #222;
  margin-bottom: 8px;
  word-break: break-word;
}

.signal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.signal-date-line {
  font-size: 12px;
  color: #888;
}

.signal-reactions {
  font-size: 12px;
  color: #888;
}

.search-wrap { margin-bottom: 14px; }

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus { border-color: var(--text); }

/* ── Табы (урок) ── */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }

.tab {
  padding: 8px 18px;
  border: 1.5px solid var(--card-border);
  border-radius: 20px;
  background: var(--card-bg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab--active {
  background: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
}

/* ── Урок ── */
.lesson-images { display: flex; flex-direction: column; gap: 8px; }

.lesson-img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

/* ── Прайс ── */
.price-plans { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.price-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-card-label { font-size: 16px; font-weight: 600; }
.price-card-right { text-align: right; }
.price-card-price { font-size: 20px; font-weight: 800; }
.price-card-note { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; }

.usdt-block {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
}

.usdt-label {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.usdt-address {
  font-size: 13px;
  font-family: "SF Mono", "Fira Mono", monospace;
  word-break: break-all;
  line-height: 1.6;
}

/* ── Ссылки ── */
.links-list { display: flex; flex-direction: column; gap: 8px; }

.link-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.link-card:active { background: #E8E6DC; }
.link-icon { font-size: 22px; flex-shrink: 0; }
.link-label { flex: 1; font-size: 16px; font-weight: 600; }
.link-arrow { font-size: 16px; color: #aaa; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.faq-q {
  padding: 16px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}

.faq-chevron { font-size: 11px; color: #888; flex-shrink: 0; }

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 14px;
  line-height: 1.6;
  color: #444;
  padding: 0 16px;
}

.faq-item--open .faq-a {
  max-height: 400px;
  padding: 0 16px 16px;
}

/* ── Профиль ── */
.profile-loading {
  text-align: center;
  color: #888;
  padding: 40px 0;
  font-size: 16px;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 24px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--selected-bg);
  color: var(--selected-text);
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profile-username {
  font-size: 15px;
  color: #888;
}

.profile-section {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.profile-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 12px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  padding: 6px 0;
  border-bottom: 1px solid var(--card-border);
}

.profile-row:last-child { border-bottom: none; }

.profile-label { color: #666; }

.profile-no-sub {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.profile-tag {
  display: inline-block;
  background: var(--selected-bg);
  color: var(--selected-text);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 2px;
}

.profile-rank {
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}

.profile-badge {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

.profile-progress-wrap {
  margin-top: 10px;
  height: 6px;
  background: var(--card-border);
  border-radius: 3px;
  overflow: hidden;
}

.profile-progress-bar {
  height: 100%;
  background: var(--selected-bg);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ── Продажи ── */
.sales-bullets { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; }

.sales-bullet {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 500;
}

.sales-check {
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.sales-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 28px;
}

.sales-link-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.sales-link-card:active { background: #E8E6DC; }
.sales-link-icon { font-size: 22px; flex-shrink: 0; }
.sales-link-label { flex: 1; font-size: 16px; font-weight: 600; }
.sales-link-arrow { font-size: 16px; color: #aaa; }
