/* ============================================================
   PigDrop Mini App — monochrome design system
   Black · white · gray · no accent colors
   ============================================================ */

:root {
  --bg: #0a0a0b;
  --surface: #101012;
  --surface-2: #161618;
  --surface-3: #1c1c1f;
  --border: #26262a;
  --border-soft: rgba(250, 250, 250, 0.08);
  --text: #fafafa;
  --text-soft: #a1a1aa;
  --text-faint: #71717a;

  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.04),
                 0 12px 32px -14px rgba(0, 0, 0, 0.9);
  --shadow-float: 0 18px 44px -14px rgba(0, 0, 0, 0.95);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 160ms;
  --dur-med: 280ms;

  --max-w: 1120px;
  --header-h: 64px;

  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(1100px 460px at 82% -12%, rgba(255, 255, 255, 0.04), transparent 60%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; }
svg { flex-shrink: 0; }

/* ---------- Shell ---------- */

.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 32px);
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.header-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.nav-link:active { transform: scale(0.97); }

.nav-link.is-active { color: var(--text); background: var(--surface-3); }

.avatar-chip {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.avatar-chip:active { transform: scale(0.96); }

.avatar-chip__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
}

/* ---------- Main ---------- */

.app-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px) 32px;
  animation: fade-slide 320ms var(--ease-out);
}

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

.view-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; letter-spacing: -0.03em; margin: 0 0 4px; }
.view-subtitle { color: var(--text-soft); font-size: 0.95rem; margin: 0 0 24px; }

/* ---------- Cards ---------- */

.card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.card:hover { border-color: var(--border-soft); }
.card:active { transform: scale(0.985); }

.card--highlight { border-color: var(--text-faint); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
  will-change: transform;
}

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

.btn--primary {
  color: #0a0a0b;
  background: var(--text);
  box-shadow: 0 10px 28px -14px rgba(250, 250, 250, 0.4);
}

.btn--ghost {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.btn--ghost:hover { border-color: var(--text-faint); }

.btn--block { width: 100%; }
.btn--lg { padding: 15px 20px; font-size: 1.02rem; }
.btn--sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 10px; }

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

/* ---------- Inputs ---------- */

.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

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

.input:focus {
  outline: none;
  border-color: var(--text-faint);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* ---------- Search hero ---------- */

.search-hero { padding: clamp(22px, 5vw, 40px); position: relative; overflow: hidden; }

.search-hero__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 14px;
}

.search-hero h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 700; letter-spacing: -0.03em; margin: 0 0 8px; }
.search-hero p { color: var(--text-soft); margin: 0 0 22px; max-width: 560px; line-height: 1.55; }

.search-form { display: grid; gap: 12px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: stretch; }

.quick-hints { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.hint-chip {
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.hint-chip:hover { color: var(--text); border-color: var(--text-faint); }
.hint-chip:active { transform: scale(0.96); }

/* ---------- Stats ---------- */

.stat-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin: 18px 0; }

.stat { padding: 18px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border); }
.stat--wide { grid-row: span 2; }

.stat__label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 6px; }
.stat__value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }

/* ---------- History ---------- */

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 14px; }
.section-head h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.section-head a { color: var(--text); font-size: 0.88rem; text-decoration: underline; }

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.history-item:hover { border-color: var(--text-faint); }
.history-item:active { transform: scale(0.99); }

.history-item__query { font-weight: 600; font-size: 0.98rem; word-break: break-word; }
.history-item__meta { display: flex; gap: 12px; font-size: 0.82rem; color: var(--text-faint); margin-top: 4px; }

.history-item__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.history-item__status--completed { color: var(--text); background: var(--surface-2); }
.history-item__status--failed { color: var(--text-soft); background: var(--surface-2); }

/* ---------- Result ---------- */

.result-card { padding: clamp(20px, 4vw, 32px); }

.result-query {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.05rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  word-break: break-word;
  margin: 0 0 18px;
}

.result-empty { text-align: center; padding: 30px 10px; }

.result-empty__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* ---------- Tariffs ---------- */

.tariff-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.tariff-card {
  position: relative;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.tariff-card:hover { border-color: var(--text-faint); }
.tariff-card:active { transform: scale(0.985); }

.tariff-card--featured {
  grid-row: span 2;
  border-color: var(--text-faint);
  background: var(--surface-2);
}

.tariff-card--featured::before {
  content: "Хит";
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
}

.tariff-card__name { font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }
.tariff-card__requests { color: var(--text-soft); font-size: 0.88rem; margin: 0 0 14px; }
.tariff-card__price { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 16px; }
.tariff-card__price span { font-size: 0.85rem; color: var(--text-faint); font-weight: 500; }

/* ---------- Profile ---------- */

.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 22px;
  margin-bottom: 16px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.profile-name { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.profile-username { color: var(--text-soft); font-size: 0.9rem; margin-top: 2px; }

.profile-badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---------- Referrals ---------- */

.referral-link { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.referral-link .input { font-family: "JetBrains Mono", monospace; font-size: 0.85rem; }

/* ---------- Mirror ---------- */

.mirror-token {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  word-break: break-all;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 12px 0;
  user-select: all;
}

/* ---------- FAQ ---------- */

.faq-item { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); margin-bottom: 10px; overflow: hidden; }

.faq-item__head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; text-align: left; font-weight: 600; }
.faq-item__head:active { background: var(--surface-2); }
.faq-item__chevron { transition: transform var(--dur-med) var(--ease-out); color: var(--text-faint); }
.faq-item.is-open .faq-item__chevron { transform: rotate(180deg); }
.faq-item__body { max-height: 0; overflow: hidden; transition: max-height var(--dur-med) var(--ease-out); }
.faq-item__inner { padding: 0 16px 16px; color: var(--text-soft); line-height: 1.55; }

/* ---------- Skeleton ---------- */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { 100% { transform: translateX(100%); } }

.skeleton-list { display: grid; gap: 10px; }
.skeleton-list .skeleton { height: 64px; }

/* ---------- States ---------- */

.state-box { text-align: center; padding: 40px 20px; color: var(--text-soft); }
.state-box__icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-faint); }
.state-box h3 { color: var(--text); margin: 0 0 6px; font-size: 1.05rem; }
.state-box p { margin: 0; font-size: 0.9rem; line-height: 1.5; }

/* ---------- Toast ---------- */

.toast-root {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  font-size: 0.9rem;
  animation: toast-in 260ms var(--ease-out);
  text-align: center;
}

.toast--error { border-color: var(--text-faint); color: var(--text-soft); }
.toast--success { border-color: var(--text-faint); color: var(--text); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(16, 16, 18, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-soft);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--text-faint);
  padding: 6px 0;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out);
}

.bottom-nav__item:active { transform: scale(0.95); }
.bottom-nav__item.is-active { color: var(--text); }

/* ---------- Modal ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(10, 10, 11, 0.72); backdrop-filter: blur(6px); animation: fade-slide 200ms var(--ease-out); }
.modal { width: min(480px, 100%); padding: 22px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal__title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.modal__close { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); }
.modal__close:active { transform: scale(0.95); }

.mono { font-family: "JetBrains Mono", monospace; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .header-nav { display: none; }
  .bottom-nav { display: grid; }
  .app-shell { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

@media (max-width: 680px) {
  .search-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat--wide { grid-row: auto; }
  .tariff-grid { grid-template-columns: 1fr; }
  .tariff-card--featured { grid-row: auto; }
  .profile-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .history-item { grid-template-columns: 1fr; }
  .referral-link { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
