@media (max-width: 900px) and (orientation: landscape) {
  html, body, .container {
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
  }
  .table-responsive {
    max-width: 100vw !important;
  }
  #score-table, #sum-table, table {
    min-width: 600px !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

/* Footer abgerundete Kanten */
.footer-radius-left {
  border-bottom-left-radius: 12px !important;
}
.footer-radius-right {
  border-bottom-right-radius: 12px !important;
}

/* Tablet-spezifische Anpassungen */
@media (min-width: 768px) and (max-width: 1024px) {
  #sum-row-fixed {
    font-size: 1rem;
  }
  #sum-row-fixed table {
    min-width: 100%;
  }
}
/* Winner Modal */
.winner-modal-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.25);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.winner-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 32px 0 rgba(60, 80, 120, 0.18);
  padding: 32px 24px 18px 24px;
  min-width: 260px;
  max-width: 90vw;
  text-align: center;
}
.winner-modal h2 {
  color: var(--primary-green-dark);
  font-size: 1.4rem;
  margin-bottom: 18px;
}
.winner-places {
  margin-bottom: 18px;
}
.winner-place {
  font-size: 1.08rem;
  margin: 2px 0;
}
.winner-rank {
  font-weight: bold;
  color: var(--primary-green);
  margin-right: 7px;
}
.winner-name {
  font-weight: 600;
}
.winner-score {
  color: var(--text-muted);
  margin-left: 7px;
}
.winner-modal .btn {
  margin-top: 18px;
  width: auto;
  min-width: 120px;
}

/* Statistik Modal */
.stats-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  max-width: 90vw;
  max-height: 90vh;
  width: 700px;
  display: flex;
  flex-direction: column;
}

.stats-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 24px;
  text-align: center;
}

.stats-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.stats-icon {
  margin-right: 8px;
  font-size: 1.2em;
}

.stats-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-height: calc(90vh - 140px);
}

.stats-section {
  margin-bottom: 32px;
}

.stats-section:last-child {
  margin-bottom: 0;
}

.stats-section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #ecf0f1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card.success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border-color: #28a745;
}

.stat-card.danger {
  background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
  border-color: #dc3545;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 500;
}

.stats-table-container {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.95rem;
}

.stats-table th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.stats-table th:first-child {
  border-radius: 12px 0 0 0;
}

.stats-table th:last-child {
  border-radius: 0 12px 0 0;
}

.stats-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #e9ecef;
}

.stats-table tbody tr:hover {
  background: #f8f9fa;
}

.stats-table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 12px;
}

.stats-table tbody tr:last-child td:last-child {
  border-radius: 0 0 12px 0;
}

.player-name {
  font-weight: 600;
  color: #2c3e50;
}

.hit-rate {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
  transition: width 0.3s ease;
}

.stats-footer {
  padding: 20px 24px;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 120px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Runden-Header mit Spielkarte */
.input-container {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.card-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.playing-card {
  width: 60px;
  height: 84px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #dee2e6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 3px 6px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  transition: all 0.3s ease;
}

.playing-card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.playing-card::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: 8px;
  height: 8px;
  background: #dc3545;
  border-radius: 50%;
}

.playing-card::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: #dc3545;
  border-radius: 50%;
}

.card-number {
  font-size: 1.8rem;
  font-weight: bold;
  color: #2c3e50;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
/* Black circle for last 1 in Runde column */
.runde-black-circle {
  display: inline-block;
  width: 1.7em;
  height: 1.7em;
  background: #111;
  color: #fff;
  border-radius: 50%;
  line-height: 1.7em;
  text-align: center;
  font-weight: bold;
  font-size: 1.1em;
  box-shadow: 0 1px 4px 0 rgba(0,0,0,0.13);
}
#round-section {
  margin-bottom: 18px;
}
/* Modern, responsive, light green theme for Nullern Punkte App */
:root {
  --primary-bg: #eafbe7;
  --primary-green: #6fcf97;
  --primary-green-dark: #3a7e6c;
  --primary-green-light: #d6f5e3;
  --accent-blue: #2a5d8f;
  --table-header-bg: #d6f5e3;
  --table-row-even: #f6fcf7;
  --table-row-odd: #eafbe7;
  --table-border: #b6e3c6;
  --table-sum-bg: #c6f2d6;
  --text-main: #23272f;
  --text-muted: #6b7a8f;
}

html, body {
  margin: 0;
  padding: 0;
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  /* Support for iOS safe areas */
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Inter', Arial, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, var(--primary-bg) 100%);
  color: var(--text-main);
}


