/* ── Design tokens (mirrors KonzeptHub) ─────────────────── */
:root {
  --bg:         #0b0f19;
  --surface:    #0f172a;
  --surface2:   #1e293b;
  --border:     #1e293b;
  --border2:    #334155;
  --blue:       #2563eb;
  --blue-lt:    #60a5fa;
  --blue-dim:   #1e3a5f;
  --text:       #f0f4ff;
  --text2:      #94a3b8;
  --text3:      #475569;
  --green:      #4ade80;
  --green-dim:  #052e16;
  --amber:      #fb923c;
  --amber-dim:  #1c0f00;
  --red:        #f87171;
  --red-dim:    #1f0a0a;

  /* highlight colours per strength */
  --hl-low:     rgba(251, 146, 60, 0.18);
  --hl-medium:  rgba(251, 146, 60, 0.32);
  --hl-high:    rgba(248, 113, 113, 0.38);
  --hl-low-border:    rgba(251, 146, 60, 0.5);
  --hl-medium-border: rgba(251, 146, 60, 0.75);
  --hl-high-border:   rgba(248, 113, 113, 0.85);

  --radius:     14px;
  --radius-sm:  9px;
  --font:       'DM Sans', sans-serif;
  --mono:       'DM Mono', monospace;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --surface2:   #f1f5f9;
  --border:     #e2e8f0;
  --border2:    #cbd5e1;
  --blue-lt:    #2563eb;
  --blue-dim:   #dbeafe;
  --text:       #0f172a;
  --text2:      #475569;
  --text3:      #94a3b8;
  --green:      #16a34a;
  --green-dim:  #dcfce7;
  --amber:      #ea580c;
  --amber-dim:  #ffedd5;
  --red:        #dc2626;
  --red-dim:    #fee2e2;

  --hl-low:     rgba(234, 88, 12, 0.10);
  --hl-medium:  rgba(234, 88, 12, 0.20);
  --hl-high:    rgba(220, 38, 38, 0.18);
  --hl-low-border:    rgba(234, 88, 12, 0.45);
  --hl-medium-border: rgba(234, 88, 12, 0.7);
  --hl-high-border:   rgba(220, 38, 38, 0.75);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

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

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-wordmark {
  display: flex;
  align-items: baseline;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: -0.3px;
  line-height: 1;
}

.logo-konzept { font-weight: 400; color: var(--text); }
.logo-hub     { font-weight: 500; color: var(--blue-lt); }

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.theme-toggle:hover {
  background: var(--border2);
  color: var(--text);
  transform: scale(1.08) rotate(12deg);
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 56px 24px 36px;
  max-width: 600px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--blue-lt);
  background: var(--blue-dim);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 18px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-lt);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

.hero h1 {
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -1.5px;
  line-height: 1.05;
  margin-bottom: 14px;
  color: var(--text);
}

/* AISensei title colouring — mirrors KonzeptHub logo */
.title-ai     { color: var(--text); }
.title-sensei { color: var(--blue-lt); }

.hero-sub {
  font-size: 15px;
  color: var(--text2);
  font-weight: 300;
  line-height: 1.65;
  margin-bottom: 10px;
}

.hero-disclaimer {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.2px;
}

/* ── Tool section ───────────────────────────────────────── */
.tool-section {
  padding: 0 24px 64px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.tool-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* ── Shared panel styles ────────────────────────────────── */
.panel-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
}

/* ── Input panel ────────────────────────────────────────── */
.input-panel {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.input-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-select-wrap select {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.lang-select-wrap select:focus {
  border-color: var(--blue);
}

.char-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  transition: color var(--transition);
}
.char-count.near-limit { color: var(--amber); }
.char-count.at-limit   { color: var(--red); }

textarea {
  flex: 1;
  resize: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.7;
  padding: 16px;
  min-height: 320px;
  outline: none;
  caret-color: var(--blue-lt);
}
textarea::placeholder { color: var(--text3); }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  gap: 10px;
}

.btn-clear {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  transition: color var(--transition);
}
.btn-clear:hover { color: var(--text2); }

.btn-scan {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.btn-scan:hover:not(:disabled) { background: var(--blue-lt); color: var(--bg); }
.btn-scan:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-scan.loading .btn-scan-text { opacity: 0; }

.btn-scan-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.btn-scan.loading .btn-scan-spinner { display: block; }

@keyframes spin {
  to { transform: translateX(-50%) rotate(360deg); }
}

/* ── Results panel ──────────────────────────────────────── */
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.results-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  text-align: center;
}

.results-empty-icon {
  font-size: 40px;
  opacity: 0.12;
  font-family: serif;
  line-height: 1;
}

.results-empty p {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.65;
}

/* Strength bar */
.results-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.strength-bar-wrap {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}

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

.strength-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  transition: color var(--transition);
}
.strength-label.low    { color: var(--amber); }
.strength-label.medium { color: var(--amber); }
.strength-label.high   { color: var(--red); }

.strength-track {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background var(--transition);
}
.strength-fill.low    { background: var(--amber); width: 25%; }
.strength-fill.medium { background: var(--amber); width: 58%; }
.strength-fill.high   { background: var(--red);   width: 90%; }

.strength-note {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.5;
}

/* Highlighted text box */
.highlight-wrap {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.highlight-box {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Highlight marks */
mark.hl {
  background: none;
  border-radius: 3px;
  padding: 1px 0;
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
}
mark.hl.low    { background: var(--hl-low);    border-bottom: 2px solid var(--hl-low-border); }
mark.hl.medium { background: var(--hl-medium); border-bottom: 2px solid var(--hl-medium-border); }
mark.hl.high   { background: var(--hl-high);   border-bottom: 2px solid var(--hl-high-border); }

mark.hl.active,
mark.hl:hover {
  filter: brightness(1.2);
  outline: 1px solid var(--hl-medium-border);
  outline-offset: 1px;
}

/* Findings list */
.findings-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.findings-count {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text2);
  margin-left: 4px;
}

.findings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.finding-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.finding-card:hover {
  border-color: var(--border2);
  transform: translateX(2px);
}
.finding-card.active {
  border-color: var(--amber);
}

.finding-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.finding-category {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finding-strength {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.finding-strength.low    { background: var(--amber-dim); color: var(--amber); }
.finding-strength.medium { background: var(--amber-dim); color: var(--amber); }
.finding-strength.high   { background: var(--red-dim);   color: var(--red);   }

.finding-quote {
  font-size: 13px;
  color: var(--text);
  font-style: italic;
  margin-bottom: 5px;
  line-height: 1.5;
  /* clamp long quotes */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.finding-explanation {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.55;
}

/* No findings */
.no-findings {
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.no-findings-icon {
  font-size: 24px;
  color: var(--green);
}

.no-findings p {
  font-size: 13px;
  color: var(--text3);
}

/* Error */
.results-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
}

.error-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red-dim);
  color: var(--red);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-error p {
  font-size: 13px;
  color: var(--text3);
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 24px;
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-back {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
}
.footer-back:hover { color: var(--text2); }

.footer-note {
  flex: 1;
  text-align: center;
}

.footer-impressum {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
}
.footer-impressum:hover { color: var(--text2); }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 680px) {
  .tool-wrap {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero {
    padding: 40px 20px 28px;
  }

  .tool-section {
    padding: 0 16px 48px;
  }

  textarea {
    min-height: 220px;
  }

  .footer-note {
    display: none;
  }
}
