/* ── Bootstrap dark-theme overrides ─────────────────────── */
[data-bs-theme="dark"] {
  --bs-primary:          #4a90e2;
  --bs-primary-rgb:      74, 144, 226;
  --bs-body-bg:          #0f0f23;
  --bs-body-color:       #ffffff;
  --bs-secondary-bg:     #1a1a35;
  --bs-tertiary-bg:      rgba(255,255,255,0.07);
  --bs-border-color:     rgba(255,255,255,0.1);
  --bs-card-bg:          rgba(255,255,255,0.07);
  --bs-card-border-color: rgba(255,255,255,0.1);
  --bs-border-radius:    20px;
  --bs-border-radius-lg: 24px;
  --bs-btn-border-radius: 16px;
}

/* ── App-specific tokens ────────────────────────────────── */
:root {
  --ep-correct:    #4caf50;
  --ep-correct-bg: rgba(76,175,80,0.15);
  --ep-wrong:      #f44336;
  --ep-wrong-bg:   rgba(244,67,54,0.15);

  /* Fluid scale — primary target 1280×800 TV */
  --ep-sm:   clamp(0.85rem, 1.3vw,  1.05rem);
  --ep-base: clamp(1rem,    1.8vw,  1.4rem);
  --ep-lg:   clamp(1.3rem,  2.4vw,  2rem);
  --ep-xl:   clamp(1.7rem,  3.2vw,  2.8rem);
  --ep-xxl:  clamp(2.2rem,  4.8vw,  4.2rem);
}

body {
  font-size: var(--ep-base);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: manipulation;
}

/* ── Global utilities ───────────────────────────────────── */
.hidden  { display: none !important; }

.fade-in { animation: fadeIn 300ms ease forwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

#version-badge {
  position: fixed; bottom: 6px; right: 10px;
  font-size: 0.7rem; color: rgba(255,255,255,0.25);
  pointer-events: none; z-index: 9999;
}

/* ── Home view ──────────────────────────────────────────── */
#app.view-home { height: 100vh; overflow-y: auto; }

.home-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 2rem;
  background: rgba(15,15,35,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky; top: 0; z-index: 100;
}
.logo-mark { font-size: 1.4rem; color: var(--bs-primary); }
.logo-name  { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }

.home-body {
  padding: 2rem;
  max-width: 1300px; margin: 0 auto;
}
.home-section-title {
  font-size: var(--ep-lg); font-weight: 700; margin-bottom: 1.5rem;
}

.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.activity-card {
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.card-template-badge {
  font-size: 0.75rem; background: rgba(255,255,255,0.08);
  border-radius: 8px; padding: 2px 8px;
  color: rgba(255,255,255,0.55);
}
.card-title    { font-size: 1rem; font-weight: 700; margin: 0; }
.card-subtitle { font-size: var(--ep-sm); color: rgba(255,255,255,0.5); margin: 0; }
.card-meta     { font-size: 0.8rem; color: rgba(255,255,255,0.35); }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.75rem;
  text-align: center; padding: 6rem 2rem; min-height: 60vh;
}
.empty-icon { font-size: 3.5rem; opacity: 0.4; }
.empty-state h2 { font-size: var(--ep-xl); font-weight: 700; margin: 0; }

/* ── Zone reveal animations (textCorrection template) ───── */
.acc-zone.zone-ok   { animation: zoneReveal 350ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.acc-zone.zone-miss { animation: zoneMiss   380ms ease both; }

@keyframes zoneReveal {
  0%   { transform: scale(0.5); opacity: 0.2; }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes zoneMiss {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-5px); }
  50%     { transform: translateX(5px); }
  75%     { transform: translateX(-3px); }
}

/* ── Lock screen / pattern ──────────────────────────────────── */
.view-lock {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bs-body-bg);
}
.lock-card {
  width: min(340px, 90vw);
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
  padding: 2rem;
  background: var(--bs-tertiary-bg);
  border-radius: 1rem; border: 1px solid var(--bs-border-color);
}
.lock-logo  { display: flex; align-items: center; gap: .75rem; font-size: 1.5rem; }
.lock-hint  { color: var(--bs-secondary-color); text-align: center; margin: 0; font-size: .95rem; }
.lock-error { color: var(--bs-danger); text-align: center; margin: 0; font-size: .9rem; min-height: 1.2em; }
.pattern-wrap {
  position: relative; width: 240px; height: 240px;
  touch-action: none; user-select: none;
}
.pattern-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.pattern-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  width: 100%; height: 100%;
}
.pattern-dot {
  display: flex; align-items: center; justify-content: center;
}
.pattern-dot::after {
  content: ''; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: background 120ms, transform 120ms, box-shadow 120ms;
}
.pattern-dot.selected::after {
  background: var(--bs-primary);
  transform: scale(1.35);
  box-shadow: 0 0 10px rgba(74,144,226,0.6);
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
.shake { animation: shake 0.4s ease; }
