/* Spectroton — Stil.
   Am 14.09.2026 unveraendert aus index.html herausgeloest, damit die Datei
   dem Hausmuster der Geschwister-Werkzeuge folgt. Kein Inhalt geaendert. */
  :root {
    color-scheme: light;
    --bg: #f2f3f5;
    --panel: #ffffff;
    --panel-2: #eceef1;
    --line: #dcdfe3;
    --rim: rgba(0,0,0,0.12);
    --ink: #1a1b1e;
    --ink-dim: #5a5f68;
    --ink-faint: #8b909a;
    --focus: #2b6cb0;
    --r: 10px;
    --row-h: 54px;
  }

  /* System bevorzugt Dunkel → automatisch die angenehmere Variante, nicht die härteste */
  @media (prefers-color-scheme: dark) {
    :root {
      color-scheme: dark;
      --bg: #2a2c30;
      --panel: #34373c;
      --panel-2: #3c3f45;
      --line: #4a4e55;
      --rim: rgba(255,255,255,0.18);
      --ink: #f0f1f3;
      --ink-dim: #b7bcc4;
      --ink-faint: #888e97;
      --focus: #8fd0ff;
    }
  }

  /* Explizite Wahl schlägt beide oberen Regeln — [data-theme] hat eine höhere Spezifität als :root allein */
  html[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f3f5; --panel: #ffffff; --panel-2: #eceef1; --line: #dcdfe3; --rim: rgba(0,0,0,0.12);
    --ink: #1a1b1e; --ink-dim: #5a5f68; --ink-faint: #8b909a; --focus: #2b6cb0;
  }
  html[data-theme="soft-dark"] {
    color-scheme: dark;
    --bg: #2a2c30; --panel: #34373c; --panel-2: #3c3f45; --line: #4a4e55; --rim: rgba(255,255,255,0.18);
    --ink: #f0f1f3; --ink-dim: #b7bcc4; --ink-faint: #888e97; --focus: #8fd0ff;
  }
  html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #17181a; --panel: #202225; --panel-2: #26282c; --line: #33363b; --rim: rgba(255,255,255,0.18);
    --ink: #eceef1; --ink-dim: #9aa0a8; --ink-faint: #6e747c; --focus: #7cc4ff;
  }

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

  * { box-sizing: border-box; }

  html {
    background: var(--bg);
  }

  html, body {
    margin: 0;
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Roboto", sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
  }

  body {
    background: transparent;
    padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
    max-width: 720px;
    margin: 0 auto;
  }

  /* --- Aurora: Hintergrund folgt der Basisfarbe --- */
  .aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
  }
  .aurora .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.5;
    transition: background 0.9s ease;
  }
  .aurora .a1 { width: 70vw; height: 60vh; top: -18vh; left: -20vw; }
  .aurora .a2 { width: 56vw; height: 54vh; bottom: -20vh; right: -14vw; }
  .aurora .a3 { width: 30vw; height: 32vh; top: 30vh; right: -8vw; opacity: 0.32; }

  @media (prefers-reduced-motion: no-preference) {
    .aurora .a1 { animation: adrift1 34s ease-in-out infinite; }
    .aurora .a2 { animation: adrift2 40s ease-in-out infinite; }
  }
  @keyframes adrift1 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3vh); } }
  @keyframes adrift2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4vh); } }

  .topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
  }

  h1 {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0 0 2px;
  }

  .sub {
    color: var(--ink-faint);
    font-size: 0.8rem;
    margin: 0;
  }

  /* Der Titelblock nimmt, was die Waehler uebrig lassen. Ohne min-width: 0
     kann ein Flex-Element nicht unter seine Inhaltsbreite schrumpfen. */
  /* Der Titelblock fordert 12rem. Bleibt daneben kein Platz fuer die
     Waehlergruppe, rutscht sie geschlossen in die naechste Zeile, statt
     die Anschrift auf ein Dutzend Zeilen zu quetschen. */
  .topbar > div:first-child { flex: 1 1 12rem; min-width: 0; }
  .topbar-tools { display: flex; gap: 8px; flex: 0 0 auto; }

  /* Beide Waehler in der Kopfzeile, gleich schmal gehalten. Ein <select>
     waechst sonst auf seine laengste Option — "Helleres Dunkel" bzw.
     "Nederlands" — und draengt die Anschrift auf ein Dutzend Zeilen.
     Der Deckel kuerzt nur die geschlossene Ansicht; aufgeklappt steht
     jede Option vollstaendig da. */
  #theme,
  #langSelect {
    flex: 0 0 auto;
    width: 7.25rem;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.76rem;
    text-overflow: ellipsis;
  }

  .card > summary {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-dim);
    cursor: pointer;
    list-style: none;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 12px;
  }
  .card > summary::-webkit-details-marker { display: none; }
  .card > summary::after { content: "+"; font-weight: 400; color: var(--ink-faint); font-size: 1rem; }
  .card[open] > summary::after { content: "–"; }
  .card:not([open]) > summary { margin-bottom: 0; }

  .card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px;
    margin-bottom: 14px;
  }

  .card h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-dim);
    margin: 0 0 12px;
  }

  /* --- Basisfarbe --- */
  .base {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    align-items: stretch;
  }

  #swatch {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 88px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: none;
    cursor: pointer;
  }
  #swatch::-webkit-color-swatch-wrapper { padding: 0; }
  #swatch::-webkit-color-swatch { border: none; border-radius: 7px; }
  #swatch::-moz-color-swatch { border: none; border-radius: 7px; }

  .base-fields { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }

  input[type="text"] {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    font-variant-numeric: tabular-nums;
    padding: 10px 12px;
    min-height: 44px;
  }

  input[type="text"]:focus-visible,
  button:focus-visible,
  input[type="range"]:focus-visible,
  input[type="color"]:focus-visible,
  .row:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }

  .readout {
    font-variant-numeric: tabular-nums;
    color: var(--ink-dim);
    font-size: 0.82rem;
    padding-left: 2px;
  }

  /* --- Farbname --- */
  .name-row { display: grid; grid-template-columns: 1fr 118px; gap: 8px; }

  select {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
    padding: 10px 8px;
    min-height: 44px;
  }
  select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

  #hits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  #hits:empty { margin-top: 0; }

  .hit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px 7px 8px;
    color: var(--ink);
    font: inherit;
    font-size: 0.8rem;
    min-height: 38px;
    cursor: pointer;
  }
  .hit .dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--rim); flex: none; }
  .hit .code { color: var(--ink-faint); font-variant-numeric: tabular-nums; font-size: 0.74rem; }

  /* --- Akzentfarben --- */
  .accent-chips { display: flex; flex-wrap: wrap; gap: 12px; }
  .accent-chip { position: relative; width: 44px; height: 44px; flex: none; }
  .accent-chip input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 44px; height: 44px;
    padding: 0;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: none;
    cursor: pointer;
  }
  .accent-chip input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
  .accent-chip input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
  .accent-chip input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }
  .accent-chip .rm {
    position: absolute;
    top: -6px; right: -6px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    border: 2px solid var(--panel);
    font-size: 0.75rem;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    padding: 0;
  }

  .harmony-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
  .harmony-btn {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 8px 12px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
  }

  /* --- Rampe --- */
  .ramp-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 48px 48px 26px;
    gap: 6px;
    padding: 0 6px 6px 12px;
    font-size: 0.7rem;
    color: var(--ink-faint);
  }
  .ramp-head span:nth-child(3),
  .ramp-head span:nth-child(4) { text-align: right; }

  .ramp { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }

  .row {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 48px 48px 26px;
    gap: 6px;
    align-items: center;
    min-height: var(--row-h);
    padding: 0 6px 0 12px;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
  }
  .row.locked { box-shadow: inset 3px 0 0 currentColor; }
  .row .lock {
    width: 26px; height: 34px;
    background: none; border: none; padding: 0; margin: 0;
    color: inherit; opacity: 0.45; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .row .lock[aria-pressed="true"] { opacity: 1; }

  .mode-row { display: flex; gap: 6px; margin: 0 0 8px; }
  .mode-row .tab { flex: 0 1 auto; }

  /* --- Bibliothek --- */
  #libList { margin-top: 12px; }
  #libList:empty { margin-top: 0; }
  .lib-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }
  .lib-row:first-child { border-top: none; padding-top: 0; }
  .lib-dots { display: flex; gap: 3px; }
  .lib-dots span { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--rim); }
  .lib-name { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lib-name small { display: block; color: var(--ink-faint); font-size: 0.72rem; }
  .btn.mini { flex: none; min-height: 38px; padding: 0 12px; font-size: 0.8rem; }

  .row .step { font-weight: 600; opacity: 0.85; }
  .row .hex {
    letter-spacing: 0.02em;
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px;
  }
  .row .cw, .row .cb { text-align: right; font-size: 0.8rem; opacity: 0.9; }
  .row .fail { opacity: 0.42; }
  .flag {
    font-size: 0.68rem;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 0 4px;
    opacity: 0.75;
  }
  .row .flag { cursor: help; }

  /* Legende unter der Rampe. Mit Maus erklärt das title am Schild; die Legende
     braucht es nur auf Geräten ohne Hover, also Handy und Tablet. */
  .ramp-legend {
    margin-top: 10px;
    padding-left: 2px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--ink-dim);
  }
  .ramp-legend p { margin: 0 0 4px; }
  .ramp-legend p:last-child { margin-bottom: 0; }
  .ramp-legend .legend-item { display: flex; gap: 6px; align-items: baseline; }
  .ramp-legend .flag { flex: none; opacity: 1; white-space: nowrap; }
  @media (hover: hover) and (pointer: fine) {
    .ramp-legend { display: none; }
  }
  /* Das Schild ist je nach Sprache bis zu neun Zeichen lang. Auf schmalen
     Bildschirmen steht es deshalb unter dem HEX-Wert, bei allen Zeilen gleich —
     sonst rücken die Kontrastspalten je nach Zeile verschieden weit nach rechts. */
  @media (max-width: 440px) {
    .row .hex { flex-direction: column; align-items: flex-start; }
  }

  /* --- Regler --- */
  .ctrl { margin-bottom: 14px; }
  .ctrl:last-child { margin-bottom: 0; }
  .ctrl label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--ink-dim);
    margin-bottom: 6px;
  }
  .ctrl label b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 30px;
    background: none;
    margin: 0;
  }
  input[type="range"]::-webkit-slider-runnable-track {
    height: 4px; border-radius: 2px; background: var(--line);
  }
  input[type="range"]::-moz-range-track {
    height: 4px; border-radius: 2px; background: var(--line);
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px; height: 26px; margin-top: -11px;
    border-radius: 50%; background: var(--ink); border: none; cursor: pointer;
  }
  input[type="range"]::-moz-range-thumb {
    width: 26px; height: 26px;
    border-radius: 50%; background: var(--ink); border: none; cursor: pointer;
  }

  /* --- Export --- */
  .tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
  .tab {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 8px 10px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink-dim);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
  }
  .tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }

  textarea {
    width: 100%;
    min-height: 190px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    padding: 12px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.76rem;
    line-height: 1.55;
    resize: vertical;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
  }

  .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
  .btn {
    flex: 1 1 120px;
    min-height: 46px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
  }
  .btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
  .btn:active { transform: translateY(1px); }

  .prefix-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .prefix-row .field label { display: block; font-size: 0.75rem; color: var(--ink-faint); margin-bottom: 4px; }

  #note {
    position: fixed;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(14px);
    background: var(--ink);
    color: var(--bg);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: 90vw;
    text-align: center;
  }
  #note.on { opacity: 1; transform: translateX(-50%) translateY(0); }

  footer { color: var(--ink-faint); font-size: 0.74rem; line-height: 1.6; margin-top: 4px; }
  footer p { margin: 0; }

  @media (prefers-reduced-motion: reduce) {
    #note { transition: none; }
    .btn:active { transform: none; }
  }
