/* Phishing-Check — eigenes Design: Warn-Gelb/Schwarz, Sicherheits-Look */
:root {
  --accent: #ca8a04;
  --accent-bright: #eab308;
  --accent-soft: rgba(202, 138, 4, 0.16);

  --risk-low: #16a34a;
  --risk-med: #d97706;
  --risk-high: #dc2626;

  --radius: 14px;
  --radius-sm: 9px;
  --gap: 16px;
  --maxw: 720px;

  --ring: 0 0 0 3px rgba(234, 179, 8, 0.55);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Dunkelmodus (Standard) */
[data-theme="dark"] {
  --bg: #0c0a06;
  --bg-grad-a: #14110a;
  --bg-grad-b: #0a0a0a;
  --surface: #1a160e;
  --surface-2: #221d12;
  --border: #3a3118;
  --text: #f5efe0;
  --text-dim: #b9b196;
  --text-faint: #8a8268;
  --chip-bg: #241f14;
  --code-bg: #2a2415;
}

/* Hellmodus */
[data-theme="light"] {
  --bg: #f7f3e8;
  --bg-grad-a: #fbf8ef;
  --bg-grad-b: #f0ead8;
  --surface: #ffffff;
  --surface-2: #fbf6e9;
  --border: #e3d8b8;
  --text: #1c1708;
  --text-dim: #5c5331;
  --text-faint: #8a7f55;
  --chip-bg: #f4eed8;
  --code-bg: #f1e8cd;
  --shadow: 0 10px 28px rgba(120, 90, 0, 0.14);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-a), var(--bg-grad-b));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.55;
  padding:
    env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #000;
  padding: 10px 14px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

.visually-on {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 6px;
}

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

.brand-shield {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--accent-bright));
  color: #1a1300;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15), 0 4px 12px rgba(202,138,4,.35);
}

.brand-text { min-width: 0; }
.brand h1 {
  font-size: 1.32rem;
  margin: 0;
  letter-spacing: .3px;
  line-height: 1.1;
}
.brand-sub {
  margin: 2px 0 0;
  font-size: .78rem;
  color: var(--text-dim);
  letter-spacing: .2px;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, color .18s ease;
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-bright));
  color: #1a1300;
  border-color: transparent;
  font-weight: 800;
}
.btn-ghost { background: transparent; }
.btn-danger { background: var(--risk-high); color: #fff; border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

.btn-icon {
  padding: 9px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 1.15rem;
  background: var(--surface-2);
}

/* Main */
.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-size: 1.05rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.intro { border-left: 4px solid var(--accent); }
.intro-text { margin: 0 0 12px; color: var(--text); }
.intro-text strong { color: var(--accent-bright); }

.disclaimer {
  margin: 0;
  font-size: .85rem;
  color: var(--text-dim);
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.disc-icon { color: var(--accent-bright); font-weight: 800; }

/* Form */
.field-label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 8px;
}
.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.text-input {
  flex: 1 1 220px;
  min-width: 0;
  font: inherit;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  word-break: break-all;
}
.text-input::placeholder { color: var(--text-faint); }
.text-input:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }

.input-row .btn-primary { flex: 0 0 auto; }

