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

:root {
  --bg:        #27262b;
  --surface:   #2f2e34;
  --surface2:  #44434d;
  --border:    #3a383f;
  --accent:    #e8491d;
  --accent-h:  #cf3e15;
  --accent-lo: rgba(232,73,29,.15);
  --ok:        #10b981;
  --ok-lo:     rgba(16,185,129,.12);
  --err:       #ef4444;
  --err-lo:    rgba(239,68,68,.12);
  --warn:      #f59e0b;
  --text:      #e6e1e8;
  --muted:     #9a929f;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Inter', system-ui, sans-serif;
  --r:         12px;
  --r-sm:      8px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,73,29,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,73,29,.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── SCREENS ── */
.screen        { display: none; min-height: 100vh; position: relative; z-index: 1; padding-bottom: 44px; }
.screen.active { display: block; }

#screen-welcome.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 40px;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── LANG BAR ── */
.lang-bar {
  position: fixed;
  top: 14px; right: 14px;
  display: flex;
  gap: 8px;
  z-index: 200;
}

.lang-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: 500 13px var(--sans);
  cursor: pointer;
  transition: all .2s;
}
.lang-btn:hover,
.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── WELCOME ── */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 36px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 4px 32px rgba(0,0,0,.5), 0 0 60px rgba(232,73,29,.08);
}

