/* ═══════════════════════════════════════════════════════════════════
   PASTA Quiz — standalone stylesheet
   Light theme, coherent with pasta-theme.css (--ei2-* variables).
   ═══════════════════════════════════════════════════════════════════ */

/* ── Local token aliases (mirrors pasta-theme.css :root) ─────────── */
:root {
  --pq-bg:          #f6f2ec;
  --pq-surface:     #ffffff;
  --pq-surface-2:   #f2ede6;
  --pq-surface-3:   #ece5db;
  --pq-ink:         #1c1917;
  --pq-ink-2:       #44403c;
  --pq-ink-muted:   #78716c;
  --pq-ink-faint:   #a8a29e;
  --pq-border:      #ddd6cc;
  --pq-border-2:    #e7e2db;
  --pq-accent:      #831843;
  --pq-accent-mid:  #9f1239;
  --pq-green:       #14532d;
  --pq-green-mid:   #166534;
  --pq-green-light: #dcfce7;
  --pq-red-light:   #fee2e2;
  --pq-amber-light: #fef9c3;
  --pq-shadow:      rgba(28, 25, 23, 0.07);
  --pq-shadow-md:   rgba(28, 25, 23, 0.12);
}

/* ── Page shell ──────────────────────────────────────────────────── */
.pq-page {
  min-height: 100vh;
  background: var(--pq-bg);
  color: var(--pq-ink);
  font-family: 'Source Sans Pro', sans-serif;
}

.pq-inner {
  max-width: 50rem;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* ── Screens ─────────────────────────────────────────────────────── */
.pq-screen { display: none; }
.pq-screen.active { display: block; }

/* ── Hero ────────────────────────────────────────────────────────── */
.pq-hero {
  padding: 5rem 0 4rem;
  text-align: center;
}

.pq-logo-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--pq-accent);
  border: 1px solid rgba(131,24,67,.25);
  padding: .3rem .85rem;
  border-radius: 2rem;
  margin-bottom: 2rem;
  background: rgba(131,24,67,.05);
}

.pq-hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.12;
  margin: 0 0 1rem;
  color: var(--pq-ink);
  letter-spacing: -.02em;
}

.pq-hero h1 span {
  color: var(--pq-accent);
}

.pq-hero p {
  font-size: 1rem;
  color: var(--pq-ink-muted);
  max-width: 30rem;
  margin: 0 auto 2.2rem;
  line-height: 1.65;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.pq-btn {
  display: inline-block;
  padding: .7rem 1.8rem;
  background: var(--pq-ink);
  border: 1.5px solid var(--pq-ink);
  color: #fff;
  border-radius: .35rem;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}

.pq-btn:hover {
  background: var(--pq-ink-2);
  border-color: var(--pq-ink-2);
}

.pq-btn-secondary {
  background: transparent;
  color: var(--pq-ink);
  border-color: var(--pq-border);
  margin-left: .6rem;
}

.pq-btn-secondary:hover {
  background: var(--pq-surface-2);
  border-color: var(--pq-ink-faint);
}

.pq-btn-share {
  background: #0f172a;
  border-color: #0f172a;
}

.pq-btn-share:hover {
  background: #1e293b;
  border-color: #1e293b;
}

/* ── Loading ─────────────────────────────────────────────────────── */
.pq-loading {
  padding: 6rem 0;
  text-align: center;
}

.pq-spinner {
  width: 2rem;
  height: 2rem;
  border: 2.5px solid var(--pq-border);
  border-top-color: var(--pq-accent);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: pq-spin .8s linear infinite;
}

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

.pq-loading p {
  color: var(--pq-ink-muted);
  font-size: .9rem;
}

/* ── Question screen ─────────────────────────────────────────────── */
.pq-question-screen {
  padding-top: 3rem;
}

/* ── Progress bar ────────────────────────────────────────────────── */
.pq-progress-bar {
  height: 3px;
  background: var(--pq-border);
  border-radius: 2px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.pq-progress-fill {
  height: 100%;
  background: var(--pq-accent);
  border-radius: 2px;
  transition: width .4s ease;
}

/* ── Question header ─────────────────────────────────────────────── */
.pq-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.pq-question-counter {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pq-ink-muted);
}

.pq-difficulty-badge {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .22rem .65rem;
  border-radius: 2rem;
}

.pq-diff-easy   { color: var(--pq-green-mid);  border: 1px solid rgba(20,83,45,.25);  background: #dcfce7; }
.pq-diff-medium { color: #92400e;               border: 1px solid rgba(146,64,14,.25); background: #fef3c7; }
.pq-diff-hard   { color: var(--pq-accent-mid);  border: 1px solid rgba(159,18,57,.25); background: #fee2e2; }

/* ── Timer ───────────────────────────────────────────────────────── */
.pq-timer-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.6rem;
}

.pq-timer-track {
  flex: 1;
  height: 4px;
  background: var(--pq-border);
  border-radius: 2px;
  overflow: hidden;
}

.pq-timer-fill {
  height: 100%;
  background: var(--pq-green-mid);
  border-radius: 2px;
  transition: width .9s linear, background .4s;
  width: 100%;
}

.pq-timer-fill.warning { background: #d97706; }
.pq-timer-fill.danger  { background: var(--pq-accent-mid); }

.pq-timer-label {
  font-size: .82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pq-ink-muted);
  min-width: 2ch;
  text-align: right;
}

/* ── Metric box ──────────────────────────────────────────────────── */
.pq-metric-box {
  background: var(--pq-surface);
  border: 1px solid var(--pq-border);
  border-radius: .65rem;
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.6rem;
  text-align: center;
  box-shadow: 0 1px 3px var(--pq-shadow);
}

.pq-metric-label-hint {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pq-ink-faint);
  margin-bottom: .35rem;
}

.pq-metric-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--pq-ink);
  line-height: 1.3;
}

