* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f4f4f4;
}

/* ===============================
   APP CONTAINER
   =============================== */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 72px;
}

/* ===============================
   CONTROLS – EINE ZEILE
   =============================== */

.controls {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  background: #ffffff;
  border-bottom: 1px solid #ccc;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.controls input,
.controls select {
  flex: 1;
  min-width: 0;
  padding: .6rem;
  font-size: 1rem;
}

.search-box input {
  width: 100%;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + .2rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
  overflow: hidden;
  z-index: 40;
}

.search-suggestion-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #ececec;
  background: #fff;
  text-align: left;
  padding: .62rem .75rem;
  font: inherit;
  cursor: pointer;
}

.search-suggestion-item:last-child {
  border-bottom: 0;
}

.search-suggestion-item:hover {
  background: #f5f5f5;
}

#overview .k-font-control {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

#overview .k-font-control label {
  font-size: .8rem;
  font-weight: 600;
  color: #444;
}

#overview .k-font-control input[type="range"] {
  width: 88px;
}

#overview .k-font-control span {
  font-size: .75rem;
  color: #555;
  min-width: 40px;
  text-align: right;
}

/* ===============================
   PAGE NAVIGATION
   =============================== */

.page-nav {
  display: block;
  padding: .5rem .75rem;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
}

.page-nav a {
  display: inline-block;
  margin-right: 1rem;
  text-decoration: none;
  color: #555;
  font-weight: 500;
  padding: .25rem .5rem;
  border-radius: 4px;
}

.page-nav a.active {
  background: #ffffff;
  border: 1px solid #ccc;
  color: #000;
}

.page-nav a:hover {
  background: #eaeaea;
}

/* ===============================
   MAIN CONTENT
   =============================== */

main {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

/* ===============================
   INDEX.PHP – DETAILS VIEW
   =============================== */

.detail-row {
  margin-bottom: .35rem;
}

/* ===============================
   OVERVIEW.PHP – RANKING VIEW
   =============================== */

#overview .ranking-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem .7rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

#overview .ranking-row:hover {
  background: #dedede;
}

#overview .ranking-row:nth-of-type(odd) {
  background: #ffffff;
}

#overview .ranking-row:nth-of-type(even) {
  background: #eaeaea;
}

#overview .ranking-row.is-eliminated,
#overview .ranking-row.is-eliminated:hover {
  background: #c62828;
  color: #fff;
}

#overview .ranking-row.is-eliminated .rank-number,
#overview .ranking-row.is-eliminated .rank-name,
#overview .ranking-row.is-eliminated .rank-total-points,
#overview .ranking-row.is-eliminated .rank-text,
#overview .ranking-row.is-eliminated .rank-metric-label,
#overview .ranking-row.is-eliminated .rank-metric-value {
  color: #fff;
  opacity: 1;
}

#overview .ranking-row.is-eliminated .rank-metric {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.45);
}

/* Ranking Nummer */
#overview .rank-number {
  font-weight: 600;
  min-width: 2rem;
  flex-shrink: 0;
}

/* Inhalt (Name + Werte + Bewertung) */
#overview .rank-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Kopfzeile (Name links, Gesamtpunkte rechts) */
#overview .rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}

/* Name */
#overview .rank-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}

#overview .eliminated-badge {
  display: inline-block;
  margin-left: .45rem;
  padding: .14rem .42rem;
  border-radius: 999px;
  background: #c62828;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.1;
  vertical-align: middle;
  letter-spacing: .02em;
}

#overview .rank-total-points {
  font-size: .85rem;
  font-weight: 600;
  opacity: .85;
  white-space: nowrap;
  flex-shrink: 0;
}

#overview .rank-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: .45rem;
  margin-top: 6px;
}

#overview .rank-metric {
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  padding: .25rem .35rem;
  background: rgba(255, 255, 255, 0.55);
  min-width: 0;
}

#overview .rank-metric-label {
  display: block;
  font-size: .66rem;
  line-height: 1.2;
  opacity: .7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#overview .rank-metric-value {
  display: block;
  font-size: .82rem;
  line-height: 1.25;
  font-weight: 600;
  word-break: break-word;
}

/* 🔥 Bewertungstext (Spalte K) */
#overview .rank-text {
  font-size: var(--overview-k-font-size, .75rem);
  opacity: 0.6;
  margin-top: 8px;
  line-height: 1.35;
  word-break: break-word;
}

