/* ============================================================
   Material Math Challenge — game styles
   Extends style.css. No new dependencies.
   ============================================================ */

/* ---------- screen management ---------- */
.game-main {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.game-screen {
  width: 100%;
  max-width: 580px;
  display: none;
}
.game-screen.game-screen--active {
  display: block;
}

.game-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.game-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

.game-content h1 {
  margin-top: 0;
  font-size: 1.6rem;
  color: var(--text);
}

.game-content > p {
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ---------- rules list ---------- */
.game-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
  text-align: left;
}
.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
}
.rule-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- actions ---------- */
.game-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---------- high score ---------- */
.game-highscore {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 1.4em;
}
.game-highscore strong {
  color: var(--accent);
}

/* ---------- buttons ---------- */
.btn-game-start {
  width: 100%;
  max-width: 280px;
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-game-start:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-game-start:active {
  transform: scale(0.98);
}
.btn-game-start:hover {
  background: var(--accent-dark);
  color: #fff;
  text-decoration: none;
}
.btn-secondary:hover {
  text-decoration: none;
}

/* ============================================================
   Quiz screen
   ============================================================ */
.game-progress {
  margin-bottom: 20px;
}
.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.game-streak {
  color: #f59e0b;
  font-weight: 600;
}

/* Timer bar */
.game-timer-bar {
  margin-bottom: 16px;
}
.timer-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.1s linear, background 0.3s;
}
.timer-fill.warning {
  background: #f59e0b;
}
.timer-fill.danger {
  background: #ef4444;
}

/* Question card */
.game-question-card {
  text-align: left;
}
.game-question-card h2 {
  margin-top: 14px;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--text);
}

.game-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.opt-btn {
  width: 100%;
  padding: 13px 18px;
  font-size: 1rem;
  text-align: left;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  line-height: 1.4;
}
.opt-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.opt-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.opt-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.opt-btn.correct {
  border-color: var(--green) !important;
  background: var(--green-soft) !important;
  color: var(--green);
}
.opt-btn.wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #ef4444;
}
.opt-btn:disabled {
  cursor: default;
  opacity: 0.7;
}
.opt-btn.show-correct {
  border-color: var(--green) !important;
  background: var(--green-soft) !important;
}

/* ============================================================
   Results screen
   ============================================================ */
.result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 8px;
}
.result-big {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.result-label {
  font-size: 1rem;
  color: var(--text-muted);
}

.result-message {
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Review table */
.result-review {
  margin: 20px 0;
  text-align: left;
}
.result-review h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--text);
}
.review-row {
  display: grid;
  grid-template-columns: 52px 1fr 72px 72px 32px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.review-row:last-child {
  border-bottom: none;
}
.review-cat {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
}
.review-cat.paint  { background: #eff4ff; color: #2563eb; }
.review-cat.concrete { background: #fff7ed; color: #c2410c; }
.review-cat.flooring { background: #f0fdf4; color: #16a34a; }
.review-q { color: var(--text); line-height: 1.3; }
.review-your,
.review-correct { color: var(--text-muted); text-align: center; }
.review-your.wrong-answer { color: #ef4444; font-weight: 600; }
.review-verdict { text-align: center; font-size: 1rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
  .game-content {
    padding: 24px 18px;
  }
  .game-icon {
    font-size: 2.4rem;
  }
  .game-content h1 {
    font-size: 1.35rem;
  }
  .result-big {
    font-size: 2.8rem;
  }
  .review-row {
    grid-template-columns: 44px 1fr 58px 58px 28px;
    font-size: 0.82rem;
  }
  .review-q {
    font-size: 0.82rem;
  }
}