/* ── Player cards ────────────────────────────────────────────────── */
.pq-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  margin-bottom: .9rem;
}

@media (max-width: 440px) {
  .pq-cards { grid-template-columns: 1fr; }
}

.pq-player-card {
  background: var(--pq-surface);
  border: 1.5px solid var(--pq-border);
  border-radius: .75rem;
  padding: 1.4rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: background .13s, border-color .15s, box-shadow .13s, transform .1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px var(--pq-shadow);
}

.pq-player-card:hover:not(.disabled) {
  border-color: var(--pq-ink-muted);
  box-shadow: 0 3px 8px var(--pq-shadow-md);
  transform: translateY(-1px);
}

.pq-player-card.selected-correct {
  background: #f0fdf4;
  border-color: var(--pq-green-mid);
  box-shadow: 0 0 0 3px rgba(22,101,52,.12);
}

.pq-player-card.selected-wrong {
  background: #fff1f2;
  border-color: var(--pq-accent-mid);
  box-shadow: 0 0 0 3px rgba(159,18,57,.12);
}

.pq-player-card.correct-answer {
  background: #f0fdf4;
  border-color: var(--pq-green-mid);
}

.pq-player-card.disabled {
  cursor: default;
  transform: none;
}

.pq-card-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--pq-surface-2);
  border: 1px solid var(--pq-border);
  color: var(--pq-ink-muted);
  font-size: .75rem;
  font-weight: 800;
  margin-bottom: .75rem;
}

.pq-card-name {
  font-size: .98rem;
  font-weight: 700;
  color: var(--pq-ink);
  line-height: 1.25;
  margin-bottom: .3rem;
}

.pq-card-role {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pq-ink-faint);
}

/* ── Feedback panel ──────────────────────────────────────────────── */
.pq-feedback {
  margin-top: 1rem;
  padding: 1.1rem 1.3rem;
  border-radius: .65rem;
  background: var(--pq-surface);
  border: 1px solid var(--pq-border);
  box-shadow: 0 1px 3px var(--pq-shadow);
  display: none;
}

.pq-feedback.show { display: block; }

.pq-feedback-verdict {
  font-size: .95rem;
  font-weight: 800;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.pq-verdict-correct { color: var(--pq-green-mid); }
.pq-verdict-wrong   { color: var(--pq-accent-mid); }
.pq-verdict-timeout { color: #92400e; }

.pq-feedback-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .75rem;
  font-size: .85rem;
}

.pq-fb-val {
  background: var(--pq-surface-2);
  border: 1px solid var(--pq-border-2);
  border-radius: .45rem;
  padding: .5rem .7rem;
}

.pq-fb-val-name {
  color: var(--pq-ink-muted);
  font-size: .72rem;
  margin-bottom: .2rem;
  font-weight: 600;
}

.pq-fb-val-num {
  font-weight: 800;
  color: var(--pq-ink);
  font-variant-numeric: tabular-nums;
}

.pq-fb-val.winner {
  background: #f0fdf4;
  border-color: rgba(22,101,52,.25);
}

.pq-fb-val.winner .pq-fb-val-num {
  color: var(--pq-green-mid);
}

.pq-feedback-explanation {
  font-size: .88rem;
  color: var(--pq-ink-muted);
  line-height: 1.5;
  border-top: 1px solid var(--pq-border-2);
  padding-top: .65rem;
  margin-top: .1rem;
}

.pq-feedback-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: .9rem;
}

.pq-next-btn {
  min-height: 2.45rem;
  padding: 0 1.1rem;
  font-size: .78rem;
}

/* ── Rule / divider ──────────────────────────────────────────────── */
.pq-rule {
  border: none;
  border-top: 1px solid var(--pq-border);
  margin: 2rem 0;
}

/* ── Result screen ───────────────────────────────────────────────── */
.pq-result-screen {
  padding: 4.5rem 0;
  text-align: center;
}

.pq-score-circle {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  border: 2px solid var(--pq-border);
  background: var(--pq-surface);
  box-shadow: 0 2px 8px var(--pq-shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.8rem;
}

.pq-score-number {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--pq-accent);
  line-height: 1;
  letter-spacing: -.03em;
}

.pq-score-total {
  font-size: .75rem;
  color: var(--pq-ink-faint);
  font-weight: 700;
  letter-spacing: .06em;
}