.container {
  width: 100vw;
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 16px 0 rgba(60, 80, 120, 0.09);
  padding: 0 0 24px 0;
  display: flex;
  flex-direction: column;
}

header.app-header {
  background: var(--primary-green);
  border-radius: 18px 18px 0 0;
  padding: 18px 0 10px 0;
  text-align: center;
  color: #fff;
  box-shadow: 0 2px 8px 0 rgba(60, 80, 120, 0.04);
  position: relative;
}

.restart-game-btn {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.4rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.35s;
  padding: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.restart-game-btn:hover {
  background: rgba(255,255,255,0.30);
  transform: translateY(-50%) rotate(-45deg);
}
.restart-game-btn:active {
  background: rgba(255,255,255,0.45);
  transform: translateY(-50%) rotate(-90deg) scale(0.92);
}

h1 {
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -1px;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--primary-green-dark);
  text-align: center;
}

#round-section {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding: 18px 12px 8px 12px;
  box-shadow: 0 2px 8px 0 rgba(60, 80, 120, 0.04);
}

#table-section {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 0 64px 0;
}

#game-section {
  padding: 16px 20px 120px 20px;
  min-height: 100vh;
}

#table-section {
  margin-bottom: 24px;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border-radius: 12px;
  overflow: hidden;
  table-layout: fixed;
}
th, td {
  padding: 0.6em 0.3em;
  border-bottom: 1px solid var(--table-border);
  text-align: center;
}

/* Double border after Runde column */
th.runde-sep, td.runde-sep {
  border-right: 3px double var(--primary-green-dark) !important;
}
th {
  background: var(--table-header-bg);
  font-weight: 600;
  color: var(--accent-blue);
  font-size: 1rem;
}
table tbody tr:nth-child(even) {
  background: var(--table-row-even);
}
table tbody tr:nth-child(odd) {
  background: var(--table-row-odd);
}
.player-sep {
  border-left: 2px solid var(--table-border) !important;
}
.score-correct {
  background: #e3fbe7;
  color: var(--primary-green-dark);
  font-weight: 600;
  border-radius: 5px;
}
.score-wrong {
  background: #ffeaea;
  color: #b94a48;
  font-weight: 600;
  border-radius: 5px;
}
.sum-row td {
  background: var(--table-sum-bg);
  color: var(--primary-green-dark);
  font-weight: 700;
  border-radius: 0 0 7px 7px;
}

input[type="number"], input[type="text"] {
  width: 7em;
  min-width: 4em;
  max-width: 100px;
  padding: 7px 9px;
  border: 1px solid var(--table-border);
  border-radius: 7px;
  font-size: 16px;
  margin-bottom: 8px;
  background: #f4f8fb;
  color: var(--text-main);
  outline: none;
  transition: border 0.2s;
  display: inline-block;
}
input[type="number"]:focus, input[type="text"]:focus {
  border: 1.5px solid var(--primary-green);
}
.btn {
  background: linear-gradient(90deg, var(--primary-green) 0%, #a8e063 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px 0 rgba(60, 80, 120, 0.07);
  margin-top: 6px;
  transition: background 0.2s, box-shadow 0.2s;
  width: 100%;
}
.btn:hover {
  background: linear-gradient(90deg, #a8e063 0%, var(--primary-green) 100%);
  box-shadow: 0 2px 8px 0 rgba(60, 80, 120, 0.13);
}

/* Pulsier-Animation für den Nächste Runde Button */
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 1px 3px 0 rgba(60, 80, 120, 0.07);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 3px 12px 0 rgba(60, 80, 120, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 1px 3px 0 rgba(60, 80, 120, 0.07);
  }
}

.btn-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}
.round-inputs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 -6px;
  gap: 8px;
  flex: 1;
}
.round-inputs label {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 6px 8px 6px;
  min-width: 75px;
}

.round-inputs .player-label {
  margin-bottom: 4px;
  font-size: 0.9rem;
  color: var(--primary-green-dark, #219150);
  font-weight: 500;
}

.round-inputs input[type="number"] {
  width: 55px;
  padding: 4px 6px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #b2dfdb;
  text-align: center;
  height: 36px;
}

.input-row {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
@media (max-width: 1200px) {
  .container {
    max-width: 98vw;
  }
  .table-responsive {
    max-width: 98vw;
  }
  #score-table, #sum-table {
    min-width: 600px;
    width: 100%;
  }
}

/* Tabelle bei vielen Spielern kompakter machen */
@media (max-width: 1200px), (max-width: 1600px) and (min-width: 900px) {
  table, #score-table, #sum-table {
    font-size: 0.92rem;
    min-width: 100vw;
  }
  th, td {
    padding: 0.3em 0.1em;
  }
  input[type="number"], input[type="text"] {
    max-width: 70px;
    font-size: 0.95rem;
    padding: 5px 6px;
  }
}

