/* ================================================
   PITHIKOS — Design System v2
   ================================================ */

/* ----- Design tokens ----- */
:root {
  --c-bg1:      #000c22;
  --c-bg2:      #002a68;
  --c-card:     rgba(0, 22, 70, 0.82);
  --c-input:    rgba(0, 12, 50, 0.75);
  --c-border:   rgba(255, 255, 255, 0.1);
  --c-accent:   #d21f3c;
  --c-accent2:  #fb923c;
  --shadow-card: 0 20px 60px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.3);
}

/* ================================================
   LAYOUT — 100dvh
   ================================================ */

html { height: 100%; }

body {
  height: 100dvh !important;
  min-height: unset !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(0, 80, 200, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(210, 31, 60, 0.08) 0%, transparent 50%),
    linear-gradient(150deg, var(--c-bg1) 0%, #001a55 50%, var(--c-bg2) 100%) !important;
  background-attachment: fixed !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

header { flex-shrink: 0; }

main {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

main::-webkit-scrollbar       { width: 3px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

footer {
  flex-shrink: 0 !important;
  border-top: 1px solid rgba(255,255,255,0.07) !important;
  background: rgba(0,10,38,0.6) !important;
  padding: 0.5rem 1rem !important;
}

footer p { font-size: 0.72rem; opacity: 0.4; }

/* Mobile */
@media (max-width: 639px) {
  body {
    height: auto !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }
  main {
    overflow: visible !important;
    align-items: flex-start;
    padding: 1.25rem 0.9rem;
  }
}

/* ================================================
   ANIMATIONS D'ENTRÉE
   ================================================ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

section.bg-bleuFonce {
  animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.prog-widget {
  animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.04s;
}

/* ================================================
   NAVIGATION
   ================================================ */

nav.bg-bleuFonce {
  background: rgba(0, 18, 58, 0.97) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 24px rgba(0,0,0,0.4);
}

nav a {
  position: relative;
  transition: opacity 0.18s ease;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.6);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

nav a:hover::after { transform: scaleX(1); }
nav a:hover        { opacity: 0.82; }

/* ================================================
   CARDS
   ================================================ */

section.bg-bleuFonce {
  background: var(--c-card) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: var(--shadow-card) !important;
}

/* ================================================
   PROGRESSION WIDGET (exercices.php)
   ================================================ */

.prog-widget {
  background: rgba(0, 16, 52, 0.72);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.85rem;
  padding: 0.85rem 1.2rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.prog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 0.28rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(251, 146, 60, 0.14);
  border: 1px solid rgba(251, 146, 60, 0.32);
  padding: 0.28rem 0.75rem;
  border-radius: 99px;
  font-size: 0.85rem;
  color: #fb923c;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.streak-badge.pop {
  animation: streakPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes streakPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ================================================
   PROGRESS BAR
   ================================================ */

.score-bar-wrap {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.score-bar {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #4ade80, #22d3ee);
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 6px;
}

.score-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  text-align: right;
  margin-bottom: 0.4rem;
}

/* ================================================
   SKIP BUTTON
   ================================================ */

.btn-skip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.38);
  border-radius: 0.6rem;
  padding: 0.55rem 1.5rem;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.btn-skip:hover {
  border-color: rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.04);
  transform: translateY(-1px);
}

/* ================================================
   FORM INPUTS
   ================================================ */

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  background: var(--c-input) !important;
  border: 1.5px solid var(--c-border) !important;
  border-radius: 0.6rem !important;
  color: white !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: rgba(251, 146, 60, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1) !important;
}

input::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.45) !important;
  opacity: 1 !important;
}

input.inputReponse.correct {
  background-color: rgba(22, 163, 74, 0.38) !important;
  border-color: #4ade80 !important;
}

input.inputReponse.incorrect {
  background-color: rgba(220, 38, 38, 0.38) !important;
  border-color: #f87171 !important;
}

/* ================================================
   BUTTONS
   ================================================ */

