@font-face {
  font-family: 'Cinzel';
  src: url('/font/Cinzel.woff2') format('woff2'),
           url('/font/Cinzel.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

input[type="number"] ,
input[type="text"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: center;
  padding: 0;
  caret-color: transparent;
  background-color: transparent;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
  caret-color: transparent;
}

/* Reset & Base Layout */
html, body {
  background-color: var(--layout-background, white); /* fallback to white */
  color: black;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: 'Cinzel', sans-serif;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  height: 100%;
  width: 100%;
  z-index: -1;
  transition: background-color 0.2s ease-out, opacity 0.15s ease-out;
}

button, input, select, textarea {
  font-family: inherit;                  /* inherit the parent font */
  -webkit-font-smoothing: antialiased;   /* smooth fonts on WebKit browsers */
  -moz-osx-font-smoothing: grayscale;    /* smooth fonts on macOS Firefox */
  text-rendering: optimizeLegibility;    /* improve readability */
  font-weight: inherit;                  /* match parent's font weight */
  line-height: inherit;                  /* match parent's line height */
}

/* Fixed Layout Container */
#wrapper {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: transform 0.6s ease;
  background: white;
  border-radius: 28px;
  position: fixed;
  top: 0px;
  left: 0px;
  margin-right: 0;
  margin-bottom: 0;
  width: calc(100vw - 28px);
  height: calc(100vh - 28px);
  padding: 13px;
  overflow: hidden;
}

#container {
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

/* Score Container */
.container {
  will-change:transform, width, height;
  transform: scale(var(--layout-scale, 1));
  width: var(--layout-width, 950px);
  height: var(--layout-height, 500px);
  left: var(--layout-offset-x, 0);
  top: var(--layout-offset-y, 0);
  transform-origin: top left;
  background: white;
  position: absolute;
  display: flex;
  justify-content: space-between;
  border: 3px solid darkgreen;
  border-radius: 15px;
  padding-bottom: 10px;
  box-sizing: border-box;
  transition: transform 0.6s ease, opacity 0.6s ease-in-out;
  overflow: hidden;
}

/* Player Columns */
.player-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Middle Column */
.middle-column {
  position: relative;
  display: flex;
  flex: 0 0 150px;
  flex-direction: column;
  padding-top: 8px;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  max-height: 583px;
  z-index: 1;
}

/* Text & Labels */
.middle-column label,
.bestof-wrapper label {
  font-weight: bold;
  font-size: 22px;
  user-select: none;
  pointer-events: none;
}

.label {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

/* Score Buttons */
.button-size {
  width: 95%;
  height: 100%;
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: transform 0.3s ease, opacity 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
}

#thuis, #uit {
  cursor: pointer;
  transition: transform 0.15s ease; /* optional press effect */
}

#thuis:disabled,
#uit:disabled {
pointer-events: none;
}

#thuis {
  border: 2px solid #0066ff;
  background: linear-gradient(145deg, #0047b3, #0066ff);
  transform-origin: top left;
}

#uit {
  border: 2px solid  #dd0000;
  background: linear-gradient(235deg, #a80000, #dd0000);
  transform-origin: top right;
}

#thuis::before,
#uit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#thuis::before {
  background: linear-gradient(190deg, #0047b3, #0066ff);
}

#uit::before {
  background: linear-gradient(170deg, #a80000, #cc3333);
}

#thuis:hover::before,
#uit:hover::before {
  opacity: 1;
}

#thuis .score-wrapper,
#uit .score-wrapper {
  position: relative;
  z-index: 1;
}

/* Score Styling */
.score {
  font-weight: bold;
  font-size: 170px;
  transform: scaleY(1.9);
  color: white;
  line-height: 1;
  display: inline-block;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  user-select: none;
}

.score-wrapper {
  position: absolute;
  transform: translateY(5%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  transition: font-size 0.3s ease, transform 0.3s ease;
}

.overlay-card .score {
  padding-top: 5px;
  color: yellow;
  font-size: 60px;
  font-weight: bold;
  display: inline-block;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change:  transform, opacity;
  pointer-events: none;
  user-select: none;
}

/* Overlay Cards */
.button-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#home-wrapper {
  padding-left: 7px;
}

#away-wrapper {
  padding-right:7px;
}

.overlay-card {
  position: absolute;
  top: 3px;
  width: 33%;
  height: 33%;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.6s ease;
  pointer-events: none;
  opacity: 1;
  z-index: 2;
}

#home-card { background-color: #0055cc; }
#away-card { background-color: #cc0000; }