/* Bei ganz kleinen Bildschirmen noch kompakter */
@media (max-width: 900px) {
  table, #score-table, #sum-table {
    font-size: 0.82rem;
    min-width: 100vw;
  }
  th, td {
    padding: 0.15em 0.03em;
  }
  input[type="number"], input[type="text"] {
    max-width: 45px;
    font-size: 0.85rem !important;
    padding: 3px 3px;
  }
  .container {
    max-width: 100vw;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }
  header.app-header {
    border-radius: 0;
    padding: 8px 0 6px 0;
    font-size: 1.1rem;
  }
  #round-section {
    padding: 8px 2vw 6px 2vw;
  }
  table {
    font-size: 0.92rem;
  }
  th, td {
    padding: 0.25em 0.05em;
  }
  .winner-modal {
    max-width: 98vw;
    min-width: 0;
    padding: 18px 6vw 12px 6vw;
    font-size: 0.98rem;
  }
  .winner-modal-bg {
    align-items: flex-end;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}
@media (max-width: 700px) {
  .table-responsive {
    max-width: 100vw;

  }
  #score-table, #sum-table {
    min-width: 320px;
    width: 100%;
  }
  .winner-modal {
    max-width: 99vw;
    min-width: 0;
    padding: 12px 2vw 8px 2vw;
    font-size: 0.95rem;
  }
}
@media (max-width: 500px) {
  .container {
    padding: 0;
    border-radius: 0;
    min-width: 100vw;
  }
  table {
    font-size: 0.85rem;
  }
  th, td {
    font-size: 0.89rem;
    padding: 2px 1px;
  }
  .winner-modal {
    max-width: 100vw;
    min-width: 0;
    padding: 8px 1vw 6px 1vw;
    font-size: 0.92rem;
  }
}
/* Center the button below the round input fields */
.round-inputs + .btn,
.round-inputs.grid-players + .btn {
  display: block;
  width: 100%;
  margin: 8px 0 0 0;
}
/* Grid layout for 5+ players */
.round-inputs.grid-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  justify-items: center;
}

/* dealer-circle class for dealer's turn indication */
.dealer-circle {
  display: inline-block;
  border: 2px solid #27ae60;
  border-radius: 50%;
  padding: 0.2em 0.7em;
  background: #eaffea;
  color: #219150;
  font-weight: bold;
  margin: 0 2px;
}
.dealer-circle.start-player {
  border-color: #2a5d8f;
  background: #e3f0ff;
  color: #2a5d8f;
}
.dealer-circle.dealer-start {
  background: linear-gradient(45deg, #ffd700 50%, #e3f0ff 50%);
  color: #2a5d8f;
  border-color: #2a5d8f;
}

/* Einheitliche Abstände und Ausrichtung für Spieleranzahl und Spielernamen */
#setup-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#setup-form label {
  margin-bottom: 6px;
  font-size: 1rem;
  color: var(--primary-green-dark, #219150);
  align-self: flex-start;
}

#setup-form input[type="number"] {
  width: 80px;
  padding: 7px 9px;
  font-size: 1rem;
  border-radius: 7px;
  border: 1px solid var(--table-border);
  margin-bottom: 8px;
  background: #f4f8fb;
  color: var(--text-main);
  outline: none;
  transition: border 0.2s;
  display: inline-block;
  text-align: center;
}

.player-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 16px;
  width: 100%;
}

.player-name-input {
  width: 120px;
  padding: 6px 8px;
  font-size: 16px !important;
  border-radius: 7px;
  border: 1px solid var(--table-border);
  margin-bottom: 8px;
  background: #f4f8fb;
  color: var(--text-main);
  outline: none;
  transition: border 0.2s;
  display: inline-block;
  text-align: center;
}

