/* Fluency: header */
.fluency-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.screen-title { font-size: 1.5rem; font-weight: 700; }
.screen-subtitle { color: var(--text-muted); margin-top: 4px; }

/* Operation selection */
.op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.op-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 12px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.op-btn:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.op-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.op-symbol { font-size: 2.6rem; font-weight: 800; color: var(--primary); }
.op-name { font-weight: 700; }
.op-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Mode selection */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.mode-btn {
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.mode-btn:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.mode-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.mode-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.mode-desc { color: var(--text-muted); line-height: 1.45; }

/* Level selection */
.level-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 20px; }
.level-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: left;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.level-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.level-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.level-label { display: flex; flex-direction: column; gap: 2px; }
.level-name { font-weight: 700; }
.level-num { font-size: 0.8rem; color: var(--text-muted); }

/* Game screen */
.game { display: flex; flex-direction: column; gap: 18px; }
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.game-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.game-status { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.timer { font-variant-numeric: tabular-nums; }
.combo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.combo[data-tier="1"],
.combo[data-tier="2"],
.combo[data-tier="3"],
.combo[data-tier="4"],
.combo[data-tier="5"] { opacity: 1; }

.combo-label {
  min-height: 1.5em;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
}

.combo[data-tier="1"] { --combo-color: #16a34a; }
.combo[data-tier="2"] { --combo-color: #0284c7; }
.combo[data-tier="3"] { --combo-color: #ea580c; }
.combo[data-tier="4"] { --combo-color: #dc2626; }
.combo[data-tier="5"] { --combo-color: #9333ea; }
.combo-label { color: var(--combo-color, var(--text-muted)); }

.combo-bar {
  width: 220px;
  max-width: 70%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.combo-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--combo-color, var(--border));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.combo.combo-pop { animation: combo-pop 0.3s ease; }
.combo.combo-burst { animation: combo-burst 0.5s ease; }
@keyframes combo-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes combo-burst {
  0% { transform: scale(1); filter: brightness(1); }
  30% { transform: scale(1.28); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}
.combo[data-tier="4"] .combo-label,
.combo[data-tier="5"] .combo-label {
  animation: combo-pulse 0.9s ease-in-out infinite;
}
@keyframes combo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.question-panel { text-align: center; padding: 20px 12px; }
.question {
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  transition: color 0.12s ease;
}
.feedback {
  min-height: 1.6em;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  opacity: 0;
}
.feedback.correct { color: var(--success); }
.feedback.wrong { color: var(--danger); }
.feedback.show { animation: feedback-fade 1.5s ease forwards; }
@keyframes feedback-fade {
  0% { opacity: 0; transform: translateY(2px); }
  12% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .feedback.show { animation: none; opacity: 1; }
}

.answer-form { display: flex; gap: 12px; align-items: stretch; }
.answer-input {
  flex: 1;
  font-size: 1.8rem;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  border: 3px solid var(--border);
  font-family: var(--font);
  min-width: 0;
}
.answer-input:focus { outline: none; border-color: var(--primary); }
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; }

/* Results */
.results {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}
.results .stars { font-size: 3rem; }
.results-title { font-size: 1.7rem; font-weight: 800; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
}
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.level-up { font-weight: 700; color: var(--success); }
.results-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

@media (max-width: 520px) {
  .question { font-size: 2.6rem; }
  .answer-input { font-size: 1.5rem; }
}
