:root {
  --bg: #111827;
  --bg-soft: #0f766e;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --primary: #ea580c;
  --line: #e2e8f0;
  --ok: #15803d;
  --err: #b91c1c;
  --app-top-offset: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  touch-action: manipulation;
  background:
    radial-gradient(circle at 0% 0%, #334155 0, transparent 45%),
    radial-gradient(circle at 100% 20%, #0f766e 0, transparent 35%),
    linear-gradient(160deg, var(--bg), #1e3a8a);
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: calc(28px + var(--app-top-offset)) 12px 92px;
  display: grid;
  gap: 12px;
}

body.is-telegram-webapp {
  --app-top-offset: var(--tg-top-inset, 84px);
}

.page {
  display: none;
  gap: 12px;
}

.page.is-active {
  display: grid;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 20px 42px rgba(15, 23, 42, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.hero h1 {
  margin: 10px 0 14px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0 0 10px;
  color: var(--muted);
}

.constructor-intro {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(251, 146, 60, 0.2) 0, transparent 48%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
}

.constructor-intro::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -42px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.26) 0, rgba(251, 146, 60, 0) 70%);
  pointer-events: none;
}

.hero-cta {
  width: 100%;
  margin-top: 10px;
  padding: 13px 14px;
  font-size: 1rem;
  box-shadow: 0 14px 24px rgba(234, 88, 12, 0.28);
}

.tag {
  margin: 0;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffedd5;
  color: #c2410c;
  font-weight: 700;
  font-size: 0.85rem;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.head span {
  color: var(--muted);
  font-size: 0.85rem;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  font: inherit;
}

input:focus {
  outline: 2px solid #fdba74;
  outline-offset: 1px;
  border-color: #fb923c;
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn--primary {
  background: linear-gradient(135deg, #fb923c, var(--primary));
  color: #fff;
}

.create-submit {
  width: 100%;
  margin-top: 4px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 13px;
  background:
    linear-gradient(140deg, #fdba74 0%, #f97316 42%, #c2410c 100%);
  box-shadow:
    0 14px 26px rgba(194, 65, 12, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  letter-spacing: 0.01em;
}

.create-submit:active {
  transform: translateY(1px);
  box-shadow:
    0 10px 18px rgba(194, 65, 12, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn--ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn--back {
  padding: 8px 10px;
  font-size: 0.86rem;
}

.btn--danger {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.status {
  min-height: 0;
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: var(--ok);
}

.status:empty {
  display: none;
}

.create-card.is-hidden {
  display: none;
}

.create-card.is-visible {
  display: block;
  animation: cardReveal 240ms ease-out;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status.error {
  color: var(--err);
}

.result {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.result:empty {
  display: none;
}

.stores {
  display: grid;
  gap: 8px;
}

.store {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.store h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.store p {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.store-bot-connect {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.store-bot-input {
  min-width: 0;
  width: 100%;
}

.store-bot-save {
  justify-self: start;
}

.store-bot-note {
  margin-top: 6px;
  font-size: 0.82rem;
}

.store-key-note {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #92400e;
}

.store-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.store-action-btn,
.store-actions .btn--danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.store-action-btn {
  flex: 1 1 calc(50% - 5px);
}

.store-action-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
  box-shadow: 0 10px 18px rgba(3, 105, 161, 0.28);
}

.store-action-btn--admin {
  color: #fff;
  background: linear-gradient(135deg, #334155, #0f172a);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.28);
}

.store-action-btn.is-disabled {
  pointer-events: none;
  opacity: 0.6;
}

.btn.is-disabled {
  pointer-events: none;
  opacity: 0.6;
}

.store-actions .btn--danger {
  flex: 1 1 100%;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: 0 10px 18px rgba(185, 28, 28, 0.25);
}

.store-action-btn:active,
.store-actions .btn--danger:active {
  transform: translateY(1px);
  filter: saturate(0.98);
}

.guide {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.guide li {
  line-height: 1.45;
}

.guide code {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 6px;
}

.guide-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.tariff-options {
  display: grid;
  gap: 10px;
}

.tariff-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.tariff-btn strong {
  font-size: 1rem;
}

.tariff-btn span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.tariff-btn.is-active {
  border-color: #fdba74;
  background: #fff7ed;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(900px, calc(100% - 16px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  z-index: 30;
}

.bottom-nav__btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 8px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.bottom-nav__btn.is-active {
  border-color: #fdba74;
  background: #fff7ed;
  color: #c2410c;
}

.payment-modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.payment-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.payment-modal__card {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.payment-modal__card h3 {
  margin: 0;
}

.payment-modal__plan {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 700;
}

.payment-modal__price {
  margin: 0;
  color: #0f766e;
  font-weight: 800;
}

.payment-modal__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.payment-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 680px) {
  .card {
    border-radius: 14px;
    padding: 14px;
  }

  .payment-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