.home-card { 
  left: var(--layout-card-offset, 16px);
  transform-origin: top left;
}
.away-card {
  right: var(--layout-card-offset, 16px);
  transform-origin: top right;
}

.overlay-card.visible {
  opacity: 1;
}

.scale-out {
  transform: scale(0.7, 1.5);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.scale-in {
  transform: scale(1.2, 2.2);
  opacity: 1;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.scale-in-active {
  transform: scale(1, 1.9);
  transition: transform 0.3s ease;
}

/* Input Fields */
.input-wrapper,
.bestof-wrapper .input-wrapper {
  grid-column: auto;
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}
#race-input-wrapper {
margin-top: 5px;
}

#doel-display {
 height: 40px;
 font-size: 38px;
 margin-top: 5px;
}

#race-input {
  width: 60px;
  height: 30px;
  padding: 10px;
  font-size: 22px;
  text-align: center;
  background-color: rgba(255,255,255,0.6);
  color: black;
  border: 2px solid transparent;
  box-shadow: 0 0 6px grey;
  border-radius: 6px;
  appearance: textfield;
  transition: border 0.3s ease;
}

#race-input:focus {
  outline: none;
  border: 2px solid darkgreen;
  box-shadow: 0 0 6px darkgreen;
}

/* Reset & Rerack Buttons */
#reset-button, #rerack-button {
  font-size: 22px;
  width: 140px;
  color: white;
  border-radius: 10px;
}

#reset-button {
  color: lightgrey;
  border: 1px solid #660000;
  padding: 12px 4px;
  background: linear-gradient(to bottom, #000000, #330000);
  transition: opacity 0.4s ease;
  opacity: 0.9;
  pointer-events: auto;
}

#reset-button:hover {
  color: white;
  background: linear-gradient(to bottom, #660000, #330000);
}

#reset-button:active {
  background: linear-gradient(to bottom, #330000, #660000);
}

#reset-button:disabled {
  opacity: 0.3;
}  

#rerack-button {
  border: 1px solid #004400;
  padding: 12px 4px;
  background: linear-gradient(to bottom, #007700, #005500);
  transition: all 0.4s ease;
  pointer-events: auto;
}

#rerack-button:hover {
  background: linear-gradient(to bottom, #00aa00, #007700);
  color: yellow;
}

#rerack-button:active {
  background: linear-gradient(to bottom, #007700, #00aa00);
  color: yellow;
}

#rerack-button:disabled {
  color: lightgrey;
  background: linear-gradient(to bottom, #007700, #00aa00);
  opacity: 0.3;
}

/* Modals */
.close-modal-button {
  position: absolute;
  top: 2px;
  right: 0px;
  width: 32px;
  height: 32px;
  font-size: 30px;
  line-height: 30px;
  background: rgba(255, 255, 255, 0.1);
  color: darkgreen;
  border: 1px solid darkgreen;
  border-radius: 15px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.3s ease, background 0.3s ease;
  user-select: none;
}

.close-modal-button:hover {
  color: darkgreen;
  background: linear-gradient(to bottom, #d6f5de, #a3deb5);
}

.modal-overlay {
  position: absolute;
  width: 100%;
  height: 96%;
  border-radius: 15px;
  display: inline-block;
  justify-content: center;
  align-items: center;
  color: black;
  z-index: 500;
}

.modal-content {
  color: darkgreen;
  position: relative;
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 15px;
  padding: 10px;
  border-radius: 15px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#turn-input-modal-thuis {
   background: linear-gradient(145deg, #ffffff, #e0f5e0 80%, #ffffff);
}
  
 #turn-input-modal-uit {
   background: linear-gradient(235deg, #ffffff, #e0f5e0 80%, #ffffff);
}

#turn-input-modal-thuis::before,
#turn-input-modal-uit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
  border-radius: 15px;
}

#turn-input-modal-thuis::before {
  background: linear-gradient(145deg,  #ffffff, #e0f5e0 30%, #ffffff);
}

#turn-input-modal-uit::before {
  background: linear-gradient(235deg, #ffff , #e0f5e0 30%, #ffffff);
}

#turn-input-modal-thuis:hover::before,
#turn-input-modal-uit:hover::before {
  opacity: 1;
}

.input-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr;
  align-items: center;
}

.input-grid > *:nth-child(1) {
  justify-self: end; /* riight align first column */
  min-height: 32px;
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
}

