/* Scam Text Decoder — styles.css */
:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #13151c;
  --border: #2a2e3b;
  --border-light: #3a3f52;
  --text: #e2e4ed;
  --text-muted: #8b8fa3;
  --text-dim: #5c6078;
  --accent: #dc2626;
  --accent-light: #ef4444;
  --accent-glow: rgba(220, 38, 38, 0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.12);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.site-nav a:hover { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

.btn-small { padding: 6px 14px; font-size: 0.82rem; }
.btn-tiny { padding: 2px 8px; font-size: 0.75rem; }

/* Section: Decoder */
.section-decoder { padding: 60px 0 40px; }

.decoder-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
}

.decoder-main h1 {
  font-size: 2.2rem;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.decoder-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 28px;
  max-width: 600px;
}

.input-area textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 16px;
  resize: vertical;
  min-height: 160px;
  transition: border-color 0.2s;
}

.input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-area textarea::placeholder { color: var(--text-dim); }

.input-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Results */
.results-area {
  margin-top: 32px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.risk-gauge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.gauge-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.gauge-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease, background 0.6s ease;
  width: 0%;
}

.gauge-text {
  font-weight: 700;
  font-size: 1.1rem;
}

.highlighted-output {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Tactic tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: default;
}

.tag.urgency { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(249,115,22,0.3); }
.tag.authority { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(59,130,246,0.3); }
.tag.fear { background: rgba(220,38,38,0.15); color: var(--accent-light); border: 1px solid rgba(220,38,38,0.3); }
.tag.reward { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(251,191,36,0.3); }
.tag.curiosity { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,0.3); }
.tag.social-proof { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.tag.personal-info { background: rgba(239,68,68,0.2); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.tag.link-pressure { background: rgba(251,146,60,0.15); color: #fb923c; border: 1px solid rgba(251,146,60,0.3); }

.highlighted-output .hl {
  padding: 2px 4px;
  border-radius: 4px;
  cursor: help;
  border-bottom: 2px solid currentColor;
  transition: background 0.2s;
}

.highlighted-output .hl:hover { opacity: 0.85; }

.tactic-breakdown {
  margin-bottom: 20px;
}

.tactic-breakdown h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.breakdown-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.breakdown-list .tag { flex-shrink: 0; margin-top: 2px; }

.breakdown-list .bd-text { font-size: 0.9rem; color: var(--text-muted); }
.breakdown-list .bd-text strong { color: var(--text); }

.safe-response-box {
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.safe-response-box h3 {
  color: var(--green);
  font-size: 1rem;
  margin-bottom: 8px;
}

.safe-response-box p {
  color: var(--text);
  font-size: 0.95rem;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Sidebar */
.decoder-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tactic-legend, .history-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.tactic-legend h2, .history-panel h2 {
  font-size: 0.95rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tactic-legend ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tactic-legend li {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tactic-legend li .tag { flex-shrink: 0; }

#history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

#history-list li {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

#history-list li:hover { border-color: var(--text-dim); }

#history-list .hist-risk {
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

#history-list .hist-preview {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#history-list .hist-time {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-top: 4px;
}

/* Section: Patterns */
.section-patterns { padding: 60px 0; }
.section-patterns h2, .section-reference h2, .section-templates h2, .section-edge h2, .section-how h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.section-intro {
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 650px;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.pattern-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.pattern-card:hover { border-color: var(--border-light); }

.pattern-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pattern-type {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}

.pattern-risk {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.risk-high { background: rgba(220,38,38,0.15); color: var(--accent-light); }
.risk-medium { background: var(--yellow-dim); color: var(--yellow); }
.risk-low { background: var(--green-dim); color: var(--green); }

.pattern-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 14px;
  line-height: 1.6;
}

.pattern-text a { color: var(--accent-light); text-decoration: underline; }

.pattern-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Section: Reference */
.section-reference { padding: 60px 0; }

.reference-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
}

.ref-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.ref-card-header h3 { font-size: 1.2rem; }
.ref-version { color: var(--text-dim); font-size: 0.8rem; }

.ref-list {
  list-style: none;
  counter-reset: ref;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ref-list li {
  counter-increment: ref;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-left: 36px;
  position: relative;
}

.ref-list li::before {
  content: counter(ref);
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  background: var(--accent-glow);
  color: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.ref-list li strong { color: var(--text); }

.ref-card-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Section: Templates */
.section-templates { padding: 60px 0; }

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.template-card h3 { font-size: 1rem; margin-bottom: 6px; }
.template-scenario { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 16px; }
.template-body { flex: 1; font-size: 0.88rem; color: var(--text-muted); }
.template-body p { margin-bottom: 8px; }
.template-body strong { color: var(--text); }
.template-card .btn { margin-top: 16px; align-self: flex-start; }

/* Section: Edge Cases */
.section-edge { padding: 60px 0; }

.edge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.edge-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.edge-card h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--yellow); }
.edge-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.7; }

/* Section: How It Works */
.section-how { padding: 60px 0; }

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.how-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.step-num {
  width: 36px;
  height: 36px;
  background: var(--accent-glow);
  color: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.how-step h3 { font-size: 0.95rem; margin-bottom: 8px; }
.how-step p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; }

.assumptions-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.assumptions-box h3 { font-size: 1rem; margin-bottom: 14px; }
.assumptions-box ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.assumptions-box li { font-size: 0.88rem; color: var(--text-muted); padding-left: 20px; position: relative; }
.assumptions-box li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: 40px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--text); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom a { color: var(--text-muted); }
.footer-note { max-width: 500px; text-align: right; }

/* Print */
@media print {
  .site-header, .site-footer, .input-area, .result-actions, .decoder-side, .section-patterns, .section-templates, .section-edge, .section-how, .section-reference .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .results-area { display: block !important; }
  .reference-card { border: 2px solid #000; background: #fff; }
  .gauge-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Responsive */
@media (max-width: 900px) {
  .decoder-layout { grid-template-columns: 1fr; }
  .decoder-side { flex-direction: row; flex-wrap: wrap; }
  .tactic-legend, .history-panel { flex: 1; min-width: 260px; }
  .decoder-main h1 { font-size: 1.7rem; }
}

@media (max-width: 600px) {
  .site-header .container { flex-direction: column; height: auto; padding: 12px 20px; gap: 10px; }
  .site-nav { gap: 14px; flex-wrap: wrap; justify-content: center; }
  .decoder-main h1 { font-size: 1.4rem; }
  .pattern-grid, .template-grid, .edge-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: left; }
  .footer-note { text-align: left; }
  .how-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .how-grid { grid-template-columns: 1fr; }
  .input-actions { flex-direction: column; }
  .input-actions .btn { width: 100%; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
