/* ── Tokens ─────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700;800&display=swap');

:root {
  --black:    #000000;
  --surface:  #0a0a0a;
  --surface2: #111111;
  --border:   #1c1c1c;
  --green:    #32CD32;
  --green-dim:rgba(50,205,50,0.12);
  --green-glow:rgba(50,205,50,0.25);
  --white:    #ffffff;
  --grey:     rgba(255,255,255,0.45);
  --red:      #ef4444;

  --font-ar:  'Cairo', sans-serif;
  --font-en:  'Space Grotesk', sans-serif;
  --ease:     cubic-bezier(0.4, 0, 0.2, 1);
  --radius:   10px;
  --radius-sm: 6px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #32CD32; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #28b828; }
* { scrollbar-width: thin; scrollbar-color: #32CD32 #000; }

body {
  font-family: var(--font-ar);
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ── Background ─────────────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(50,205,50,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(50,205,50,0.025) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 0 80px rgba(50,205,50,0.04);
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.card.fade-out {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.card-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.logo-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--green);
  box-shadow: 0 0 20px rgba(50,205,50,0.25);
}

.card-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.card-sub {
  font-size: 13px;
  color: var(--grey);
  line-height: 1.6;
}

/* ── Step indicator ─────────────────────────────────────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--grey);
  background: var(--surface);
  transition: all 0.3s var(--ease);
  flex-shrink: 0;
  font-family: var(--font-en);
}

.step-dot.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 0 3px rgba(50,205,50,0.1);
}

.step-dot.done {
  border-color: var(--green);
  background: var(--green);
  color: var(--black);
}

.step-dot.done::before { content: ''; }

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  transition: background 0.3s var(--ease);
}

.step-line.done { background: var(--green); }

/* ── Panels ─────────────────────────────────────────────────────────────────── */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* ── Discord profile chip ───────────────────────────────────────────────────── */
.discord-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 14px 8px 8px;
  margin-bottom: 24px;
}

.discord-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid rgba(50,205,50,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
  flex-shrink: 0;
  overflow: hidden;
}

.discord-avatar img { width: 100%; height: 100%; object-fit: cover; }

.discord-chip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
}

.discord-chip-tag {
  font-size: 11px;
  color: var(--grey);
}

/* ── Form elements ──────────────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--font-en);
  color: var(--white);
  outline: none;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder { color: rgba(255,255,255,0.2); }

.form-input:focus {
  border-color: rgba(50,205,50,0.5);
  box-shadow: 0 0 0 3px rgba(50,205,50,0.08);
}

.form-input.error {
  border-color: rgba(239,68,68,0.6);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
}

.form-input.success {
  border-color: rgba(50,205,50,0.6);
  box-shadow: 0 0 0 3px rgba(50,205,50,0.08);
}

/* Hide HTML5 number input spinner arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.form-group { margin-bottom: 18px; }

/* ── Activity Selector ──────────────────────────────────────────────────────── */
.activity-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.activity-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 8px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  user-select: none;
}

.activity-opt:hover { border-color: rgba(50,205,50,0.3); }

.activity-opt.selected {
  border-color: var(--green);
  background: var(--green-dim);
}

.activity-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--grey);
  margin-bottom: 6px;
  transition: all 0.2s;
}

.activity-opt.selected .activity-num {
  background: var(--green);
  border-color: var(--green);
  color: var(--black);
}

.activity-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.activity-desc {
  font-size: 10px;
  color: var(--grey);
  margin-top: 2px;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 5px;
}

/* ── Game selector ──────────────────────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.game-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  user-select: none;
}

.game-option:hover { border-color: rgba(50,205,50,0.3); background: #0f0f0f; }

.game-option.selected {
  border-color: var(--green);
  background: var(--green-dim);
}

.game-emoji { font-size: 22px; flex-shrink: 0; }

.game-info { flex: 1; }

.game-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 2px;
}

.game-desc { font-size: 12px; color: var(--grey); }

.game-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

.game-option.selected .game-check {
  background: var(--green);
  border-color: var(--green);
  color: var(--black);
}

/* ── CAPTCHA ─────────────────────────────────────────────────────────────────── */
.captcha-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(50, 205, 50, 0.4);
  box-shadow: 0 0 30px rgba(50,205,50,0.08);
  margin-bottom: 12px;
}

.captcha-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

.captcha-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.captcha-controls .form-input {
  flex: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-en);
}

.captcha-btn {
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(50,205,50,0.3);
  font-family: var(--font-en);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.captcha-btn.refresh {
  background: rgba(50,205,50,0.07);
  color: rgba(50,205,50,0.7);
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.captcha-btn.refresh svg {
  display: block;
  margin: 0 auto;
}

.captcha-status {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.captcha-status.ok  { color: var(--green); }
.captcha-status.err { color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s var(--ease);
}

.btn-primary {
  background: var(--green);
  color: var(--black);
}

.btn-primary:hover:not(:disabled) {
  background: #28b828;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(50,205,50,0.25);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--grey);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--white); border-color: rgba(255,255,255,0.2); }

.btn-discord {
  background: #5865F2;
  color: #fff;
}

.btn-discord:hover {
  background: #4752c4;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(88,101,242,0.3);
}

.btn-discord svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Nav buttons ─────────────────────────────────────────────────────────────── */
.nav-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.nav-btns .btn { flex: 1; }
.nav-btns .btn-ghost { flex: 0 0 auto; width: 90px; }

/* ── Success ─────────────────────────────────────────────────────────────────── */
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 2px solid rgba(50,205,50,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
  box-shadow: 0 0 40px rgba(50,205,50,0.15);
}

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ─────────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--grey);
  font-size: 12px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Already applied notice ─────────────────────────────────────────────────── */
.notice {
  background: rgba(50,205,50,0.06);
  border: 1px solid rgba(50,205,50,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: rgba(50,205,50,0.8);
  margin-bottom: 16px;
}

.notice.warn {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.2);
  color: #f59e0b;
}

/* ── Footer link ────────────────────────────────────────────────────────────── */
.footer-link {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: rgba(255,255,255,0.2);
}

.footer-link a { color: var(--green); text-decoration: none; }
.footer-link a:hover { text-decoration: underline; }

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 580px) {
  body {
    padding: 16px 12px;
  }

  .card {
    padding: 24px 16px;
    border-radius: 12px;
  }

  .card-header {
    margin-bottom: 24px;
  }

  .logo-img {
    width: 52px;
    height: 52px;
  }

  .card-title {
    font-size: 20px;
  }

  .card-sub {
    font-size: 12px;
  }

  .steps {
    margin-bottom: 24px;
  }

  .step-dot {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .game-option {
    padding: 12px 14px;
    gap: 10px;
  }

  .game-emoji {
    font-size: 20px;
  }

  .game-name {
    font-size: 13px;
  }

  .game-desc {
    font-size: 11px;
  }

  .captcha-controls {
    flex-wrap: wrap;
  }

  .captcha-controls .form-input {
    width: 100%;
    flex: 1 0 100%;
    margin-bottom: 4px;
  }

  .captcha-btn.verify {
    flex: 1;
  }

  .nav-btns {
    flex-direction: column-reverse;
  }

  .nav-btns .btn-ghost {
    width: 100%;
  }
}
