/* Farbtokens, hell und dunkel. Ohne Framework: die Seite hat eine Handvoll Bausteine. */
:root {
  --hintergrund: #ffffff;
  --vordergrund: #171717;
  --karte: #ffffff;
  --gedaempft: #6b7280;
  --gedaempft-flaeche: #f3f4f6;
  --rand: #e5e7eb;
  --ring: #6b7280;
  --primaer: #1f2937;
  --primaer-text: #fafafa;
  --gefahr: #b91c1c;
  --gefahr-flaeche: #fef2f2;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(0, 0, 0, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #111214;
    --vordergrund: #f5f5f5;
    --karte: #1b1c1f;
    --gedaempft: #a1a1aa;
    --gedaempft-flaeche: #26272b;
    --rand: rgba(255, 255, 255, 0.12);
    --ring: #8b8b95;
    --primaer: #e5e7eb;
    --primaer-text: #1f2937;
    --gefahr: #f87171;
    --gefahr-flaeche: #2a1515;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--vordergrund);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.seite { max-width: 56rem; margin: 0 auto; padding: 2.5rem 1rem 4rem; display: grid; gap: 1.5rem; }
.kopf h1 { margin: 0 0 0.25rem; font-size: 1.9rem; letter-spacing: -0.02em; }
.kopf p { margin: 0; }
h2.titel { margin: 0; font-size: 1rem; font-weight: 600; }
.gedaempft { color: var(--gedaempft); }
.klein { font-size: 0.85rem; }
.tabellarisch { font-variant-numeric: tabular-nums; }
.abgeschnitten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { font-size: 0.85em; background: var(--gedaempft-flaeche); padding: 0 0.3em; border-radius: 4px; }
.fuss { margin-top: 2rem; }
[hidden] { display: none !important; }

.karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}
.karte-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Knoepfe: eine Form, drei Ausfuehrungen. Mindestens 36 px hoch - auf dem Handy trifft ein Finger das. */
.knopf {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--vordergrund);
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  min-height: 2.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.knopf:hover:not(:disabled) { background: var(--gedaempft-flaeche); }
.knopf:focus-visible, .ablage-flaeche:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.knopf:disabled { opacity: 0.5; cursor: not-allowed; }
.knopf.primaer { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
.knopf.primaer:hover:not(:disabled) { opacity: 0.9; background: var(--primaer); }
.knopf.symbol { width: 2.25rem; padding: 0; justify-content: center; font-size: 1rem; }
.knopf[aria-pressed="true"] { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
.knopf.leise { border-color: transparent; background: transparent; }
.knopf.leise:hover:not(:disabled) { background: var(--gedaempft-flaeche); }

/* Erklaerungen: erscheinen beim Zeigen und beim Tastaturfokus - anders als title. */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 18rem;
  padding: 0.45rem 0.6rem;
  background: var(--primaer);
  color: var(--primaer-text);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
  border-radius: 6px;
  z-index: 20;
  pointer-events: none;
  white-space: normal;
  text-align: left;
}
@media (hover: none) { [data-tip]:hover::after { display: none; } }

.ablage { padding: 0; }
.ablage-flaeche {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  border: 2px dashed var(--rand);
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.ablage-flaeche:hover, .ablage.darueber .ablage-flaeche { border-color: var(--ring); background: var(--gedaempft-flaeche); }
.ablage-flaeche svg { color: var(--gedaempft); }
.ablage-titel { font-weight: 500; }

.schachbrett {
  background-color: var(--karte);
  background-image:
    linear-gradient(45deg, var(--gedaempft-flaeche) 25%, transparent 25%),
    linear-gradient(-45deg, var(--gedaempft-flaeche) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--gedaempft-flaeche) 75%),
    linear-gradient(-45deg, transparent 75%, var(--gedaempft-flaeche) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.vorschau-rahmen { display: flex; justify-content: center; border: 1px solid var(--rand); border-radius: 8px; padding: 1rem; }
.vorschau-rahmen img { max-height: 24rem; max-width: 100%; width: auto; object-fit: contain; }
.fakten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1rem; margin: 0; font-size: 0.875rem; color: var(--gedaempft); }
.fakten div { min-width: 0; }
.fakten dt { display: inline; font-weight: 500; }
.fakten dd { display: inline; margin: 0; }
@media (min-width: 640px) { .fakten { grid-template-columns: repeat(3, minmax(0, 1fr)); } .fakten.vier { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 400px) { .fakten, .fakten.vier { grid-template-columns: 1fr; } }

.vergleich { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .vergleich { grid-template-columns: 1fr 1fr; } }
.haelfte { margin: 0; display: grid; gap: 0.25rem; }
.rahmen {
  position: relative;
  height: 18rem;
  border: 1px solid var(--rand);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  touch-action: none;
  user-select: none;
}
.rahmen img, .rahmen svg { max-height: 100%; max-width: 100%; width: auto; height: auto; display: block; }
.rahmen img { image-rendering: pixelated; }
.rahmen.greifbar { cursor: grab; }
.rahmen.greift { cursor: grabbing; }
.rahmen.fadenkreuz, .rahmen.fadenkreuz svg { cursor: crosshair; }
.rahmen svg path.klickbar { cursor: pointer; }
.rahmen svg path.klickbar:hover { fill: #dc2626; }
.rahmen svg path.klickbar.nur-strich:hover { fill: none; stroke: #dc2626; }
.auswahl { position: absolute; border: 2px solid var(--primaer); background: rgba(31, 41, 55, 0.15); pointer-events: none; }
.marke { background: var(--gedaempft-flaeche); border-radius: 4px; padding: 0 0.4em; font-weight: 400; }
.spinner { display: inline-block; width: 0.8em; height: 0.8em; border: 2px solid var(--gedaempft); border-right-color: transparent; border-radius: 50%; animation: dreh 0.8s linear infinite; vertical-align: -0.1em; }
@keyframes dreh { to { transform: rotate(360deg); } }

.werkzeuge { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }
.zoomleiste { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--gedaempft); font-size: 0.875rem; }
.stift { display: inline-flex; align-items: center; gap: 0.4rem; }
.stift input { width: 6rem; }
.nur-breit { display: none; }
@media (min-width: 640px) { .nur-breit { display: inline; } }
#bearbeitung { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.fehlertext { color: var(--gefahr); font-size: 0.875rem; margin: 0; }

.hinweis { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--rand); border-radius: 8px; background: var(--gedaempft-flaeche); font-size: 0.875rem; color: var(--gedaempft); }
.hinweis p { margin: 0; flex: 1 1 18rem; }

.vorschlaege { display: grid; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--rand); border-radius: 8px; }
.vorschlaege-kopf { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; font-weight: 500; }
.vorschlaege ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 640px) { .vorschlaege ul { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vorschlag { width: 100%; display: flex; flex-direction: column; gap: 0.25rem; padding: 0.5rem; border: 1px solid var(--rand); border-radius: 8px; background: var(--karte); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.vorschlag:hover:not(:disabled) { border-color: var(--ring); }
.vorschlag:disabled { opacity: 0.5; cursor: not-allowed; }
.vorschlag .bild { height: 9rem; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 4px; }
.vorschlag .bild img { max-height: 100%; width: auto; object-fit: contain; }
.vorschlag .name { font-size: 0.875rem; font-weight: 500; }

/* Die Regler: Beschriftung, Bedienelement, Erklaerung - die Form, die jede Option hat. */
.formular { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .formular { grid-template-columns: 1fr 1fr; } }
.feld { display: grid; gap: 0.4rem; }
.feld-kopf { display: flex; justify-content: space-between; align-items: baseline; }
.feld label, .feld .beschriftung { font-size: 0.875rem; font-weight: 500; }
.feld .erklaerung { font-size: 0.75rem; color: var(--gedaempft); margin: 0; }
.feld select, .feld input[type="color"] {
  width: 100%;
  min-height: 2.25rem;
  font: inherit;
  font-size: 0.875rem;
  color: inherit;
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
}
.feld input[type="color"] { padding: 0.15rem; cursor: pointer; }
.farbzeile { display: flex; gap: 0.5rem; }
.farbzeile input { flex: 1; }
input[type="range"] { width: 100%; accent-color: var(--primaer); height: 2.25rem; margin: 0; }
.schalter { display: flex; justify-content: space-between; align-items: center; }
.schalter input { width: 1.4rem; height: 1.4rem; accent-color: var(--primaer); }

.fehlerbox { border: 1px solid var(--gefahr); background: var(--gefahr-flaeche); color: var(--gefahr); border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.875rem; }
.fehlerbox p { margin: 0.25rem 0 0; }
