/* ===== Colors used across the app ===== */
:root {
  --navy: #0b1f3a;
  --navy-light: #16325c;
  --bg: #f3f6fa;
  --card: #ffffff;
  --text: #1a2433;
  --muted: #5b6878;
  --verified: #1f8a4c;
  --suspicious: #c0392b;
  --unverified: #b7791f;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.app-header {
  background: var(--navy);
  color: #fff;
  padding: calc(16px + env(safe-area-inset-top)) 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo { width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0; }
.app-header h1 { margin: 0; font-size: 24px; }
.tagline { margin: 0; opacity: 0.8; font-size: 15px; }

/* ===== Layout ===== */
.container {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(11, 31, 58, 0.08);
}

.label { display: block; font-weight: 600; margin-bottom: 8px; }

textarea {
  width: 100%;
  font: inherit;
  padding: 12px;
  border: 2px solid #d5dde8;
  border-radius: 10px;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--navy-light); }

/* ===== Buttons ===== */
.btn-primary {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.btn-primary:active { background: var(--navy-light); }

.btn-link {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  font: inherit;
  color: var(--navy-light);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* ===== Result card ===== */
.result { border-left: 8px solid var(--muted); }
.result.verified   { border-left-color: var(--verified); }
.result.suspicious { border-left-color: var(--suspicious); }
.result.unverified { border-left-color: var(--unverified); }

.result-label { font-size: 22px; font-weight: 800; margin: 0 0 8px; }
.result.verified .result-label   { color: var(--verified); }
.result.suspicious .result-label { color: var(--suspicious); }
.result.unverified .result-label { color: var(--unverified); }

.result-summary { margin: 0 0 14px; font-weight: 600; }
.result-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.result-top .result-label { margin: 0; flex: 1; min-width: 0; white-space: nowrap; }
.result-top .btn-speak { flex-shrink: 0; }
.btn-speak {
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap;
  padding: 8px 12px; border-radius: 99px; border: 1px solid #d5dde8;
  background: #fff; color: var(--navy); cursor: pointer;
}
.btn-speak:active { background: #eef2f7; }

/* Language switch */
.header-text { flex: 1; min-width: 0; }
.lang-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--navy); padding: 0 16px 14px;
}
.lang-switch button {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 15px; font-weight: 600; color: #fff;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
  padding: 9px 6px; border-radius: 10px; cursor: pointer;
}
.lang-switch button.active { background: #fff; color: var(--navy); border-color: #fff; }
.flag { width: 22px; height: 15px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }

.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 18px 0 8px; }

.reasons { padding-left: 20px; margin: 0; }
.reasons li { margin-bottom: 8px; }

/* Trust score meter */
.meter-top { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; }
.meter-track { height: 12px; background: #e6ebf2; border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--muted); transition: width 0.6s ease; }
.result.verified .meter-fill   { background: var(--verified); }
.result.suspicious .meter-fill { background: var(--suspicious); }
.result.unverified .meter-fill { background: var(--unverified); }

/* Highlighted message */
.highlighted {
  background: #f7f9fc;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
mark { padding: 1px 3px; border-radius: 4px; color: inherit; }
.mark-high   { background: #fadbd8; border-bottom: 2px solid var(--suspicious); }
.mark-medium { background: #fdebd0; border-bottom: 2px solid var(--unverified); }
.mark-low    { background: #fdf3dc; }
.mark-good   { background: #d5f0e0; border-bottom: 2px solid var(--verified); }

.legend { display: flex; gap: 8px; margin-top: 8px; font-size: 13px; }
.legend span { padding: 2px 8px; border-radius: 4px; }

/* Link X-ray */
.xray { border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid #e1e7ef; }
.xray-host { font-weight: 700; font-family: ui-monospace, Menlo, monospace; font-size: 14px; word-break: break-all; }
.xray-why { font-size: 15px; margin-top: 4px; }
.xray-official { background: #eef9f2; border-color: #bfe5cf; }
.xray-warning  { background: #fdf6ea; border-color: #f3d9a8; }
.xray-danger   { background: #fdf0ee; border-color: #f2c4bd; }

/* ===== Official alerts card ===== */
.official-head { display: flex; justify-content: space-between; align-items: center; }
.official h2 { font-size: 18px; margin: 0; }
.btn-small {
  font: inherit; font-size: 18px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid #d5dde8; background: #fff; color: var(--navy); cursor: pointer;
}
.btn-small:disabled { opacity: 0.4; }
.official-status { font-size: 14px; color: var(--muted); margin: 6px 0 10px; }
.status-saved { color: var(--unverified); font-weight: 600; }
.status-demo  { color: #6b3fa0; font-weight: 600; }
.official-list { list-style: none; padding: 0; margin: 0 0 12px; }
.official-item {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; margin-bottom: 8px;
  border-left: 4px solid var(--suspicious); background: #fdf6f5; border-radius: 8px; font-size: 15px;
}
.official-item span { font-size: 14px; color: var(--muted); }
.official-none { padding: 10px 12px; background: #eef9f2; border-radius: 8px; color: var(--verified); font-weight: 600; }
.demo-toggle { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); cursor: pointer; }
.demo-toggle input { width: 18px; height: 18px; }
.demo-badge {
  font-size: 11px; vertical-align: middle; background: #6b3fa0; color: #fff;
  padding: 2px 6px; border-radius: 4px; letter-spacing: 0.06em;
}

/* ===== Offline banner ===== */
.offline-banner {
  background: var(--unverified);
  color: #fff;
  text-align: center;
  padding: 10px;
  font-weight: 600;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.offline-banner + .app-header { padding-top: 16px; }

/* ===== Footer ===== */
.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

/* ===== Share (QR) ===== */
.btn-share {
  width: 100%; margin-top: 16px; padding: 12px; font: inherit; font-weight: 700;
  color: var(--navy); background: #eef2f7; border: 1px solid #d5dde8; border-radius: 10px; cursor: pointer;
}
.btn-share:active { background: #e1e7ef; }
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(11, 31, 58, 0.6); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto;
}
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet h2 { margin: 0 0 6px; font-size: 20px; }
.sheet p { margin: 0 0 10px; font-size: 15px; }
.qr-box { width: min(78vw, 320px); margin: 12px auto 14px; border: 1px solid #e1e7ef; border-radius: 12px; overflow: hidden; }
.qr-box svg { display: block; width: 100%; height: auto; }
.sheet .note { font-size: 14px; color: var(--muted); }
.sheet .warn { font-size: 14px; color: var(--unverified); font-weight: 600; }
.sheet-actions { display: grid; gap: 8px; margin-top: 14px; }
.shared-banner {
  background: #eaf1fb; border: 1px solid #c6d7f0; color: var(--navy-light);
  border-radius: 10px; padding: 10px 12px; font-size: 15px; font-weight: 600; margin-bottom: 12px;
}

/* ===== Spot the Fake game ===== */
.game-card p { margin: 0; font-weight: 600; }
.game-card .btn-share { margin-top: 12px; }
.game { position: relative; }
.game-close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid #d5dde8; background: #fff; font-size: 16px; cursor: pointer; color: var(--muted);
}
.game-emoji { font-size: 48px; text-align: center; margin: 8px 0 4px; }
.game h2 { padding-right: 44px; }
.game-progress { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); margin: 4px 48px 14px 0; }
.game-dots { display: flex; gap: 6px; }
.game-dots i { width: 10px; height: 10px; border-radius: 50%; background: #d5dde8; }
.game-dots i.done { background: var(--navy-light); }
.game-dots i.now { background: var(--navy); box-shadow: 0 0 0 3px #c6d7f0; }
.game-message {
  background: #f7f9fc; border: 1px solid #e1e7ef; border-radius: 12px; padding: 14px;
  font-size: 17px; margin: 10px 0 16px; white-space: pre-wrap; word-break: break-word;
}
.game-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-choices button {
  font: inherit; font-size: 18px; font-weight: 800; padding: 16px 8px; border-radius: 12px; cursor: pointer; border: 2px solid;
}
.choice-real { background: #eef9f2; border-color: var(--verified) !important; color: var(--verified); }
.choice-fake { background: #fdf0ee; border-color: var(--suspicious) !important; color: var(--suspicious); }
.game-feedback { border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.game-feedback strong { font-size: 20px; }
.game-feedback.right { background: #eef9f2; color: var(--verified); }
.game-feedback.wrong { background: #fdf0ee; color: var(--suspicious); }
.game-feedback span { color: var(--text); font-weight: 600; }
.game .btn-primary { margin-top: 16px; }
.game-bar { margin: 6px 0 14px; }
.game-bar .meter-fill { background: var(--verified); }
.game-tip { background: #fdf6ea; border-radius: 10px; padding: 10px 12px; font-size: 15px; }
