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

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

:root {
  --bg: #080810;
  --surface: #12121e;
  --surface2: #1a1a2e;
  --border: rgba(255,255,255,0.07);
  --accent: #7c6fff;
  --accent-glow: rgba(124,111,255,0.25);
  --accent-dark: #5a50cc;
  --success: #10b981;
  --success-glow: rgba(16,185,129,0.2);
  --danger: #ef4444;
  --text: #f0f0f8;
  --muted: #6b7280;
  --muted2: #9ca3af;
  --radius: 16px;
  --radius-sm: 10px;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 80px;
}

/* ── Header ── */
header {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a78bfa, #7c6fff, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo span { -webkit-text-fill-color: #f0f0f8; color: #f0f0f8; }

.header-date {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── Main card ── */
.card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 12px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7c6fff, #60a5fa, #a78bfa);
}

/* ── Countdown ── */
.countdown-wrap {
  text-align: center;
  padding: 48px 24px;
}

.countdown-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.countdown-timer {
  font-size: 3.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #a78bfa, #7c6fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 12px;
}

.countdown-sub {
  font-size: 0.85rem;
  color: var(--muted2);
}

/* ── Badges ── */
.badge-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-theme { background: rgba(124,111,255,0.15); color: #a78bfa; border: 1px solid rgba(124,111,255,0.3); }
.badge-facile { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge-moyen  { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.badge-difficile { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }

/* ── Question section ── */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 20px;
}

/* ── Skip button ── */
.skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 24px;
}

.skip-btn:hover:not(:disabled) {
  border-color: rgba(124,111,255,0.4);
  color: #a78bfa;
  background: rgba(124,111,255,0.08);
}

.skip-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.skip-btn .icon { font-size: 0.9rem; }

/* ── Form ── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"], textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}

input[type="text"]:focus, textarea:focus {
  border-color: rgba(124,111,255,0.5);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { min-height: 120px; }

/* ── Submit button ── */
.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
  background: #6b5ff0;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.submit-btn:active:not(:disabled) { transform: translateY(0); }

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.submit-btn .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.submit-btn.loading .btn-text { display: none; }
.submit-btn.loading .spinner { display: block; }

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

/* ── Error message ── */
.error-msg {
  font-size: 0.8rem;
  color: var(--danger);
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: none;
}
.error-msg.visible { display: block; }

/* ── Result card ── */
.result-card {
  width: 100%;
  max-width: 480px;
  margin-top: 16px;
  display: none;
}

.result-card.visible { display: block; }

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.result-icon {
  width: 36px; height: 36px;
  background: var(--success-glow);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.result-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--success);
}

.result-title small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.answer-box {
  background: var(--surface2);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted2);
  margin-bottom: 24px;
  white-space: pre-wrap;
}

/* ── Autres réponses ── */
.others-section { margin-top: 4px; }

.others-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 12px;
}

.reponse-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.3s ease both;
}

.reponse-item:last-child { border-bottom: none; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6fff, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.reponse-content { flex: 1; min-width: 0; }

.reponse-prenom {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.reponse-text {
  font-size: 0.85rem;
  color: var(--muted2);
  line-height: 1.5;
}

.reponse-time {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}

/* ── Already answered ── */
.already-answered {
  text-align: center;
  padding: 32px 16px;
}

.already-answered .big-check {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

.already-answered h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.already-answered p {
  font-size: 0.85rem;
  color: var(--muted);
}

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

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card { animation: fadeInUp 0.4s ease; }

/* ── No question state ── */
.no-question {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Footer ── */
footer {
  width: 100%;
  max-width: 480px;
  text-align: center;
  margin-top: 32px;
  font-size: 0.7rem;
  color: var(--muted);
}

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

/* ── Confetti ── */
.confetti-piece {
  position: fixed;
  width: 8px; height: 8px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall var(--dur, 1.5s) ease-in forwards;
  top: -10px;
  left: var(--x, 50%);
  background: var(--color, #7c6fff);
  transform: rotate(var(--rot, 0deg));
  z-index: 9999;
}

@keyframes confettiFall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ── Responsive ── */
@media (max-width: 400px) {
  .card { padding: 18px; }
  .countdown-timer { font-size: 2.8rem; }
}