.input-grid > *:nth-child(2),
.input-grid > *:nth-child(3) {
  justify-self: center; /* center align middle and right columns */
  font-size: 24px;
}

.header-row {
  display: grid;
  margin-top: 2px;
  font-size: 20px !important;
  justify-content: center;
  align-items: end;
}

.input-grid label {
  white-space: nowrap;
  overflow: hidden;
  font-weight: bold;
}

.input-grid input[type="number"] {
  width: 80%;
  text-align: center;
  color: black;
  background-color:  rgba(255,255,255,0.6);
  padding: 4px;
  font-size: 24px;
  border-radius: 6px;
  border: 2px solid transparent;
  box-shadow: 0 0 6px grey;
}

#balls-input-thuis:focus,
#balls-input-uit:focus {
  outline: none;
  border: 2px solid darkgreen;
  box-shadow: 0 0 6px darkgreen;
}

.foul-toggle {
  position: relative;
  overflow: hidden;
  width: 95%;
  max-width: 120px;
  font-size: 22px;
  padding: 6px 4px;
  background: linear-gradient(to bottom, #aa0000, #770000);
  border: 1px solid darkred;
  color: white;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s ease-out;
  z-index: 0;
}

.foul-toggle:disabled {
  background: linear-gradient(to bottom, #880000, #cc0000);
  cursor: default;
  pointer-events: none;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.foul-toggle:hover {
  background: linear-gradient(to bottom, #cc0000, #880000);
}

.foul-toggle:active {
  background: linear-gradient(to bottom, #880000, #cc0000);
}

.confirm-button {
  width: 95%;
  height: 40px;
  max-width: 120px;
  font-size: 26px !important;
  font-weight: bold;
  background: linear-gradient(to bottom, #d6f5de, #a3deb5);
  color: darkgreen;
  border: 1px solid #8dcf9b;
  border-radius: 10px;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s ease, background 0.2s ease;
}

.confirm-button:disabled {
  background: linear-gradient(to bottom, #73ae85, #d6f5de);
  cursor: default;
  pointer-events: none;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.confirm-button:hover {
  background: linear-gradient(to bottom, #d6f5de, #73ae85);
}

.confirm-button:active {
  background: linear-gradient(to bottom, #73ae85, #d6f5de);
}

.calc-score {
 font-size: 20px !important;
 justify-self: right !important;
}

.score-row {
  margin-top: 3px;
  font-weight: bold;
}

.turn-input-modal {
  position: relative; /* or absolute if inside container */
  display: flex;
  width: 88%;
  max-width: 350px;
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
  justify-content: center;
  /* modal styling */
  background: transparent;
  pointer-events: none;
  
  border-radius: 15px;
  transform: translate(-50%, -150%) translateZ(0);
  will-change: transform, opacity;
}

.turn-nav { 
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 95%;
  max-width: 120px;
  height: 40px !important;
  box-sizing: border-box;
  background: linear-gradient(to bottom, #d6f5de, #a3deb5);
  border: 1px solid #8dcf9b;
  border-radius: 10px;
}

.nav-button,
.nav-button-txt {
  position: absolute;
  height: 38px;
  width: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(0, 75, 44, 0); /* Start fully transparent */
  pointer-events: none;
}

.nav-button.enabled {
  color: darkgreen;
  pointer-events: auto;
}

.nav-button.enabled:hover {
  background: linear-gradient(to bottom, #d6f5de, #73ae85);
}

.nav-button.enabled:active {
  background: linear-gradient(to bottom, #73ae85, #d6f5de);
}

#turn-index-thuis,
#turn-index-uit {
  height: 38px;
  line-height: 40px;
  position: relative;
  text-align: center;
  justify-content: center;
  font-size: 24px;
  color: darkgreen;
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

#prev-btn-thuis,
#prev-btn-uit {
  line-height: 38px;
  font-style: bold;
  font-size: 40px !important;
  left: 2px;
  text-align: left;
  box-sizing: border-box;
  height: 38px;
  transition: color 0.2s ease, background 0.2s ease;
}
 
#next-btn-thuis,
#next-btn-uit {
  line-height: 38px;
  font-style: bold;
  font-size: 40px !important;
  right: 2px;
  text-align: right;
  box-sizing: border-box;
  height: 38px;
  transition: color 0.2s ease, background 0.2s ease;
}

#turn-input-modal-thuis,
#turn-input-modal-uit {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  left: 50%;
}

#turn-input-modal-thuis.show,
#turn-input-modal-uit.show {
  transform: translate(-50%, 0) translateZ(0);
  opacity: 1;
  pointer-events: auto;
}

.modal-buttons {
  display: flex;
  justify-content: space-around;
}

.modal-button {
  padding: 10px 10px;
  font-size: 18px;
  width: 35%;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.modal-button.confirm {
  background: linear-gradient(to bottom, #007700, #005500);
  color: white;
  border: 1px solid #8dcf9b;
  border-radius: 10px;
  font-weight: bold;
  transition: background 0.3s ease, opacity 0.4s ease;
}

.modal-button.confirm:hover {
  color: yellow;
  background: linear-gradient(to bottom, #00aa00, #007700);
}

.modal-button.confirm:active {
  background: linear-gradient(to bottom, #007700, #00aa00);
}

.modal-button.confirm:disabled {
  background: linear-gradient(to bottom, #007700, #005500);
  opacity: 0.3;
  pointer-events: none;
}

.modal-button.cancel {
  background: linear-gradient(to bottom, #0056b3, #003c80);
  color: white;
  border: 1px solid #80bfff;
  border-radius: 10px;
  transition: background 0.3s ease, opacity 0.4s ease;
}

.modal-button.cancel:hover {
  color: yellow;
  background: linear-gradient(to bottom, #007bdd, #0056a3);
}

.modal-button.cancel:active {
  background: linear-gradient(to bottom, #0056a3, #007bdd);
}

.modal-button.cancel:disabled {
  background: linear-gradient(to bottom, #0056b3, #003c80);
  opacity: 0.3;
  pointer-events: none;
}

#reset-modal {
  display: flex; /* Initially hidden */
  align-items: center;
  pointer-events: none;
}

/* Modal content */
#reset-modal .modal-content {
  background: linear-gradient(145deg, #d5f5d5, #eeffee 50%, #d5f5d5);
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid darkgreen;
  gap: 15px;
  padding: 15px;
  border-radius: 15px;
  text-align: center;
  max-width: 400px;
  width: 70%;
  transition: transform 0.3s ease;
}

/* Fade-in animation */
#reset-modal.show {
  opacity: 1; /* Visible when the modal is active */
  pointer-events: all;  /* Enable interactions */
  z-index: 1100;
}

#reset-modal .modal-content h2 {
  color: black;
  padding-top: 6px;
  font-size: 26px;  /* e.g. 24px if your root is 16px */
  margin: 0 0 4px 0;        /* Remove default vertical margins */
}

#reset-modal .modal-content p {
  white-space: pre-line;
  color: black;
  padding-top: 6px;
  font-size: 22px;    /* e.g. 16px */
  margin: 0 0 4px 0;        /* Remove default vertical margins */
}

.fading-line {
  width: 100%;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent,
    var(--fading-line-color, darkgreen),
    transparent
  );
  margin: 2px 0 0 0;
  z-index: 5;
}

/* Settings modal */
.settings-backdrop,
#settings-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); /* Dimmed background */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 998; /* Behind the modal */
}

/* Show the backdrop when needed */
#settings-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

#settings-modal {
  position: absolute;       /* or fixed, depending on desired scroll behavior */
  top: -3px;                /* 10px from the top */
  left: 50%;                /* center horizontally */
  transform: translateX(-50%); /* truly center horizontally */
  width: 72%;               /* desired width */
  height: 60%;              /* desired height */
  padding: 10px;            /* optional spacing inside */
  font-size: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  align-items: center;
  color: darkgreen;
  background: linear-gradient(145deg, #d5f5d5, #eeffee 50%, #d5f5d5);
  transition: opacity 0.4s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
}

#settings-modal.show {
 opacity: 1;
 pointer-events: auto;
}

.columns-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 75%;
}

.settings-column {
  display: flex;
  border-radius: 15px;
  width: 36%;
  height: 100%;
  flex-direction: column;
}

#settings-thuis,
#settings-uit {
  justify-content: space-around;
  align-items: center;
}
#settings-thuis input {
  border: 2px solid #0066ff;
}
#settings-thuis {
  border: 3px solid #0066ff; 
}
#settings-uit input {
  border: 2px solid #dd0000;
}
#settings-uit {
  border: 3px solid  #dd0000;
}

.settings-middle-column {
  font-size: 22px;
  grid-column: auto;
  display: flex;
  width: 24%;
  height: 100%;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  box-sizing: border-box;
  border-radius: 15px;
}

.settings-buttons {
  display: flex;
  width: 100%;
  justify-content: space-around;
}

#naam-uit,
#naam-thuis,
#adv-uit,
#adv-thuis {
  width: 60px;
  padding: 5px;
  font-size: 22px;
  text-align: center;
  background-color: rgba(255,255,255,0.6);
  color: black;
  border: 2px solid transparent;
  box-shadow: 0 0 6px grey;
  border-radius: 6px;
  appearance: textfield;
  transition: border 0.3s ease;
  margin-bottom: 5px;
}

#naam-uit,
#naam-thuis {
 width: 70%;
}

#naam-uit:focus,
#naam-thuis:focus,
#adv-uit:focus,
#adv-thuis:focus {
  outline: none;
  border: 2px solid darkgreen;
  box-shadow: 0 0 6px darkgreen;
}

/* Toggle Switch */
.toggle-wrapper {
  margin-bottom: 10px;
}

/* Rectangular Toggle Switch with Labels */
.mode-switch {
  position: relative;
  width:130px;   /* wider */
  height: 50px;   /* taller */
  margin: 0 auto; /* center in middle column */
  user-select: none;
}

.switch-label {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, #dddddd, #999999); /* overall grey recessed base */
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  color: #444;
  box-sizing: border-box;
  padding: 0;
}

.switch-label .switch-text-left,
.switch-label .switch-text-right {
  width: 50%;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  transition: color 0.3s ease;
}

.switch-label .switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: calc(50% - 2px);
  height: 48px;
  background: linear-gradient(to bottom, #0066ff,#0047b3); /* blue lighter top -> darker bottom */
  border-radius: 10px;
  transition: all 0.3s ease;
  z-index: 1;
}

#mode-toggle:checked + .switch-label .switch-thumb {
  left: calc(50% + 1px);
  background: linear-gradient(to bottom, #dd0000, #a80000); /* red vibrant top → deep red bottom */
}

.switch-label .switch-text-left,
.switch-label .switch-text-right {
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

#mode-toggle:checked + .switch-label .switch-text-right {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#mode-toggle:checked + .switch-label .switch-text-left {
  color: #999;
}

#mode-toggle:checked + .switch-label .switch-text-right {
  color: #fff;
}

#mode-toggle:not(:checked) + .switch-label .switch-text-left {
  color: #fff;
}

