/* ===================================================
   IQ Score — Global Styles
   Dark / Gradient Theme (fiolet → niebieski)
   =================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:           #0a0a0f;
  --bg-card:      #12121a;
  --bg-card-alt:  #16161f;
  --border:       #1e1e2e;
  --border-glass: rgba(255,255,255,0.05);
  --text:         #e0e0e0;
  --text-muted:   #8888aa;
  --text-head:    #ffffff;
  --accent-from:  #667eea;
  --accent-to:    #764ba2;
  --accent-grad:  linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --radius-card:  12px;
  --radius-btn:   8px;
  --shadow-card:  0 4px 24px rgba(0,0,0,0.4);
  --transition:   200ms ease;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent-from); text-decoration: none; }
a:hover { text-decoration: underline; }

img, canvas, svg { max-width: 100%; display: block; }

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4 {
  color: var(--text-head);
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: clamp(1rem, 2.5vw, 1.3rem); font-weight: 600; }

p { margin-bottom: 0.75rem; }

/* ===========================
   Layout helpers
   =========================== */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 5rem 0;
}

/* ===========================
   Buttons
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

.btn:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102,126,234,0.4); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-from);
  border: 1.5px solid var(--accent-from);
}

.btn-lg {
  padding: 1.1rem 2.8rem;
  font-size: 1.15rem;
  border-radius: 10px;
}

.btn-disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===========================
   Cards / Glassmorphism
   =========================== */

.card {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), border-color var(--transition);
}

.card:hover {
  border-color: rgba(102,126,234,0.3);
  transform: translateY(-3px);
}

