:root {
  --blau: #2563eb;
  --rot: #dc2626;
  --gruen: #16a34a;
  --grau: #6b7280;
  --hell: #f3f4f6;
  --gelb: #eab308;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--hell);
  color: #111827;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-nav .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--blau);
  text-decoration: none;
}

.top-nav nav a {
  display: inline-block;
  margin-left: 16px;
  padding: 12px 0;
  text-decoration: none;
  color: #374151;
  font-weight: 500;
}

.sprach-umschalter {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid #e5e7eb;
}

.sprach-umschalter a {
  margin-left: 8px;
  padding: 6px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 6px;
  color: var(--grau);
}

.sprach-umschalter a.aktiv {
  background: var(--blau);
  color: white;
}

.sprach-umschalter a:first-child { margin-left: 0; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; margin-top: 24px; }

.karte {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.field input {
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  min-height: 44px;
  width: 100%;
}

.btn-primary {
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: var(--blau);
  border: none;
  border-radius: 8px;
  min-height: 48px;
  cursor: pointer;
}

.btn-primary:active { background: #1d4ed8; }

.btn-secondary {
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blau);
  background: white;
  border: 1px solid var(--blau);
  border-radius: 8px;
  min-height: 44px;
  cursor: pointer;
}

.btn-secondary:active { background: #dbeafe; }

.btn-reset {
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--rot);
  background: white;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  min-height: 44px;
  cursor: pointer;
}

.btn-reset:active { background: #fee2e2; }

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.spiel-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.spiel-kachel {
  display: block;
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: #111827;
  font-weight: 700;
  font-size: 1.1rem;
  border: 2px solid transparent;
}

.spiel-kachel:active { border-color: var(--blau); }

.statistik-tabelle {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.statistik-tabelle th, .statistik-tabelle td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}

.statistik-tabelle th { background: #f9fafb; }
.statistik-tabelle td.empty { text-align: center; color: var(--grau); font-style: italic; }

.modus-auswahl {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.modus-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  color: #374151;
}

.modus-btn.aktiv {
  background: var(--blau);
  color: white;
  border-color: var(--blau);
}

.zug-anzeige {
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 12px 0;
  min-height: 1.4em;
}

.ergebnis-banner {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
  background: #dcfce7;
  color: #166534;
}

.ergebnis-banner.unentschieden {
  background: #f3f4f6;
  color: #374151;
}

.spielbrett-xo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
  background: var(--blau);
  padding: 8px;
  border-radius: 12px;
}

.xo-zelle {
  aspect-ratio: 1;
  background: white;
  border: none;
  border-radius: 8px;
  font-size: 2.5rem;
  font-weight: 700;
  cursor: pointer;
  color: #111827;
}

.xo-zelle:disabled { cursor: default; }
.xo-zelle.symbol-x { color: var(--blau); }
.xo-zelle.symbol-o { color: var(--rot); }

.spielbrett-vier-gewinnt {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
  background: #1d4ed8;
  padding: 8px;
  border-radius: 12px;
}

.vg-spalte {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.vg-spalte:disabled { cursor: default; }

.vg-zelle {
  aspect-ratio: 1;
  border-radius: 50%;
  background: white;
}

.vg-zelle.stein-spieler1 { background: var(--rot); }
.vg-zelle.stein-spieler2 { background: var(--gelb); }

@media (max-width: 480px) {
  .xo-zelle { font-size: 2rem; }

  .statistik-tabelle {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .statistik-tabelle th, .statistik-tabelle td {
    padding: 8px;
    font-size: 0.85rem;
  }

  .top-nav { flex-wrap: wrap; row-gap: 8px; }
  .top-nav nav a { margin-left: 0; margin-right: 14px; }
}

.schiffe-boards {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 16px 0;
}

.schiffe-board-label {
  text-align: center;
  font-weight: 600;
  margin: 0 0 6px 0;
}

.spielbrett-schiffe {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  max-width: 340px;
  margin: 0 auto;
  background: #1d4ed8;
  padding: 6px;
  border-radius: 8px;
}

.sv-zelle {
  aspect-ratio: 1;
  background: #93c5fd;
  border: none;
  border-radius: 2px;
  padding: 0;
}

.sv-zelle.treffer { background: var(--rot); }
.sv-zelle.wasser { background: #e5e7eb; }
.sv-zelle:disabled { cursor: default; }
.sv-zelle:not(:disabled) { cursor: pointer; }

.flotten-status {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.flotte-liste {
  list-style: none;
  padding: 0;
  margin: 6px 0 0 0;
  font-size: 0.9rem;
}

.flotte-liste li { padding: 2px 0; }
.flotte-liste li.versenkt { text-decoration: line-through; color: var(--grau); }
