/**
 * Grouvel - Styles du chronomètre de vie (chronometre.html)
 * Thème cosmique sombre avec animations, jauges et grilles de semaines.
 */

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

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
  color: #e8e8f0;
  padding: 1.5rem;
}

/* Background effects */
.bg-effects {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.2;
}
.bg-blob-1 {
  top: 25%;
  left: -15%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
}
.bg-blob-2 {
  bottom: 25%;
  right: -15%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}
.back-link:hover { color: #f59e0b; }
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, #818cf8 0%, #c084fc 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}
.subtitle {
  color: #94a3b8;
  font-size: 1.1rem;
}

/* Cards */
.card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 1.5rem 2rem;
  border: 1px solid rgba(100, 116, 139, 0.2);
  margin-bottom: 1.5rem;
}

/* Profiles */
.profiles {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.profile-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.3);
  background: rgba(30, 41, 59, 0.4);
  color: #94a3b8;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #e8e8f0;
}
.profile-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-color: transparent;
  color: white;
}
.profile-avatar {
  font-size: 1.1rem;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.form-group { display: flex; flex-direction: column; }
.form-group label {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(100, 116, 139, 0.3);
  background: rgba(30, 41, 59, 0.6);
  color: #e8e8f0;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #818cf8;
}
.form-group select option {
  background: #1e293b;
}

/* Timer display */
.section-title {
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #64748b;
  margin-bottom: 1.5rem;
}
.timer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 2rem;
}
.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.time-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: #e8e8f0;
}
.time-value.accent {
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}
.time-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-top: 0.25rem;
}
.time-separator {
  font-size: 1.5rem;
  color: #475569;
  align-self: center;
  display: none;
}

/* Progress section */
.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Circular progress */
.circular-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.circular-wrapper {
  position: relative;
  animation: float 6s ease-in-out infinite;
}
.circular-wrapper svg {
  width: 260px;
  height: 260px;
}
.circular-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.percentage {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
  color: #fbbf24;
}
.percentage-label {
  font-size: 0.9rem;
  color: #64748b;
}
.years-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  text-align: center;
}
.years-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
}
.years-value.lived { color: #fbbf24; }
.years-value.remaining { color: #34d399; }
.years-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Life bar */
.life-bar-section { padding-top: 0.5rem; }
.life-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.life-bar-header span:first-child { color: #64748b; }
.life-bar-header span:last-child { color: #fbbf24; font-weight: 600; }
.life-bar {
  height: 32px;
  background: rgba(100, 116, 139, 0.2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.life-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
  position: relative;
  transition: width 0.5s ease-out;
}
.life-bar-indicator {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: white;
  animation: pulse-glow 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255,255,255,0.8);
}
.life-bar-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  padding: 0 0.75rem;
  white-space: nowrap;
}

/* Decades */
.decades-title {
  font-size: 0.85rem;
  color: #64748b;
  margin: 1.5rem 0 0.75rem;
}
.decades-grid {
  display: flex;
  gap: 4px;
}
.decade {
  flex: 1;
  height: 48px;
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  overflow: hidden;
}
.decade.past {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}
.decade.future {
  background: rgba(100, 116, 139, 0.2);
}
.decade.current {
  background: rgba(100, 116, 139, 0.2);
  border: 2px solid #f59e0b;
}
.decade-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(251, 191, 36, 0.5);
}

/* Milestones */
.milestones {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(100, 116, 139, 0.2);
}
.milestone {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.milestone:last-child { margin-bottom: 0; }
.milestone-icon { font-size: 1rem; }
.milestone-bar {
  flex: 1;
  height: 8px;
  background: rgba(100, 116, 139, 0.2);
  border-radius: 999px;
  overflow: hidden;
}
.milestone-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease-out;
}
.milestone-fill.reached {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}
.milestone-fill.pending {
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
}
.milestone-age {
  min-width: 50px;
  text-align: right;
}
.milestone-age.reached { color: #34d399; }
.milestone-age.pending { color: #64748b; }

/* Survival statistics */
.quartiles-section {
  margin-bottom: 1.5rem;
}
.quartiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.quartile-card {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  border: 1px solid rgba(100, 116, 139, 0.15);
}
.quartile-card.highlight {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
  border-color: rgba(251, 191, 36, 0.3);
}
.quartile-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 0.5rem;
}
.quartile-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #e8e8f0;
}
.quartile-card.highlight .quartile-value {
  color: #fbbf24;
}
.quartile-desc {
  font-size: 0.65rem;
  color: #475569;
  margin-top: 0.25rem;
}
.quartile-range {
  margin-top: 1rem;
}
.quartile-range-bar {
  height: 24px;
  background: rgba(100, 116, 139, 0.2);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.quartile-range-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #c084fc 100%);
  border-radius: 12px;
  opacity: 0.6;
}
.quartile-range-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
  border-radius: 2px;
}
.quartile-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.5rem;
  padding: 0 0.5rem;
}

