:root {
  --tg-bg-color: #17212b;
  --tg-secondary-bg-color: #232e3c;
  --tg-section-bg-color: #1f2936;
  --tg-text-color: #f5f7fb;
  --tg-hint-color: #95a4b7;
  --tg-link-color: #6ab3f3;
  --tg-button-color: #2ea6ff;
  --tg-button-text-color: #ffffff;
  --tg-destructive-color: #ff5d5d;
  --tg-subtle-color: rgba(255, 255, 255, 0.08);
  --tg-card-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  --tg-radius-xl: 24px;
  --tg-radius-lg: 18px;
  --tg-radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(46, 166, 255, 0.16), transparent 28%),
    linear-gradient(180deg, var(--tg-bg-color) 0%, #111922 100%);
  color: var(--tg-text-color);
}

button,
input,
select,
a {
  font: inherit;
}

.app-shell {
  width: min(760px, calc(100vw - 20px));
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 16px)
    0
    calc(env(safe-area-inset-bottom, 0px) + 28px);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.app-header h1,
.hero-card h2,
.section-head h3,
.tracker-title {
  margin: 0;
}

.app-kicker,
.section-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tg-link-color);
}

.icon-btn,
.primary-btn,
.secondary-btn,
.pill-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.icon-btn:hover,
.primary-btn:hover,
.secondary-btn:hover,
.pill-btn:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.icon-btn {
  padding: 10px 14px;
  color: var(--tg-link-color);
  background: rgba(106, 179, 243, 0.12);
}

.hero-card,
.surface-card {
  border-radius: var(--tg-radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(35, 46, 60, 0.96), rgba(22, 31, 42, 0.98));
  box-shadow: var(--tg-card-shadow);
}

.hero-card {
  padding: 22px;
  margin-bottom: 14px;
}

.hero-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-copy h2 {
  width: 100%;
  margin-top: 4px;
  font-size: clamp(28px, 5vw, 36px);
  line-height: 1.05;
}

.hero-copy p {
  width: 100%;
  margin: 10px 0 0;
  color: var(--tg-hint-color);
  line-height: 1.45;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--tg-text-color);
  font-size: 13px;
}

.surface-card {
  padding: 18px;
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--tg-hint-color);
  font-size: 14px;
}

.field span {
  color: var(--tg-text-color);
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--tg-radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--tg-text-color);
}

input::placeholder {
  color: rgba(149, 164, 183, 0.8);
}

input:focus,
select:focus {
  outline: 2px solid rgba(46, 166, 255, 0.26);
  border-color: rgba(46, 166, 255, 0.5);
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn {
  padding: 12px 16px;
  background: var(--tg-button-color);
  color: var(--tg-button-text-color);
}

.secondary-btn,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--tg-text-color);
  text-decoration: none;
}

.section-note {
  margin: 12px 0 0;
  color: var(--tg-hint-color);
  line-height: 1.45;
  font-size: 14px;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.store-card {
  padding: 16px;
  border-radius: var(--tg-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
}

.store-card h4,
.store-card p {
  margin: 0;
}

.store-head {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.store-card p {
  color: var(--tg-hint-color);
  line-height: 1.45;
  margin-bottom: 14px;
}

.lenta-inline-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.field--compact {
  gap: 6px;
  font-size: 13px;
}

.field--compact input,
.field--compact select {
  min-height: 42px;
  padding: 10px 12px;
}

.action-row--tight {
  gap: 8px;
}

.store-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.store-card--5ka .store-badge {
  color: #8cff9f;
  background: rgba(62, 189, 91, 0.18);
}

.store-card--lenta .store-badge {
  color: #7cc7ff;
  background: rgba(46, 166, 255, 0.18);
}

.store-badge--catalog {
  color: #a8d6ff;
  background: rgba(86, 149, 255, 0.16);
}

.catalog-empty {
  padding: 18px;
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, 0.04);
  color: var(--tg-hint-color);
  line-height: 1.45;
}

.section-note--compact {
  margin-top: 10px;
  font-size: 13px;
}

.lenta-preview-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.lenta-preview-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(35, 72, 115, 0.32), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.02);
}

.lenta-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.lenta-preview-title,
.lenta-preview-code {
  margin: 0;
}

.lenta-preview-title {
  font-size: 14px;
  line-height: 1.35;
}

.lenta-preview-code {
  margin-top: 6px;
  color: var(--tg-hint-color);
  font-size: 12px;
}

.lenta-preview-price {
  font-size: 14px;
  font-weight: 700;
  color: #9ef1d9;
  white-space: nowrap;
}

.lenta-preview-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--tg-link-color);
  text-decoration: none;
  font-size: 13px;
}

.tracker-list {
  display: grid;
  gap: 12px;
}

.tracker-card {
  padding: 16px;
  border-radius: var(--tg-radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tracker-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tracker-title {
  font-size: 17px;
  line-height: 1.3;
}

.tracker-link {
  color: var(--tg-link-color);
  text-decoration: none;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 209, 122, 0.14);
  color: #72f2ab;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge.inactive {
  background: rgba(255, 93, 93, 0.14);
  color: #ff8e8e;
}

.tracker-meta {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
  color: var(--tg-hint-color);
  font-size: 14px;
}

.tracker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost-action,
.danger-action {
  padding: 10px 14px;
  border-radius: 999px;
  border: 0;
}

.ghost-action {
  background: rgba(255, 255, 255, 0.08);
  color: var(--tg-text-color);
}

.danger-action {
  background: rgba(255, 93, 93, 0.14);
  color: var(--tg-destructive-color);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  width: min(92vw, 420px);
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(7, 11, 16, 0.92);
  color: #fff;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 12px, 100%);
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .surface-card,
  .hero-card {
    padding: 16px;
    border-radius: 20px;
  }

  .split-grid {
    grid-template-columns: 1fr;
  }

  .store-grid {
    grid-template-columns: 1fr;
  }

  .action-row--tight {
    align-items: stretch;
  }
}
