@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Manrope:wght@400;500;600;700;800&display=swap');

/* ══════════════════════════════════════════
   DESIGN TOKENS
   Theme: Editorial Newspaper — bold, high-contrast,
   unmistakably authoritative. Light base, ink blacks,
   stark red/green verdicts that demand attention.
══════════════════════════════════════════ */
:root {
  --page-bg:      #f5f2eb;       /* warm newsprint */
  --surface:      #ffffff;
  --surface-alt:  #f9f7f2;
  --ink:          #111111;       /* near-black text */
  --ink-mid:      #444444;
  --ink-light:    #888888;
  --ink-faint:    #cccccc;

  --rule:         #e0ddd6;       /* divider lines */

  --red:          #d42b2b;       /* FAKE verdict */
  --red-bg:       #fff0f0;
  --red-border:   #f5c0c0;

  --green:        #1a7a4a;       /* REAL verdict */
  --green-bg:     #f0fff6;
  --green-border: #a8e6c4;

  --accent:       #d42b2b;       /* primary accent = red */

  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    16px;

  --shadow-card:  0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-lift:  0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── BASE ── */
body {
  font-family: 'Manrope', sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  min-height: 100vh;
  padding: 48px 20px 100px;
  line-height: 1.6;
  /* Subtle paper texture via repeating gradient */
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(212,43,43,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(26,122,74,0.02) 0%, transparent 50%);
}

/* ── LAYOUT ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ══════════════════════════════════════════
   HEADER — newspaper masthead style
══════════════════════════════════════════ */
.header {
  text-align: center;
  padding: 0 0 28px;
  border-bottom: 3px double var(--ink);
  animation: fadeDown 0.5s ease both;
}

/* "EST. 2026" editorial tag */
.header::before {
  content: 'AI · VERIFICATION SYSTEM · EST. 2026';
  display: block;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--ink-light);
  margin-bottom: 18px;
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.0;
  color: var(--ink);
  margin-bottom: 14px;
}

/* Red underline accent on title */
.header h1 span {
  color: var(--red);
  border-bottom: 4px solid var(--red);
}

.subtitle {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-mid);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.5s ease both;
  transition: box-shadow 0.25s ease;
}
.card:hover { box-shadow: var(--shadow-lift); }

.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.18s; }

/* ── INPUT LABEL ── */
.input-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--ink-light);
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── TEXTAREA ── */
textarea {
  width: 100%;
  min-height: 210px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--rule);
  background: var(--surface-alt);
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.75;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  caret-color: var(--red);
}

textarea::placeholder {
  color: var(--ink-faint);
  font-style: italic;
  font-weight: 400;
}

textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(17,17,17,0.06);
}

/* ── CHAR COUNT ── */
.char-count {
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

/* ── BUTTONS ── */
button {
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 28px;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.18s ease;
}

#detectBtn {
  background: var(--ink);
  color: #ffffff;
  margin-right: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#detectBtn:hover:not(:disabled) {
  background: #000000;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}

#detectBtn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#detectBtn:disabled {
  background: var(--ink-faint);
  color: #fff;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--ink-mid);
  border: 2px solid var(--rule);
}

.btn-secondary:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
  background: var(--surface-alt);
}

.btn-small {
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  color: var(--ink-mid);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.btn-small:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface-alt);
}

/* ── LOADING ── */
.loading {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-mid);
  font-size: 14px;
  font-weight: 600;
  padding: 20px 28px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  letter-spacing: 0.02em;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--rule);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   RESULT CARD — the hero moment
   Verdict is HUGE. Confidence is BIG.
   Nothing is hidden or faint.
══════════════════════════════════════════ */
.result-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 48px 40px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.4s ease both;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

/* Thick top border takes the verdict color */
.result-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: var(--rule);
  transition: background 0.4s ease;
}

.result-card.fake-verdict::before  { background: var(--red); }
.result-card.real-verdict::before  { background: var(--green); }

.result-card.fake-verdict {
  border-color: var(--red-border);
  box-shadow: var(--shadow-lift), 0 0 0 1px var(--red-border);
  background: var(--red-bg);
}

.result-card.real-verdict {
  border-color: var(--green-border);
  box-shadow: var(--shadow-lift), 0 0 0 1px var(--green-border);
  background: var(--green-bg);
}

/* VERDICT WORD — unmissable */
.result-label {
  font-family: 'Playfair Display', serif;
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 900;
  letter-spacing: -3px;
  line-height: 1;
  margin-bottom: 6px;
  animation: verdictPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.fake-result { color: var(--red); }
.real-result { color: var(--green); }

/* CONFIDENCE — big, bold, prominent */
.result-confidence {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

/* Secondary line under confidence */
.result-confidence::before {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--ink-faint);
  margin: 10px auto 16px;
  border-radius: 2px;
}

/* ── PROBABILITY BARS ── */
.prob-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 440px;
  margin: 0 auto;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.prob-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.prob-name {
  width: 48px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}

.prob-row:first-child .prob-name { color: var(--red); }
.prob-row:last-child  .prob-name { color: var(--green); }

.prob-bar-bg {
  flex: 1;
  height: 10px;
  border-radius: 99px;
  background: rgba(0,0,0,0.07);
  overflow: hidden;
}

.prob-bar {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fake-bar  { background: var(--red); }
.real-bar  { background: var(--green); }

.prob-value {
  width: 56px;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.prob-row:first-child .prob-value { color: var(--red); }
.prob-row:last-child  .prob-value { color: var(--green); }

/* ── ERROR BOX ── */
.error-box {
  background: var(--red-bg);
  border: 1.5px solid var(--red-border);
  color: var(--red);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  animation: fadeUp 0.3s ease both;
}

/* ── STATS BAR ── */
.stats-bar {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow-card);
}

.stats-bar span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stats-bar strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
  text-transform: none;
}

/* ── HISTORY ── */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.history-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.history-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.history-item:last-child { border-bottom: none; }

.history-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.history-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.history-badge.fake {
  background: var(--red-bg);
  color: var(--red);
  border: 1.5px solid var(--red-border);
}

.history-badge.real {
  background: var(--green-bg);
  color: var(--green);
  border: 1.5px solid var(--green-border);
}

.history-conf {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-mid);
}

.history-time {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-light);
  margin-left: auto;
}

.history-preview {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-mid);
  line-height: 1.65;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }

.muted {
  color: var(--ink-light);
  font-size: 14px;
  font-weight: 500;
  font-style: italic;
  padding: 12px 0;
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes verdictPop {
  from { opacity: 0; transform: scale(0.75) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  body { padding: 28px 14px 60px; }
  .header h1 { font-size: 2.2rem; letter-spacing: -0.5px; }
  .card { padding: 22px 18px; }
  .result-card { padding: 36px 20px 28px; }
  .result-label { font-size: 4.5rem; letter-spacing: -2px; }
  .result-confidence { font-size: 1.4rem; }
  #detectBtn { width: 100%; margin-right: 0; margin-bottom: 10px; }
  .btn-secondary { width: 100%; }
  .stats-bar { gap: 16px; }
  .stats-bar strong { font-size: 18px; }
}