.num-players-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.num-players-group label {
  margin-bottom: 6px;
  font-size: 1rem;
  color: var(--primary-green-dark, #219150);
  text-align: center;
}

.dealer-select {
  width: 100%;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--primary-green, #6fcf97);
  background: var(--primary-green-light, #d6f5e3);
  color: var(--primary-green-dark, #3a7e6c);
  font-size: 1.1rem;
  margin: 18px 0 10px 0;
  outline: none;
  transition: border 0.2s;
  box-shadow: 0 2px 8px 0 rgba(60, 80, 120, 0.07);
}

.dealer-select:focus {
  border: 2px solid var(--primary-green-dark, #3a7e6c);
  background: #fff;
}

#sum-row-fixed {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: auto;
  max-width: 100%;
  background: transparent;
  z-index: 100;
  box-shadow: 0 -2px 8px 0 rgba(60, 80, 120, 0.07);
  text-align: center;
  overflow-x: hidden;
  font-weight: bold;
  font-size: 1.08rem;
  padding: 0 0 env(safe-area-inset-bottom, 0) 0;
  border-radius: 0 0 12px 12px;
  pointer-events: none;
  overflow-x: hidden;
}
#sum-row-fixed table {
  width: 100%;
  max-width: none;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0 auto;
  padding: 0;
}

/* Spezielle Positionierung für Tablets */
@media (min-width: 768px) and (max-width: 1024px) {
  #sum-row-fixed table {
    table-layout: fixed;
    width: auto;
    min-width: auto;
  }
}

@media (max-width: 900px) {
  #sum-row-fixed {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: 0 -2px 8px 0 rgba(60, 80, 120, 0.07);
    padding: 0 0 calc(env(safe-area-inset-bottom, 0) + 8px) 0;
  }
  #sum-row-fixed table {
    width: 100%;
    min-width: 400px;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }
}
@media (max-width: 700px) {
  #sum-row-fixed {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: 0 -2px 8px 0 rgba(60, 80, 120, 0.07);
    padding: 0 0 calc(env(safe-area-inset-bottom, 0) + 8px) 0;
  }
  #sum-row-fixed table {
    width: 100%;
    min-width: 400px;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }
}
@media (max-width: 500px) {
  #sum-row-fixed {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: 0 -2px 8px 0 rgba(60, 80, 120, 0.07);
    padding: 0 0 calc(env(safe-area-inset-bottom, 0) + 8px) 0;
  }
  #sum-row-fixed table {
    width: 100%;
    min-width: 400px;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }
}

/* Responsive Anpassungen f�r Statistik Modal */
@media (max-width: 768px) {
  .stats-modal {
    width: 95vw;
    max-height: 95vh;
  }
  
  .stats-content {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .stat-card {
    padding: 12px 8px;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .stats-table {
    font-size: 0.85rem;
  }
  
  .stats-table th,
  .stats-table td {
    padding: 8px 6px;
  }
  
  .hit-rate {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }
  
  .progress-bar {
    height: 6px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-table th,
  .stats-table td {
    padding: 6px 4px;
  }
  
  .stats-header {
    padding: 16px;
  }
  
  .stats-footer {
    padding: 16px;
  }
}

/* Responsive Anpassungen für Kartenanzeige */
@media (max-width: 768px) {
  .input-container {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .playing-card {
    width: 70px;
    height: 98px;
  }
  
  .card-number {
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  .playing-card {
    width: 60px;
    height: 84px;
  }
  
  .card-number {
    font-size: 2rem;
  }
  
  .playing-card::before,
  .playing-card::after {
    width: 6px;
    height: 6px;
    top: 6px;
    left: 6px;
  }
  
  .playing-card::after {
    bottom: 6px;
    right: 6px;
  }
}

/* Bessere Scrolling-Unterstützung für verschiedene Bildschirmgrößen */
@media (max-height: 850px) {
  #game-section {
    padding-bottom: 90px;
  }
  header.app-header {
    padding: 8px 0 5px 0;
  }
  h1 {
    font-size: 1.5rem;
  }
  #round-section {
    padding: 8px 12px 5px 12px;
  }
}

@media (max-height: 600px) {
  #game-section {
    padding-bottom: 80px;
  }
}

/* iPad Querformat Optimierung */
@media (min-width: 768px) and (orientation: landscape) {
  header.app-header {
    padding: 6px 0 4px 0;
  }
  h1 {
    font-size: 1.4rem;
  }
  #round-section {
    padding: 6px 12px 4px 12px;
  }
  #game-section {
    padding: 8px 16px 80px 16px;
  }
  .input-container {
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }
  .playing-card {
    width: 52px;
    height: 72px;
  }
  .card-number {
    font-size: 1.5rem;
  }
}

