:root {
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(20, 24, 33, 0.1);
  --text: #15181f;
  --dim: #5d6677;
  --accent: #e20074;
  --good: #0f9d63;
  --shadow: 0 10px 30px rgba(20, 24, 33, 0.14), 0 1px 3px rgba(20, 24, 33, 0.08);
  --radius: 16px;
  --bg: #eeebe6;
  --field: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(22, 24, 30, 0.72);
    --glass-strong: rgba(22, 24, 30, 0.9);
    --line: rgba(255, 255, 255, 0.1);
    --text: #eef1f7;
    --dim: #a3abbb;
    --accent: #ff3d9e;
    --good: #3ecf8e;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --bg: #1a1b1f;
    --field: #25272e;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button, select, input { font: inherit; color: inherit; }

/* ---------- Vollbild-Bühne */
.stage { position: fixed; inset: 0; touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }
.tip { position: absolute; pointer-events: none; background: rgba(15, 17, 23, 0.92); color: #fff; font-size: 0.8rem;
  padding: 5px 9px; border-radius: 8px; transform: translate(12px, -130%); white-space: nowrap; z-index: 5; }

/* ---------- Schwebende Elemente */
.float { position: fixed; z-index: 10; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }

.brand { top: 14px; left: 16px; padding: 9px 14px; display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 1rem; letter-spacing: -0.01em; }
.brand span { font-size: 0.75rem; color: var(--dim); }

.toolbar { top: 14px; left: 50%; transform: translateX(-50%); padding: 7px 10px; display: flex; gap: 6px 16px; align-items: center;
  flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 480px); }
