:root {
  --bg: #f6f3ee; --flaeche: #ffffff; --text: #221c16; --leise: #6e655b; --linie: #e4ddd2;
  --holz: #3a2c20; --holz-kante: #2a1f16; --bund: #c9c2b6; --saite: #d8c7a6; --marker: #5a4635;
  --ton: #f3ece0; --ton-text: #221c16; --grund: #e8553d; --grund-text: #ffffff;
  --akzent: #c8432d; --schatten: 0 10px 30px rgba(60, 40, 20, .10);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16130f; --flaeche: #211c17; --text: #f1ebe2; --leise: #a99f92; --linie: #352d25;
    --holz: #2e2319; --holz-kante: #1d160f; --bund: #8f877b; --saite: #b9a98b; --marker: #4c3b2c;
    --ton: #efe6d6; --ton-text: #1d1812; --grund: #f0644b; --grund-text: #ffffff;
    --akzent: #f0806b; --schatten: 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16130f; --flaeche: #211c17; --text: #f1ebe2; --leise: #a99f92; --linie: #352d25;
  --holz: #2e2319; --holz-kante: #1d160f; --bund: #8f877b; --saite: #b9a98b; --marker: #4c3b2c;
  --ton: #efe6d6; --ton-text: #1d1812; --grund: #f0644b; --grund-text: #ffffff;
  --akzent: #f0806b; --schatten: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }

header h1 { margin: 0; font-size: 1.9rem; letter-spacing: -.02em; }
.unter { margin: 4px 0 20px; color: var(--leise); }

.steuerung {
  display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px;
  padding: 16px; box-shadow: var(--schatten);
}
.feld { display: flex; flex-direction: column; gap: 6px; min-width: 110px; }
.feld-breit { flex: 1 1 220px; }
.feld > span { font-size: .78rem; font-weight: 600; color: var(--leise); text-transform: uppercase; letter-spacing: .06em; }
select {
  font: inherit; font-size: 1rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.umschalter { display: inline-flex; align-self: flex-start; border: 1px solid var(--linie); border-radius: 10px; overflow: hidden; }
.umschalter button {
  font: inherit; border: 0; background: var(--bg); color: var(--text);
  padding: 0 14px; min-height: 44px; cursor: pointer;
}
.umschalter button + button { border-left: 1px solid var(--linie); }
.umschalter button[aria-pressed="true"] { background: var(--akzent); color: #fff; font-weight: 600; }
.haken { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.haken input { width: 18px; height: 18px; accent-color: var(--akzent); }

.info { margin: 24px 0 12px; }
.info h2 { margin: 0 0 10px; font-size: 1.25rem; }
.toene { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.toene button {
  display: flex; flex-direction: column; align-items: center; min-width: 48px;
  padding: 6px 10px; border-radius: 10px; background: var(--flaeche); border: 1px solid var(--linie);
  font: inherit; color: inherit; cursor: pointer; touch-action: manipulation;
}
.toene b { font-size: 1.05rem; }
.toene small { color: var(--leise); font-size: .75rem; }
.toene li.grund button { background: var(--grund); border-color: var(--grund); color: var(--grund-text); }
.toene li.grund button small { color: var(--grund-text); opacity: .85; }

.brett-rahmen {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px;
  box-shadow: var(--schatten); padding: 12px 0 8px;
}
.brett-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 12px; }
#brett { display: block; }
.hinweis { margin: 8px 16px 4px; color: var(--leise); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.punkt-grund { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--grund); margin-left: 6px; }

/* SVG */
.holz { fill: var(--holz); }
.sattel { fill: var(--bund); }
.bund { stroke: var(--bund); stroke-width: 2; }
.saite { stroke: var(--saite); }
.marker { fill: var(--marker); }
.bundnr { fill: var(--leise); font-size: 12px; text-anchor: middle; }
.saitenname { fill: var(--leise); font-size: 13px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.ton circle { fill: var(--ton); stroke: var(--holz-kante); stroke-width: 1.5; }
.ton text { fill: var(--ton-text); font-size: 12px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.ton.grund circle { fill: var(--grund); }
.ton.grund text { fill: var(--grund-text); }
.ton.leer circle { stroke: var(--bund); }

.ton { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ton:focus { outline: none; }
.ton:focus-visible circle { stroke: var(--akzent); stroke-width: 3; }
.ton circle { transform-box: fill-box; transform-origin: center; }
.ton.spielt circle { animation: anschlag .35s ease-out; }
.toene button.spielt { animation: anschlag .35s ease-out; }
@keyframes anschlag { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ton.spielt circle, .toene button.spielt { animation: none; } }
