:root {
  --bg: #f5f7fc;
  --surface: #ffffff;
  --ink: #16203a;
  --ink-soft: #4a5773;
  --line: #e3e8f3;
  --brand: #2348c9;
  --brand-dark: #1a36a0;
  --brand-soft: #eaf0ff;
  --safe: #15a05a;
  --warn: #d98a0b;
  --danger: #d83a3a;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(20, 35, 80, 0.08);
  --shadow-lg: 0 12px 40px rgba(20, 35, 80, 0.14);
  --max: 980px;
}

* { box-sizing: border-box; }

/* hidden-Attribut muss CSS-display schlagen (Modal, Loading, Preview etc.) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }

a { color: var(--brand); }

/* HEADER */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 28px);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-logo { border-radius: 8px; display: block; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.header-nav { display: flex; align-items: center; gap: 8px; }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-btn { border: 0; background: transparent; padding: 6px 11px; font-weight: 700; font-size: .82rem; color: var(--ink-soft); cursor: pointer; }
.lang-btn.active { background: var(--brand); color: #fff; }

/* BUTTONS */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #b8c2dd; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost:disabled { color: var(--safe); border-color: var(--line); cursor: default; }

/* TOOL SECTION */
main { max-width: var(--max); margin: 0 auto; padding: clamp(20px, 5vw, 44px) clamp(14px, 4vw, 28px) 64px; }

.tool-intro { text-align: center; margin-bottom: 22px; }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); margin: 0 0 10px; }
.lead { font-size: clamp(1rem, 2.6vw, 1.18rem); color: var(--ink-soft); max-width: 620px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 4vw, 26px);
}

.uploader { display: flex; flex-direction: column; gap: 16px; }

