:root {
  --ink: #191C2B;
  --muted: #5B6478;
  --bg: #F2F4F9;
  --surface: #FFFFFF;
  --border: #DDE2EC;
  --accent: #12707E;
  --accent-press: #0D555F;

  --red: #C93A3A;
  --red-bg: #FBEBEB;
  --yellow: #B9770E;
  --yellow-bg: #FBF1DF;
  --green: #1F8A5B;
  --green-bg: #E7F4EC;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(25,28,43,.06), 0 8px 24px rgba(25,28,43,.06);
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100dvh; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

/* ---- Header ---- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.mark svg { width: 19px; height: 19px; }

.brand-text { min-width: 0; }
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.01em;
  line-height: 1;
}
.brand-tag {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang {
  flex: 0 0 auto;
  position: relative;
}
.lang select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  padding: 9px 30px 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  max-width: 140px;
}
.lang::after {
  content: "";
  position: absolute;
  right: 11px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ---- Input card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
}
textarea::placeholder { color: #9AA2B4; }

.check-btn {
  margin-top: 12px;
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  padding: 15px 18px;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}

.tools { margin-top: 10px; }
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #F3F5FA;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease;
}
.tool-btn:hover { background: #E9EDF4; }
.tool-btn svg { color: var(--accent); flex: 0 0 auto; }

.preview { margin-top: 12px; }
.preview.hidden { display: none; }
.preview img {
  max-width: 170px;
  max-height: 170px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}
.remove-btn {
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: var(--body);
  color: var(--ink);
  cursor: pointer;
}
.remove-btn:hover { background: #F3F5FA; }
.check-btn:hover { background: var(--accent-press); }
.check-btn:active { transform: translateY(1px); }
.check-btn:disabled { opacity: .6; cursor: default; }

.err {
  color: var(--red);
  font-size: 14px;
  margin: 10px 2px 0;
  min-height: 0;
}

/* ---- Verdict ---- */
.verdict {
  margin-top: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.verdict.hidden { display: none; }

.verdict-band {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
}
.verdict-icon {
  font-size: 34px;
  line-height: 1;
  flex: 0 0 auto;
}
.verdict-badge {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -.01em;
  color: #fff;
  line-height: 1.15;
}

.verdict.RED    .verdict-band { background: var(--red); }
.verdict.YELLOW .verdict-band { background: var(--yellow); }
.verdict.GREEN  .verdict-band { background: var(--green); }

.verdict-body { padding: 4px 18px 18px; }

.verdict-headline {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  margin: 14px 0 4px;
  line-height: 1.3;
}

.row { margin-top: 14px; }
.row-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 3px;
}
.row-text { font-size: 16px; line-height: 1.5; }

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.signal {
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(201,58,58,.18);
}
.verdict.YELLOW .signal { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(185,119,14,.2); }
.verdict.GREEN  .signal { background: var(--green-bg); color: var(--green); border-color: rgba(31,138,91,.2); }

.report {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F7F9FC;
}
.report.hidden { display: none; }
.report-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 11px;
}
.report-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.report-btn {
  flex: 1 1 45%;
  text-align: center;
  text-decoration: none;
  padding: 12px 10px;
  border-radius: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  transition: background .15s ease;
}
.report-btn:hover { background: #F0F3F8; }
.report-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.report-btn.primary:hover { background: var(--accent-press); }

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn-secondary, .btn-share {
  flex: 1;
  border-radius: 12px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  transition: background .15s ease;
}
.btn-secondary:hover { background: #F3F5FA; }
.btn-share {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-share:hover { background: #0F1220; }
.btn-share:disabled { opacity: .6; cursor: default; }

/* ---- Disclaimer ---- */
.disclaimer {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #E9ECF4;
  color: #4A5266;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
}
.disclaimer svg { flex: 0 0 auto; margin-top: 1px; }

.footer {
  text-align: center;
  color: #9AA2B4;
  font-size: 12px;
  margin-top: 26px;
}
.footer b { font-family: var(--display); color: var(--muted); font-weight: 600; }

/* Spinner */
.spin {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* RTL (Urdu) */
[dir="rtl"] .verdict-band { flex-direction: row-reverse; }
[dir="rtl"] .lang::after { right: auto; left: 11px; }
[dir="rtl"] .lang select { padding: 9px 12px 9px 30px; }

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
  * { transition: none !important; }
}

/* offscreen canvas holder */
#cardCanvas { display: none; }