.survival-section {
  margin-top: 1rem;
}
.survival-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.survival-item {
  display: grid;
  grid-template-columns: 60px 1fr 50px;
  align-items: center;
  gap: 1rem;
}
.survival-age {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 500;
}
.survival-bar-container {
  height: 12px;
  background: rgba(100, 116, 139, 0.2);
  border-radius: 6px;
  overflow: hidden;
}
.survival-bar {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
  transition: width 0.5s ease-out;
}
.survival-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #34d399;
  text-align: right;
}

/* Birthday countdown */
.birthday-card {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
  border: 1px solid rgba(251, 191, 36, 0.3);
  text-align: center;
  padding: 1.5rem;
}
.birthday-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.birthday-countdown {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0;
}
.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.countdown-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: #fbbf24;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}
.countdown-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-top: 0.25rem;
}
.birthday-next {
  font-size: 0.85rem;
  color: #94a3b8;
}
.birthday-next strong {
  color: #fbbf24;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.stat-card {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid rgba(100, 116, 139, 0.15);
}
.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
}
.stat-label {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Footer */
.footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: #475569;
  margin-top: 1.5rem;
  line-height: 1.6;
}

/* Birthday celebration */
.birthday-banner {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ef4444 100%);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  animation: birthday-glow 2s ease-in-out infinite;
}
.birthday-banner-icon { font-size: 3rem; }
.birthday-banner-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
  margin-top: 0.5rem;
}
@keyframes birthday-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 0 40px rgba(251, 191, 36, 0.8); }
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
}
@keyframes confetti-fall {
  0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Birth info card */
.birth-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}
.birth-info-item {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(100, 116, 139, 0.15);
}
.birth-info-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.birth-info-value {
  font-size: 1rem;
  font-weight: 600;
  color: #e8e8f0;
}
.birth-info-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

/* Weeks grid */
.weeks-container {
  margin-top: 1rem;
}
.weeks-grid {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  flex: 1;
}
.week-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(100, 116, 139, 0.2);
  min-width: 4px;
}
.week-cell.lived {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}
.week-cell.current {
  background: #fbbf24;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.8);
}
.week-cell.beyond {
  background: rgba(239, 68, 68, 0.3);
}

/* Zones de quartiles sur la grille des semaines */
.week-cell.zone-before-q1:not(.lived):not(.current) {
  background: rgba(52, 211, 153, 0.08);
}
.week-cell.zone-q1-median:not(.lived):not(.current) {
  background: rgba(251, 191, 36, 0.1);
}
.week-cell.zone-median-q3:not(.lived):not(.current) {
  background: rgba(139, 92, 246, 0.1);
}
.week-cell.zone-beyond-q3:not(.lived):not(.current):not(.beyond) {
  background: rgba(239, 68, 68, 0.15);
}

/* Lignes de quartiles */
.week-cell.quartile-q1 {
  border-bottom: 2px solid rgba(56, 189, 248, 0.8);
}
.week-cell.quartile-median {
  border-bottom: 2px solid rgba(251, 191, 36, 0.9);
}
.week-cell.quartile-q3 {
  border-bottom: 2px solid rgba(168, 85, 247, 0.8);
}

/* Marqueurs de morts célèbres */
.week-cell.famous-death {
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.7);
  z-index: 1;
}
.week-cell.famous-death::after {
  content: attr(data-emoji);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.45rem;
  line-height: 1;
  pointer-events: none;
}

