/* Mind Games — calm focus practice UI */
:root {
  --bg: #0c0a14;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f4f2f8;
  --muted: rgba(244, 242, 248, 0.72);
  --violet: #a78bfa;
  --cyan: #67e8f9;
  --mint: #6ee7b7;
  --radius: 14px;
  --display: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

.cosmic-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% -10%, rgba(167, 139, 250, 0.14), transparent),
    radial-gradient(ellipse 50% 40% at 95% 30%, rgba(103, 232, 249, 0.08), transparent),
    linear-gradient(180deg, #0c0a14 0%, #12101c 50%, #0c0a14 100%);
  pointer-events: none;
  z-index: 0;
}
.grain {
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(12, 10, 20, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.logo-mark { font-size: 1.25rem; }
.nav { display: none; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.nav a:hover, .nav a.active { color: var(--violet); }
.nav-cta {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.35);
}
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s;
}
@media (min-width: 768px) {
  .nav { display: flex; }
  .menu-toggle { display: none; }
}
.nav.open {
  display: flex;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  padding: 1rem 1.25rem;
  background: rgba(12, 10, 20, 0.98);
  border-bottom: 1px solid var(--border);
}

.beta-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(167, 139, 250, 0.08);
  border-bottom: 1px solid var(--border);
}
.beta-bar a { color: var(--cyan); }

.app-main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--violet);
  margin: 0 0 0.35rem;
}
h1 {
  font-family: var(--display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 400;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 42rem; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.tile:hover {
  border-color: rgba(167, 139, 250, 0.4);
  background: var(--surface-2);
}
.tile-icon { font-size: 1.5rem; }
.tile-title { font-weight: 600; font-size: 0.95rem; }
.tile-desc { font-size: 0.8rem; color: var(--muted); }

.card {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.card-accent { border-color: rgba(167, 139, 250, 0.35); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  border: none;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.game-stage {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}
.game-prompt {
  font-size: 1.1rem;
  color: var(--muted);
}
.game-value {
  font-family: var(--display);
  font-size: 3rem;
  line-height: 1;
}
.breath-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(167, 139, 250, 0.5), rgba(99, 102, 241, 0.2));
  border: 2px solid rgba(167, 139, 250, 0.5);
  transition: transform 4s ease-in-out;
}
.breath-circle.inhale { transform: scale(1.35); }
.breath-circle.hold { transform: scale(1.35); }
.breath-circle.exhale { transform: scale(0.85); }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  max-width: 320px;
  margin: 0 auto;
}
.memory-card {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 1.25rem;
  cursor: pointer;
  color: transparent;
  user-select: none;
}
.memory-card.revealed, .memory-card.matched {
  color: var(--text);
  background: rgba(167, 139, 250, 0.2);
}
.memory-card.matched { opacity: 0.5; pointer-events: none; }

.sort-board {
  display: grid;
  gap: 1rem;
}
.sort-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.sort-chip {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: #1e1a2a;
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}
.sort-items .sort-chip {
  cursor: grab;
}
.sort-buckets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.sort-bucket {
  min-height: 100px;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
.sort-bucket h4 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--violet);
}
.sort-bucket .sort-chip {
  display: block;
  margin-bottom: 0.35rem;
  width: 100%;
  text-align: left;
  background: #12101c;
  border-color: rgba(244, 242, 248, 0.25);
  color: #f4f2f8;
}
.sort-chip.selected {
  border-color: var(--cyan);
  background: rgba(103, 232, 249, 0.15);
  color: var(--text);
}
.sort-rule {
  max-width: 28rem;
  margin: 0 auto 1rem;
  font-size: 0.95rem;
}
.sort-review {
  text-align: left;
  max-width: 28rem;
  margin: 1rem auto 0;
}
.sort-review-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.sort-review-list li { margin-bottom: 0.5rem; }
.sort-review-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.memory-grid.memory-cols-4 { grid-template-columns: repeat(4, 1fr); }
.memory-grid.memory-cols-5 { grid-template-columns: repeat(5, 1fr); max-width: 400px; }

.level-grid {
  display: grid;
  gap: 0.75rem;
  max-width: 360px;
  margin: 0 auto;
}
.level-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.level-card:hover {
  border-color: rgba(167, 139, 250, 0.45);
  background: var(--surface-2);
}
.level-num {
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--violet);
  grid-row: span 2;
}
.level-hint {
  font-size: 0.8rem;
  color: var(--muted);
  grid-column: 2;
}
.level-tag {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
}

.mindful-prompt {
  font-size: 1.1rem;
  max-width: 26rem;
  margin: 0 auto 1rem;
  line-height: 1.45;
}
.breath-safety {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 26rem;
  margin: 0 auto 0.75rem;
}
.breath-circle.fire-pulse {
  transform: scale(0.88);
  border-color: #fb923c;
  background: rgba(251, 146, 60, 0.2);
  transition: transform 0.15s ease-out;
}

.text-green { color: var(--mint); }
.text-red { color: #f87171; }

.impulse-signal {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  border: 3px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.impulse-signal.neutral {
  background: var(--surface-2);
  color: var(--muted);
}
.impulse-signal.green {
  background: rgba(110, 231, 183, 0.2);
  border-color: var(--mint);
  color: var(--mint);
}
.impulse-signal.red {
  background: rgba(248, 113, 113, 0.15);
  border-color: #f87171;
  color: #f87171;
}
.impulse-feedback.impulse-ok { color: var(--mint); }
.impulse-feedback.impulse-miss { color: #f87171; }

.scenario-text {
  max-width: 28rem;
  margin: 0 auto 1rem;
  font-size: 1.05rem;
}

.card-handoff {
  margin-top: 1rem;
  border-color: rgba(103, 232, 249, 0.35);
  text-align: left;
  width: 100%;
  max-width: 28rem;
}

.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(12, 10, 20, 0.85);
  backdrop-filter: blur(8px);
}
.onboard-panel {
  max-width: 420px;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: #16121f;
  border: 1px solid var(--border);
}
.onboard-steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.onboard-steps li { margin-bottom: 0.5rem; }


.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.stat-card {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.stat-card h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.stat-card .stat-num {
  font-family: var(--display);
  font-size: 1.75rem;
  color: var(--mint);
}
.stat-meta { font-size: 0.8rem; color: var(--muted); }

.activity-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  margin-top: 0.5rem;
}
.activity-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--muted);
}
.activity-bar {
  width: 100%;
  max-width: 28px;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--violet), #6366f1);
}

.session-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.session-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.session-list .session-meta { color: var(--muted); font-size: 0.8rem; }

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--violet); }

.empty-state { text-align: center; padding: 2rem; color: var(--muted); }

@media (max-width: 480px) {
  .sort-buckets { grid-template-columns: 1fr; }
  .memory-grid { max-width: 100%; }
}