/* Tipp-Summen-Label */
.guess-sum-label {
  text-align: center;
  margin: 10px 0;
  padding: 8px;
  border-radius: 6px;
  font-weight: bold;
}
.guess-sum-init {
  color: #6c757d;
  background: #f8f9fa;
}
.guess-sum-below {
  color: #0066cc;
  background: #e6f3ff;
}
.guess-sum-exact {
  color: #28a745;
  background: #d4edda;
}
.guess-sum-above {
  color: #dc3545;
  background: #f8d7da;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-bg: #1a2e1a;
    --primary-green: #4caf78;
    --primary-green-dark: #7ecfa0;
    --primary-green-light: #1e3a2a;
    --accent-blue: #7ab3d6;
    --table-header-bg: #1e3a2a;
    --table-row-even: #1a2620;
    --table-row-odd: #1e2c20;
    --table-border: #2d4d38;
    --table-sum-bg: #1e3a2a;
    --text-main: #dceadc;
    --text-muted: #8fa89a;
    color-scheme: dark;
  }

  html, body {
    background: linear-gradient(135deg, #0d1710 0%, #1a2e1a 100%);
    color-scheme: dark;
  }

  .container {
    background: #111e12;
    box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.4);
  }

  header.app-header {
    background: #1e4d30;
  }

  #round-section {
    background: #111e12;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.3);
  }

  input[type="number"],
  input[type="text"],
  .player-name-input {
    background: #1a2820;
    color: var(--text-main);
    border-color: #2d4d38;
  }

  input[type="number"]:focus,
  input[type="text"]:focus {
    border-color: var(--primary-green);
    background: #1e3020;
  }

  table {
    background: #131f14;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  th {
    background: var(--table-header-bg);
    color: var(--accent-blue);
  }

  .score-correct {
    background: #1a3a22;
    color: #6fcf97;
  }

  .score-wrong {
    background: #3a1a1a;
    color: #e07070;
  }

  .winner-modal,
  .stats-modal {
    background: #131f14;
    color: var(--text-main);
  }

  .winner-modal h2 {
    color: var(--primary-green);
  }

  .winner-modal-bg {
    background: rgba(0, 0, 0, 0.6);
  }

  .stat-card {
    background: #1a2820;
    border-color: #2d4d38;
  }

  .stat-card.success {
    background: linear-gradient(135deg, #1a3a22 0%, #1e4428 100%);
    border-color: #3a7a50;
  }

  .stat-card.danger {
    background: linear-gradient(135deg, #3a1a1a 0%, #4a2020 100%);
    border-color: #7a3a3a;
  }

  .stat-number {
    color: var(--text-main);
  }

  .stats-header {
    background: linear-gradient(135deg, #3a4a8a 0%, #4a2a6a 100%);
  }

  .stats-footer {
    background: #1a2820;
    border-color: #2d4d38;
  }

  .stats-section-title {
    color: var(--text-main);
    border-color: #2d4d38;
  }

  .stats-table {
    background: #131f14;
  }

  .stats-table th {
    background: linear-gradient(135deg, #3a4a8a 0%, #4a2a6a 100%);
  }

  .stats-table tbody tr:hover {
    background: #1a2820;
  }

  .stats-table td {
    border-color: #2d4d38;
  }

  .dealer-select {
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
    border-color: var(--primary-green);
  }

  #sum-row-fixed td {
    background: #1e3a2a !important;
    color: var(--primary-green-dark);
  }

  .playing-card {
    background: linear-gradient(145deg, #1e2e22 0%, #1a2820 100%);
    border-color: #2d4d38;
  }

  .card-number {
    color: var(--text-main);
  }

  .playing-card::before,
  .playing-card::after {
    background: #c04040;
  }

  .dealer-circle {
    border-color: #4caf78;
    background: #1a3a22;
    color: #7ecfa0;
  }

  .dealer-circle.start-player {
    border-color: #7ab3d6;
    background: #1a2e3a;
    color: #7ab3d6;
  }

  .dealer-circle.dealer-start {
    background: linear-gradient(45deg, #8a6a00 50%, #1a2e3a 50%);
    color: #7ab3d6;
    border-color: #7ab3d6;
  }

  .player-name {
    color: var(--text-main);
  }

  /* Spezifitäts-Override: Setup-Inputs haben höhere Spezifizität als generische Regeln */
  #setup-form input[type="number"],
  #setup-form input[type="text"] {
    background: #1a2820 !important;
    color: var(--text-main) !important;
    border-color: #2d4d38 !important;
  }

  .progress-bar {
    background: #2d4d38;
  }

  .guess-sum-init {
    color: #8fa89a;
    background: #1a2820;
  }
  .guess-sum-below {
    color: #7ab3d6;
    background: #1a2e3a;
  }
  .guess-sum-exact {
    color: #6fcf97;
    background: #1a3a22;
  }
  .guess-sum-above {
    color: #e07070;
    background: #3a1a1a;
  }
}