.weeks-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.5rem;
  margin-left: 28px;
}
.weeks-quartile-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.quartile-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.quartile-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.quartile-legend-line {
  width: 16px;
  height: 2px;
  border-radius: 1px;
}
.weeks-axis-x {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #475569;
  margin-bottom: 0.25rem;
  margin-left: 28px;
}
.weeks-main {
  display: flex;
  gap: 4px;
}
.weeks-axis-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.55rem;
  color: #475569;
  width: 24px;
  text-align: right;
  padding-right: 4px;
}
.weeks-axis-y span {
  line-height: 1;
}

/* Cohort chart */
.chart-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}
#cohortChart {
  width: 100%;
  height: auto;
  display: block;
}
.chart-tooltip {
  position: absolute;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #e8e8f0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  white-space: nowrap;
}
.chart-tooltip.visible {
  opacity: 1;
}
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #94a3b8;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Comparison controls */
.comparison-controls {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(100, 116, 139, 0.2);
}
.comparison-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #94a3b8;
  user-select: none;
}
.comparison-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #38bdf8;
  cursor: pointer;
}
.comparison-slider-container {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.comparison-slider-container input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(100, 116, 139, 0.3);
  border-radius: 3px;
  cursor: pointer;
}
.comparison-slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  cursor: grab;
}
.comparison-slider-container input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #38bdf8;
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  cursor: grab;
}
.comparison-year-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: #38bdf8;
  min-width: 50px;
}
.comparison-stats {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.comparison-stat {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}
.comparison-stat-label {
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.comparison-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #38bdf8;
}
.comparison-stat-diff {
  font-size: 0.7rem;
  margin-top: 0.2rem;
}
.comparison-stat-diff.positive { color: #34d399; }
.comparison-stat-diff.negative { color: #f87171; }
.comparison-stat-diff.neutral { color: #64748b; }

/* Keyboard hint */
.keyboard-hint {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.2);
  z-index: 100;
}
.keyboard-hint kbd {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  margin-right: 0.25rem;
}

/* Placeholder */
.placeholder {
  text-align: center;
  padding: 3rem;
  color: #64748b;
}
.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}
.placeholder-icon.float {
  animation: float 6s ease-in-out infinite;
}

/* Hidden */
.hidden { display: none !important; }

/* Animations */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Responsive - Tablet */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .birth-info {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
  body {
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    -webkit-overflow-scrolling: touch;
  }
  h1 { font-size: 1.6rem; line-height: 1.2; }
  .subtitle { font-size: 0.95rem; }
  .back-link {
    padding: 0.5rem;
    margin: -0.5rem;
    margin-bottom: 1rem;
  }
  .card {
    padding: 1.25rem;
    border-radius: 16px;
    margin-bottom: 1rem;
  }
  .profiles {
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    justify-content: center;
  }
  .profile-btn {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    min-height: 44px;
  }
  .profile-avatar { font-size: 1rem; }
  .form-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .form-group input,
  .form-group select {
    font-size: 16px;
    padding: 0.9rem 1rem;
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
  }
  .form-group label { font-size: 0.8rem; margin-bottom: 0.4rem; }
  .section-title { font-size: 0.7rem; margin-bottom: 1rem; }
  .timer-grid {
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0;
  }
  .time-unit { min-width: 45px; }
  .time-value {
    font-size: 1.5rem;
    line-height: 1.2;
  }
  .time-label { font-size: 0.6rem; }
  .time-separator { display: none; }
  .birth-info {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  .birth-info-item {
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
  }
  .birth-info-icon { font-size: 1.2rem; margin-bottom: 0.2rem; }
  .birth-info-value { font-size: 0.8rem; }
  .birth-info-label { font-size: 0.55rem; }
  .progress-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .circular-wrapper {
    animation: none;
  }
  .circular-wrapper svg {
    width: 200px;
    height: 200px;
  }
  .circular-wrapper svg circle {
    transform-origin: center;
  }
  .percentage { font-size: 2rem; }
  .percentage-label { font-size: 0.8rem; }
  .years-grid { gap: 1.5rem; margin-top: 1rem; }
  .years-value { font-size: 1.25rem; }
  .years-label { font-size: 0.6rem; }
  .life-bar { height: 28px; }
  .life-bar-header { font-size: 0.75rem; }
  .life-bar-text { font-size: 0.65rem; }
  .decades-title { font-size: 0.75rem; margin: 1rem 0 0.5rem; }
  .decade {
    height: 36px;
    font-size: 0.6rem;
    border-radius: 6px;
  }
  .milestone { gap: 0.5rem; font-size: 0.8rem; }
  .milestone-icon { font-size: 0.9rem; }
  .milestone-bar { height: 6px; }
  .milestone-age { min-width: 45px; font-size: 0.75rem; }
  .birthday-card { padding: 1.25rem 1rem; }
  .birthday-icon { font-size: 2rem; margin-bottom: 0.25rem; }
  .birthday-countdown { gap: 1rem; margin: 0.75rem 0; }
  .countdown-value { font-size: 1.5rem; }
  .countdown-label { font-size: 0.6rem; }
  .birthday-next { font-size: 0.8rem; }
  .weeks-container { margin-top: 0.75rem; }
  .weeks-axis-x { font-size: 0.5rem; margin-bottom: 0.15rem; margin-left: 20px; }
  .weeks-axis-y { font-size: 0.45rem; width: 16px; }
  .weeks-main { gap: 2px; }
  .weeks-grid {
    gap: 1px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .week-cell {
    min-width: 4px;
    border-radius: 1px;
  }
  .week-cell.famous-death::after {
    display: none;
  }
  .weeks-legend { font-size: 0.6rem; margin-top: 0.4rem; margin-left: 20px; }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .stat-card {
    padding: 0.85rem;
    border-radius: 12px;
  }
  .stat-icon { font-size: 1.25rem; margin-bottom: 0.3rem; }
  .stat-value { font-size: 0.95rem; }
  .stat-label { font-size: 0.6rem; }
  .chart-container { max-width: 100%; }
  .chart-legend {
    gap: 1rem;
    margin-top: 0.75rem;
  }
  .legend-item { font-size: 0.7rem; }
  .legend-color { width: 10px; height: 10px; }
  .comparison-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .comparison-stat {
    padding: 0.5rem;
    border-radius: 8px;
  }
  .comparison-stat-label { font-size: 0.6rem; }
  .comparison-stat-value { font-size: 0.8rem; }
  .comparison-stat-diff { font-size: 0.65rem; }
  .comparison-slider-container {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .quartiles-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  .quartile-card {
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
  }
  .quartile-label { font-size: 0.6rem; margin-bottom: 0.3rem; }
  .quartile-value { font-size: 1.1rem; }
  .quartile-desc { font-size: 0.55rem; }
  .quartile-range-bar { height: 20px; }
  .quartile-range-labels { font-size: 0.6rem; padding: 0 0.25rem; }
  .survival-item {
    grid-template-columns: 50px 1fr 45px;
    gap: 0.5rem;
  }
  .survival-age { font-size: 0.75rem; }
  .survival-bar-container { height: 10px; }
  .survival-pct { font-size: 0.8rem; }
  .footer-note { font-size: 0.65rem; margin-top: 1rem; }
  .birthday-banner {
    padding: 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
  }
  .birthday-banner-icon { font-size: 2rem; }
  .birthday-banner-text { font-size: 1.1rem; }
  .placeholder { padding: 2rem 1rem; }
  .placeholder-icon { font-size: 3rem; }
  .placeholder p { font-size: 0.9rem; }
  .keyboard-hint { display: none; }
}

/* prefers-reduced-motion : déjà géré globalement dans a11y.css */

/* Extra small screens (iPhone SE, older iPhones) */
@media (max-width: 375px) {
  h1 { font-size: 1.4rem; }
  .profiles { gap: 0.4rem; }
  .profile-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
  .time-value { font-size: 1.3rem; }
  .time-unit { min-width: 38px; }
  .circular-wrapper svg { width: 180px; height: 180px; }
  .percentage { font-size: 1.75rem; }
  .birth-info { gap: 0.4rem; }
  .birth-info-value { font-size: 0.75rem; }
  .countdown-value { font-size: 1.3rem; }
  .countdown-unit { min-width: 50px; }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .circular-wrapper svg { width: 150px; height: 150px; }
  .percentage { font-size: 1.5rem; }
  .birthday-countdown { gap: 2rem; }
}