#mode-toggle:not(:checked) + .switch-label .switch-text-right {
  color: #999;
}

.mode-switch input[type="checkbox"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;       /* reset any default margins */
  padding: 0;      /* reset any default padding */
  opacity: 0;      /* completely transparent */
  cursor: pointer; /* show pointer on hover */
  z-index: 5;      /* sit above everything that shouldn’t block it */
}

/* Keypad */
#keypadModal,
#keyboardModal {
  position: absolute;
  bottom: var(--keyPadOffset, 0);
  left: 50%;
  z-index: 1001;
  align-items: center;
  padding-bottom: 10px;
  pointer-events: none; /* disable interactions */
  transform: translate(-50%, 100%);
  transition: transform 0.4s ease;
}

#keypadModal.show,
#keyboardModal.show {
  pointer-events: all;
  transform: translate(-50%, 0);
}

#keypadModal.hide,
#keyboardModal.hide {
  pointer-events: none;
  transform: translate(-50%, 100%);
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(8, 85px);
  grid-template-rows: repeat(4, 55px);
  gap: 5px;
  padding: 10px;
  background-color: rgba(255,255,255,0.7);
  border-radius: 10px;
  border: 1px solid darkgreen;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.space-symbol {
  display: inline-block;
  width: 35px;
  height: 10px;
  border-left: 4px solid darkgreen;
  border-bottom: 3px solid darkgreen;
  border-right: 4px solid darkgreen;
  border-top: none;
  box-sizing: border-box;
  vertical-align: middle;
}