/* ===============================
   CENTER LOGO
   =============================== */

#logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60vh;
}

#logo-container img {
  max-width: 250px;
  width: 100%;
  height: auto;
  opacity: 0.9;
}

/* ===============================
   MOBILE OPTIMIERUNG
   =============================== */

@media (max-width: 600px) {

  .app {
    padding-top: 58px;
  }

  .controls {
    padding: .5rem;
    gap: .4rem;
  }

  .controls input,
  .controls select {
    padding: .5rem;
    font-size: .9rem;
  }

  .page-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: .35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding: .45rem .5rem;
  }

  .page-nav a {
    flex: 0 0 auto;
    margin-right: 0;
    padding: .24rem .45rem;
  }

  #overview .k-font-control {
    gap: .25rem;
  }

  #overview .k-font-control label {
    font-size: .72rem;
  }

  #overview .k-font-control input[type="range"] {
    width: 72px;
  }

  #overview .k-font-control span {
    font-size: .68rem;
    min-width: 34px;
  }

  main {
    padding: .6rem;
  }

  .benchmark-chart-section {
    margin: 0 .6rem .6rem;
    padding: .7rem;
  }

  .benchmark-chart-grid {
    grid-template-columns: 1fr;
    gap: .5rem;
  }

  .benchmark-chart-card {
    padding: .45rem;
  }

  .benchmark-chart-card-title {
    font-size: .82rem;
  }

  .benchmark-chart-card-subtitle {
    font-size: .7rem;
  }

  #overview .ranking-row {
    padding: .6rem .5rem;
    gap: .6rem;
  }

  #overview .rank-name {
    font-size: .95rem;
  }

  #overview .eliminated-badge {
    font-size: .62rem;
    padding: .12rem .34rem;
    margin-left: .35rem;
  }

  #overview .rank-total-points {
    font-size: .75rem;
  }

  #overview .rank-metrics-row {
    grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
    gap: .35rem;
    margin-top: 5px;
  }

  #overview .rank-metric {
    padding: .2rem .3rem;
  }

  #overview .rank-metric-label {
    font-size: .6rem;
  }

  #overview .rank-metric-value {
    font-size: .72rem;
  }

  #overview .rank-number {
    min-width: 1.6rem;
    font-size: .9rem;
  }

  #logo-container {
    height: 40vh;
  }

  #logo-container img {
    max-width: 180px;
  }
}

/* ===============================
   LOADING OVERLAY
   =============================== */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 244, 244, 0.85);
  display: none; /* 🔥 standardmäßig aus */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loading-overlay.active {
  display: flex; /* 🔥 nur wenn aktiv sichtbar */
}

.loader {
  width: 42px;
  height: 42px;
  border: 4px solid #ddd;
  border-top: 4px solid #444;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f4f4f4;
}

/* ===============================
   APP CONTAINER
   =============================== */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 72px;
}

/* ===============================
   CONTROLS – EINE ZEILE
   =============================== */

.controls {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  background: #ffffff;
  border-bottom: 1px solid #ccc;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

.controls input,
.controls select {
  flex: 1;
  min-width: 0;
  padding: .6rem;
  font-size: 1rem;
}

#overview .k-font-control {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

#overview .k-font-control label {
  font-size: .8rem;
  font-weight: 600;
  color: #444;
}

#overview .k-font-control input[type="range"] {
  width: 88px;
}

#overview .k-font-control span {
  font-size: .75rem;
  color: #555;
  min-width: 40px;
  text-align: right;
}

/* ===============================
   PAGE NAVIGATION
   =============================== */

.page-nav {
  display: block;
  padding: .5rem .75rem;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
}

.page-nav a {
  display: inline-block;
  margin-right: 1rem;
  text-decoration: none;
  color: #555;
  font-weight: 500;
  padding: .25rem .5rem;
  border-radius: 4px;
}

.page-nav a.active {
  background: #ffffff;
  border: 1px solid #ccc;
  color: #000;
}

.page-nav a:hover {
  background: #eaeaea;
}

/* ===============================
   MAIN CONTENT
   =============================== */

main {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

/* ===============================
   INDEX.PHP – DETAILS VIEW
   =============================== */

.detail-row {
  margin-bottom: .35rem;
}

/* ===============================
   OVERVIEW.PHP – RANKING VIEW
   =============================== */

#overview .ranking-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem .7rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

#overview .ranking-row:hover {
  background: #dedede;
}