.field-hint {
  margin: 8px 0 0;
  font-size: .78rem;
  color: var(--text-faint);
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chip {
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
  background: var(--chip-bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  transition: border-color .18s, color .18s, background .18s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }

/* Result */
.result-panel { border-top: 4px solid var(--border); }
.result-head {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.gauge {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: #0a0a0a;
  border: 1px solid #000;
  flex: none;
  box-shadow: inset 0 0 8px rgba(0,0,0,.6);
}
.gauge-light {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,.06);
  transition: box-shadow .25s, background .25s, opacity .25s;
  opacity: .35;
}
.gauge[data-level="high"] .light-red   { background: var(--risk-high); opacity: 1; box-shadow: 0 0 14px 2px var(--risk-high); }
.gauge[data-level="med"]  .light-yellow { background: var(--risk-med);  opacity: 1; box-shadow: 0 0 14px 2px var(--risk-med); }
.gauge[data-level="low"]  .light-green  { background: var(--risk-low);  opacity: 1; box-shadow: 0 0 14px 2px var(--risk-low); }

.result-summary { min-width: 0; flex: 1 1 220px; }
.result-verdict {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
.result-verdict[data-level="high"] { color: var(--risk-high); }
.result-verdict[data-level="med"]  { color: var(--risk-med); }
.result-verdict[data-level="low"]  { color: var(--risk-low); }

.result-score { margin: 4px 0 0; font-size: .85rem; color: var(--text-dim); }
.result-target {
  margin: 8px 0 0;
  font-size: .82rem;
  color: var(--text-faint);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  word-break: break-all;
  background: var(--code-bg);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.findings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.finding {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface-2);
  border-left-width: 4px;
}
.finding[data-sev="high"] { border-left-color: var(--risk-high); }
.finding[data-sev="med"]  { border-left-color: var(--risk-med); }
.finding[data-sev="low"]  { border-left-color: var(--risk-low); }
.finding[data-sev="ok"]   { border-left-color: var(--risk-low); }

.finding-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.finding-title { font-weight: 700; font-size: .95rem; }
.sev-tag {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  flex: none;
}
.sev-tag[data-sev="high"] { background: rgba(220,38,38,.18); color: var(--risk-high); }
.sev-tag[data-sev="med"]  { background: rgba(217,119,6,.18); color: var(--risk-med); }
.sev-tag[data-sev="low"]  { background: rgba(22,163,74,.18); color: var(--risk-low); }
.sev-tag[data-sev="ok"]   { background: rgba(22,163,74,.18); color: var(--risk-low); }

.finding-text { margin: 0; font-size: .85rem; color: var(--text-dim); }
.finding-text code,
.tips-list code,
.intro-text code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .82em;
  word-break: break-all;
}

.tips-block {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 4px 14px;
}
.tips-block summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px 0;
  list-style: none;
}
.tips-block summary::-webkit-details-marker { display: none; }
.tips-block summary::before { content: "▸ "; color: var(--accent-bright); }
.tips-block[open] summary::before { content: "▾ "; }
.tips-block summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.tips-list { margin: 0 0 12px; padding-left: 20px; }
.tips-list li { margin-bottom: 8px; font-size: .85rem; color: var(--text-dim); }

/* History */
.hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.hist-head .panel-title { margin: 0; }
.hist-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: var(--text);
  transition: border-color .18s;
}
.hist-item:hover { border-color: var(--accent); }
.hist-item:focus-visible { outline: none; box-shadow: var(--ring); }
.hist-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.hist-dot[data-level="high"] { background: var(--risk-high); }
.hist-dot[data-level="med"]  { background: var(--risk-med); }
.hist-dot[data-level="low"]  { background: var(--risk-low); }
.hist-main { min-width: 0; flex: 1 1 auto; }
.hist-target {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-meta { font-size: .72rem; color: var(--text-faint); display: block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.hist-empty { margin: 12px 0 0; font-size: .85rem; color: var(--text-faint); }
/* Mobile-Schutz: lange URLs/Inhalte sprengen die Breite nicht */
.hist-item, .hist-list, .hist-main { min-width: 0; max-width: 100%; }
.hist-target { display: block; max-width: 100%; }
.modal { max-width: calc(100vw - 24px); }
.modal-title, .modal * { overflow-wrap: anywhere; }

/* Footer */
.app-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px 28px;
  text-align: center;
}
.app-footer p { margin: 0; font-size: .74rem; color: var(--text-faint); }

/* Toast */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .88rem;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 300;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
}
.modal-title { margin: 0 0 8px; font-size: 1.1rem; }
.modal-text { margin: 0 0 18px; color: var(--text-dim); font-size: .9rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .btn:hover { transform: none; }
}

/* Mobile feinschliff */
@media (max-width: 480px) {
  .brand h1 { font-size: 1.18rem; }
  .input-row .btn-primary { flex: 1 1 100%; }
  .result-head { gap: 12px; }
  .gauge { flex-direction: row; }
}