.pq-badge-title {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--pq-ink-faint);
  margin-bottom: .4rem;
}

.pq-badge-name {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--pq-ink);
  margin-bottom: .6rem;
  letter-spacing: -.01em;
}

.pq-badge-phrase {
  font-size: .95rem;
  color: var(--pq-ink-muted);
  max-width: 30rem;
  margin: 0 auto 2.2rem;
  line-height: 1.65;
}

.pq-result-actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Back link ───────────────────────────────────────────────────── */
.pq-back-link {
  position: fixed;
  top: 1rem;
  left: 1.2rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pq-ink-muted);
  text-decoration: none;
  z-index: 100;
  transition: color .15s;
}

.pq-back-link:hover { color: var(--pq-ink); }

/* ── Cover image (hero) ──────────────────────────────────────────── */
.mip-cover-image {
  width: 100%;
  max-width: 280px;
  border-radius: 16px;
  display: block;
  margin: 0 auto 1.8rem;
  box-shadow: 0 4px 16px var(--pq-shadow-md);
}

/* ── Result banner ───────────────────────────────────────────────── */
.mip-result-banner {
  width: 100%;
  max-width: 860px;
  border-radius: 16px;
  display: block;
  margin: 0 auto 1.5rem;
  box-shadow: 0 4px 16px var(--pq-shadow-md);
}

@media (max-width: 600px) {
  .mip-cover-image   { max-width: 220px; border-radius: 12px; }
  .mip-result-banner { border-radius: 10px; }
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Man In Pasta quiz
   ══════════════════════════════════════════════════════════════════ */

/* ── Prevent horizontal overflow on all viewports ────────────────── */
.pq-page {
  overflow-x: hidden;
}

/* ── Tablets and large phones (≤ 768px) ─────────────────────────── */
@media (max-width: 768px) {
  .pq-hero {
    padding: 3.5rem 0 2.5rem;
  }

  .pq-question-screen {
    padding-top: 2rem;
  }

  .pq-result-screen {
    padding: 2.5rem 0;
  }

  /* Minimum 44px tap target on buttons */
  .pq-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .pq-badge-name {
    font-size: 1.45rem;
  }

  .mip-result-banner {
    border-radius: 12px;
    margin-bottom: 1.25rem;
  }
}

/* ── Small phones (≤ 480px) ──────────────────────────────────────── */
@media (max-width: 480px) {
  .pq-inner {
    padding: 0 1rem 3rem;
  }

  /* Hero: tighter vertical rhythm with cover image present */
  .pq-hero {
    padding: 2.5rem 0 1.8rem;
  }

  .pq-logo-badge {
    margin-bottom: 1rem;
  }

  .pq-hero p {
    font-size: .9rem;
    margin-bottom: 1.5rem;
  }

  /* Question screen */
  .pq-question-screen {
    padding-top: 1.5rem;
  }

  .pq-progress-bar {
    margin-bottom: 1.1rem;
  }

  .pq-question-header {
    margin-bottom: .9rem;
  }

  .pq-timer-row {
    margin-bottom: 1rem;
  }

  .pq-metric-box {
    padding: .8rem 1rem;
    margin-bottom: 1rem;
  }

  /* Long metric names won't overflow */
  .pq-metric-name {
    font-size: 1.05rem;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Player cards */
  .pq-cards {
    margin-bottom: .6rem;
    gap: .7rem;
  }

  .pq-player-card {
    padding: 1rem .85rem;
    /* Prevent double-tap zoom on card tap */
    touch-action: manipulation;
  }

  .pq-card-letter {
    margin-bottom: .5rem;
  }

  /* Feedback panel */
  .pq-feedback {
    padding: .85rem .9rem;
  }

  .pq-fb-val {
    padding: .4rem .55rem;
  }

  .pq-fb-val-name {
    font-size: .68rem;
  }

  /* Result screen */
  .pq-result-screen {
    padding: 2rem 0;
  }

  .pq-score-circle {
    width: 6rem;
    height: 6rem;
    margin-bottom: 1.25rem;
  }

  .pq-score-number {
    font-size: 2rem;
  }

  .pq-badge-name {
    font-size: 1.25rem;
    overflow-wrap: break-word;
  }

  .pq-badge-phrase {
    font-size: .88rem;
    margin-bottom: 1.5rem;
  }

  /* Buttons stacked full-width on very small screens */
  .pq-result-actions {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }

  .pq-result-actions .pq-btn {
    text-align: center;
    width: 100%;
    margin-left: 0;
  }

  /* Cover image */
  .mip-cover-image {
    max-width: 180px;
    border-radius: 12px;
    margin-bottom: 1.25rem;
  }

  /* Result banner — full width, reduced radius */
  .mip-result-banner {
    border-radius: 10px;
    margin-bottom: 1.25rem;
  }
}

/* ── Error box ───────────────────────────────────────────────────── */
.pq-error-box {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--pq-accent-mid);
  font-size: .92rem;
  line-height: 1.6;
  background: #fff1f2;
  border: 1px solid rgba(159,18,57,.2);
  border-radius: .65rem;
  margin-top: 2rem;
}
