/* Turnierschmiede – gemeinsames Stylesheet
   Leitidee: Turniersaal. Ruhige, kühle Fläche, Turniertisch-Grün als Hauptfarbe,
   Brettnummern als Schachfeld-Kacheln, Messing nur für „läuft gerade“. */

@font-face {
  font-family: 'Atkinson';
  src: url('/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+FEFF;
}
@font-face {
  font-family: 'Atkinson';
  src: url('/fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --tinte: #1b2430;
  --tinte-2: #4b5664;
  --flaeche: #f2f4f6;
  --karte: #ffffff;
  --linie: #d5dbe1;
  --brett: #1e3a5f;
  --brett-dunkel: #152a45;
  --brett-hell: #e3e9f2;
  --messing: #c39a4f;
  --messing-text: #7f5d1d;
  --fehler: #b3261e;
  --fehler-hell: #fbe9e7;

  --schrift: 'Atkinson', system-ui, sans-serif;
  --r-klein: 6px;
  --r: 10px;
  --schatten: 0 1px 0 rgba(27, 36, 48, .06);
  font-size: 106.25%; /* 17 px: Lesbarkeit im Spiellokal */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--schrift); color: var(--tinte); background: var(--flaeche);
  line-height: 1.45; font-variant-numeric: tabular-nums;
}
h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 750; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--brett); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--messing); outline-offset: 2px; border-radius: 4px; }

/* --- Schaltflächen ------------------------------------------------------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 2.6rem; padding: .5rem 1.05rem; border-radius: var(--r-klein);
  border: 1.5px solid var(--linie); background: var(--karte); cursor: pointer;
  font-weight: 650; text-decoration: none; color: var(--tinte); white-space: nowrap;
}
.knopf:hover { border-color: var(--tinte-2); }
.knopf.haupt { background: var(--brett); border-color: var(--brett); color: #fff; }
.knopf.haupt:hover { background: var(--brett-dunkel); border-color: var(--brett-dunkel); }
.knopf.gefahr { color: var(--fehler); }
.knopf.gefahr:hover { border-color: var(--fehler); }
.knopf.leise-gefahr { color: var(--tinte-2); font-weight: 600; }
.knopf.leise-gefahr:hover { color: var(--fehler); }
.knopf.klein { min-height: 2.1rem; padding: .25rem .7rem; font-size: .92rem; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.knopf.still { border-color: transparent; background: transparent; }
.knopf.still:hover { background: rgba(27, 36, 48, .06); }

/* --- Formulare ------------------------------------------------------------- */
.feld { display: grid; gap: .3rem; }
.feld > span { font-weight: 650; font-size: .92rem; }
.feld small { color: var(--tinte-2); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: 2.6rem; padding: .45rem .7rem; border: 1.5px solid var(--linie);
  border-radius: var(--r-klein); background: var(--karte);
}
textarea { min-height: 8rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brett); box-shadow: 0 0 0 3px var(--brett-hell); }

/* --- Brett-Kachel: das Wiedererkennungselement ------------------------------ */
.brett {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none;
  font-weight: 750; font-size: 1rem; border-radius: 3px;
  background: var(--brett); color: #fff;
}
.brett.hell { background: var(--brett-hell); color: var(--brett-dunkel); }

