/* ═══════════════════════════════════════════════
   CyberQuest – Game Stylesheet
   Audience: Students aged 13–17
   Aesthetic: Cyber-retro, neon-on-dark, game-like
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800&family=Nunito:wght@400;600;700;800&display=swap');

/* ── Variables ───────────────────────────────── */
:root {
  --cq-bg:          #0a0e1a;
  --cq-surface:     #111827;
  --cq-card:        #1a2235;
  --cq-border:      #2a3a55;
  --cq-neon:        #00f5d4;
  --cq-neon2:       #7c3aed;
  --cq-accent:      #f59e0b;
  --cq-danger:      #ef4444;
  --cq-success:     #10b981;
  --cq-text:        #e2e8f0;
  --cq-muted:       #64748b;
  --cq-radius:      14px;
  --cq-font-head:   'Orbitron', monospace;
  --cq-font-body:   'Nunito', sans-serif;
}

/* ── Reset / Wrapper ─────────────────────────── */
.cq-root *, .cq-root *::before, .cq-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.cq-root {
  font-family: var(--cq-font-body);
  background: var(--cq-bg);
  min-height: 500px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

/* animated grid background */
.cq-root::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,245,212,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,212,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

#cq-app {
  position: relative;
  z-index: 1;
  padding: 28px 20px;
  max-width: 740px;
  margin: 0 auto;
}

/* ── Screens ─────────────────────────────────── */
.cq-screen { display: none; animation: cqFadeIn .45s ease; }
.cq-screen.active { display: block; }

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

/* ── Logo / Heading ──────────────────────────── */
.cq-logo {
  text-align: center;
  margin-bottom: 32px;
}
.cq-logo h1 {
  font-family: var(--cq-font-head);
  font-size: clamp(24px, 5vw, 42px);
  color: var(--cq-neon);
  text-shadow: 0 0 20px rgba(0,245,212,.6), 0 0 60px rgba(0,245,212,.2);
  letter-spacing: 2px;
}
.cq-logo p {
  color: var(--cq-muted);
  font-size: 14px;
  margin-top: 6px;
}

/* ── Progress Bar ────────────────────────────── */
.cq-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  justify-content: center;
}
.cq-progress-step {
  flex: 1;
  max-width: 130px;
  height: 6px;
  background: var(--cq-border);
  border-radius: 99px;
  transition: background .4s;
  position: relative;
}
.cq-progress-step.done  { background: var(--cq-neon); box-shadow: 0 0 8px rgba(0,245,212,.5); }
.cq-progress-step.active{ background: var(--cq-accent); box-shadow: 0 0 8px rgba(245,158,11,.5); }

