:root {
  --primary-color: #ff6b6b;
  --secondary-color: #4a6fa5;
  --accent-color: #5a8c4a;
  --text-color: #333;
  --bg-color: #f9f9f9;
  --error-color: #ff4757;
  --success-color: #2ed573;
}

/* Базовые сбросы */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Шапка */
#header {
  text-align: center;
  margin-bottom: 30px;
}

.h1 {
  font-family: "Bungee Spice", cursive;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.h2 {
  font-family: "Poiret One", cursive;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin: 10px 0 20px;
  color: var(--secondary-color);
}

/* Выбор режима */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.mode-btn {
  padding: 12px 25px;
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-btn.active {
  background: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Основной контейнер */
#container {
  display: flex;
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Левая колонка */
#left {
  flex: 1;
  padding: 30px;
}

/* Таймер */
.container_timer {
  background: rgba(74, 111, 165, 0.1);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 25px;
  text-align: center;
}

#timer {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--secondary-color);
  margin-bottom: 15px;
  font-family: "Montserrat", sans-serif;
}

/* Кнопка Старт */
.btn_timer {
  position: relative;
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 12px 30px;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 1.1rem;
  letter-spacing: 1px;
  border-radius: 30px;
  background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
  overflow: hidden;
  border: none;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
}

/* Анимация кнопки */
.btn_timer span {
  position: absolute;
  display: block;
}

.btn_timer span:nth-child(1) {
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #fff);
  animation: btn-anim1 1s linear infinite;
}

@keyframes btn-anim1 {
  0% {
    left: -100%;
  }
  50%,
  100% {
    left: 100%;
  }
}

.btn_timer span:nth-child(2) {
  top: -100%;
  right: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, transparent, #fff);
  animation: btn-anim2 1s linear infinite;
  animation-delay: 0.25s;
}

@keyframes btn-anim2 {
  0% {
    top: -100%;
  }
  50%,
  100% {
    top: 100%;
  }
}

.btn_timer span:nth-child(3) {
  bottom: 0;
  right: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(270deg, transparent, #fff);
  animation: btn-anim3 1s linear infinite;
  animation-delay: 0.5s;
}

@keyframes btn-anim3 {
  0% {
    right: -100%;
  }
  50%,
  100% {
    right: 100%;
  }
}

.btn_timer span:nth-child(4) {
  bottom: -100%;
  left: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(360deg, transparent, #fff);
  animation: btn-anim4 1s linear infinite;
  animation-delay: 0.75s;
}

@keyframes btn-anim4 {
  0% {
    bottom: -100%;
  }
  50%,
  100% {
    bottom: 100%;
  }
}

/* Практическая часть */
.container_praxis {
  background: rgba(255, 107, 107, 0.1);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 25px;
}

#praxis {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
  font-size: 1.5rem;
}

#question {
  font-weight: bold;
}

#answer {
  width: 80px;
  height: 45px;
  font-size: 1.2rem;
  text-align: center;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.3s;
}

#answer:focus {
  border-color: var(--secondary-color);
  outline: none;
}

#resultIcon {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
}

/* Кнопка Ответить */
.btn_praxis {
  position: relative;
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 12px 30px;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 1px;
  border-radius: 30px;
  background: linear-gradient(90deg, #4a6fa5, #5a8c4a);
  overflow: hidden;
  border: none;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Результаты */
.container_score {
  text-align: center;
  padding: 20px;
  background: rgba(90, 140, 74, 0.1);
  border-radius: 15px;
}

.result {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.result_right {
  color: var(--accent-color);
  font-weight: bold;
}

.result_wrong {
  color: var(--primary-color);
  font-weight: bold;
}

#text_result {
  font-size: 1.3rem;
  margin: 10px 0 0;
  font-weight: bold;
}

/* Правая колонка */
#right {
  flex: 0 0 50%;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

#image {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
}

/* Ошибки */
#mistakes-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  background: #f5f5f5;
  overflow-y: auto;
  display: none;
}

#mistakes-container.visible {
  display: block;
}

#mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
}

.mistake-item {
  background: rgba(255, 107, 107, 0.1);
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid var(--error-color);
}

.mistake-item .wrong {
  color: var(--error-color);
  font-weight: bold;
}

.mistake-item .correct {
  color: var(--success-color);
  font-weight: bold;
}

/* Мобильные ошибки */
#mobile-mistakes-container {
  display: none;
  width: 100%;
  padding: 20px;
  background: #f5f5f5;
  margin-top: 20px;
  border-radius: 15px;
}

#mobile-mistakes-container.visible {
  display: block;
}

/* Адаптивность */
@media (max-width: 768px) {
  #container {
    flex-direction: column;
  }

  #right {
    display: none;
  }

  .h1 {
    font-size: 2rem;
  }

  .h2 {
    font-size: 1.5rem;
  }

  .mode-selector {
    flex-direction: column;
    align-items: center;
  }

  .mode-btn {
    width: 100%;
    max-width: 250px;
    justify-content: center;
  }

  #left {
    padding: 20px;
  }

  .container_timer,
  .container_praxis,
  .container_score {
    padding: 15px;
  }

  #praxis {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .btn_timer,
  .btn_praxis {
    padding: 10px 20px;
    font-size: 1rem;
  }
}
