* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
}

.container {
  max-width: 1370px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.controls-group {
  display: flex;
  gap: 16px;
  align-items: center;
}

.lang-toggle {
  display: flex;
  gap: 8px;
}

.lang-btn {
  padding: 10px 20px;
  border: 2px solid #222;
  background: #fff;
  color: #222;
  border-radius: 8px;
  cursor: pointer;
  font-size: 24px;
  font-weight: 500;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: #f5f5f5;
}

.lang-btn.active {
  background: #222;
  color: #fff;
}

.difficulty-toggle {
  display: flex;
  gap: 8px;
}

.difficulty-btn {
  padding: 10px 20px;
  border: 2px solid #222;
  background: #fff;
  color: #222;
  border-radius: 8px;
  cursor: pointer;
  font-size: 24px;
  font-weight: 500;
  transition: all 0.2s;
}

.difficulty-btn:hover {
  background: #f5f5f5;
}

.difficulty-btn.active {
  background: #222;
  color: #fff;
}

.tests-list {
  display: grid;
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 20px 40px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.emotion-test-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.test-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  margin-bottom: 12px;
}

.test-content > .controls-section {
  grid-column: 1 / -1;
  grid-row: 2;
}

.photo-container {
  flex: 1;
  position: relative;
  min-height: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.photo {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  transition: opacity 2s ease-in-out;
  opacity: 1;
}

.photo.hidden {
  opacity: 0;
  transition: opacity 2s ease-in-out;
}

.control-duration {
  margin: 0 24px;
  width: 80px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.countdown-timer {
  font-size: 48px;
  font-weight: bold;
  color: #1a1a1a;
  min-height: 48px;
  line-height: 1;
}

.progress-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-labels {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  color: #374151;
}

.progress-container {
  width: 100%;
  height: 8px;
  margin-bottom: 24px;
  background: #e5e7eb;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s ease;
}

.progress-container:hover {
  background: #d1d5db;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: #1a1a1a;
  transition: width 0.3s ease;
}

.emotion-buttons {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.emotion-btn {
  text-align: left;
  padding: 15px 20px;
  background: #fef3c7;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.2s;
}

.emotion-btn:hover:not(:disabled) {
  background: #fde68a;
}

.emotion-btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.start-wrapper {
  display: flex;
  justify-content: center;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-col {
  display: flex;
}

.control-col-left {
  flex: 1;
  justify-content: flex-end;
  padding-right: 16px;
}

.control-col-center {
  flex: 1;
  justify-content: center;
}

.control-col-right {
  flex: 1;
  justify-content: flex-start;
  padding-left: 16px;
}

@media (min-width: 768px) {
  .control-row {
    flex-direction: row;
  }
}

.answer-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.answer-badge {
  padding: 12px 16px;
  font-size: 24px;
  font-weight: bold;
  border-radius: 8px;
  min-width: 60px;
  text-align: center;
}

.answer-badge.success {
  background: #bbf7d0;
  color: #166534;
}

.answer-badge.error {
  background: #fecaca;
  color: #991b1b;
}

.answer-text {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  font-size: 24px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  white-space: nowrap;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 24px;
  background: #222;
  color: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 24px;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  opacity: 0.92;
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-secondary {
  background: #666;
}

.hidden {
  display: none !important;
}

.error {
  color: #b00020;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .container {
    padding: 16px;
  }

  .emotion-test-container {
    display: flex;
    flex-direction: column;
  }

  .test-content {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .photo-container {
    order: 1;
  }

  .control-duration {
    order: 2;
  }

  .controls-section {
    order: 3;
    margin-bottom: 24px;
  }

  .emotion-buttons {
    order: 4;
  }

  .progress-section {
    order: 3;
  }

  .start-wrapper {
    justify-content: center;
  }

  .control-col-left {
    justify-content: center;
  }

  .control-col-right {
    justify-content: center;
  }

  .control-duration {
    align-self: center;
  }

  .countdown-timer {
    text-align: center;
  }

  .topbar {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .controls-group {
    width: 100%;
    justify-content: space-between;
  }

  .lang-btn,
  .difficulty-btn {
    font-size: 18px;
    padding: 8px 16px;
  }

  .emotion-buttons {
    flex: none;
    width: 100%;
  }

  .photo-container {
    min-height: 400px;
  }

  .emotion-btn {
    font-size: 24px;
    padding: 12px 16px;
  }

  .control-duration {
    margin: 0 16px;
    width: 60px;
  }

  .countdown-timer {
    font-size: 36px;
  }

  .progress-labels {
    font-size: 16px;
  }

  .answer-badge {
    font-size: 20px;
    padding: 10px 12px;
    min-width: 50px;
  }

  .answer-text {
    font-size: 20px;
    padding: 10px 12px;
  }

  .btn {
    font-size: 20px;
    padding: 10px 20px;
  }

  .start-wrapper {
    justify-content: center;
  }

  .control-col-left {
    justify-content: center;
  }

  .control-col-right {
    justify-content: center;
  }

  .control-duration {
    align-self: center;
  }

  .countdown-timer {
    text-align: center;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .card {
    padding: 16px 16px 32px 16px;
  }

  .test-content {
    gap: 12px;
  }

  .photo-container {
    min-height: 300px;
  }

  .emotion-btn {
    font-size: 20px;
    padding: 10px 14px;
  }

  .control-duration {
    margin: 0 12px;
    width: 50px;
  }

  .countdown-timer {
    font-size: 32px;
  }

  .progress-labels {
    font-size: 14px;
  }

  .answer-badge {
    font-size: 18px;
    padding: 8px 10px;
    min-width: 45px;
  }

  .answer-text {
    font-size: 18px;
    padding: 8px 10px;
  }

  .btn {
    font-size: 18px;
    padding: 8px 16px;
  }

  .control-col-left,
  .control-col-right {
    padding: 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 8px;
  }

  .topbar {
    gap: 8px;
    align-items: center;
  }

  .controls-group {
    flex-direction: column;
    align-items: stretch;
  }

  .lang-toggle,
  .difficulty-toggle {
    justify-content: center;
  }

  .lang-btn,
  .difficulty-btn {
    font-size: 16px;
    padding: 6px 12px;
    flex: 1;
  }

  .card {
    padding: 12px 12px 24px 12px;
  }

  .photo-container {
    min-height: 250px;
  }

  .emotion-btn {
    font-size: 18px;
    padding: 8px 12px;
  }

  .control-duration {
    margin: 0 8px;
    width: 40px;
  }

  .countdown-timer {
    font-size: 24px;
  }

  .progress-labels {
    font-size: 12px;
  }

  .answer-badge {
    font-size: 16px;
    padding: 6px 8px;
    min-width: 40px;
  }

  .answer-text {
    font-size: 16px;
    padding: 6px 8px;
  }

  .btn {
    font-size: 16px;
    padding: 6px 12px;
  }

  .progress-container {
    height: 6px;
  }
}