.cq-step-labels {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}
.cq-step-label {
  flex: 1;
  max-width: 130px;
  text-align: center;
  font-size: 10px;
  color: var(--cq-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.cq-step-label.active { color: var(--cq-accent); }
.cq-step-label.done   { color: var(--cq-neon); }

/* ── Card ────────────────────────────────────── */
.cq-card {
  background: var(--cq-card);
  border: 1px solid var(--cq-border);
  border-radius: var(--cq-radius);
  padding: 28px 28px;
  margin-bottom: 20px;
  box-shadow: 0 4px 32px rgba(0,0,0,.4);
}

.cq-card-title {
  font-family: var(--cq-font-head);
  font-size: 16px;
  color: var(--cq-neon);
  margin-bottom: 18px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Form Elements ───────────────────────────── */
.cq-label {
  display: block;
  color: var(--cq-text);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.cq-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--cq-surface);
  border: 1.5px solid var(--cq-border);
  border-radius: 10px;
  color: var(--cq-text);
  font-family: var(--cq-font-body);
  font-size: 15px;
  margin-bottom: 16px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.cq-input:focus {
  border-color: var(--cq-neon);
  box-shadow: 0 0 0 3px rgba(0,245,212,.15);
}
.cq-input::placeholder { color: var(--cq-muted); }

/* ── Buttons ─────────────────────────────────── */
.cq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 10px;
  font-family: var(--cq-font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  border: none;
  transition: transform .15s, box-shadow .15s;
}
.cq-btn:active { transform: scale(.97); }

.cq-btn-primary {
  background: linear-gradient(135deg, var(--cq-neon), #00b4d8);
  color: #0a0e1a;
  box-shadow: 0 0 20px rgba(0,245,212,.3);
}
.cq-btn-primary:hover { box-shadow: 0 0 30px rgba(0,245,212,.5); }

.cq-btn-secondary {
  background: transparent;
  border: 1.5px solid var(--cq-neon);
  color: var(--cq-neon);
}
.cq-btn-secondary:hover { background: rgba(0,245,212,.08); }

.cq-btn-danger {
  background: linear-gradient(135deg, var(--cq-danger), #b91c1c);
  color: #fff;
}

.cq-btn-success {
  background: linear-gradient(135deg, var(--cq-success), #059669);
  color: #fff;
}

.cq-btn-block { width: 100%; }

/* ── Language Selector ───────────────────────── */
.cq-lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.cq-lang-btn {
  padding: 20px 10px;
  border-radius: 14px;
  border: 2px solid var(--cq-border);
  background: var(--cq-surface);
  color: var(--cq-text);
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  font-family: var(--cq-font-body);
}
.cq-lang-btn:hover,
.cq-lang-btn.selected {
  border-color: var(--cq-neon);
  background: rgba(0,245,212,.08);
  box-shadow: 0 0 16px rgba(0,245,212,.2);
}
.cq-lang-btn .cq-lang-native { font-size: 22px; font-weight: 800; display: block; margin-bottom: 4px; }
.cq-lang-btn .cq-lang-name   { font-size: 12px; color: var(--cq-muted); }

/* ── Password Strength Meter ─────────────────── */
.cq-pw-meter {
  height: 8px;
  background: var(--cq-border);
  border-radius: 99px;
  margin-bottom: 8px;
  overflow: hidden;
}
.cq-pw-bar {
  height: 100%;
  border-radius: 99px;
  transition: width .4s, background .4s;
  width: 0%;
}

.cq-pw-tips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
}
.cq-pw-tip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--cq-muted);
  transition: color .3s;
}
.cq-pw-tip.ok { color: var(--cq-success); }
.cq-pw-tip .cq-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cq-border);
  flex-shrink: 0;
  transition: background .3s;
}
.cq-pw-tip.ok .cq-dot { background: var(--cq-success); box-shadow: 0 0 6px rgba(16,185,129,.5); }

/* ── Email Compose UI ────────────────────────── */
.cq-email-client {
  border: 1px solid var(--cq-border);
  border-radius: 14px;
  overflow: hidden;
}
.cq-email-toolbar {
  background: #0d1526;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--cq-border);
}
.cq-email-dot { width: 10px; height: 10px; border-radius: 50%; }
.cq-email-app-name { margin-left: 8px; font-size: 12px; color: var(--cq-muted); font-weight: 700; letter-spacing: 1px; }
.cq-email-body { padding: 18px; }
.cq-email-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--cq-border);
  margin-bottom: 4px;
}
.cq-email-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--cq-muted);
  text-transform: uppercase;
  width: 60px;
  flex-shrink: 0;
  padding-top: 10px;
}
.cq-email-field .cq-input { margin-bottom: 0; flex: 1; }
.cq-email-compose-area {
  width: 100%;
  min-height: 120px;
  background: var(--cq-surface);
  border: 1.5px solid var(--cq-border);
  border-radius: 10px;
  color: var(--cq-text);
  font-family: var(--cq-font-body);
  font-size: 14px;
  padding: 12px 16px;
  resize: vertical;
  outline: none;
  margin-top: 12px;
  transition: border-color .2s;
}
.cq-email-compose-area:focus { border-color: var(--cq-neon); }