#overview .ranking-row:nth-of-type(odd) {
  background: #ffffff;
}

#overview .ranking-row:nth-of-type(even) {
  background: #eaeaea;
}

#overview .ranking-row.is-eliminated,
#overview .ranking-row.is-eliminated:hover {
  background: #c62828;
  color: #fff;
}

#overview .ranking-row.is-eliminated .rank-number,
#overview .ranking-row.is-eliminated .rank-name,
#overview .ranking-row.is-eliminated .rank-total-points,
#overview .ranking-row.is-eliminated .rank-text,
#overview .ranking-row.is-eliminated .rank-metric-label,
#overview .ranking-row.is-eliminated .rank-metric-value {
  color: #fff;
  opacity: 1;
}

#overview .ranking-row.is-eliminated .rank-metric {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.45);
}

/* Ranking Nummer */
#overview .rank-number {
  font-weight: 600;
  min-width: 2rem;
  flex-shrink: 0;
}

/* Inhalt (Name + Werte + Bewertung) */
#overview .rank-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Kopfzeile (Name links, Gesamtpunkte rechts) */
#overview .rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}

/* Name */
#overview .rank-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}

#overview .eliminated-badge {
  display: inline-block;
  margin-left: .45rem;
  padding: .14rem .42rem;
  border-radius: 999px;
  background: #c62828;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.1;
  vertical-align: middle;
  letter-spacing: .02em;
}

#overview .rank-total-points {
  font-size: .85rem;
  font-weight: 600;
  opacity: .85;
  white-space: nowrap;
  flex-shrink: 0;
}

#overview .rank-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: .45rem;
  margin-top: 6px;
}

#overview .rank-metric {
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  padding: .25rem .35rem;
  background: rgba(255, 255, 255, 0.55);
  min-width: 0;
}

#overview .rank-metric-label {
  display: block;
  font-size: .66rem;
  line-height: 1.2;
  opacity: .7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#overview .rank-metric-value {
  display: block;
  font-size: .82rem;
  line-height: 1.25;
  font-weight: 600;
  word-break: break-word;
}

/* 🔥 Bewertungstext (Spalte K) */
#overview .rank-text {
  font-size: var(--overview-k-font-size, .75rem);
  opacity: 0.6;
  margin-top: 8px;
  line-height: 1.35;
  word-break: break-word;
}

/* ===============================
   CENTER LOGO
   =============================== */

#logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60vh;
}

#logo-container img {
  max-width: 250px;
  width: 100%;
  height: auto;
  opacity: 0.9;
}

/* ===============================
   MOBILE OPTIMIERUNG
   =============================== */

@media (max-width: 600px) {

  .app {
    padding-top: 58px;
  }

  .controls {
    padding: .5rem;
    gap: .4rem;
  }

  .controls input,
  .controls select {
    padding: .5rem;
    font-size: .9rem;
  }

  .page-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: .35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding: .45rem .5rem;
  }

  .page-nav a {
    flex: 0 0 auto;
    margin-right: 0;
    padding: .24rem .45rem;
  }

  #overview .k-font-control {
    gap: .25rem;
  }

  #overview .k-font-control label {
    font-size: .72rem;
  }

  #overview .k-font-control input[type="range"] {
    width: 72px;
  }

  #overview .k-font-control span {
    font-size: .68rem;
    min-width: 34px;
  }

  main {
    padding: .6rem;
  }

  #overview .ranking-row {
    padding: .6rem .5rem;
    gap: .6rem;
  }

  #overview .rank-name {
    font-size: .95rem;
  }

  #overview .eliminated-badge {
    font-size: .62rem;
    padding: .12rem .34rem;
    margin-left: .35rem;
  }

  #overview .rank-total-points {
    font-size: .75rem;
  }

  #overview .rank-metrics-row {
    grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
    gap: .35rem;
    margin-top: 5px;
  }

  #overview .rank-metric {
    padding: .2rem .3rem;
  }

  #overview .rank-metric-label {
    font-size: .6rem;
  }

  #overview .rank-metric-value {
    font-size: .72rem;
  }

  #overview .rank-number {
    min-width: 1.6rem;
    font-size: .9rem;
  }

  #logo-container {
    height: 40vh;
  }

  #logo-container img {
    max-width: 180px;
  }
}

