@font-face {
  font-family: 'MyFont';
  src: url('fonts/harrypotter.ttf') format('truetype');
}

@font-face {
  font-family: 'ButtonFont';
  src: url('fonts/vinque.ttf') format('truetype');
}

body {
  margin: 0;
  padding: 0;
  background: url('background.jpg') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

#intro {
  font-family: 'MyFont', sans-serif;
  font-size: clamp(24px, 6vw, 120px);
  text-align: center;
  text-shadow:
    0px 0 1px white,
    0 -1px 1px white,
    0 0px 1px white,
    0px 0 1px white,
    0 0 8px white,
    0 0 3px white,
    0 0 3px white,
    1px 1px 1px black;

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  max-width: 90vw;
  max-height: 50vh; /* 👉 вот ограничение по высоте */
  overflow: hidden;

  padding: 1rem;
  word-break: break-word;
  opacity: 1;
  transition: opacity 0.8s ease;
  z-index: 2;
  line-height: 1.1; /* компактнее по вертикали */
  margin-bottom: 100px;
}

.button-style {
  font-family: 'ButtonFont', sans-serif;
  font-size: clamp(16px, 2vw, 80px);
  color: #fff;
  text-shadow:
    0px 0 1px black,
    0 -1px 1px black,
    0 0px 1px black;
}

.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.visible {
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.8s ease;
}

.timer-container {
  background-color: rgba(0, 0, 0, 0.0);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  transition: opacity 0.8s ease;
  z-index: 2;
}

#timer {
  font-family: 'MyFont', sans-serif;
  font-size: 10vw; /* тоже адаптивный размер */
  font-weight: 300;
  color: black;
  margin-bottom: 20px;
  text-align: center;
  text-shadow:
    0px 0 1px white,
    0 -1px 1px white,
    0 0px 1px white,
    0px 0 1px white,
    0 0 8px white,
    0 0 3px white,
    0 0 3px white,
    1px 1px 1px black;
}

.buttons {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}

/* Для больших экранов меняем направление на горизонтальное */
@media (min-width: 768px) {
  .buttons {
    flex-direction: row;
    gap: 20px;
  }
}

.buttons button {
  font-size: 20px;              /* фиксированный размер */
  padding: 10px 25px;           /* фиксированный отступ */
  border: none;
  border-radius: 10px;
  background-color: #4CAF50;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
  font-family: 'ButtonFont', sans-serif;
}

#pauseBtn {
  background-color: #f39c12;
}

#pauseBtn:hover {
  background-color: #e67e22;
}

#resetBtn {
  background-color: #e74c3c;
}

#resetBtn:hover {
  background-color: #c0392b;
}

#toggleFormatBtn {
  background-color: #2980b9;
}

#toggleFormatBtn:hover {
  background-color: #1c5a85;
}

.set-time {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(140px); /* ⬅ отодвигаем вниз от кнопок */
  z-index: 2;
}

.set-time input {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-family: 'ButtonFont', sans-serif;
  width: 160px;
  background-color: #fff;
  color: #000;
  text-align: center;
}

#setTimeBtn {
  font-size: 20px;
  padding: 10px 25px;
  border: none;
  border-radius: 10px;
  background-color: #3498db; /* синий */
  color: white;
  cursor: pointer;
  font-family: 'ButtonFont', sans-serif;
  transition: background-color 0.3s;
}

#setTimeBtn:hover {
  background-color: #217dbb;
}

.controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* по умолчанию 3 в ряд */
  gap: 10px;
  width: calc(100vw - 40px);
  max-width: 600px;
  z-index: 3;
}

@media (max-width: 600px) {
  .controls {
    grid-template-columns: repeat(2, 1fr); /* 2 кнопки в ряд на мобилке */
    gap: 8px;
  }

  .controls button,
  .controls input {
    font-size: 14px;
    padding: 8px 10px;
  }
}

.controls > * {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Сохраняем оригинальные стили кнопок */
.controls button {
  font-size: 20px;
  padding: 10px 25px;
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-family: 'ButtonFont', sans-serif;
  transition: background-color 0.3s;
}

.controls button,
.controls input {
  width: 100%;
  box-sizing: border-box;
  font-size: clamp(12px, 4vw, 18px); /* 🔁 адаптивный размер */
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'ButtonFont', sans-serif;
}

@media (max-width: 480px) {
  .controls button,
  .controls input {
    font-size: 14px;     /* 👈 уменьшаем шрифт */
    padding: 8px 10px;   /* 👈 делаем компактнее */
  }

  .controls {
    grid-template-columns: 1fr; /* всё в столбик */
    gap: 8px;
  }
}

#startBtn {
  background-color: #4CAF50;
}

#pauseBtn {
  background-color: #f39c12;
}

#pauseBtn:hover {
  background-color: #e67e22;
}

#resetBtn {
  background-color: #e74c3c;
}

#resetBtn:hover {
  background-color: #c0392b;
}

#toggleFormatBtn {
  background-color: #2980b9;
}

#toggleFormatBtn:hover {
  background-color: #1c5a85;
}

#setTimeBtn {
  background-color: #3498db;
}

#setTimeBtn:hover {
  background-color: #217dbb;
}

#timeInput {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-family: 'ButtonFont', sans-serif;
  background-color: #fff;
  color: #000;
  text-align: center;
}


@media (min-width: 768px) {
  .buttons {
    flex-direction: row;        /* выстроить в линию */
    gap: 20px;                  /* расстояние между кнопками */
  }
}