/* ── Phishing Email Card ─────────────────────── */
.cq-phish-email {
  border: 1.5px solid var(--cq-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  transition: border-color .3s;
}
.cq-phish-header {
  background: var(--cq-surface);
  padding: 14px 18px;
  border-bottom: 1px solid var(--cq-border);
}
.cq-phish-meta { display: flex; justify-content: space-between; align-items: center; }
.cq-phish-from { font-weight: 700; color: var(--cq-text); font-size: 14px; }
.cq-phish-date { font-size: 12px; color: var(--cq-muted); }
.cq-phish-subject { font-size: 13px; color: var(--cq-muted); margin-top: 4px; }
.cq-phish-body { padding: 18px; font-size: 14px; color: var(--cq-text); line-height: 1.7; }
.cq-phish-actions { display: flex; gap: 12px; padding: 14px 18px; background: var(--cq-surface); border-top: 1px solid var(--cq-border); }
.cq-phish-actions .cq-btn { flex: 1; }

.cq-phish-email.answered-safe    { border-color: var(--cq-success); }
.cq-phish-email.answered-phish   { border-color: var(--cq-danger); }

/* ── Score Results ───────────────────────────── */
.cq-results-hero {
  text-align: center;
  padding: 20px 0 28px;
}
.cq-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  font-family: var(--cq-font-head);
  font-size: 36px;
  font-weight: 800;
  margin: 0 auto 16px;
  border: 4px solid;
}
.cq-grade-a  { color: var(--cq-success); border-color: var(--cq-success); box-shadow: 0 0 30px rgba(16,185,129,.4); }
.cq-grade-b  { color: #3b82f6; border-color: #3b82f6; box-shadow: 0 0 30px rgba(59,130,246,.4); }
.cq-grade-c  { color: var(--cq-accent); border-color: var(--cq-accent); box-shadow: 0 0 30px rgba(245,158,11,.4); }
.cq-grade-df { color: var(--cq-danger); border-color: var(--cq-danger); box-shadow: 0 0 30px rgba(239,68,68,.4); }

.cq-score-bars { display: flex; flex-direction: column; gap: 14px; }
.cq-score-bar-row { display: flex; align-items: center; gap: 12px; }
.cq-score-bar-label { font-size: 13px; font-weight: 700; color: var(--cq-text); width: 100px; flex-shrink: 0; }
.cq-score-bar-track { flex: 1; background: var(--cq-border); border-radius: 99px; height: 12px; overflow: hidden; }
.cq-score-bar-fill  { height: 100%; border-radius: 99px; transition: width 1s cubic-bezier(.22,.68,0,1.2); width: 0%; }
.cq-score-bar-pct   { font-size: 13px; font-weight: 800; color: var(--cq-text); width: 42px; text-align: right; }

.cq-attempts-history { margin-top: 24px; }
.cq-attempts-history table { width: 100%; border-collapse: collapse; }
.cq-attempts-history th, .cq-attempts-history td {
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px solid var(--cq-border);
}
.cq-attempts-history th { color: var(--cq-muted); font-weight: 700; text-transform: uppercase; font-size: 11px; }
.cq-attempts-history td { color: var(--cq-text); }
.cq-top-badge { color: var(--cq-accent); font-weight: 800; }

/* ── Alerts ──────────────────────────────────── */
.cq-alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  font-weight: 600;
}
.cq-alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.cq-alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; }
.cq-alert-info    { background: rgba(0,245,212,.08); border: 1px solid rgba(0,245,212,.2);  color: var(--cq-neon); }

/* ── Phishing counter ────────────────────────── */
.cq-phish-counter {
  text-align: center;
  color: var(--cq-muted);
  font-size: 13px;
  margin-bottom: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 520px) {
  .cq-card { padding: 18px 16px; }
  .cq-lang-grid { grid-template-columns: 1fr; }
  .cq-pw-tips { grid-template-columns: 1fr; }
  .cq-phish-actions { flex-direction: column; }
}