/* ===============================
   LOADING OVERLAY
   =============================== */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 244, 244, 0.85);
  display: none; /* 🔥 standardmäßig aus */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loading-overlay.active {
  display: flex; /* 🔥 nur wenn aktiv sichtbar */
}

.loader {
  width: 42px;
  height: 42px;
  border: 4px solid #ddd;
  border-top: 4px solid #444;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* User pages: overview, comparing, details, top, compare-select */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 244, 244, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader {
  width: 42px;
  height: 42px;
  border: 4px solid #ddd;
  border-top: 4px solid #444;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#roundFilter {
  flex: 0 0 120px;
  max-width: 120px;
}

#comparing-toolbar {
  display: flex;
  gap: .5rem;
  width: 100%;
  align-items: center;
  flex-wrap: nowrap;
}

#openCompareSelection,
#clearCompareFilter,
#openCompareChart {
  flex: 0 0 auto;
  padding: .42rem .62rem;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  line-height: 1.1;
}

#openCompareSelection:hover,
#clearCompareFilter:hover,
#openCompareChart:hover {
  background: #f2f2f2;
}

#openCompareChart:disabled {
  opacity: .55;
  cursor: not-allowed;
}

#compare-selection-info {
  flex: 1;
  min-width: 140px;
  font-size: .82rem;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#overview .controls {
  padding: .55rem .7rem;
}

#overview .page-nav {
  position: sticky;
  top: 58px;
  z-index: 25;
}

#overview .k-font-control input[type="range"] {
  width: 62px;
}

.chart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: .8rem;
}

.chart-modal {
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #ccc;
  padding: .8rem;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .45rem;
}

.chart-title {
  margin: 0;
  font-size: 1rem;
}

.chart-close {
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 6px;
  padding: .35rem .55rem;
  cursor: pointer;
}

.chart-close:hover {
  background: #f2f2f2;
}

.chart-body {
  width: 100%;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-hint {
  font-size: .82rem;
  color: #666;
  margin-top: .2rem;
}

.benchmark-chart-section {
  margin: 0 1rem 1rem;
  padding: .9rem;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
}

.benchmark-chart-head {
  margin-bottom: .65rem;
}

.benchmark-chart-title {
  margin: 0;
  font-size: 1rem;
}

.benchmark-chart-subtitle {
  margin: .2rem 0 0;
  font-size: .84rem;
  color: #666;
}

.benchmark-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.benchmark-chart-card {
  min-width: 0;
  padding: .75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
}

.benchmark-chart-card-head {
  margin-bottom: .55rem;
}

.benchmark-chart-card-title {
  margin: 0;
  font-size: .92rem;
}

.benchmark-chart-card-subtitle {
  margin: .2rem 0 0;
  font-size: .78rem;
  color: #666;
}

@media (max-width: 600px) {
  .benchmark-chart-grid {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
}

#details .details-head {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .65rem;
  flex-wrap: wrap;
}

#details .details-name {
  margin: 0;
  font-size: 1.2rem;
}

#details .details-certificate-button {
  border: 1px solid #b28b4d;
  background: linear-gradient(135deg, #f4e2b4 0%, #d4ad63 100%);
  color: #2f241b;
  font-weight: 700;
  border-radius: 999px;
  padding: .48rem .85rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

#details .details-certificate-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
}

#details .details-certificate-button:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
  box-shadow: none;
}

#details .details-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: .85rem;
}

#details .details-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}

#details .details-table th,
#details .details-table td {
  border: 1px solid #ddd;
  padding: .42rem .5rem;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#details .details-table th {
  background: #f3f3f3;
  font-weight: 600;
}

#details .details-table td.bonus-penalty {
  color: #c62828;
  font-weight: 700;
}

#details .details-table td.bonus-credit {
  color: #2e7d32;
  font-weight: 700;
}

#details .details-table tfoot td {
  background: #f8f8f8;
  font-weight: 700;
}

#details .comments-block h3 {
  margin: .2rem 0 .55rem 0;
}

#details .details-legend {
  margin: .45rem 0 .9rem 0;
  color: #8a8a8a;
  font-size: .84rem;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

#details .details-points-hints {
  margin: .35rem 0 .55rem 0;
  color: #666;
  font-size: .82rem;
  line-height: 1.35;
}

#details .details-points-hints p {
  margin: .1rem 0;
}

#details .comment-item {
  margin-bottom: .7rem;
}

