/* ── Color Panic — style.css v1.0.0 ────────────────────────────────────────── */

/* ── Game card ───────────────────────────────────────────────────────────── */
.cp-game-card {
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-height: 320px;
  justify-content: center;
  position: relative;
}

/* ── Instruction label ───────────────────────────────────────────────────── */
.stroop-instruction {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text2);
  text-align: center;
  opacity: 0.9;
}

/* ── THE STROOP WORD ─────────────────────────────────────────────────────── */
.stroop-word {
  font-size: clamp(56px, 15vw, 96px);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: color 0.08s ease;
  user-select: none;
  -webkit-user-select: none;
  min-height: 1.1em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Word entrance animation */
@keyframes wordPop {
  0%   { transform: scale(0.82); opacity: 0; }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1);    opacity: 1; }
}
.stroop-word.pop {
  animation: wordPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Feedback flash ──────────────────────────────────────────────────────── */
.cp-feedback {
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
  min-height: 36px;
  line-height: 36px;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
}
.cp-feedback.correct { color: #22c55e; }
.cp-feedback.wrong   { color: #ef4444; }

/* ── Color button grid ───────────────────────────────────────────────────── */
.color-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 260px;
  width: 100%;
  margin: 0 auto;
}

.color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.15s ease;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  background-clip: padding-box;
}

.color-btn:hover {
  transform: scale(1.06);
  border-color: var(--text2);
}

.color-btn:active {
  transform: scale(0.92);
}

.color-btn:disabled {
  cursor: default;
  pointer-events: none;
}

/* Correct answer flash */
@keyframes correctPulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8); }
  50%  { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); transform: scale(1.12); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.color-btn.correct-flash {
  border-color: #22c55e !important;
  border-width: 4px !important;
  animation: correctPulse 0.35s ease forwards;
}

/* Wrong answer flash */
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.color-btn.wrong-flash {
  border-color: #ef4444 !important;
  border-width: 4px !important;
  animation: wrongShake 0.3s ease forwards;
}

/* Correct highlight (shown after wrong — which one was right) */
.color-btn.correct-highlight {
  border-color: #22c55e !important;
  border-width: 4px !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4);
}

/* ── Combo display ───────────────────────────────────────────────────────── */
.combo-display {
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
  text-align: right;
  min-height: 18px;
  line-height: 18px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.combo-display.big {
  font-size: 16px;
  transform: scale(1.15);
  color: #f97316;
}

/* Combo burst animation */
@keyframes comboBurst {
  0%   { transform: scale(0.8); opacity: 0.5; }
  50%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1.15); opacity: 1; }
}
.combo-display.burst {
  animation: comboBurst 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Timer bar ───────────────────────────────────────────────────────────── */
.cp-timer-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 -1px;
}

.cp-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #84cc16);
  border-radius: 2px;
  transition: width 0.1s linear, background 0.5s ease;
  transform-origin: left;
}

.cp-timer-bar.warning {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

/* Global timed mode clock */
.speed-clock {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* ── Progress dots ───────────────────────────────────────────────────────── */
.cp-dots-row {
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

.cp-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 300px;
}

.cp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}

.cp-dot.done-correct { background: #22c55e; border-color: #22c55e; }
.cp-dot.done-wrong   { background: #ef4444; border-color: #ef4444; }
.cp-dot.current      { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }

/* ── Mode grid (from game-shell, ensured) ────────────────────────────────── */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mode-btn:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
  transform: translateY(-1px);
}

.mode-btn:active { transform: scale(0.97); }

.mode-emoji { font-size: 1.5rem; line-height: 1; }
.mode-name  { font-size: 0.85rem; font-weight: 800; color: var(--text); }
.mode-desc  { font-size: 0.68rem; font-weight: 600; color: var(--text2); text-align: center; }
.mode-section-title { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); margin-bottom: 4px; }
.mode-start-hint    { font-size: 0.72rem; color: var(--text2); text-align: center; margin-top: 8px; }

/* ── How to play ─────────────────────────────────────────────────────────── */
.how-to-play {
  font-size: 0.75rem;
  color: var(--text2);
  text-align: center;
  line-height: 1.7;
  padding: 14px 16px;
}

/* ── Game over / stats ───────────────────────────────────────────────────── */
.over-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.stats-grid {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px;
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
}

/* ── Screen transitions ──────────────────────────────────────────────────── */
.screen { display: none; flex-direction: column; gap: 12px; padding: 16px 16px 120px; min-height: 100vh; }
.screen.active, .screen:not(.hidden) { display: flex; }
.screen.hidden { display: none !important; }

/* ── HUD ─────────────────────────────────────────────────────────────────── */
.hud {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.hud-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud-lives { font-size: 0.9rem; letter-spacing: 2px; }
.hud-mode  { font-size: 0.65rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-score { font-size: 0.85rem; font-weight: 700; color: var(--text); }

.progress-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  width: 120px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.round-counter {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
}

/* ── Nav back button ─────────────────────────────────────────────────────── */
.in-game-nav {
  display: flex;
  align-items: center;
  padding: 4px 0;
}

.in-game-back-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.in-game-back-btn:hover { color: var(--text); }

/* ── Game header ─────────────────────────────────────────────────────────── */
.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 4px;
}

.back-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: color 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.back-link:hover { color: var(--accent); background: var(--border); }

.game-title    { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.02em; text-align: center; }
.game-subtitle { font-size: 0.82rem; font-weight: 600; color: var(--text2); text-align: center; }

.settings-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: var(--text2);
}
.icon-btn:hover  { transform: scale(1.1); }
.icon-btn:active { transform: scale(0.92); }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 13px 20px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s, box-shadow 0.2s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--accent, #6c5ce7); color: #fff; }
.btn-primary:hover { box-shadow: 0 0 20px rgba(108, 92, 231, 0.4); }

.btn-success   { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.btn-success:hover { background: rgba(34, 197, 94, 0.25); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface); }

.btn-full { width: 100%; }

/* ── White color button special treatment ────────────────────────────────── */
.color-btn[data-color="White"] {
  border-color: rgba(0, 0, 0, 0.2) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .color-options { max-width: 220px; gap: 10px; }
  .stroop-word   { font-size: clamp(44px, 14vw, 80px); }
}

@media (min-width: 480px) {
  .color-options { max-width: 280px; }
}

@media (min-width: 900px) {
  .stroop-word   { font-size: clamp(80px, 12vw, 130px); }
  .color-options { max-width: 340px; gap: 16px; }
}

@media (min-width: 1200px) {
  .stroop-word   { font-size: 140px; }
  .color-options { max-width: 380px; }
}
