/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --blue: #2563eb;
  --red: #ef4444;
  --green: #16a34a;
  --ink: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e5e7eb;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #fbf7ef 0%, #eef4fb 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(31, 41, 55, 0.12), 0 0 0 1px var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 16px;
  gap: 14px;
  position: relative;
}

/* French flag accent strip */
.tricolore {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--blue) 0 33.3%, #ffffff 33.3% 66.6%, var(--red) 66.6% 100%);
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mute-btn {
  width: 38px;
  height: 38px;
  font-size: 17px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.mute-btn:hover {
  transform: scale(1.08);
}

/* ===== HUD ===== */
.hud {
  display: flex;
  gap: 8px;
}

.hud-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.hud-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.hud-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hearts {
  font-size: 14px;
  letter-spacing: 2px;
}

/* ===== Tense picker ===== */
.tense-picker {
  display: flex;
  gap: 6px;
}

.tense-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: var(--muted);
  background: #f9fafb;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tense-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.tense-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ===== Game Area ===== */
.game-area {
  position: relative;
  height: 400px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 55%, #f0fdf4 100%);
  border: 1px solid var(--border);
}

.ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(180deg, #bbf7d0 0%, #86efac 100%);
  border-top: 2px solid rgba(22, 163, 74, 0.25);
}

/* Clouds for ambiance */
.game-area::before {
  content: "☁️";
  position: absolute;
  top: 18px;
  left: 8%;
  font-size: 34px;
  opacity: 0.7;
  animation: drift 26s linear infinite;
}

@keyframes drift {
  from { transform: translateX(-60px); }
  to { transform: translateX(560px); }
}

/* ===== Snail ===== */
.snail {
  position: absolute;
  bottom: 10px;
  left: 50%;
  translate: -50% 0;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 6px 8px rgba(31, 41, 55, 0.25));
  z-index: 3;
}

.snail.idle {
  animation: sway 3.2s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.snail.bounce {
  animation: bounce 0.55s ease;
}

@keyframes bounce {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-26px) scale(1.12); }
  70% { transform: translateY(0) scale(0.94); }
  100% { transform: translateY(0) scale(1); }
}

.snail.hit {
  animation: hitshake 0.6s ease;
}

@keyframes hitshake {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-10px) rotate(-8deg); }
  30% { transform: translateX(10px) rotate(8deg); }
  45% { transform: translateX(-8px) rotate(-6deg); }
  60% { transform: translateX(8px) rotate(6deg); }
  80% { transform: translateX(-4px) rotate(-3deg); }
}

/* ===== Falling salt shaker ===== */
.shaker {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 2;
  will-change: transform;
}

.shaker-label {
  padding: 4px 12px;
  background: #ffffff;
  border: 2px solid var(--blue);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.18);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tense-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: var(--blue);
  padding: 2px 7px;
  border-radius: 999px;
}

.weak-dot {
  font-size: 12px;
  line-height: 1;
}

.shaker-emoji {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(31, 41, 55, 0.2));
}

.shaker.saved {
  animation: shatter 0.4s ease forwards;
}

@keyframes shatter {
  to {
    transform: scale(1.5) rotate(20deg);
    opacity: 0;
  }
}

.shaker.landed {
  animation: splat 0.45s ease forwards;
}

@keyframes splat {
  40% {
    transform: scale(1.25) rotate(-14deg);
    opacity: 1;
  }
  100% {
    transform: scale(0.6) translateY(14px) rotate(30deg);
    opacity: 0;
  }
}

/* ===== Floating feedback text ===== */
.float {
  position: absolute;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  z-index: 4;
  pointer-events: none;
  animation: floatUp 1.7s ease-out forwards;
}

.float.good { color: var(--green); }
.float.bad { color: var(--red); }
.float.info { color: var(--blue); }

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.85);
  }
  15% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-56px) scale(1);
  }
}

/* ===== Overlay ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay h2 {
  font-size: 24px;
  font-weight: 800;
}

.overlay-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  max-width: 320px;
}

.overlay-body .small {
  font-size: 12px;
}

.overlay-body code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}

.recap {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  color: var(--ink);
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  max-height: 150px;
  overflow-y: auto;
}

.recap .arrow {
  color: var(--green);
  font-weight: 700;
}

.feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--ink);
  font-weight: 600;
}

.fb-btn {
  font-size: 20px;
  line-height: 1;
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.fb-btn:hover {
  transform: scale(1.12);
}

.btn {
  padding: 11px 26px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.4);
}

.btn:active {
  transform: translateY(0);
}

/* ===== Input row ===== */
.input-row {
  display: flex;
  gap: 10px;
}

#answerInput {
  flex: 1;
  padding: 12px 16px;
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  background: #f9fafb;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#answerInput:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #ffffff;
}

#answerInput.shake {
  animation: inputshake 0.35s ease;
  border-color: var(--red);
}

@keyframes inputshake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

/* ===== Footer ===== */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.hint {
  white-space: nowrap;
}

.dot {
  color: #d1d5db;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--ink);
}