.shield-icon {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--accent), #ff7043);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(232,73,29,.35);
}
.shield-icon svg { width: 38px; height: 38px; stroke: #fff; }

.welcome-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -.5px;
  background: linear-gradient(120deg, #e6e1e8 30%, #e8491d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.welcome-subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 28px;
}

.welcome-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.stat-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  text-align: center;
  flex: 1;
}
.stat-num   { display: block; font-size: 1.4rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.embed-mode .lang-bar,
.embed-mode .site-footer,
.embed-mode #btn-home {
  display: none !important;
}
.site-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: .78rem;
}
.footer-title {
  font-weight: 600;
  color: var(--text);
}
.footer-sep { color: var(--border); }
.footer-by  { color: var(--muted); }
.footer-logo-link { display: flex; align-items: center; }
.p4a-logo {
  height: 20px;
  width: auto;
  opacity: .8;
  transition: opacity .2s;
  vertical-align: middle;
}
.footer-logo-link:hover .p4a-logo { opacity: 1; }
.footer-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity .2s;
}
.footer-link:hover { opacity: .75; }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font: 600 1rem var(--sans);
  cursor: pointer;
  transition: all .2s;
}
.btn-primary:hover  { background: var(--accent-h); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(232,73,29,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-full { width: 100%; border-radius: var(--r); padding: 14px; font-size: 1.05rem; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font: 500 1rem var(--sans);
  cursor: pointer;
  transition: all .2s;
}
.btn-outline:hover { border-color: var(--muted); color: var(--text); }

/* ── QUIZ HEADER ── */
.quiz-header {
  position: sticky;
  top: 0; z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.progress-label { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.progress-bar   { flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.progress-fill  { height: 100%; background: linear-gradient(90deg, var(--accent), #ff7043); border-radius: 3px; transition: width .5s ease; }
.score-pill     { font-size: .82rem; font-weight: 600; color: var(--warn); white-space: nowrap; }

.quiz-body { padding: 24px 16px 48px; }

/* ── QCM CARD ── */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px 24px;
  margin-bottom: 16px;
  animation: fadeUp .3s ease;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font: 600 .72rem var(--sans);
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.badge-qcm   { background: rgba(232,73,29,.12); color: #f07a5a; border: 1px solid rgba(232,73,29,.25); }
.badge-email { background: rgba(245,158,11,.12); color: #fbbf24; border: 1px solid rgba(245,158,11,.25); }

.question-text { font-size: 1.08rem; font-weight: 500; margin-bottom: 20px; line-height: 1.6; }

.options-list { display: flex; flex-direction: column; gap: 9px; }

.option-btn {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font: 500 .93rem var(--sans);
  cursor: pointer;
  line-height: 1.5;
  transition: border-color .15s, background .15s;
}
.option-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-lo); }
.option-btn:disabled { cursor: default; }

.opt-letter {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 .78rem var(--mono);
}

.option-btn.is-correct              { border-color: var(--ok); background: var(--ok-lo); }
.option-btn.is-correct .opt-letter  { background: var(--ok); color: #fff; }
.option-btn.is-wrong                { border-color: var(--err); background: var(--err-lo); }
.option-btn.is-wrong .opt-letter    { background: var(--err); color: #fff; }

/* ── EMAIL MOCK ── */
.email-intro {
  text-align: center;
  font-size: .88rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 10px;
}

.email-mock {
  background: #1e1d22;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 14px;
  animation: fadeUp .3s ease;
  transition: border-color .3s;
}

.email-meta {
  background: var(--surface2);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.email-row {
  display: flex;
  gap: 8px;
  font-size: .84rem;
  margin-bottom: 5px;
  align-items: baseline;
}
.email-row:last-child { margin-bottom: 0; }
.email-row-lbl { color: var(--muted); min-width: 46px; flex-shrink: 0; }
.email-row-val { color: var(--text); }
.email-addr    { font-family: var(--mono); font-size: .78rem; color: #f07a5a; }

.email-subject {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: .97rem;
}

.email-body {
  padding: 20px 18px;
  font-size: .88rem;
  line-height: 1.75;
  color: #c9c4cc;
  white-space: pre-line;
}

.email-cta { padding: 0 18px 18px; }
.email-cta-btn {
  display: inline-block;
  background: #b83c18;
  color: #fff;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 6px;
  cursor: default;
}
.email-cta-url { font-family: var(--mono); font-size: .74rem; color: var(--muted); }

.email-verdict {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-phishing,
.btn-legit {
  padding: 13px;
  border-radius: var(--r-sm);
  font: 600 .93rem var(--sans);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.btn-phishing { border: 1.5px solid var(--err); background: var(--err-lo); color: #fca5a5; }
.btn-phishing:hover { background: rgba(239,68,68,.22); transform: translateY(-1px); }
.btn-legit    { border: 1.5px solid var(--ok); background: var(--ok-lo); color: #6ee7b7; }
.btn-legit:hover { background: rgba(16,185,129,.22); transform: translateY(-1px); }
.btn-phishing:disabled,
.btn-legit:disabled { cursor: default; transform: none; }

/* ── FEEDBACK BOX ── */
.feedback-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 24px;
  animation: fadeUp .3s ease;
}
.feedback-box.hidden { display: none; }
.feedback-box.is-correct { border-color: rgba(16,185,129,.4); }
.feedback-box.is-wrong   { border-color: rgba(239,68,68,.4); }

.fb-top  { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.fb-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }

.fb-content strong { display: block; font-size: 1rem; margin-bottom: 4px; }
.fb-content p      { font-size: .88rem; color: var(--muted); line-height: 1.6; }

.fb-flags { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }

.flag {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  font-size: .84rem;
  line-height: 1.45;
}
.flag-red   { background: var(--err-lo); border: 1px solid rgba(239,68,68,.2); color: #fca5a5; }
.flag-green { background: var(--ok-lo);  border: 1px solid rgba(16,185,129,.2); color: #6ee7b7; }
.flag-icon  { flex-shrink: 0; }

/* ── RESULT SCREEN ── */
#screen-result { padding: 40px 0 60px; }
#screen-result.active { display: block; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 36px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 4px 32px rgba(0,0,0,.4);
}

.result-heading { font-size: 1.7rem; font-weight: 700; margin-bottom: 28px; }

.score-ring-wrap {
  position: relative;
  width: 152px; height: 152px;
  margin: 0 auto 22px;
}

.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track    { fill: none; stroke: var(--surface2); stroke-width: 9; }
.ring-progress {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1.1s cubic-bezier(.4,0,.2,1);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-label span  { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.ring-label small { font-size: .95rem; color: var(--muted); }

.grade-badge {
  display: inline-block;
  padding: 7px 20px;
  border-radius: 20px;
  font: 700 .97rem var(--sans);
  margin-bottom: 6px;
}
.g5 { background: rgba(16,185,129,.18); color: #10b981; }
.g4 { background: rgba(232,73,29,.15); color: #f07a5a; }
.g3 { background: rgba(245,158,11,.15); color: #f59e0b; }
.g2 { background: rgba(239,68,68,.13);  color: #f87171; }
.g1 { background: rgba(239,68,68,.18);  color: #ef4444; }

.grade-desc { color: var(--muted); font-size: .93rem; margin-bottom: 28px; }

.sec-score-wrap { margin: 18px 0 24px; text-align: center; }
.sec-score-bar-track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #ef4444, #f59e0b 50%, #10b981);
  margin: 12px 0 6px;
}
.sec-score-thumb {
  position: absolute;
  top: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 6px rgba(0,0,0,.5);
  transition: left .7s cubic-bezier(.4,0,.2,1);
}
.sec-score-labels {
  display: flex;
  justify-content: space-between;
  font-size: .73rem;
  color: var(--muted);
  margin-top: 4px;
}

.tips-box {
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 22px;
  margin-bottom: 24px;
}
.tips-box h3 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 10px;
}
#tips-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
#tips-list li {
  font-size: .86rem;
  color: var(--text);
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}
#tips-list li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.result-actions { display: flex; gap: 10px; justify-content: center; }
.result-actions .btn-primary { flex: 1; }

/* ── ANIMATION ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 560px) {
  .welcome-card, .result-card { padding: 28px 18px; }
  .welcome-stats { gap: 8px; }
  .stat-chip { padding: 9px 10px; }
  .question-card { padding: 20px 14px; }
  .email-verdict { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .quiz-header { padding: 8px 12px; gap: 8px; }
  .quiz-body { padding: 16px 0 48px; }
}
