@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"] {
  -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;
}

/* 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;
  height: 100%;
  width: 100%;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

}

button, input, select, textarea {
  font-family: inherit;
}

#wrapper {
  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;
}

/* Layout */
.container {
  will-change: transform;
  background: white;
  position: absolute;
  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;
  display: flex;
  justify-content: space-between;
  border: 3px solid darkgreen;
  font-size: 70px;
  border-radius: 15px;
  box-sizing: border-box;
  padding-bottom: 10px; 
  transition: transform 0.6s ease, opacity 0.6s ease-in-out;
  overflow: hidden;
}

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

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

.middle-column label {
  font-weight: bold;
  font-size: 24px;
}

.middle-column > * {
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  text-align: center; /* fallback for inline content */
}

/* Make the wrapper around the button the positioning context */
.button-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height:  100%; 
}

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

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

/* Overlay, now 45% of its wrapper (the button) */
.overlay-card {
  position: absolute;
  z-index: 100;
  top: 3px;
  width: 40%;
  height: 40%;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  opacity:0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  color: yellow;
  font-weight: bold;
  padding-top: 20px;
  text-align: center;
  justify-content: center;
  align-items: center; 
  display: flex;
  backdrop-filter: blur(4px);
}

.overlay-card .score {
  color: yellow; /* Ensure color is applied to score */
}

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

 #away-card {
  background-color:  #cc0000;
}
 
/* Anchor corners */
.home-card { 
  left: var(--layout-card-offset, 16px);
  transform-origin: top left;
}
.away-card {
  right: var(--layout-card-offset, 16px);
  transform-origin: top right;
}

/* Visible when toggle ON */
.overlay-card.visible {
  opacity: 1;
  pointer-events: none;
}

/* Labels */
.label {
  font-size: 28px;
  text-align: center;
  pointer-events: none; 
}

/* Score Buttons */
.button-size {
  width: 95%;
  height: 100%;
  border: 2px solid transparent;
  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 {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease; /* optional press effect */
  transform-origin: top left;
}

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

#uit {
  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:disabled,
#uit:disabled {
  pointer-events: none;
}

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

/* Score Text */
.score {
  font-size: inherit;
  font-weight: bold;
  transform: scaleY(2);
  color: white;
  line-height: 1;
  display: inline-block;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform, opacity;
  pointer-events: none;
}

.score-wrapper {
  transition: font-size 0.3s ease, transform 0.3s ease;
  font-size: 180px; /* or whatever fills the button */
  transform: translateY(5%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%; /* Ensure full button height */
}

/* When active, push & shrink */
.home-wrapper.active .score-wrapper {
 transform: translate(10%, 10%);
 font-size: 160px;
}

.away-wrapper.active .score-wrapper {
 transform: translate(-10%, 10%);
 font-size: 160px;
}

/* Scale-out animation */
.scale-out {
  transform: scale(0.7, 1.5);   /* Scale down */
  opacity: 0;              /* Fade out */
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Scale-in animation */
.scale-in {
  transform: scale(1.2, 2.2);   /* Scale up */
  opacity: 1;              /* Fade in */
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Active scale-in state (final scale) */
.scale-in-active {
  transform: scale(1, 2);     /* Scale to normal size */
  transition: transform 0.3s ease;
}

/* Input & Reset */
.input-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

#race-input-wrapper label,
#bestof-wrapper label {
  font-size: 22px;
  pointer-events: none;
}

#race-input, #best-of {
  background-color: white;
  color: black;
  width: 100px;
  padding: 2px 5px;
  font-size: 30px;
  transform: scaleX(0.8);
  text-align: center;
  border-radius: 6px;
  border: 2px solid transparent;  /* Replace with a visible color like grey or #ccc */
  box-shadow: 0 0 6px grey; /* Optional - adjust for effect */
  appearance: textfield;
  transition: border 0.3s ease, border-color 0.3s ease;
  z-index: 5;
}

#bestof-wrapper {
  transition: transform 0.4s forwards;
}

#reset-button {
  font-size: 22px;
  width: 140px;
  color: lightgrey;
  border: 1px solid #660000;
  border-radius: 10px;
  padding: 12px 36px;
  margin-top: 10px;
  cursor: pointer;
  background: linear-gradient(to bottom, #000000, #330000);
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.05);
  transition: opacity 0.4s ease;
  opacity: 0.9;
}

