:root {
  --sb-radius: 12px;
  --sb-border: #eaeaea;
  --sb-border-soft: #eee;
}

/* Table card */
#scoreboardTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px; /* small gap between rows */
  border-radius: var(--sb-radius);
  overflow: hidden;
}

#scoreboardTable th,
#scoreboardTable td {
  padding: 10px 12px;
  border: 1px solid var(--sb-border-soft);
  vertical-align: middle;
}

/* Rounded corners for scoreboardTable rows */
#scoreboardTable tbody tr td:first-child {
  border-top-left-radius: var(--sb-radius);
  border-bottom-left-radius: var(--sb-radius);
}
#scoreboardTable tbody tr td:last-child {
  border-top-right-radius: var(--sb-radius);
  border-bottom-right-radius: var(--sb-radius);
}

#scoreboardTable thead tr th:first-child {
  border-top-left-radius: var(--sb-radius);
}
#scoreboardTable thead tr th:last-child {
  border-top-right-radius: var(--sb-radius);
}

#scoreboardTable th { 
  background: #e0e0e0;
  font-weight: 600;
}

/* Column sizing: position (1), name (2), numeric (>=3) */
#scoreboardTable > thead > tr > th:nth-child(1),
#scoreboardTable > tbody > tr > td:nth-child(1) { width: 6ch; text-align: center; }

#scoreboardTable > thead > tr > th:nth-child(2),
#scoreboardTable > tbody > tr > td:nth-child(2) {
  min-width: 220px; /* Name darf nicht zu schmal werden */
  width: auto;
  text-align: left;
  white-space: normal;
}

#scoreboardTable > thead > tr > th:nth-child(n+3),
#scoreboardTable > tbody > tr > td:nth-child(n+3) { text-align: center; }

/* Cell that embeds the inner scorecard table: symmetric padding */
#scoreboardTable td:has(> .inner-scorecard) {
  padding: 8px;
  box-sizing: border-box;
  background: #fff;
}

/* ========= Inner scorecard (per player) ========= */
.inner-scorecard {
  --holes: 18;      /* Anzahl der Loch-Spalten (ohne Label & Summe) */
  --side-col: 84px; /* Breite für erste & letzte Spalte */

  width: 100% !important;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 0; /* no gap between rows */
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  overflow: hidden;
  box-sizing: border-box;
  background: #fff;
}

/* Colgroup gesteuerte Breiten */
.inner-scorecard col.col-label { width: var(--side-col); }
.inner-scorecard col.col-hole  { width: calc((100% - 2 * var(--side-col)) / var(--holes)); }
.inner-scorecard col.col-sum   { width: var(--side-col); }

.inner-scorecard th,
.inner-scorecard td {
  padding: 10px 12px;
  border: 1px solid var(--sb-border-soft);
  text-align: center;
  white-space: normal; /* globale nowrap-Regeln überschreiben */
}
.inner-scorecard th:not(:first-child),
.inner-scorecard td:not(:first-child) { text-align: center !important; }
.inner-scorecard th { background: #f5f5f5; font-weight: 700; }
.inner-scorecard th:first-child,
.inner-scorecard td:first-child { text-align: left; }

/* Rounded corners for inner-scorecard rows */
.inner-scorecard tbody tr td:first-child {
  /* no rounded corners on inner-scorecard rows */
}
.inner-scorecard tbody tr td:last-child {
  /* no rounded corners on inner-scorecard rows */
}
/* For thead (header) of inner-scorecard */
.inner-scorecard thead tr th:first-child {
  border-top-left-radius: var(--sb-radius);
}
.inner-scorecard thead tr th:last-child {
  border-top-right-radius: var(--sb-radius);
}

/* ========= Controls ========= */
select {
  border-radius: var(--sb-radius);
  padding: 10px 12px;
  border: 1px solid #ddd;
  background: #fff;
}

/* ========= Responsive ========= */
@media (max-width: 900px) {
  #scoreboardTable > thead > tr > th:nth-child(2),
  #scoreboardTable > tbody > tr > td:nth-child(2) { min-width: 180px; }
}

@media (max-width: 600px) {
  /* Enable horizontal scroll on small screens */
  #scoreboardTable { display: block; overflow-x: auto; }
  .inner-scorecard { display: block; overflow-x: auto; }
}


body {
    background-color: #f9f9f9;
    color: black;
}

/* Grundlegende typografische Formatierungen */
body {
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

div {
    margin: 5px 2%;
    padding: 5px 2%;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* Einheitliche Formatierung für Überschriften */
h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
    color: #333;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-weight: lighter;
}

.logo { height: 100px; width:auto; }

/* ================= Scoreboard header & tournament picker ================= */
/* Header logo consistent sizing */
.app-header .logo {
  display: block;
  height: 44px;
  width: auto;
  margin: 0; /* keep left with menu */
}

/* Page title spacing */
#scoreboardTable ~ .nothing {} /* noop to keep syntax highlighter calm */

/* Centered title */
body h1 {
  text-align: center;
  font-size: clamp(24px, 3.2vw, 36px);
  margin: 16px 0 10px;
}

/* Wrap that contains the label + select (based on DOM: body > div[align="center"] > div) */
body > div[align="center"] > div:has(> #tournamentSelect) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* Label styling */
label[for="tournamentSelect"] {
  color: #444;
  font-weight: 600;
}

/* Select styling to match app controls */
#tournamentSelect {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 10px 36px 10px 12px;
  border-radius: var(--sb-radius);
  border: 1px solid #ddd;
  background: #fff;
  font-size: 16px;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  position: relative;
}

/* Add a simple arrow using a pseudo-element */
#tournamentSelect {
  background-image: linear-gradient(45deg, transparent 50%, #888 50%),
                    linear-gradient(135deg, #888 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 10px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

#tournamentSelect:focus {
  outline: none;
  border-color: #bbb;
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

/* Constrain the whole scoreboard content to a comfortable max width */
body > div[align="center"] > div:last-of-type { /* the wrapper that contains the table */
  max-width: 1200px;
  margin-inline: auto;
}