/* NEC Journeyman Quiz - Styles */
:root {
  --bg: #0e0f13;
  --bg-alt: #12141b;
  --card: #171923;
  --text: #e7e9ee;
  --muted: #a7adc0;
  --primary: #6ee7ff;
  --primary-700: #3dd9ff;
  --accent: #ffd36e;
  --danger: #ff6e88;
  --success: #63ffb1;
  --pill: #232638;
  --shadow: rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% -10%, #1a1d2b 0%, var(--bg) 50%, var(--bg) 100%);
}

.app { max-width: 980px; margin: 0 auto; padding: 20px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; background: linear-gradient(135deg, #22263b, #1b1f30); border-radius: 10px; box-shadow: 0 10px 20px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.03); }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }

.hud { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hud-item { background: var(--pill); border-radius: 10px; padding: 8px 12px; min-width: 80px; text-align: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 6px 16px var(--shadow); }
.hud-item.timer { background: linear-gradient(to right, #1f2437, #232844); }
.label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.value { font-size: 18px; font-weight: 700; margin-top: 2px; }

.progress { height: 6px; background: #1a1e2f; border-radius: 999px; overflow: hidden; margin: 14px 0 10px 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 6px 16px var(--shadow); }
.progress-bar { position: relative; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.2s ease; }
.progress-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%); background-size: 200% 100%; animation: shimmer 2.2s linear infinite; pointer-events: none; mix-blend-mode: screen; }

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Confetti */
.confetti-container { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 9999; }
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px; height: 4px;
  opacity: 0.95;
  border-radius: 2px;
  animation-name: confetti-fall, confetti-spin;
  animation-timing-function: ease-in, linear;
  animation-iteration-count: 1, infinite;
}

@keyframes confetti-fall {
  0% { top: -12px; }
  100% { top: 110vh; }
}
@keyframes confetti-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(720deg); }
}

.game { display: grid; }
.card { position: relative; background: linear-gradient(180deg, rgba(23,25,35,0.78), rgba(18,20,27,0.64)); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 20px; box-shadow: 0 24px 48px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06); backdrop-filter: blur(8px) saturate(120%); }
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(120% 80% at 20% -20%, rgba(110,231,255,0.08), transparent 60%); pointer-events: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pill { background: var(--pill); color: var(--primary); font-weight: 600; border-radius: 999px; padding: 6px 12px; font-size: 13px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04); }
.ref { color: var(--muted); font-size: 12px; }
.ref-group { display: flex; align-items: center; gap: 8px; }

.question { margin: 8px 0 14px 0; font-size: clamp(18px, 2.4vw, 24px); line-height: 1.3; }
.answers { display: grid; grid-template-columns: 1fr; gap: 10px; }

.answer-btn { position: relative; padding: 14px 14px; background: #0f111a; color: var(--text); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; box-shadow: 0 10px 20px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.03); text-align: left; cursor: pointer; transition: transform 0.06s ease, border-color 0.2s, background 0.3s; }
.answer-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.14); }
.answer-btn:active { transform: translateY(0); }
.answer-btn.correct { border-color: rgba(99, 255, 177, 0.8); background: rgba(99,255,177,0.08); }
.answer-btn.wrong { border-color: rgba(255, 110, 136, 0.8); background: rgba(255,110,136,0.08); }
.answer-btn.disabled { opacity: 0.6; pointer-events: none; }

.feedback { min-height: 20px; margin: 8px 0; font-weight: 600; }
.feedback.ok { color: var(--success); }
.feedback.bad { color: var(--danger); }

/* Explanation and tips */
.hotkey-tip { margin: 6px 0; font-size: 12px; color: var(--muted); }
.explain { margin: 6px 0 0; padding: 10px; font-size: 13px; color: var(--muted); background: rgba(110,231,255,0.06); border: 1px solid rgba(110,231,255,0.12); border-radius: 10px; }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.btn { background: linear-gradient(180deg, var(--primary), var(--primary-700)); color: #081018; border: none; padding: 10px 16px; border-radius: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 12px 24px rgba(61, 217, 255, 0.25), inset 0 1px 0 rgba(255,255,255,0.35); transition: transform 0.06s ease, opacity 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: #0f111a; color: var(--text); border: 1px solid rgba(255,255,255,0.10); box-shadow: 0 8px 18px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.03); }
.btn.xl { padding: 14px 22px; font-size: 18px; }

/* Icon button for sound toggle */
.icon-btn { background: transparent; border: none; color: var(--primary-700); font-weight: 700; font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: 10px; cursor: pointer; transition: transform 0.06s ease, background 0.2s; }
.icon-btn.small { font-size: 14px; padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { transform: translateY(-1px); background: rgba(61, 217, 255, 0.12); }
.hud-item.sound { min-width: 56px; display: grid; place-items: center; }

.footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.linklike { background: transparent; border: none; color: var(--primary-700); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.58); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 20; }
.modal.show { display: flex; }
.modal-content { width: min(720px, 96vw); background: linear-gradient(180deg, #171923, #12141b); padding: 22px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 30px 60px var(--shadow); }
.modal-content h2 { margin-top: 0; }
.mode { margin: 14px 0; }
.mode-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: #0f111a; color: var(--text); border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; padding: 10px 14px; cursor: pointer; font-weight: 600; }
.chip.active { background: rgba(61, 217, 255, 0.12); border-color: var(--primary-700); color: var(--primary-700); }
.small { color: var(--muted); font-size: 12px; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.summary > div { background: #0f111a; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); text-align: center; }
.summary span { display: block; font-size: 11px; color: var(--muted); }
.summary strong { font-size: 20px; }
.buttons-row { display: flex; gap: 10px; justify-content: flex-end; }

.howto { color: var(--muted); }
.howto li { margin: 8px 0; }

/* Utilities */
.hidden { display: none !important; }

/* Low-time pulse */
.hud-item.timer.low .value { color: var(--danger); }
.progress-bar.low { background: linear-gradient(90deg, var(--danger), var(--accent)); animation: lowPulse 1.3s ease-in-out infinite; }
@keyframes lowPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,110,136,0); }
  50% { box-shadow: 0 0 0 6px rgba(255,110,136,0.08); }
  100% { box-shadow: 0 0 0 0 rgba(255,110,136,0); }
}

@media (min-width: 680px) {
  .answers { grid-template-columns: 1fr 1fr; }
}