#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;
}  

#undo-button {
  margin-top: 2rem;  /* Same as reset button to maintain consistency */
  font-size: 22px;
  width: 140px;
  color: white;
  border: 1px solid #004400;
  border-radius: 10px;
  padding: 12px 4px;
  cursor: pointer;
  background: linear-gradient(to bottom, #007700, #005500);
  transition: all 0.4s ease;
  pointer-events: auto;
}

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

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

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

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  pointer-events: all;
  z-index: 1000;
}

/* Modal Box */
.modal-content {
  display: flex;
  flex-direction: column;
  gap: 15px; /* Adds clean vertical spacing */
  background: white;
  border: 4px solid darkgreen;
  border-radius: 10px;
  padding: 2rem;
  width: 300px;
  text-align: center;
}

/* Buttons in Modal */
.modal-buttons {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
}

.modal-button {
  padding: 12px 24px;
  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;
}

.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.cancel {
  background: linear-gradient(to bottom, #0056b3, #003c80);
  color: white;
  border: none;
  border-radius: 10px;
  transition: background 0.3s 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 styles */
#reset-modal {
  display: flex; /* Initially hidden */
  position: absolute;
   background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
  transition: opacity 0.4s ease;  /* Fade-in and fade-out transition */
  opacity: 0; /* Start with invisible */
  pointer-events: none;
  z-index: 1000;
}

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

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

#reset-modal .modal-content h2 {
  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;
  padding-top: 6px;
  font-size: 24px;    /* e.g. 16px */
  margin: 0 0 4px 0;        /* Remove default vertical margins */
}

.fading-line {
  height: 2px;   /* Set the height of the line */
  background: linear-gradient(to right, transparent, darkgreen, transparent);
  margin: 2px 0 0 0 ;  /* Adjust space between elements */
}

.reset-wrapper {
  position: relative;
  margin: 0;
}

.bestof-wrapper {
  position: relative;
  width: 100%;
  text-align: center;
  display: block;  /* Initially hidden */
  z-index: 5;
}

.bestof-wrapper label {
  font-weight: bold;
  font-size: 20px;
  margin-bottom: 0.25rem;
  display: block;
}

.bestof-wrapper .input-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  transition: opacity 0.2s ease-in;
}

.bestof-wrapper input {
  background-color: white;
  width: 60px;
  padding: 10px;
  font-size: 20px;
  text-align: center;
  border-radius: 6px;
  display: inline-block;
  transform: scaleX(1.4);
  appearance: textfield;
}

#bestof-wrapper {
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Toggle Switch */
.toggle-wrapper {
  margin: 15px 0;
}

/* Rectangular Toggle Switch with Labels */
.mode-switch {
  position: relative;
  width: 150px;   /* wider */
  height: 55px;   /* 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;
  /* Not setting font-size here, inherited from .middle-column label (apparently) */
  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: 53px;
  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 */
}

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

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

@keyframes slideInUp {
  from {
    transform: translate(-50%, 100%);
    opacity: 1;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes slideOutDown {
  from {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  to {
    transform: translate(-50%, 100%);
    opacity: 1;
  }
}

#keypadModal {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 500;
  align-items: center;
  pointer-events: none; /* disable interactions */
  padding-bottom: 10px;
}

#keypadModal.show {
  animation: slideInUp 0.4s forwards;
  pointer-events: all;
}

#keypadModal.hide {
  animation: slideOutDown 0.4s forwards;
  pointer-events: none;
}

.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 10px 10px 10px;
  border: 1px solid darkgreen;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.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;
}

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

.keypad-button {
  width: 100%;
  height: 100%;
  font-size: 26px;
  font-weight: bold;
  background-color: white;
  border: 1px solid #ccc;
  box-shadow: inset 0 -4px 0 #ccc;
  color: darkgreen;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.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;
}

.hidden {
  display: none;
}

    img {
      user-select: none;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -40%);
      display: flex;
      border: 3px solid darkgreen;
      border-radius: 10px;
      font-size: 20px;
      z-index: 0;
      margin-top: 5px;
      transition: opacity 0.4s ease-in-out;
    }

