/* ============================================================
   SveTools – Design-System
   Grün als dezenter Akzent · Dark + Light · kantig-modern
   ============================================================ */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* ---------- Design-Tokens: Dark (Default) ---------- */
:root,
:root[data-theme="dark"] {
  --bg:            #0c0f0d;
  --bg-grid:       rgba(255, 255, 255, 0.018);
  --surface:       #141815;
  --surface-2:     #1b211d;
  --elevated:      #1e2521;
  --border:        #262d29;
  --border-strong: #38423b;
  --text:          #eef2f0;
  --text-dim:      #9aa89f;
  --text-faint:    #6a766e;
  --accent:        #34d17f;
  --accent-strong: #22c55e;
  --accent-contrast:#04140b;
  --accent-soft:   rgba(52, 209, 127, 0.13);
  --accent-line:   rgba(52, 209, 127, 0.35);
  --danger:        #f87171;
  --warn:          #fbbf24;
  --shadow:        0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm:     0 6px 18px -10px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Design-Tokens: Light ---------- */
:root[data-theme="light"] {
  --bg:            #f3f5f4;
  --bg-grid:       rgba(0, 0, 0, 0.022);
  --surface:       #ffffff;
  --surface-2:     #eef1ef;
  --elevated:      #ffffff;
  --border:        #e2e7e4;
  --border-strong: #cfd7d2;
  --text:          #121714;
  --text-dim:      #586159;
  --text-faint:    #8a938c;
  --accent:        #17a34a;
  --accent-strong: #15803d;
  --accent-contrast:#ffffff;
  --accent-soft:   rgba(23, 163, 74, 0.10);
  --accent-line:   rgba(23, 163, 74, 0.30);
  --danger:        #dc2626;
  --warn:          #d97706;
  --shadow:        0 20px 50px -24px rgba(20, 40, 30, 0.25);
  --shadow-sm:     0 8px 20px -14px rgba(20, 40, 30, 0.22);
  color-scheme: light;
}

/* ---------- Globale Größen ---------- */
:root {
  --radius:    16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --maxw:      1180px;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Inline-SVG-Icons (siehe js/icons.js) – erben immer die Textfarbe */
.ico { display: block; flex-shrink: 0; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  /* Der Schimmer bleibt am Viewport verankert und wird NICHT gekachelt.
     Ohne no-repeat/fixed wiederholt er sich alle 100 vh und erzeugt beim
     Scrollen eine harte Kante quer über die Seite. */
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 700px at 78% -8%, var(--accent-soft), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, .brand-name, .footer-brand { font-family: var(--font-display); }

a { color: inherit; }

::selection { background: var(--accent); color: var(--accent-contrast); }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px clamp(16px, 4vw, 34px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 42px;
  height: 21px;
  background: var(--text);
  -webkit-mask: url("assets/sve-logo.png") left center / contain no-repeat;
  mask: url("assets/sve-logo.png") left center / contain no-repeat;
  transition: background 0.25s ease;
}

.brand:hover .brand-logo { background: var(--accent); }

.brand-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-accent { color: var(--accent); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Sprachumschalter */
.lang-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.lang-btn {
  padding: 5px 11px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--accent); color: var(--accent-contrast); }

/* Icon-Buttons (Topbar) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(0.95); }

.menu-btn { display: none; }

.theme-btn .theme-icon-light { display: none; }
:root[data-theme="light"] .theme-btn .theme-icon-dark { display: none; }
:root[data-theme="light"] .theme-btn .theme-icon-light { display: inline-flex; }

/* ============================================================
   Layout
   ============================================================ */
.layout {
  display: flex;
  gap: 0;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 246px;
  flex-shrink: 0;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-group {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-faint);
  margin: 20px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item .nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  opacity: 0.9;
}

.nav-item:hover { background: var(--surface); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px 0;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  margin-top: 22px;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
  backdrop-filter: blur(2px);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 34px clamp(18px, 4vw, 44px) 72px;
}

/* ============================================================
   Home – Hero & Grid
   ============================================================ */
.hero { margin-bottom: 40px; }

.hero-kicker {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -1.6px;
}

.hero h1 .accent { color: var(--accent); }

.hero-sub {
  margin: 0;
  max-width: 560px;
  font-size: clamp(15px, 2.2vw, 18px);
  color: var(--text-dim);
}

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

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.tool-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, var(--accent-soft), transparent 45%);
  opacity: 0;
  transition: opacity 0.18s;
}

.tool-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.tool-card:hover::after { opacity: 1; }

.tc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  color: var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.tool-card h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.tool-card p { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }

.tc-go {
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   View-Kopf & Karten
   ============================================================ */
.view { animation: view-in 0.25s ease; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-head { margin-bottom: 26px; }

.view-head h1, .view h1 {
  margin: 0 0 7px;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.9px;
}

.view-head .sub, .view .sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  max-width: 620px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, color 0.15s;
}

.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); }

.btn.small { padding: 7px 13px; font-size: 12.5px; }

.btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  border-color: var(--border);
  color: var(--text-faint);
}
.btn:disabled:active { transform: none; }

/* ============================================================
   Inputs / Controls
   ============================================================ */
.textarea, .select, .text-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea:focus, .select:focus, .text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; line-height: 1.5; font-family: var(--font-mono); font-size: 13.5px; }
.select { width: auto; cursor: pointer; }

.field-row { margin-bottom: 18px; }
.field-row:last-child { margin-bottom: 0; }
.field-row > label { display: block; margin-bottom: 10px; font-size: 14px; color: var(--text-dim); }
.field-row > label strong { color: var(--text); font-family: var(--font-display); }
.field-row.inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field-row.inline > label { margin: 0; }

/* Kopfzeile eines Reglers: Beschriftung · Zahlenfeld · Einheit */
.range-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-dim);
}
.range-head > label { margin: 0; }

/* Zahlenfeld zum Eintippen – Alternative zum Ziehen des Reglers */
.num-input {
  width: 62px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.num-input:hover { border-color: var(--accent-line); }
.num-input:focus { border-color: var(--accent); }

/* Spinner ausblenden – der Regler daneben übernimmt das Feinjustieren,
   Pfeiltasten funktionieren im Feld trotzdem weiter. */
.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input { -moz-appearance: textfield; appearance: textfield; }

/* Range-Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border: 3px solid var(--bg);
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}

/* Chips (Checkbox-Kacheln) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--accent-line); }
.chip input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.chip:has(input:checked) {
  color: var(--text);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* Switch-Zeile */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
}
.switch input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}
.seg {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--accent); color: var(--accent-contrast); }

/* ============================================================
   Passwort-Generator
   ============================================================ */
.pw-card { display: flex; flex-direction: column; gap: 16px; }

.pw-output {
  min-height: 64px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: clamp(18px, 3vw, 24px);
  letter-spacing: 1px;
  word-break: break-all;
}
.pw-output .c-letter { color: var(--text); }
.pw-output .c-digit  { color: var(--accent); }
.pw-output .c-symbol { color: var(--warn); }
.pw-output .c-space  { min-width: 8px; display: inline-block; }

.pw-actions { display: flex; gap: 10px; }
.pw-actions .btn { flex: 1; }
.pw-actions .icon-btn { flex-shrink: 0; }

.strength { display: flex; flex-direction: column; gap: 8px; }
.strength-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.strength-bar > div {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease, background 0.3s ease;
}
.strength-label { font-size: 13px; color: var(--text-dim); min-height: 18px; }
.strength-label strong { color: var(--text); }

.pw-opts { display: flex; flex-direction: column; gap: 18px; }

/* ============================================================
   Rechner
   ============================================================ */
.calc-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

.calc { padding: 18px; }

.calc-display {
  padding: 18px 20px 22px;
  text-align: right;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}