.dropzone {
  border: 2px dashed #c2cce6;
  border-radius: 14px;
  background: var(--brand-soft);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  padding: 18px;
  overflow: hidden;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--brand);
  background: #e2eaff;
  outline: none;
}
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink-soft); }
.dz-icon { width: 46px; height: 46px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { font-weight: 700; color: var(--ink); font-size: 1.05rem; margin: 0; }
.dz-hint { font-size: .88rem; margin: 0; }
.preview { max-width: 100%; max-height: 340px; border-radius: 10px; display: block; object-fit: contain; }

.controls { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.lang-out {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.lang-out select {
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}
.controls .btn-primary { flex: 0 0 auto; align-self: flex-end; }

.trust-line { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-soft); margin: 0; }
.dot-safe { width: 9px; height: 9px; border-radius: 50%; background: var(--safe); flex: 0 0 auto; }
.quota-line { font-size: .82rem; color: var(--ink-soft); margin: 0; }
.page-info { font-size: .82rem; font-weight: 600; color: var(--brand); margin: -6px 0 0; }

/* LOADING */
.loading { display: flex; align-items: center; gap: 14px; margin-top: 18px; justify-content: center; color: var(--ink-soft); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* RESULT CARD */
.result { margin-top: 18px; padding: 0; overflow: hidden; }
.result-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px clamp(16px, 4vw, 24px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.urgency-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: .85rem;
  padding: 5px 12px; border-radius: 999px;
}
.urgency-chip .ring { width: 10px; height: 10px; border-radius: 50%; }
.u-high { background: #fdecec; color: var(--danger); }
.u-high .ring { background: var(--danger); }
.u-medium { background: #fdf3e0; color: var(--warn); }
.u-medium .ring { background: var(--warn); }
.u-low { background: #e7f6ee; color: var(--safe); }
.u-low .ring { background: var(--safe); }
.sender-tag { font-weight: 600; color: var(--ink-soft); font-size: .9rem; }

.result-body { padding: clamp(16px, 4vw, 24px); display: flex; flex-direction: column; gap: 18px; }
.r-block { }
.r-label { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 6px; }
.r-summary { font-size: 1.15rem; font-weight: 600; margin: 0; }
.r-text { margin: 0; }
.r-actions { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.r-actions li { display: flex; gap: 10px; align-items: flex-start; }
.r-actions .step-dot { flex: 0 0 24px; height: 24px; background: var(--brand); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; }
.r-meta { display: flex; flex-wrap: wrap; gap: 12px; }
.meta-pill { flex: 1 1 180px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.meta-pill .mp-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 3px; }
.meta-pill .mp-val { font-weight: 600; margin: 0; }

.scam { border-radius: 12px; padding: 14px 16px; display: flex; gap: 11px; align-items: flex-start; color: #16203a; }
.scam-ok { background: #e7f6ee; }
.scam-warn { background: #fdecec; }
.scam .scam-icon { flex: 0 0 auto; font-size: 1.2rem; }

.reply-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; font-size: .96rem; }
.reply-locked { position: relative; }
.reply-locked .reply-blur { filter: blur(5px); user-select: none; pointer-events: none; }
.reply-cta { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 4px; }

.result-foot { padding: 14px clamp(16px, 4vw, 24px); border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.result-foot .legal { font-size: .78rem; color: var(--ink-soft); margin: 0; flex: 1 1 200px; }
.foot-actions { display: flex; gap: 8px; }

.result-error { padding: clamp(18px, 4vw, 26px); text-align: center; }
.result-error .err-icon { font-size: 2rem; }
.result-error h3 { margin: 8px 0; }
.result-error p { color: var(--ink-soft); margin: 0 0 14px; }

/* SECTIONS */
.steps, .trust, .pricing, .faq { margin-top: 56px; }
.steps h2, .trust h2, .pricing h2, .faq h2 { text-align: center; font-size: clamp(1.4rem, 4vw, 2rem); margin: 0 0 24px; }

.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; text-align: center; }
.step-num { width: 38px; height: 38px; margin: 0 auto 12px; background: var(--brand-soft); color: var(--brand); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.step h3 { margin: 0 0 6px; font-size: 1.08rem; }
.step p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.trust-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.trust-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.trust-list strong { display: block; margin-bottom: 4px; }
.trust-list span { color: var(--ink-soft); font-size: .95rem; }

/* PRICING */
.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; max-width: 660px; margin: 0 auto; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; position: relative; display: flex; flex-direction: column; }
.plan-pro { border: 2px solid var(--brand); box-shadow: var(--shadow-lg); }
.plan .badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: .74rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.plan h3 { margin: 0 0 6px; }
.price { font-size: 2rem; font-weight: 800; margin: 0; }
.price .per { font-size: .95rem; font-weight: 600; color: var(--ink-soft); }
.price-alt { color: var(--ink-soft); font-size: .88rem; margin: 2px 0 0; }
.billing-toggle { display: flex; gap: 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 5px; margin: 8px 0 12px; }
.billing-toggle button { flex: 1 1 0; border: 0; background: transparent; border-radius: 8px; padding: 8px 4px; font-size: .76rem; font-weight: 700; color: var(--ink-soft); cursor: pointer; line-height: 1.1; }
.billing-toggle button.active { background: var(--brand); color: #fff; }
.save-badge { display: inline-block; background: #e7f6ee; color: var(--safe); font-weight: 700; font-size: .74rem; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.plan ul { list-style: none; padding: 0; margin: 16px 0 20px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan ul li { padding-left: 26px; position: relative; }
.plan ul li::before { content: "✓"; position: absolute; left: 0; color: var(--safe); font-weight: 800; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; padding: 12px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--ink-soft); }

/* FOOTER */
.site-footer { text-align: center; padding: 30px 20px 40px; color: var(--ink-soft); font-size: .88rem; border-top: 1px solid var(--line); margin-top: 50px; }
.footer-disclaimer { font-size: .78rem; opacity: .8; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--brand); }

/* LEGAL PAGES */
.legal { max-width: 760px; }
.legal h1 { margin-bottom: 14px; }
.legal h2 { margin-top: 26px; font-size: 1.12rem; }
.legal p, .legal li { color: var(--ink-soft); }
.legal a { color: var(--brand); }
.legal .legal-note { font-size: .85rem; background: var(--brand-soft); padding: 12px 14px; border-radius: 10px; color: var(--ink); }

/* PRINT: nur die Erklär-Karte + dezentes Clario-Wasserzeichen */
@media print {
  body * { visibility: hidden; }
  #result, #result * { visibility: visible; }
  #result { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: none; }
  .foot-actions { display: none !important; }
  #result::after { content: "Erstellt mit Clario · clario.help"; display: block; text-align: center; color: #888; font-size: 11px; margin-top: 16px; }
}

/* ACCOUNT / LOGIN */
.account-box { display: inline-flex; gap: 6px; align-items: center; }
.login-input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 1rem; margin: 6px 0 12px; background: #fff; color: var(--ink); }
.login-status { font-size: .85rem; color: var(--ink-soft); margin: 10px 0 0; }
#loginModal .btn-primary { width: 100%; }
#loginCodeSection { margin-top: 6px; }
@media (prefers-color-scheme: dark) { .login-input { background: #11192e; } }
@media (max-width: 720px) { #loginBtn[data-i18n], .account-box { font-size: .85rem; } }

/* TOAST */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .25s, transform .25s; z-index: 60; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* MODAL */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 28px 24px; max-width: 420px; width: 100%; text-align: center; position: relative; box-shadow: var(--shadow-lg); }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.modal-card h3 { margin: 4px 0 10px; }
.modal-card p { color: var(--ink-soft); margin: 0 0 14px; }
.paywall-price { font-weight: 700; color: var(--ink) !important; }
.paywall-note { font-size: .78rem; margin-top: 12px !important; }

/* RTL support for result content */
[dir="rtl"] .r-actions li, [dir="rtl"] .scam { direction: rtl; text-align: right; }

/* RESPONSIVE: Desktop zweispaltig im Tool */
@media (min-width: 860px) {
  .uploader { display: grid; grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .steps-grid, .trust-list { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .controls { flex-direction: column; }
  .controls .btn-primary { align-self: stretch; }
  .header-nav .btn-ghost[href="#preise"] { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1729;
    --surface: #18233d;
    --ink: #eef2fb;
    --ink-soft: #a7b2cc;
    --line: #283456;
    --brand-soft: #1e2c52;
  }
  .site-header { background: rgba(15, 23, 41, 0.9); }
  .lang-out select, .reply-box, .meta-pill { background: #11192e; color: var(--ink); }
  .dropzone { background: #1a274a; border-color: #34436e; }
  .dropzone:hover, .dropzone.dragover { background: #20305c; }
  .modal-card { background: var(--surface); }
}