.enter-triangle {
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-bottom: 15px solid darkgreen;
  transform: rotate(270deg);
}

.enter-angle {
  width: 15px;
  height: 7px;
  border-bottom: 3px solid darkgreen;
  border-right: 4px solid darkgreen;
  margin-bottom: 5px;
}
  
.slash-symbol {
  display: inline-block;
  width: 25px;
  height: 10px;
  transform: rotate(120deg);
  border-bottom: 4px solid darkgreen;
  box-sizing: border-box;
  vertical-align: middle;
  margin-left: 7px;
}

.dash-symbol {
  display: inline-block;
  width: 15px;
  border-bottom: 3px solid darkgreen;
  box-sizing: border-box;
  vertical-align: middle;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 85px);
  grid-template-rows: repeat(4, 55px);
  gap: 5px;
  padding: 10px;
  background-color: rgba(255,255,255,0.7);
  border-radius: 10px;
  border: 1px solid darkgreen;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.keypad-button {
  font-size: 26px;
  font-weight: bold;
  background: rgba(255,255,255,0.9);
  border: 1px solid #ccc;
  color: darkgreen;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 -4px 0 #ccc;
  transition: background-color 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.keypad-button.special {
  font-size: 22px;
  background: linear-gradient(to right, #b7eac3 0%, #d6f5de 50%, #b7eac3 100%);
  box-shadow: inset 0 -4px 0 #ccc;
  color: darkgreen;
}

.keypad-button:hover {
  background-color: #c2e9d0;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.keypad-button.special:hover {
  background: linear-gradient(to right, #a3deb5 0%, #c2e9d0 50%, #a3deb5 100%);
}

.keypad-button.special:active,
.keypad-button.special.highlight {
  background: linear-gradient(to right, #c7fad3 0%, #e6f5ee 50%, #c7fad3 100%);
}

.keypad-button:active,
.keypad-button.highlight {
  background: #d2f9e0;
}

#view-scorecard-btn {
  position: absolute;
  align-self: end;
  font-size: 18px;
  width: 45%;
  color: white;
  background: linear-gradient(to bottom, #007700, #005500);
  padding: 14px 6px;
  border-radius: 10px;
  border: 1px solid #004400;
  margin-bottom: 1px;
  transition: all 0.3s ease;
}

#view-scorecard-btn:hover {
  color: yellow;
  background: linear-gradient(to bottom, #007700, #009900);
}

#view-scorecard-btn:active {
  background: linear-gradient(to bottom, #004400, #003300);
  color: yellow;
}

    img {
      user-select: none;
      border: 3px solid darkgreen;
      border-radius: 10px;
    }
    
.score-thuis-wrapper,
.score-uit-wrapper {
  position: absolute;
  display: flex;
  will-change: transform, opacity;
  justify-content: center;
  align-items: start;

  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  transform: translateY(100%) translateZ(0);
  opacity: 0;
  z-index: -1;
  transition: transform 0.5s ease-in;
}
 
    tr {line-height: 28px;}
    .score-table {
      margin-top: 5px;
      table-layout: fixed;
      position: relative;
      width: 90%;
      border-collapse: separate; /* Important for border-radius */
      border-spacing: 0;          /* No gaps between cells */
      border-radius: 10px;
      overflow: hidden;           /* Clips the corners */
      font-size: 14px;
    }
    #score-table-thuis {
      border: 2px solid  #0055cc;
    }
     #score-table-uit {
      border: 2px solid #cc0000;
    }
    #score-table-thuis th, #score-table-thuis td {
      border: 1px solid rgba(0, 85, 204, 0.3); /* #0055cc with 0.6 opacity */
    }

    #score-table-uit th, #score-table-uit td {
      border: 1px solid rgba(204, 0, 0, 0.3); /* #cc0000 with 0.6 opacity */
    }
    
    .score-table th, .score-table td {
      text-align: center;
    }
    #scorecard-date {
      width: 95%;
      font-size: 14px;
    }

    #colofon-wrapper {
      font-size: 12px;
      max-width: 140px;
      text-align: center;
      opacity: 0.7;
    }

    #save-scorecard {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      top: 130px;
      width: 130px;
      margin-top: 0.5rem;
      border: 2px solid darkgreen;
      border-radius: 10px;
      cursor: pointer;
      color: white;
      background: linear-gradient(to bottom, #007700, #005500);
      z-index: 3;
      text-align: center;
      white-space: nowrap;
    }
    #save-scorecard:hover {
     color: yellow;
     background: linear-gradient(to bottom, #007700, #009900);
    }
    #save-scorecard:active {
      color: yellow;
      background: linear-gradient(to bottom, #004400, #003300);
    } 
    #save-scorecard:disabled {
      opacity: 0.5;
      user-select: none;
    }

.scorecard-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  z-index: 10;
}

.middle-score {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding: 1px;
  padding-bottom: 10px;
  top: 0;           /* Or top: -100% to place it above */
  left: 0;
  width: 96%;
  height: 81%;
  max-height: 488px;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  opacity: 0;
  transform: translateY(-100%) translateZ(0);
  transition: transform 0.5s ease-in;
}
.in-view {
  opacity: 1;
  transform: translateY(0%) translateZ(0);
  z-index: 100;
 }
.hidden {
  display: none;
}
}