.ctl { display: flex; align-items: center; gap: 7px; }
.lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
.seg { display: inline-flex; background: rgba(127, 127, 127, 0.1); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 0.85rem; white-space: nowrap; }
.seg button:hover { background: rgba(127, 127, 127, 0.14); }
.seg button.on { background: var(--accent); color: #fff; }
.tog { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.85rem; color: var(--dim); white-space: nowrap; }
.tog input { accent-color: var(--accent); width: 15px; height: 15px; }
.val { font-variant-numeric: tabular-nums; color: var(--dim); min-width: 2.8em; font-size: 0.85rem; }
#foldRange { width: 110px; accent-color: var(--accent); }

.views { left: 16px; top: 50%; transform: translateY(-50%); padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.views .lbl { text-align: center; }
.seg.vertical { flex-direction: column; }
.seg.vertical button { text-align: left; }
.side-actions { top: 14px; right: 16px; padding: 6px; display: flex; gap: 6px; align-items: center; }
.pill-btn { border: 0; background: var(--accent); color: #fff; padding: 7px 14px; border-radius: 10px; cursor: pointer; font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.pill-btn[aria-expanded="true"] { filter: brightness(0.88); }
.icon-btn { border: 0; width: 34px; height: 34px; border-radius: 10px; background: rgba(127, 127, 127, 0.12); cursor: pointer; font-size: 1rem; flex: none; }
.icon-btn:hover { background: rgba(127, 127, 127, 0.22); }

.help { top: 70px; right: 16px; padding: 12px 16px; font-size: 0.85rem; max-width: 320px; }
.help ul { margin: 6px 0 0; padding-left: 18px; color: var(--dim); }
.help li { margin: 3px 0; }

/* ---------- Geräte-Karten unten */
.slots { bottom: 16px; left: 50%; transform: translateX(-50%); padding: 8px; display: grid; gap: 8px;
  grid-template-columns: repeat(var(--n, 2), minmax(220px, 280px)); max-width: calc(100vw - 32px); }
.slot { background: var(--glass-strong); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.slot .row { display: flex; gap: 7px; align-items: center; min-width: 0; }
.slot .tag { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 0.75rem; flex: none; color: #fff; }
.slot select { flex: 1; min-width: 0; background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font-size: 0.88rem; }
.slot select.storage { flex: 0 0 auto; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); cursor: pointer; padding: 0; }
.sw.on { border-color: var(--accent); }
.slot .price { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.slot .price b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.slot .price small { color: var(--dim); font-size: 0.75rem; }
.slot .cname { font-size: 0.75rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Technische Daten als Seitenpanel */
.specs { top: 70px; right: 16px; bottom: 16px; width: min(var(--specs-w, 760px), calc(100vw - 32px)); padding: 14px; display: flex; flex-direction: column;
  background: var(--glass-strong); z-index: 20; }
.specs[hidden] { display: none; }
.specs-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.specs h2 { margin: 0; font-size: 1.15rem; }
.table-scroll { overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; flex: 1; min-height: 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 9px 11px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
thead th { position: sticky; top: 0; background: var(--glass-strong); backdrop-filter: blur(10px); font-size: 0.9rem; z-index: 2; }
tbody th { color: var(--dim); font-weight: 500; white-space: nowrap; width: 1%; }
td { min-width: 150px; }
td .main { font-variant-numeric: tabular-nums; }
td .sub { color: var(--dim); font-size: 0.76rem; margin-top: 2px; }
td.best .main { color: var(--good); font-weight: 600; }
td .bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 6px; overflow: hidden; }
td .bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
td.best .bar i { background: var(--good); }
td ul { margin: 0; padding-left: 16px; }
td li { margin: 2px 0; }
.delta { font-size: 0.74rem; color: var(--dim); margin-left: 6px; }
.note { color: var(--dim); font-size: 0.76rem; margin: 8px 2px 0; }

/* ---------- Kleinere Bildschirme */
@media (max-width: 1100px) {
  .toolbar { top: 74px; max-width: calc(100vw - 32px); }
  .help { top: 130px; }
}
@media (max-width: 900px) {
  .slots[data-n="3"], .slots[data-n="4"] { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .slots { grid-template-columns: repeat(var(--n, 2), minmax(150px, 1fr)); width: calc(100vw - 24px); }
}
@media (max-width: 640px) {
  .brand span { display: none; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; left: 12px; right: 12px; transform: none; max-width: none; top: 66px; }
  .toolbar .lbl { display: none; }
  .views { left: 16px; top: 50%; transform: translateY(-50%); padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.views .lbl { text-align: center; }
.seg.vertical { flex-direction: column; }
.seg.vertical button { text-align: left; }
.side-actions { right: 12px; top: 12px; }
  .brand { left: 12px; top: 12px; }
  .views { top: 116px; left: 12px; transform: none; flex-direction: row; overflow-x: auto; right: 12px; }
  .views .lbl { display: none; }
  .seg.vertical { flex-direction: row; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); bottom: 10px; padding: 6px; gap: 6px; }
  .slots[data-n="1"] { grid-template-columns: 1fr; }
  .slot { padding: 7px; gap: 5px; }
  .slot .cname, .slot .price small { display: none; }
  .specs { top: 116px; left: 12px; right: 12px; bottom: 12px; width: auto; }
  tbody th { position: sticky; left: 0; background: var(--glass-strong); z-index: 1; white-space: normal; min-width: 90px; }
  td { min-width: 140px; }
}

[hidden] { display: none !important; }

/* Auswahllisten in beiden Farbschemata lesbar */
select { color: var(--text); background-color: var(--field); }
select option, select optgroup { color: var(--text); background-color: var(--field); }

/* ---------- Präsentationsmodus */
.ghost-btn { border: 1px solid var(--line); background: transparent; padding: 7px 12px; border-radius: 10px; cursor: pointer; font-size: 0.88rem; white-space: nowrap; }
.ghost-btn:hover { background: rgba(127, 127, 127, 0.12); }
.exit-btn { display: none; top: 14px; right: 16px; padding: 8px 14px; cursor: pointer; font-size: 0.85rem; color: var(--text); }
body.present .toolbar, body.present .views, body.present .side-actions, body.present .help, body.present .specs { display: none !important; }
body.present .brand { opacity: 0.85; }
body.present .exit-btn { display: block; opacity: 0.35; transition: opacity .2s; }
body.present .exit-btn:hover { opacity: 1; }
body.present .slots { opacity: 0.25; transition: opacity .25s; }
body.present .slots:hover, body.present .slots:focus-within { opacity: 1; }

/* ---------- Datentabelle: Abschnitte, Highlights, Stärken */
tr.sec th { background: rgba(226, 0, 116, 0.07); color: var(--accent); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; padding: 7px 11px; }
thead .dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: #fff; font-size: 0.72rem; margin-right: 7px; vertical-align: 1px; }
td .main.big { font-size: 1.05rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { background: rgba(226, 0, 116, 0.1); color: var(--text); border: 1px solid rgba(226, 0, 116, 0.25); border-radius: 999px; padding: 3px 9px; font-size: 0.78rem; line-height: 1.3; }
ul.plus { list-style: none; padding: 0; margin: 0; }
ul.plus li { padding-left: 18px; position: relative; margin: 3px 0; }
ul.plus li::before { content: '✓'; position: absolute; left: 0; color: var(--good); font-weight: 700; }

@media (max-width: 640px) {
  table { font-size: 0.8rem; }
  .chip { font-size: 0.72rem; padding: 2px 7px; }
  .ghost-btn { padding: 7px 9px; }
}

/* Tabelle passt sich der Panelbreite an – kein seitliches Scrollen */
table { table-layout: fixed; }
table col.lab { width: 138px; }
td { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
tbody th { white-space: normal; }
.table-scroll { overflow-x: hidden; overflow-y: auto; }
@media (max-width: 640px) {
  table col.lab { width: 84px; }
  th, td { padding: 7px 6px; }
  td .bar { display: none; }
}
