@font-face {
  font-family: "Bebas Neue";
  src: url("./fonts/bebas-neue.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- GLOBAL BOX-SIZING RESET --- */
html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}
/* -------------------------------- */

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Bebas Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100dvh;
  background-color: #f4f4f4;
  margin: 0;
  padding: 0;
  overflow: hidden;
  touch-action: manipulation;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* --- UTILITY CLASSES --- */
.hidden {
  display: none !important;
}

#settings-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100svh; /* Using small viewport height for mobile compatibility */
  z-index: 10;
  display: flex;
  flex-direction: column;
  color: white;
}

#settings-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.settings-container {
  background-color: #2c3e50;
  padding: 10px 20px;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  text-align: center;
  justify-content: space-between;
  position: relative; /* Needed for positioning the info button */
}

#info-button {
  position: absolute;
  top: 8px;
  right: 15px;
  width: 35px;
  height: 35px;
  padding: 0;
  font-size: 1.5em;
  background: rgba(31, 43, 56, 0.3);
  color: white;
  border: none;
  border-radius: 25%;
  cursor: pointer;
  display: none; /* Hiding the button */
  align-items: center;
  justify-content: center;
}

.settings-container h2 {
  font-size: 2.5em;
  margin: 15px 0;
  letter-spacing: 3px;
  color: #faa32c;
  text-shadow: 2px 3px 1px #764219;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.settings-container h2 .tagline {
  font-size: 0.5em;
  font-weight: normal;
  text-shadow: none;
  letter-spacing: 1.5px;
  margin-top: 2px;
  text-transform: uppercase;
  color: #90adc6;
}

.setting-group {
  margin-bottom: 15px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.setting-group label {
  width: 35%;
  font-size: 2em;
  margin-bottom: 0;
  text-align: center;
  letter-spacing: 1px;
}

.range-group label {
  font-size: 1.25em;
  color: wheat;
}

.control-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 65%;
  background-color: #1f2b38;
  border-radius: 8px;
  overflow: hidden;
}

.range-control {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 0;
  width: 65%;
}

#preparation-slider {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  --slider-progress: 0%; /* Zmienna CSS dla postępu */
}

/* Styl tracka dla Webkit (Chrome, Safari) */
#preparation-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 1.25em;
  background: linear-gradient(
    to right,
    #ff8911 var(--slider-progress),
    #90adc6 var(--slider-progress)
  );
  border-radius: 5px;
  cursor: pointer;
}

/* Styl thumba dla Webkit */
#preparation-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  border: none;
  height: 3em;
  width: 3em;
  border-radius: 50%;
  background: #e97807;
  border: 4px solid #ccc;
  cursor: pointer;
  margin-top: -0.875em;
}

/* Styl tracka dla Mozilli (Firefox) */
#preparation-slider::-moz-range-track {
  width: 100%;
  height: 1.25em;
  background: linear-gradient(
    to right,
    #ff8911 var(--slider-progress),
    #90adc6 var(--slider-progress)
  );
  border-radius: 5px;
  cursor: pointer;
}

/* Styl thumba dla Mozilli */
#preparation-slider::-moz-range-thumb {
  border: none;
  height: 2em;
  width: 2em;
  border-radius: 50%;
  background: #ff8911;
  cursor: pointer;
}

#preparation-display {
  min-width: 30px;
}

.control-button {
  font-size: 1.5em;
  border: none;
  cursor: pointer;
  user-select: none;
  height: 50px;
  width: 60px;
  padding: 0;
  color: white;
  border-radius: 0;
}

.control-button:focus {
  outline: none;
  box-shadow: none;
}

.plus-button {
  background-color: #3273b3;
}

.minus-button {
  background-color: #0e375d;
}

.control-value {
  flex-grow: 2;
  font-size: 2.5em;
  padding: 0;
  text-align: center;
}

#timer-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  background-color: #2c3e50;
}