#details .comment-title {
  margin: 0 0 .2rem 0;
  font-size: .98rem;
}

#details .comment-text {
  margin: 0;
  white-space: pre-wrap;
}

#toplist {
  overflow-x: auto;
}

#toplist-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

#toplist-table th,
#toplist-table td {
  border: 1px solid #ddd;
  padding: .45rem .5rem;
  text-align: left;
  white-space: nowrap;
}

#toplist-table th {
  background: #f3f3f3;
  font-weight: 700;
}

#toplist-table td.rank {
  width: 1%;
  font-weight: 700;
}

#toplist-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#toplist-table td.neg {
  color: #c62828;
  font-weight: 700;
}

#toplist .hint {
  margin: .55rem 0 0;
  color: #777;
  font-size: .84rem;
}

body#compare-select {
  background: #f4f4f4;
}

#compare-select .select-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem;
}

#compare-select .select-head {
  display: block;
  margin-bottom: .8rem;
}

#compare-select .select-head input {
  width: 100%;
  padding: .6rem;
  margin-bottom: .5rem;
}

#compare-select .quick-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

#compare-select .quick-actions button,
#compare-select .select-actions button,
#compare-select .select-actions a {
  padding: .55rem .8rem;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  color: #111;
  text-decoration: none;
  cursor: pointer;
}

#compare-select .quick-actions button:hover,
#compare-select .select-actions button:hover,
#compare-select .select-actions a:hover {
  background: #ececec;
}

#compare-select .checklist {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  max-height: 62vh;
  overflow: auto;
  padding: .5rem;
}

#compare-select .check-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .3rem;
  border-radius: 4px;
}

#compare-select .check-item:hover {
  background: #f4f4f4;
}

#compare-select .check-item input {
  transform: translateY(1px);
}

#compare-select .select-actions {
  margin-top: .75rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

#compare-select .hint {
  color: #555;
  font-size: .9rem;
  margin-bottom: .5rem;
}

#compare-select .hint.warn {
  color: #a13700;
}

@media (max-width: 860px) {
  #compare-selection-info {
    min-width: 80px;
    max-width: 110px;
    font-size: .75rem;
  }

  #openCompareSelection,
  #clearCompareFilter,
  #openCompareChart {
    font-size: .82rem;
    padding: .38rem .5rem;
  }

  #overview .controls {
    padding: .45rem .5rem;
  }

  #overview .page-nav {
    top: 58px;
  }

  #overview .k-font-control label {
    font-size: .7rem;
  }

  #overview .k-font-control input[type="range"] {
    width: 52px;
  }

  #overview .k-font-control span {
    min-width: 30px;
    font-size: .68rem;
  }
}

@media (max-width: 700px) {
  #details .details-table {
    table-layout: fixed;
    width: 100%;
  }

  #details .details-table th,
  #details .details-table td {
    padding: .3rem .32rem;
    font-size: .78rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #details .details-name {
    font-size: 1.05rem;
  }

  #details .details-legend {
    font-size: .78rem;
  }
}

@media (max-width: 640px) {
  #compare-select .quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #compare-select .quick-actions button {
    width: 100%;
    padding: .5rem .45rem;
    font-size: .88rem;
    white-space: nowrap;
  }

  #compare-select .select-actions {
    display: none;
  }
}

@media (max-width: 600px) {
  #roundFilter {
    flex: 0 0 92px;
    max-width: 92px;
  }
}

/* ===============================
   TOP.PHP - LEADERBOARD
   =============================== */

#toplist {
  width: 100%;
  max-width: none;
  margin: 0;
}

#toplist .top-intro {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .95rem 1rem;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  background: linear-gradient(140deg, #ffffff 0%, #f2f3f7 100%);
}

#toplist .top-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.1vw, 1.7rem);
  font-weight: 800;
  letter-spacing: .01em;
  color: #1f1f1f;
}

#toplist .top-subtitle {
  margin: 0;
  color: #4c4f57;
  font-size: .92rem;
  text-align: right;
}

#toplist > .top-subtitle {
  margin: 0 0 .55rem;
  text-align: left;
}

#toplist .top-podium {
  margin-top: .95rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

#toplist .podium-card {
  border: 1px solid #dadada;
  border-radius: 12px;
  padding: .8rem .9rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: pointer;
}

#toplist .podium-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