.card-solid {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

/* ===========================
   Progress Bar
   =========================== */

.progress-wrap {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: 999px;
  transition: width 400ms cubic-bezier(0.4,0,0.2,1);
}

/* ===========================
   Navigation bar
   =========================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===========================
   Landing Hero
   =========================== */

.hero {
  text-align: center;
  padding: 6rem 1.25rem 5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(ellipse 60% 40% at 50% 20%, rgba(102,126,234,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(102,126,234,0.12);
  border: 1px solid rgba(102,126,234,0.3);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-size: 0.85rem;
  color: var(--accent-from);
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin-bottom: 1.25rem;
}

.hero h1 span {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-top: 3rem;
}

.hero-stat {
  text-align: center;
}

.hero-stat-num {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ===========================
   Grid layouts
   =========================== */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

/* ===========================
   Section headings
   =========================== */

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  margin-bottom: 0.75rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto;
}

.section-tag {
  display: inline-block;
  background: rgba(102,126,234,0.1);
  color: var(--accent-from);
  border-radius: 4px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.7rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* ===========================
   Step cards (Jak to działa)
   =========================== */

.step-icon {
  font-size: 2.4rem;
  margin-bottom: 1rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-grad);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

/* ===========================
   Category cards
   =========================== */

.cat-icon {
  font-size: 2rem;
  margin-bottom: 0.85rem;
}

.cat-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.cat-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

/* ===========================
   Scroll reveal
   =========================== */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Footer
   =========================== */

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-disclaimer {
  max-width: 640px;
  margin: 0 auto 1rem;
  font-size: 0.82rem;
  line-height: 1.7;
}

/* ===========================
   QUIZ PAGE
   =========================== */

.quiz-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.quiz-header {
  padding: 1rem 1.25rem;
  background: rgba(10,10,15,0.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.quiz-header-inner {
  max-width: 800px;
  margin: 0 auto;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.quiz-category-label {
  background: rgba(102,126,234,0.15);
  color: var(--accent-from);
  border-radius: 4px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.quiz-counter {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.quiz-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.question-card {
  width: 100%;
  max-width: 800px;
  animation: fadeIn 300ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

.question-card.leaving {
  animation: fadeOut 250ms ease forwards;
}

/* Question text */
.question-text {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
  color: var(--text-head);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

/* Answer options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.options-grid.options-4 {
  grid-template-columns: repeat(2, 1fr);
}

.options-grid.options-6 {
  grid-template-columns: repeat(3, 1fr);
}

.option-btn {
  background: rgba(255,255,255,0.03);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  text-align: center;
  position: relative;
}

.option-btn:hover {
  border-color: var(--accent-from);
  background: rgba(102,126,234,0.08);
}

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

.option-btn.selected {
  border-color: var(--accent-from);
  background: rgba(102,126,234,0.15);
  animation: pulse 250ms ease;
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.option-btn:disabled {
  cursor: default;
}

/* Sequence / text answer options */
.option-btn.text-option {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
}

/* Matrix display */
.matrix-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.matrix-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
}

.matrix-cell.empty {
  border: 2px dashed var(--accent-from);
  background: rgba(102,126,234,0.05);
}

.matrix-cell svg, .matrix-cell canvas {
  width: 70px;
  height: 70px;
}

/* Memory sequence */
.memory-sequence {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  min-height: 80px;
}

.memory-digit {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-head);
  font-family: 'Courier New', monospace;
  width: 60px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(102,126,234,0.1);
  border: 1.5px solid rgba(102,126,234,0.3);
  border-radius: 10px;
  animation: digitReveal 300ms ease;
}

@keyframes digitReveal {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.memory-recall-msg {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 1.5rem 0;
  font-style: italic;
}

/* Color squares for Simon memory */
.simon-sequence {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.simon-square {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.1);
  transition: opacity 200ms, transform 200ms;
}

.simon-square.flash {
  transform: scale(1.15);
  box-shadow: 0 0 20px currentColor;
}

/* Memory grid for mem_06 */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 4px;
  margin: 0 auto;
  width: fit-content;
}

.memory-cell {
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 200ms;
}

.memory-cell.lit {
  background: #e74c4c;
  box-shadow: 0 0 12px rgba(231,76,60,0.6);
}

/* Speed timer bar */
.speed-timer-wrap {
  margin-bottom: 1.25rem;
}

.speed-timer-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.speed-timer-label span:last-child {
  font-weight: 700;
  color: var(--text-head);
  font-variant-numeric: tabular-nums;
}

.speed-timer-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 999px;
  overflow: hidden;
}

.speed-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #27ae60, #e67e22, #e74c3c);
  border-radius: 999px;
  transition: width 100ms linear, background 1s ease;
}

/* Symbol sets */
.symbol-set {
  font-size: 1.5rem;
  letter-spacing: 0.6rem;
  color: var(--text-head);
  text-align: center;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 1rem 0;
  line-height: 1.8;
  word-break: break-all;
}

/* Spatial block figures */
.spatial-display {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

/* Category transition screen */
.transition-screen {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 500px;
  margin: 0 auto;
}

.transition-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.transition-screen h2 {
  margin-bottom: 0.75rem;
  color: var(--text-head);
}

.transition-screen p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.next-category-badge {
  display: inline-block;
  background: var(--accent-grad);
  color: #fff;
  padding: 0.4rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

/* ===========================
   RESULT PAGE
   =========================== */

.result-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 3rem 1.25rem;
}

.result-card {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

.result-lock-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.result-iq-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem auto;
  position: relative;
}

.result-iq-circle::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--accent-grad);
  z-index: -1;
}

.result-iq-circle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bg-card);
  z-index: -1;
}

.result-iq-question {
  font-size: 3.5rem;
  font-weight: 900;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-iq-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.result-ready-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(39,174,96,0.15);
  border: 1px solid rgba(39,174,96,0.3);
  color: #2ecc71;
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.5rem 0;
}

/* Blurred result rows */
.result-blurred-section {
  margin: 1.5rem 0;
  position: relative;
}

.result-blurred-section::after {
  content: '🔒 Odblokuj aby zobaczyć';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  z-index: 2;
  pointer-events: none;
}

.result-blurred-inner {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.result-row-label { color: var(--text-muted); }
.result-row-value { font-weight: 700; color: var(--text-head); }

/* CTA button */
.result-cta {
  margin: 2rem 0 1rem;
}

.btn-cta {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102,126,234,0.4);
  transition: opacity var(--transition), transform var(--transition);
  text-align: center;
}

.btn-cta:hover { opacity: 0.9; transform: translateY(-2px); }

.result-email-hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.75rem;
}

.email-field-wrap {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  opacity: 0.5;
}

.email-field {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===========================
   Loading spinner
   =========================== */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 300px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-from);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 600px) {
  .matrix-cell {
    width: 72px;
    height: 72px;
  }
  .matrix-cell svg, .matrix-cell canvas {
    width: 56px;
    height: 56px;
  }
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
  .options-grid.options-6 {
    grid-template-columns: repeat(3, 1fr);
  }
  .memory-digit {
    width: 46px;
    height: 56px;
    font-size: 1.8rem;
  }
  .hero-stats {
    gap: 1.5rem;
  }
  .section {
    padding: 3rem 0;
  }
}

@media (max-width: 400px) {
  .matrix-cell {
    width: 60px;
    height: 60px;
  }
  .options-grid.options-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}