#sequence-counter {
  font-size: 3em;
  font-weight: bold;
  color: #fad02c;
  margin-top: 20px;
  text-align: center;
}

#active-timer-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90vw;
  height: 60vh;
  background-color: #fff;
  border: 4px solid #3c3a3a;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, transform 0.5s ease;
  margin: auto;
  overflow: hidden;
}

#timer-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  background-color: rgba(0, 0, 0, 0.6);
  mix-blend-mode: overlay;
  z-index: 1;
}

#timer-label,
#timer-display {
  position: relative;
  z-index: 2;
}

#timer-label {
  margin: 0 0 -20px 0;
  font-size: 6em;
  color: #3b3b3b;
}

#timer-display {
  font-size: 10em;
  font-weight: bold;
  color: #333;
}

button {
  width: 100%;
  padding: 20px 0;
  font-size: 1.5em;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#timer-controls {
  width: 100%;
  padding: 0 20px 20px 20px;
}

#stopButton {
  border-radius: 5px;
  width: 100%;
  padding: 20px;
  font-size: 2em;
  font-family: "Bebas Neue";
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: bold;
  background-color: #7b1b1b;
}

#startButton {
  margin-top: 30px;
  background-color: #229954;
  font-size: 2em;
  font-family: "Bebas Neue";
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: bold;
}

button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

#summary-controls {
  display: flex;
  gap: 10px;
  width: 100%;
}

#repeatButton,
#backButton {
  width: 50%;
  padding: 20px;
  font-size: 2em;
  font-family: "Bebas Neue";
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: bold;
}

#repeatButton {
  background-color: #229954; /* Green */
}

#backButton {
  background-color: #34495e; /* Grayish blue */
}

@media (max-width: 600px) {
  #timer-display {
    font-size: 14em;
  }
}

/* --- FOOTER STYLES --- */
#settings-screen footer {
  background-color: #2c3e50;
  padding: 10px 20px;
  text-align: center;
  width: 100%;
  font-size: 0.85em;
  letter-spacing: 2px;
}

#settings-screen footer p {
  margin: 0;
  color: #90adc6;
}

#settings-screen footer a {
  color: #faa32c;
  text-decoration: none;
  font-weight: bold;
}

/* Apply hover effect only on devices that support it (desktops) */
@media (hover: hover) {
  #settings-screen footer a:hover {
    text-decoration: underline;
  }
}

/* --- DIALOG STYLES --- */
#info-dialog {
  width: calc(100% - 40px);
  max-width: 500px;
  padding: 20px;
  border: 2px solid #1f2b38;
  border-radius: 12px;
  background-color: #f4f4f4;
  color: #2c3e50;
  font-family: Arial, sans-serif;
}

#info-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

#info-dialog p {
  font-size: 1.1em;
  line-height: 1.5;
  margin: 0 0 15px 0;
}

#close-dialog-button {
  width: 100%;
  padding: 15px;
  font-size: 1.2em;
  font-weight: bold;
  font-family: "Bebas Neue", Arial, sans-serif;
  letter-spacing: 1px;
  background-color: #3273b3;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
}

/* --- DESKTOP STYLES --- */
@media (min-width: 768px) {
  body {
    background-color: #3a3a3a;
  }

  #settings-screen,
  #timer-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 100%;
    height: 100%;

    max-width: 420px;
    max-height: 840px;

    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 10px solid #1e1e1e;
  }

  #active-timer-container {
    width: 90%;
    height: 60%;
  }
}

/* --- CONFETTI STYLES --- */
.confetti-particle {
  position: absolute;
  z-index: 100;
  top: -10vh;
  font-size: 2em;
  pointer-events: none;
  animation: fall var(--fall-duration, 4s) linear var(--fall-delay, 0s) forwards;
}

@keyframes fall {
  from {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  to {
    transform: translateY(110vh) rotate(var(--rotation, 360deg));
    opacity: 0;
  }
}
