/* Real or Fake? – styles */

/* ── Colours and fonts ───────────────────────────────────────────────── */
:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #5b6474;
  --line: #ddd6c8;

  --accent: #1f4e79;
  --accent-ink: #ffffff;
  --focus: #f0a000;
  --link: #1a56c4;

  --real: #1e7a46;
  --real-bg: #e3f4ea;
  --real-line: #a9d9bd;
  --fake: #b42318;
  --fake-bg: #fdecea;
  --fake-line: #f1b5ae;

  --highlight: #ffe08a;
  --highlight-line: #c99700;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

/* ── Base ────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { font-size: 18px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.5; }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 2rem; line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.4rem; margin: 1.2em 0 .5em; }
p { margin: .5em 0; }
[tabindex="-1"]:focus { outline: none; }   /* headings focused only to guide screen readers */

.lead { font-size: 1.1rem; color: var(--muted); }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; margin: 16px 0; box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.tip { background: #fff8e1; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 14px; margin: 12px 0; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; min-height: 52px; padding: 14px 22px;
  font: inherit; font-size: 1.05rem; font-weight: 600;
  border: 2px solid var(--accent); border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:focus-visible,
.vote button:focus-visible,
.pretend-link:focus-visible,
.pretend-attachment:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.next { display: flex; justify-content: flex-end; margin-top: 8px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* ── Email screen: progress and "What you know" ──────────────────────── */
.progress { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: .95rem; }
.progress-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.context {
  background: #eef3f8; border-left: 5px solid var(--accent); border-radius: 8px;
  padding: 10px 14px; margin: 12px 0; font-size: .95rem;
}
.context strong { display: block; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }

/* ── The email ───────────────────────────────────────────────────────── */
.email {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.email header { padding: 16px 18px; border-bottom: 1px solid var(--line); background: #fbfaf7; }
.email .body { padding: 18px; }
.subject { font-size: 1.15rem; font-weight: 700; margin: 0 0 8px; }
.from { display: flex; gap: 12px; align-items: center; }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.sender { min-width: 0; }
.sender b { display: block; }
.address { font-size: .92rem; color: var(--muted); word-break: break-all; padding: 1px 4px; border-radius: 4px; }
.to { display: block; font-size: .85rem; color: var(--muted); }
.time { margin-left: auto; align-self: flex-start; color: var(--muted); font-size: .85rem; }

/* Pretend buttons, links and attachments – none of them go anywhere */
.pretend-button {
  display: inline-block; padding: 10px 18px; border-radius: 8px;
  background: #d6461f; color: #fff; font-weight: 700; cursor: not-allowed; user-select: none;
}
.pretend-button.blue { background: #2c5fb3; }
.pretend-link { color: var(--link); text-decoration: underline; font-weight: 600; cursor: pointer; }
.pretend-attachment {
  display: inline-flex; gap: 10px; align-items: center; padding: 10px 14px;
  font: inherit; text-align: left; color: var(--ink);
  background: #f3f4f6; border: 1px solid #cfd4dc; border-radius: 10px; cursor: pointer;
}
.pretend-attachment small { color: var(--muted); }
.attachment-mark { display: inline-block; margin-top: 6px; }

/* ── After answering: reveal the red flags ───────────────────────────── */
mark { background: none; color: inherit; }   /* invisible until revealed */
.revealed mark { background: var(--highlight); border-bottom: 2px solid var(--highlight-line); padding: 0 2px; border-radius: 3px; }
.revealed mark::after { content: " " attr(data-icon); }
.revealed .address.mismatch { background: var(--fake-bg); color: var(--fake); font-weight: 600; outline: 2px solid var(--fake); }
.revealed .address.match { background: var(--real-bg); color: var(--real); font-weight: 600; }

.link-reveal {
  display: none; margin: 6px 0 10px; padding: 8px 10px; border-radius: 8px;
  font: 14px/1.4 var(--mono); word-break: break-all;
}
.revealed .link-reveal { display: block; }
.link-reveal.bad { background: var(--fake-bg); color: var(--fake); border: 1px solid var(--fake-line); }
.link-reveal.good { background: var(--real-bg); color: var(--real); border: 1px solid var(--real-line); }
.link-reveal b { text-decoration: underline; font-size: 15px; }

/* ── Voting ──────────────────────────────────────────────────────────── */
.vote { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.vote button {
  min-height: 64px; padding: 18px; font: inherit; font-size: 1.25rem; font-weight: 700;
  border: 3px solid; border-radius: 14px; cursor: pointer;
}
.vote .real { background: var(--real-bg); color: var(--real); border-color: var(--real); }
.vote .fake { background: var(--fake-bg); color: var(--fake); border-color: var(--fake); }
.vote button:disabled { cursor: default; opacity: .4; }
.vote button.chosen { opacity: 1; box-shadow: 0 0 0 4px rgba(0,0,0,.15); }

/* ── Feedback ────────────────────────────────────────────────────────── */
.feedback { margin: 12px 0; padding: 18px 20px; border: 2px solid; border-radius: 16px; }
.feedback.correct { background: var(--real-bg); border-color: var(--real); }
.feedback.wrong { background: var(--fake-bg); border-color: var(--fake); }
.feedback h3 { margin: 0 0 4px; font-size: 1.3rem; }
.verdict-fake { color: var(--fake); }
.verdict-real { color: var(--real); }

.checklist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.check {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.check-icon { flex: none; width: 1.6em; text-align: center; font-weight: 700; }
.check.red-flag { border-color: var(--fake-line); }
.check.red-flag .check-icon { color: var(--fake); }
.check.passed .check-icon { color: var(--real); }

/* ── Lesson screen ───────────────────────────────────────────────────── */
.score { font-size: 3rem; font-weight: 800; color: var(--accent); line-height: 1; }

.flag-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.flag-card {
  padding: 16px; background: var(--card);
  border: 1px solid var(--line); border-top: 6px solid var(--fake); border-radius: 14px;
}
.flag-card h3 { margin: .2em 0 .3em; font-size: 1.15rem; }
.flag-icon { font-size: 2rem; }
.flag-example { margin-top: 10px; padding-left: 10px; border-left: 3px solid var(--highlight-line); font-size: .92rem; color: var(--muted); }

.lookalikes { width: 100%; border-collapse: collapse; font-size: .92rem; }
.lookalikes th, .lookalikes td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.lookalikes code { font: 14px var(--mono); word-break: break-all; }
.lookalikes .good { color: var(--real); }
.lookalikes .bad { color: var(--fake); }

.advice { padding-left: 1.2em; }
.advice li { margin: .4em 0; }

.answer-list { list-style: none; padding: 0; margin: 0; }
.answer-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.answer-list li:last-child { border-bottom: none; }
.answer-title { flex: 1; }
.tag { flex: none; align-self: center; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.tag-real { background: var(--real-bg); color: var(--real); }
.tag-fake { background: var(--fake-bg); color: var(--fake); }

/* ── Pop-up message and pretend browser status bar ───────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: .95rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.status-bar {
  display: none; position: fixed; left: 0; bottom: 0; z-index: 5; max-width: 90vw;
  padding: 4px 10px; background: #e8eaed; color: #202124; font: 13px var(--mono); word-break: break-all;
  border: 1px solid #bbb; border-top-right-radius: 6px;
}
.status-bar.show { display: block; }

/* ── Small screens and printing ──────────────────────────────────────── */
@media (max-width: 560px) {
  html { font-size: 17px; }
  .flag-cards { grid-template-columns: 1fr; }
  .vote button { font-size: 1.1rem; padding: 14px; }
  .time { display: none; }
}

@media print {
  .vote, .next, .actions, .toast, .status-bar { display: none; }
}