#toplist .podium-card.place-1 {
  border-color: #e4c24c;
  background: linear-gradient(180deg, #fffdf4 0%, #fff7dd 100%);
}

#toplist .podium-card.place-2 {
  border-color: #bfc6d2;
  background: linear-gradient(180deg, #f8fbff 0%, #edf1f6 100%);
}

#toplist .podium-card.place-3 {
  border-color: #cba88b;
  background: linear-gradient(180deg, #fffaf6 0%, #f7ede6 100%);
}

#toplist .podium-place {
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #50535a;
}

#toplist .podium-name {
  margin: .28rem 0;
  font-size: 1.16rem;
  line-height: 1.25;
  color: #1e2025;
  word-break: break-word;
}

#toplist .podium-score {
  margin: 0;
  font-weight: 700;
  font-size: .95rem;
  color: #222;
}

#toplist .top-table-wrap {
  margin-top: 1rem;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  max-height: calc(100vh - 240px);
  overflow-x: auto;
  overflow-y: auto;
}

#toplist-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#toplist-table th,
#toplist-table td {
  border: 0;
  padding: .58rem .65rem;
  border-bottom: 1px solid #ececec;
  border-right: 1px solid #d9d9d9;
}

#toplist-table th:last-child,
#toplist-table td:last-child {
  border-right: none;
}

#toplist-table th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: #f5f6f8;
  color: #4a4d55;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 3;
}

#toplist-table td {
  background: #fff;
}

#toplist-table td:nth-child(3) {
  white-space: nowrap;
}

#toplist .trend-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78em;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

#toplist-table td .trend-indicator.is-up {
  color: #218838;
}

#toplist-table td .trend-indicator.is-down {
  color: #c62828;
}

#toplist-table td.num,
#toplist-table td.rank,
#toplist-table td.trend-cell {
  text-align: right;
  white-space: nowrap;
}

#toplist-table td.top-name,
#toplist-table th:nth-child(3) {
  text-align: left !important;
}

#toplist-table th:nth-child(n+4),
#toplist-table td:nth-child(n+4) {
  text-align: center;
}

#toplist-table th:nth-child(2),
#toplist-table td:nth-child(2) {
  border-right: none;
}

#toplist-table td.top-name {
  border-left: none;
}

#toplist-table tbody tr {
  transition: background-color .12s ease;
}

#toplist-table tbody tr:nth-child(odd) td {
  background: #fff8dd;
}

#toplist-table tbody tr:nth-child(even) td {
  background: #eff3f8;
}

#toplist-table tbody tr:hover td {
  background: #e7effd;
}

#toplist-table td.neg {
  color: #b12525;
  font-weight: 700;
}

#toplist .hint {
  margin: .65rem .15rem 0;
  color: #5a5d66;
  font-size: .84rem;
}

@media (max-width: 900px) {
  #toplist .top-podium {
    grid-template-columns: 1fr;
  }

  #toplist .top-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  #toplist .top-subtitle {
    text-align: left;
  }
}

@media (max-width: 700px) {
  #toplist .top-table-wrap {
    max-height: calc(100vh - 260px);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #toplist-table {
    table-layout: fixed;
  }

  #toplist-table th:nth-child(1),
  #toplist-table td:nth-child(1) { width: 7%; }
  #toplist-table th:nth-child(2),
  #toplist-table td:nth-child(2) { width: 5%; }
  #toplist-table th:nth-child(3),
  #toplist-table td:nth-child(3) { width: 28%; }
  #toplist-table th:nth-child(4),
  #toplist-table td:nth-child(4) { width: 9%; }
  #toplist-table th:nth-child(5),
  #toplist-table td:nth-child(5) { width: 13%; }
  #toplist-table th:nth-child(6),
  #toplist-table td:nth-child(6) { width: 9%; }
  #toplist-table th:nth-child(7),
  #toplist-table td:nth-child(7) { width: 9%; }
  #toplist-table th:nth-child(8),
  #toplist-table td:nth-child(8) { width: 13%; }

  #toplist-table th,
  #toplist-table td {
    padding: .38rem .28rem;
    font-size: .73rem;
  }

  #toplist-table th:nth-child(3),
  #toplist-table td:nth-child(3) {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #toplist-table th:not(:nth-child(3)),
  #toplist-table td:not(:nth-child(3)) {
    white-space: nowrap;
  }

  #toplist .podium-name {
    font-size: 1.03rem;
  }
}
