*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000;
  --surface: #121212;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --text: #fff;
  --muted: #8a8a8a;
  --pink: #fe2c55;
  --cyan: #25f4ee;
  --radius: 12px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.tiktok-logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
}

.badge-18 {
  display: inline-block;
  background: var(--pink);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ff3040;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Feed ── */
.feed {
  flex: 1;
  padding: 24px 20px;
}

.feed-tag {
  font-size: 0.75rem;
  color: var(--pink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.feed h1 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}

.feed h1 em {
  color: var(--pink);
  font-style: normal;
}

.feed-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ── Video grid ── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.video-card {
  position: relative;
  aspect-ratio: 9/14;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
}

.video-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    hsl(var(--hue, 280) 40% 25%) 0%,
    hsl(calc(var(--hue, 280) + 40) 50% 15%) 100%
  );
  filter: blur(0);
}

.video-card .blur-overlay {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(18px);
  background: rgba(0,0,0,0.3);
}

.video-card .lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 2;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
}

.video-card .lock-icon {
  font-size: 1.4rem;
}

.video-card .duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  z-index: 3;
}

.video-card .play {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  z-index: 3;
  opacity: 0.6;
}

/* ── Perks ── */
.perks {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.perks li {
  font-size: 0.8rem;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--muted);
}

.perks li::before {
  content: '✓ ';
  color: var(--cyan);
}

.free-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── CTA ── */
.cta-btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--pink), #ff0050);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cta-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 24px rgba(254, 44, 85, 0.4);
}

.cta-btn.small {
  width: auto;
  padding: 12px 32px;
  margin: 16px auto 0;
}

/* ── Footer ── */
.footer {
  padding: 16px 20px 24px;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--card);
  border: none;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding-right: 40px;
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.modal-step.hidden { display: none; }

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.tab.active {
  background: var(--card);
  color: var(--text);
  border-color: var(--pink);
}

.panel-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
}

/* QR */
.qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  position: relative;
}

#qr-canvas {
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.qr-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.qr-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

/* MAX button */
.max-icon-lg {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 auto 16px;
}

.btn-max {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.btn-max:hover { opacity: 0.9; }

.btn-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--cyan);
}

/* Waiting */
.waiting-block {
  text-align: center;
  padding: 16px 0;
}

.waiting-block .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.waiting-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Success / Error */
.success-icon, .error-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 auto 16px;
}

.success-icon {
  background: rgba(37, 244, 238, 0.15);
  color: var(--cyan);
  border: 2px solid var(--cyan);
}

.error-icon {
  background: rgba(254, 44, 85, 0.15);
  color: var(--pink);
  border: 2px solid var(--pink);
}

.modal-step h3 {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.modal-step > p {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Phone form */
.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.phone-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.phone-prefix {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.phone-input input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.phone-input input::placeholder {
  color: #555;
}

.privacy-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Code inputs */
.code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 24px 0;
}

.code-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}

.code-digit:focus {
  border-color: var(--pink);
}

.hidden { display: none !important; }

@media (min-width: 500px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal {
    border-radius: 20px;
  }
}