/* --- Paarungsliste --------------------------------------------------------- */
.paarungen { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.paarung {
  display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: .9rem;
  padding: .55rem .75rem .55rem .55rem; background: var(--karte); border-radius: var(--r-klein);
}
.paarung .spieler-w, .paarung .spieler-s { min-width: 0; display: flex; flex-direction: column; }
.paarung .spieler-s { text-align: right; }
.paarung .name { font-weight: 650; overflow-wrap: anywhere; }
.paarung .info { font-size: .85rem; color: var(--tinte-2); }
.paarung .mitte { display: flex; justify-content: center; }
.farbe { display: inline-block; width: .7rem; height: .7rem; border: 1.5px solid var(--tinte); border-radius: 2px; vertical-align: -1px; margin-right: .35rem; }
.farbe.s { background: var(--tinte); }
kbd { font-family: inherit; font-weight: 700; font-size: .85em; padding: .05rem .4rem; border: 1px solid var(--linie); border-bottom-width: 2px; border-radius: 4px; background: var(--karte); }
.ergebnis-text { white-space: nowrap; font-weight: 750; font-size: 1.05rem; min-width: 4.2rem; text-align: center; }
.ergebnis-text.offen { color: var(--tinte-2); font-weight: 500; }
.paarung.frei .mitte { color: var(--tinte-2); }
.paarung.markiert { outline: 3px solid var(--messing); outline-offset: -3px; }

/* Ergebnis-Eingabe */
.ergebnisse { display: inline-flex; border: 1.5px solid var(--linie); border-radius: var(--r-klein); overflow: hidden; background: var(--karte); }
.ergebnisse button {
  min-width: 3.1rem; min-height: 2.5rem; border: 0; background: transparent; cursor: pointer; font-weight: 700;
  border-right: 1.5px solid var(--linie);
}
.ergebnisse button:last-child { border-right: 0; }
.ergebnisse button:hover { background: var(--flaeche); }
.ergebnisse button[aria-pressed=true] { background: var(--brett); color: #fff; }
.ergebnisse button.mehr { min-width: 2.4rem; font-weight: 500; }

/* --- Tabellen -------------------------------------------------------------- */
.tabelle { width: 100%; border-collapse: collapse; background: var(--karte); border-radius: var(--r); overflow: hidden; }
.tabelle th, .tabelle td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--linie); }
.tabelle th { font-size: .85rem; font-weight: 650; color: var(--tinte-2); background: #fafbfc; }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle .platz { width: 3rem; font-weight: 750; }
.tabelle .punkte { font-weight: 750; }
.tabelle-huelle { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--linie); }

/* --- Allgemein ----------------------------------------------------------- */
.leer { padding: 2rem 1.2rem; text-align: center; color: var(--tinte-2); background: var(--karte); border-radius: var(--r); border: 1.5px dashed var(--linie); }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 650; background: var(--brett-hell); color: var(--brett-dunkel); }
.chip.live { background: #f5ecd9; color: var(--messing-text); }
.chip.live::before { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--messing); animation: puls 2s ease-in-out infinite; }
.chip.grau { background: #e8ebee; color: var(--tinte-2); }
@keyframes puls { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .chip.live::before { animation: none; } }

.meldung { padding: .7rem .9rem; border-radius: var(--r-klein); background: var(--fehler-hell); color: var(--fehler); font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50;
  padding: .75rem 1.1rem; border-radius: var(--r); background: var(--tinte); color: #fff; font-weight: 600;
  max-width: calc(100vw - 2rem); box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.toast.fehler { background: var(--fehler); }

.meldung.erfolg { background: var(--brett-hell); color: var(--brett-dunkel); }
.fuss-links { display: flex; gap: 1.25rem; justify-content: center; padding: 1.5rem 1rem 2rem; font-size: .9rem; }
.fuss-links a { color: var(--tinte-2); }
.haken { display: grid; grid-template-columns: auto 1fr; gap: .65rem; align-items: start; cursor: pointer; font-size: .95rem; }
.haken input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--brett); }
.haken-ok { color: var(--brett); font-weight: 800; }

.marke { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.1rem; color: var(--tinte); text-decoration: none; }
.marke svg { width: 1.6rem; height: 1.6rem; }

.versteckt { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  :root { font-size: 100%; }
  h1 { font-size: 1.55rem; }
  .paarung { grid-template-columns: auto 1fr; gap: .35rem .75rem; }
  .paarung .brett { grid-row: span 3; align-self: start; }
  .paarung .spieler-s { text-align: left; }
  .paarung .mitte { justify-content: flex-start; order: 3; }
}

@media print {
  :root { font-size: 11pt; }
  body { background: #fff; }
  .nicht-drucken { display: none !important; }
  .paarung { padding: .25rem 0; border-bottom: 1px solid #ccc; border-radius: 0; break-inside: avoid; }
  .brett { width: 1.8rem; height: 1.8rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tabelle-huelle { border: 0; }
}

/* Logo */
.logo-bild { width: 2rem; height: 2rem; flex: none; display: block; }
.marke { gap: .6rem; }
.start-text .marke .logo-bild { width: 3rem; height: 3rem; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .35)); }
.start-text .marke { font-size: 1.25rem; }