button[class*="bg-gradient"],
a[class*="bg-gradient"] {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button[class*="bg-gradient"]:hover,
a[class*="bg-gradient"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(210, 31, 60, 0.42);
}

button[class*="bg-gradient"]:active,
a[class*="bg-gradient"]:active {
  transform: translateY(0) scale(0.99);
}

/* ----- Answer buttons ----- */
.answer-btn {
  width: 100%;
  padding: 0.75rem 1.4rem;
  border-radius: 0.6rem;
  background: rgba(0, 18, 62, 0.75);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1rem;
  text-align: left;
  font-family: inherit;
}

.answer-btn:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.38);
  transform: translateX(4px);
}

.answer-btn.selected {
  border-color: var(--c-accent2);
  background: rgba(251, 146, 60, 0.15);
}

/* ================================================
   LEVEL OPTIONS (choixNiveau)
   ================================================ */

.level-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1.1rem;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  border: 1.5px solid rgba(255,255,255,0.09);
  background: rgba(0, 12, 50, 0.5);
  user-select: none;
}

.level-option:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.22);
  transform: translateX(3px);
}

.level-option input[type="radio"] {
  accent-color: var(--c-accent2);
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex-shrink: 0;
}

.level-option input[type="radio"]:checked ~ span {
  font-weight: 700;
  color: var(--c-accent2);
}

/* ================================================
   PROGRESS CIRCLES
   ================================================ */

.progress-circle {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
  font-size: 0.82rem;
  width: 2.2rem !important;
  height: 2.2rem !important;
}

.progress-circle:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

/* ================================================
   FLAGS / IMAGES
   ================================================ */

.hover-image {
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.hover-image:hover {
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.55));
}

img[src*="drapeau"] {
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

img[src*="rank"] {
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

img[src*="rank"]:hover {
  transform: scale(1.14) rotate(-3deg);
}

/* ================================================
   AUDIO
   ================================================ */

audio {
  border-radius: 10px;
  max-width: 300px;
  width: 100%;
  filter: invert(1) hue-rotate(180deg);
  opacity: 0.9;
}

/* ================================================
   TOASTS
   ================================================ */

.toast-container {
  position: fixed;
  top: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.toast {
  padding: 0.85rem 1.75rem;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  text-align: center;
  min-width: 240px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.5);
  animation: toastIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
             toastOut 0.4s ease 2.6s forwards;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,0.14);
}

.toast-success { background: linear-gradient(135deg, #15803d, #22c55e); color: white; }
.toast-error   { background: linear-gradient(135deg, #b91c1c, #ef4444); color: white; }
.toast-info    { background: linear-gradient(135deg, #1e40af, #3b82f6); color: white; }

@keyframes toastIn {
  from { transform: translateY(-110%) scale(0.88); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.9) translateY(-14px); }
}

/* ================================================
   ALERTS INLINE
   ================================================ */

.alert {
  padding: 0.65rem 1.1rem;
  border-radius: 0.55rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  text-align: center;
}

.alert-error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.38);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.38);
  color: #86efac;
}

/* ================================================
   MISSING TAILWIND UTILITIES
   ================================================ */

.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-5  { gap: 1.25rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

.tracking-wider  { letter-spacing: 0.05em; }
.tracking-wide   { letter-spacing: 0.025em; }
.leading-snug    { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.uppercase       { text-transform: uppercase; }
.underline       { text-decoration-line: underline; }
.opacity-40      { opacity: 0.4; }
.opacity-45      { opacity: 0.45; }
.opacity-50      { opacity: 0.5; }
.opacity-55      { opacity: 0.55; }
.opacity-60      { opacity: 0.6; }
.opacity-65      { opacity: 0.65; }
.opacity-70      { opacity: 0.7; }
.opacity-75      { opacity: 0.75; }
.opacity-80      { opacity: 0.8; }
.opacity-90      { opacity: 0.9; }
.ring-2          { box-shadow: 0 0 0 2px currentColor; }

.sm\:inline { display: none; }

@media (min-width: 640px) {
  .sm\:inline { display: inline; }
}

/* ================================================
   WORD CHIPS (type 4)
   ================================================ */

.word-chip {
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.word-chip:hover { background: rgba(255,255,255,0.14); transform: translateY(-1px); }
