:root {
  --display-bg: #111827;
  --display-panel: #020617;
  --display-panel-soft: #0b1120;
  --display-accent: #38bdf8;
  --display-accent-soft: rgba(56, 189, 248, 0.15);
  --display-text-main: #e5e7eb;
  --display-text-muted: #9ca3af;
  --display-danger: #ef4444;
  --display-success: #22c55e;
  --display-shadow: #0f172ad9;
  --display-radius-lg: 18px;
  --display-border: #94a3b859;
  --display-transition-fast: 180ms ease-out;
  --display-colorStartDiv: #0b1120;
  --display-panelBgLogo: #4a2f96;
  --display-font-heading: clamp(1.5rem, 6vh, 4rem);
  --display-font-sub: clamp(1rem, 3.5vh, 2.2rem);
  --display-logo-size: clamp(150px, 40vh, 500px);
  --display-error-WS-text: #a7e1fa;
}

* {
  box-sizing: border-box;
}

head>* {
  pointer-events: none;
}

body {
  margin: 0;
}

.displayDiv {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

.displayDiv {
  display: flex;
  justify-content: center;
  align-items: stretch;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--display-bg);
  color: var(--display-text-main);
  overflow: hidden;
}

/* WebSocket error overlay */
.displayDiv.errorws {
  position: relative;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 0;
  background: radial-gradient(circle at top, #020617 0, #020617 55%);
  z-index: 10000;
}

.displayDiv.errorws svg {
  width: 100%;
  object-fit: cover;
  position: absolute;
  top: 20vh;
}

.displayDiv.errorws .logoimg {
  max-width: var(--display-logo-size);
  height: auto;
  margin-bottom: 2vh;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.65));
}

.divErrorTextWs {
  position: absolute;
  bottom: 5vh;
}

.errortext {
  margin: 0;
  font-size: clamp(1.8rem, 8vw, 5rem);
  line-height: 1.1;
  max-width: 90vw;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--display-error-WS-text);
  text-align: center;
}

.errortextSmall {
  margin: 10px;
  font-size: clamp(0.5rem, 3vw, 2rem);
  opacity: 0.8;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--display-error-WS-text);
  text-align: center;
}

/* Startup logo overlay */
.logobg {
  padding: 4vh;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background-color: var(--display-panelBgLogo);
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.logoimg {
  width: auto;
  max-height: min(45vh, 100%);
  max-width: min(80vw, 100%);
  object-fit: contain;
}

.logotext {
  margin: 0;
  font-size: clamp(1.8rem, 7vh, 6rem);
  text-align: center;
  width: 90vw;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.logotext,
.logoctext {
  color: var(--display-text-color) !important;
  text-align: center;
  font-weight: 400;
  margin-top: 1vh;
}

.logoctext {
  margin: calc(clamp(2rem, 7vw, 12rem) / calc(100% / 10)) 0;
  font-size: clamp(2rem, 7vw, 12rem);
}

/* 4. Responsive adjustments for different screen ratios */
@media (aspect-ratio: 4/3),
(aspect-ratio: 10/7) {

  /* Tablet specific tweaks (iPad/Android Tabs) */
  :root {
    --display-logo-size: 30vh;
  }

  .logotext {
    font-size: 5vh;
  }
}

@media (min-width: 1921px) {

  /* Ultra-large TV/4K tweaks */
  .logotext {
    letter-spacing: 0.25em;
    /* Better legibility at distance */
  }
}

/* Main scoreboard container – full screen */
.pagediv {
  flex: 1;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2vh;
  padding: 2.2vh 2.4vw;
  box-sizing: border-box;
  background:
    radial-gradient(circle at top left, var(--display-bg-soft), transparent 60%),
    radial-gradient(circle at bottom right, var(--display-bg-soft), transparent 60%);
}

.pagediv.manuel {
  padding-right: clamp(60px, 2.4vw, 2.4vw);
}

/* Common row styling */
.display-row {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 30px;
  border-radius: var(--display-radius-lg);
  background: linear-gradient(135deg, var(--display-panel-soft), var(--display-panel));
  border-bottom: 1px solid var(--display-border);
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 45px var(--display-shadow);
}

.display-row::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, var(--display-bg-soft), transparent 55%);
  opacity: 0.5;
  pointer-events: none;
}

.row1text,
.row2text p,
.row3>p,
.start_text {
  margin: 0;
  padding: 0;
  line-height: 1.1;
  align-self: start;
  z-index: 2;
}

/* Row 1: athlete name */
.row1text {
  font-size: min(8vh, 4.6vw);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Row 2: club, program, start/stop */
.row2 {
  justify-content: space-between;
  gap: 2vw;
}

.row2::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at bottom right, var(--display-colorStartDiv), transparent 55%);
  opacity: 0.5;
  pointer-events: none;
}

.row2text {
  display: flex;
  flex-direction: column;
  gap: 0.8vh;
  width: 50vw;
  height: 100%;
}

.row2_1text {
  color: var(--display-text-muted);
}

.row2_2text {
  font-weight: 600;
}

/* Start / stop pill */
.start_div {
  width: 35vw;
  height: 100%;
  display: flex;
  justify-content: end;
  align-items: center;
}

.start_text {
  display: flex;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: auto 0;
}

/* Row 3: D-score and total */
.row3 {
  justify-content: space-between;
  gap: 2vw;
}

.row3>p {
  font-size: min(9vh, 5vw);
  font-weight: 700;
}

.row3_1text {
  color: var(--display-color-note-l);
}

.row3_2text {
  color: var(--display-color-note-r);
}

/* Existing #score and char/row styles if you use them elsewhere */
#score {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.char {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 40vw;
  line-height: 1;
}

.row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  font-size: 20vw;
}

/* Landscape / portrait logo scaling */
@media (orientation: landscape) {
  .logoimg {
    max-height: min(60vh, 100%);
  }
}

@media (orientation: portrait) {
  .logoimg {
    max-width: min(60vw, 100%);
  }
}

/* Small screens – keep everything readable */
@media (max-width: 768px) {
  .pagediv {
    padding: 1.6vh 3vw;
    gap: 1.4vh;
  }

  .display-row {
    padding: 1.4vh 3vw;
  }

  .row2 {
    flex-direction: column;
    align-items: flex-start;
  }

  .start_div {
    align-self: flex-end;
    min-width: 40vw;
  }
}

.noWsConnection {
  position: absolute;
  bottom: 20px;
  right: 20px;

  transform: rotate(270deg);
  transform-origin: right bottom;
}

.rotator {
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translateX(100%);
}

.noWsConnection img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.noWsConnection p {
  font-size: 20px;
  color: var(--display-text-muted);
  margin: 0;
  letter-spacing: 1.1px;
}

.hidden {
  display: none !important;
}

.ctext .cTextHidden {
  display: none !important;
}