.calc-expr {
  min-height: 22px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-dim);
  word-break: break-all;
}
.calc-result {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 8vw, 52px);
  line-height: 1.1;
  letter-spacing: -1px;
  word-break: break-all;
}

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.key {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.08s, filter 0.12s, background 0.12s, border-color 0.12s;
}
.key:hover { border-color: var(--border-strong); filter: brightness(1.12); }
.key:active { transform: scale(0.95); }
.key.fn { background: var(--elevated); color: var(--text-dim); font-size: 18px; }
.key.op { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.key.op.eq { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.key.zero { aspect-ratio: auto; grid-column: span 2; }

.calc-history { display: flex; flex-direction: column; min-height: 200px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.panel-head .muted { color: var(--text-faint); font-weight: 400; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.calc-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.calc-history-list li {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  cursor: pointer;
  text-align: right;
  transition: border-color 0.12s;
}
.calc-history-list li:hover { border-color: var(--accent-line); }
.calc-history-list .h-expr { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.calc-history-list .h-res { font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.calc-history-empty { color: var(--text-faint); font-size: 13.5px; margin: 4px 2px; }

/* ============================================================
   Währungsrechner
   ============================================================ */
.cur-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 560px;
}
.cur-field { display: flex; flex-direction: column; gap: 8px; }
.cur-field label { font-size: 13px; color: var(--text-dim); }
.cur-amount { font-size: 18px; font-family: var(--font-mono); }

.cur-convert {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}
.cur-select { width: 100%; }
.cur-swap { flex-shrink: 0; margin-bottom: 1px; }

.cur-result-box {
  padding: 20px 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cur-result {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 6vw, 42px);
  letter-spacing: -0.6px;
  line-height: 1.1;
  color: var(--accent);
  word-break: break-all;
}
.cur-rate { margin-top: 8px; font-size: 14px; color: var(--text-dim); }
.cur-note { font-size: 12.5px; color: var(--text-faint); }
.cur-note.error { color: var(--danger); }

@media (max-width: 460px) {
  .cur-convert { grid-template-columns: 1fr; }
  .cur-swap { justify-self: center; transform: rotate(90deg); }
}

/* ============================================================
   Random Wheel
   ============================================================ */
.wheel-layout {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.wheel-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}
.wheel-wrap {
  position: relative;
  width: min(100%, 480px);
  aspect-ratio: 1 / 1;
}
#wheel-canvas { width: 100%; height: 100%; display: block; }

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 26px solid var(--accent);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.35));
  z-index: 3;
}

.wheel-spin {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(13px, 2.6vw, 17px);
  letter-spacing: 0.5px;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,0.5);
  transition: transform 0.12s, filter 0.12s;
}
.wheel-spin:hover { filter: brightness(1.08); }
.wheel-spin:active { transform: translate(-50%, -50%) scale(0.94); }
.wheel-spin:disabled { opacity: 0.6; cursor: default; }

.wheel-side { display: flex; flex-direction: column; gap: 14px; }
.wheel-opts { display: flex; flex-direction: column; gap: 12px; }

/* Gewinner-Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  animation: view-in 0.2s ease;
}
.modal-box {
  width: min(440px, 100%);
  padding: 34px 30px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.modal-winner {
  font-family: var(--font-display);
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--accent);
  word-break: break-word;
  margin-bottom: 26px;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   Color Picker
   ============================================================ */
.cp-layout {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.cp-pick { display: flex; flex-direction: column; gap: 15px; }

/* Schachbrett hinter allem, was durchsichtig sein kann */
.cp-checker {
  background-image:
    linear-gradient(45deg, var(--border-strong) 25%, transparent 25%),
    linear-gradient(-45deg, var(--border-strong) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--border-strong) 75%),
    linear-gradient(-45deg, transparent 75%, var(--border-strong) 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}

/* Auswahlfläche: waagerecht Sättigung, senkrecht Helligkeit, darunter der Farbton */
.cp-sv {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 190px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: crosshair;
  touch-action: none;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, transparent),
    var(--hue, hsl(154 100% 50%));
}

.cp-sv:focus-visible,
.cp-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cp-sv-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.cp-slider {
  position: relative;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  touch-action: none;
}

.cp-hue {
  background: linear-gradient(to right,
    #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
}

.cp-alpha-fill { position: absolute; inset: 0; border-radius: inherit; }

.cp-thumb {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ---------- Vorschau + Formate ---------- */
.cp-preview { display: flex; gap: 10px; }

.cp-swatch-wrap {
  flex: 1;
  height: 66px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  overflow: hidden;
}
.cp-swatch { width: 100%; height: 100%; }
.cp-preview .icon-btn { width: 52px; height: 66px; }

.cp-formats { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }

.cp-fmt {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 9px;
  align-items: center;
}
.cp-fmt label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-faint);
}
.cp-fmt .text-input {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 11px;
}
.cp-fmt .text-input.invalid { border-color: var(--danger); }

/* ---------- Farbfelder (Harmonien, Abstufungen, Verlauf) ---------- */
.cp-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.cp-chip {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 64px;
  height: 54px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.cp-chip:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.cp-chip.base { box-shadow: 0 0 0 2px var(--accent); }

.cp-chip-label {
  width: 100%;
  padding: 2px 0 3px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2px;
}

#cp-recent .cp-chip { width: 44px; height: 38px; }

/* Harmonien füllen die Kartenbreite: auf breiten Schirmen 2×2 statt
   vier links klebende Reihen mit leerem Raum daneben. */
#cp-harmonies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px 24px;
}
.cp-harmony-name { margin-bottom: 8px; font-size: 12.5px; color: var(--text-dim); }

/* ---------- Kontrast ---------- */
/* Beide Vergleiche (auf Weiß / auf Schwarz) nebeneinander, damit die
   Karte die Breite nutzt statt nur die linke Hälfte. */
#cp-contrast {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 24px;
}
.cp-contrast-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.cp-contrast-demo {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}
.cp-contrast-meta { flex: 1; min-width: 110px; }
.cp-contrast-label { font-size: 13.5px; color: var(--text-dim); }
.cp-contrast-ratio {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}

.cp-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.cp-badge {
  padding: 4px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.cp-badge.ok { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.cp-badge.no { color: var(--text-faint); border-color: var(--border); }

.cp-note { margin: 10px 0 0; font-size: 12.5px; color: var(--text-faint); }

@media (max-width: 900px) {
  .cp-layout { grid-template-columns: 1fr; }
}

/* ============================================================
   Footer & Toast
   ============================================================ */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px clamp(18px, 4vw, 44px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 13px;
}
.footer-brand { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: -0.3px; }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: toast-in 0.22s ease;
}
.toast-ico { display: flex; }
.toast.error { background: var(--danger); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .calc-layout, .wheel-layout { grid-template-columns: 1fr; }
  .wheel-stage { padding: 12px; }
}

@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 60;
    width: 260px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding-top: 74px;
  }
  .sidebar.open { transform: translateX(0); }
  .layout { display: block; }
  .content { padding-top: 26px; }
}
