/* ── Gameplay Modifiers ─────────────────────────────────────────────────── */

/* ── Memory Peek: countdown banner ── */
#peek-countdown {
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: bold;
  color: #00f3ff;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.8);
  margin-bottom: 8px;
  animation: peek-blink 0.5s ease-in-out infinite;
}
#peek-countdown.hidden { display: none; }

@keyframes peek-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Peek Mode Button ── */
#peek-mode-btn {
  background: transparent;
  color: rgba(0, 243, 255, 0.75); /* raised from 0.35 — WCAG 1.4.3 text contrast */
  border: 1px solid rgba(0, 243, 255, 0.5); /* raised from 0.2 — WCAG 1.4.11 non-text contrast */
  border-radius: 4px;
  padding: 3px 10px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}
#peek-mode-btn:hover { color: rgba(0, 243, 255, 0.9); border-color: rgba(0, 243, 255, 0.7); } /* raised from 0.7/0.4 */
#peek-mode-btn.active {
  color: #00f3ff;
  border-color: #00f3ff;
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.6);
}

/* ── Glitch Event: body flicker ── */
/* WCAG 2.3.1: original 0.45s steps(3) = 6.7 Hz — above the 3 Hz safe limit.
   Fixed: 1 slow hue-rotate sweep with no brightness spikes (no flash). */
body.glitch-event {
  animation: glitch-flicker 1.2s linear forwards;
}

@keyframes glitch-flicker {
  0%   { filter: none; }
  30%  { filter: hue-rotate(90deg) saturate(2); }
  70%  { filter: hue-rotate(-60deg) saturate(1.5); }
  100% { filter: none; }
}

/* ── Idle Animation: unmatched cards pulse after 5s inactivity ── */
.idle-pulse {
  animation: idle-glow 1.8s ease-in-out infinite;
}

@keyframes idle-glow {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 18px rgba(0, 243, 255, 0.35), inset 0 0 8px rgba(0, 243, 255, 0.1); }
}

/* ── Custom Difficulty Panel ── */
#custom-panel {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: 8px;
  background: rgba(0, 243, 255, 0.03);
}
#custom-panel.hidden { display: none; }

.custom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.custom-label {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: rgba(0, 243, 255, 0.7);
  letter-spacing: 2px;
  min-width: 80px;
}

.custom-row input[type="range"] {
  flex: 1;
  accent-color: #00f3ff;
  cursor: pointer;
}

.custom-preview {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: rgba(0, 243, 255, 0.5);
  letter-spacing: 1px;
  text-align: center;
  margin: 8px 0;
}

.custom-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.custom-actions button {
  background: transparent;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 4px;
  transition: all 0.2s;
}

.custom-actions button:first-child {
  color: rgba(0, 243, 255, 0.6);
  border: 1px solid rgba(0, 243, 255, 0.3);
}
.custom-actions button:first-child:hover {
  color: #00f3ff;
  border-color: #00f3ff;
}

.custom-actions button:last-child {
  color: #000;
  background: #00f3ff;
  border: 1px solid #00f3ff;
  font-weight: bold;
}
.custom-actions button:last-child:hover {
  background: #00c8d4;
}

.diff-btn-custom {
  border-style: dashed !important;
  opacity: 0.85;
}

/* ── Onboarding Modal — native <dialog> for focus trap (WCAG 2.1.2 / #51) ── */
#onboarding-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}
#onboarding-modal[open] {
  display: flex;
}
#onboarding-modal::backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

.onboarding-content {
  background: rgba(5, 8, 20, 0.98);
  border: 2px solid rgba(0, 243, 255, 0.5);
  border-radius: 16px;
  padding: 36px 32px 28px;
  max-width: 360px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.2);
  font-family: 'Courier New', monospace;
}

.onboarding-step.hidden { display: none; }

.onboarding-demo {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.onboarding-demo-pair { gap: 16px; }

.demo-card {
  width: 54px;
  height: 72px;
  border-radius: 8px;
  border: 2px solid rgba(0, 243, 255, 0.5);
  background: rgba(5, 5, 8, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: rgba(0, 243, 255, 0.4);
  animation: demo-flip 2s ease-in-out infinite;
}

.demo-matched {
  border-color: #00ff88;
  color: #00ff88;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.3);
  animation: demo-match-pulse 1.5s ease-in-out infinite;
}

.demo-combo {
  font-size: 28px;
  font-weight: bold;
  color: #ff0055;
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255, 0, 85, 0.8);
  animation: demo-combo-pop 1.2s ease-in-out infinite;
}

@keyframes demo-flip {
  0%, 40%  { transform: rotateY(0deg); color: rgba(0, 243, 255, 0.4); }
  50%, 90% { transform: rotateY(180deg); color: transparent; }
  100%     { transform: rotateY(360deg); }
}
@keyframes demo-match-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
@keyframes demo-combo-pop {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); opacity: 0.8; }
}

.onboarding-title {
  font-size: 18px;
  font-weight: bold;
  color: #00f3ff;
  letter-spacing: 3px;
  margin: 0 0 8px;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.onboarding-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 1px;
  line-height: 1.5;
  margin: 0 0 20px;
}

.onboarding-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.onboarding-nav button {
  background: transparent;
  border: 1px solid rgba(0, 243, 255, 0.4);
  color: #00f3ff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}
.onboarding-nav button:hover { background: rgba(0, 243, 255, 0.1); }
.onboarding-nav button.hidden { visibility: hidden; }

.onboarding-dots { display: flex; gap: 0; }

/* WCAG 2.5.8 — 24×24px minimum touch target; visual dot stays 8×8 via ::before */
.onboarding-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  cursor: pointer;
}
.onboarding-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 243, 255, 0.25);
  transition: background 0.2s, box-shadow 0.2s;
}
.onboarding-dot.active::before { background: #00f3ff; box-shadow: 0 0 6px #00f3ff; }

#onboarding-start {
  display: block;
  width: 100%;
  padding: 12px;
  background: #00f3ff;
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 3px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.2s;
}
#onboarding-start:hover { background: #00c8d4; }
#onboarding-start.hidden { display: none; }

#onboarding-skip {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: color 0.2s;
}
#onboarding-skip:hover { color: rgba(255, 255, 255, 0.6); }
