@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #e0e7ff;
  --bg: #f8f8f8;
  --card: #ffffff;
  --text: #111111;
  --text-2: #555555;
  --text-3: #999999;
  --border: #e8e8e8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --nav-h: 68px;
  --header-h: 60px;
  --max-w: 480px;
}

html, body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #ebebeb;
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── WRAPPER ── */
.s-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
}

/* ── HEADER ── */
.s-header {
  height: var(--header-h);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.s-header-logo {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.s-header-logo span { color: var(--text); }
.s-header-balance {
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 100px;
  text-decoration: none;
}
.lang-switch {
  display: flex;
  align-items: center;
  gap: 3px;
}
.lang-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.lang-btn:hover { color: var(--text-2); }
.lang-active {
  color: var(--accent);
  font-weight: 700;
}
.lang-sep {
  font-size: 10px;
  color: var(--border);
}

/* ── BOTTOM NAV ── */
.s-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
}
.s-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-3);
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: color 0.15s;
}
.s-nav-item.active { color: var(--accent); }
.s-nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.s-nav-item.nav-cta {
  position: relative;
  top: -14px;
}
.s-nav-item.nav-cta .nav-cta-btn {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
.s-nav-item.nav-cta .nav-cta-btn svg { width: 24px; height: 24px; }

/* ── PAGE BODY ── */
.s-body {
  padding: 20px 16px calc(var(--nav-h) + 20px);
}
.s-body-no-nav {
  padding: 20px 16px;
}

/* ── CARDS ── */
.s-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.s-card-sm {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

/* ── TYPOGRAPHY ── */
.s-h1 { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -0.5px; }
.s-h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.s-h3 { font-size: 16px; font-weight: 600; }
.s-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; }
.s-muted { color: var(--text-2); font-size: 14px; }
.s-small { font-size: 12px; color: var(--text-3); }

/* ── SECTION HEADER ── */
.s-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.s-section-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

/* ── BUTTONS ── */
.s-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  width: 100%;
}
.s-btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.s-btn-primary:hover { background: var(--accent-dark); }
.s-btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.s-btn-ghost:hover { background: var(--border); }
.s-btn-sm {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 10px;
  width: auto;
}
.s-btn-danger { background: var(--danger); color: white; }

/* ── INPUTS ── */
.s-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.s-input:focus { border-color: var(--accent); }
.s-input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  display: block;
}
.s-form-group { margin-bottom: 14px; }

/* ── TOKEN BADGE ── */
.token-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
}
.token-big {
  font-size: 52px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -2px;
  line-height: 1;
}
.token-big-label {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 2px;
}

/* ── STATUS CHIPS ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chip-processing { background: #fef3c7; color: #92400e; }
.chip-completed { background: #dcfce7; color: #166534; }
.chip-failed { background: #fee2e2; color: #991b1b; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── GRID / MASONRY ── */
.gen-grid {
  columns: 2;
  column-gap: 10px;
}
.gen-card {
  break-inside: avoid;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
}
.gen-card img, .gen-card video {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 1;
}
.gen-card-info {
  padding: 10px 12px;
}
.gen-card-date { font-size: 11px; color: var(--text-3); }
.gen-card-placeholder {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.gen-card-placeholder svg { width: 32px; height: 32px; opacity: 0.5; }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card);
  position: relative;
}
.upload-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
.upload-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon {
  width: 60px;
  height: 60px;
  background: var(--accent-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
}
.upload-icon svg { width: 28px; height: 28px; }
.upload-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: none;
  margin-bottom: 12px;
}

/* ── PACKAGE CARDS ── */
.pkg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pkg-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  border: 2px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.pkg-card.popular { border-color: var(--accent); }
.pkg-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pkg-popular-tag {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--accent);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 0 var(--radius-sm) 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pkg-tokens { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -1px; }
.pkg-price { font-size: 14px; color: var(--text-2); margin-top: 4px; }

/* ── TRANSACTION LIST ── */
.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-desc { font-size: 13px; font-weight: 500; }
.tx-date { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-amount.pos { color: var(--success); }
.tx-amount.neg { color: var(--danger); }

/* ── ALERT ── */
.s-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
}
.s-alert-error { background: #fee2e2; color: #991b1b; }
.s-alert-success { background: #dcfce7; color: #166534; }
.s-alert-info { background: var(--accent-light); color: var(--accent-dark); }

/* ── SPINNER ── */
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SEPARATOR ── */
.s-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-3);
  font-size: 12px;
}
.s-sep::before, .s-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── LOGO HERO ── */
.hero-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}
.hero-logo svg { width: 36px; height: 36px; color: white; }

/* ── STATS ROW ── */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -1px; }
.stat-label { font-size: 11px; color: var(--text-3); font-weight: 500; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── RESULT VIDEO ── */
.result-video {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  background: #000;
}

/* ── DIVIDER ── */
.s-divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── LINK ── */
.s-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.s-link:hover { text-decoration: underline; }

/* ── DESKTOP SIDE FILL ── */
@media (min-width: 481px) {
  body { background: #d4d4d4; }
  .s-nav { border-radius: 0; }
  .s-wrap {
    box-shadow: 0 0 60px rgba(0,0,0,0.1);
  }
}

/* ── PULL TO REFRESH hint ── */
.ptr-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 0;
}

/* ── RESULT WAITING ── */
.waiting-card {
  text-align: center;
  padding: 48px 24px;
}
.waiting-card .spinner { margin-bottom: 24px; }

/* ── QUICK ACTIONS ── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa-btn {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.1s;
  border: none;
}
.qa-btn:hover { transform: translateY(-2px); }
.qa-btn svg { width: 24px; height: 24px; color: var(--accent); }
.qa-btn span { font-size: 12px; font-weight: 600; text-align: center; }
