* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  padding: 40px;
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.6em;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Clerk Sign-in Styling */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.app-title {
  text-align: center;
  margin-bottom: 10px;
}

.app-title h2 {
  color: #333;
  margin-bottom: 10px;
  font-size: 1.4em;
}

.app-title p {
  color: #666;
  font-size: 0.9em;
}

.clerk-signin {
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: center;
}

/* Override Clerk default styles for better centering */
.clerk-signin > div {
  width: 100% !important;
  max-width: 400px !important;
}

/* Disabled Auto Mode */
.mode-option.disabled {
  background-color: #f0f0f0 !important;
  color: #999 !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

.mode-option.disabled:hover {
  background-color: #f0f0f0 !important;
  transform: none !important;
}

.coming-soon-notice {
  text-align: center;
  margin-top: 10px;
  padding: 8px;
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 6px;
}

.coming-soon-notice small {
  color: #856404;
  font-weight: 500;
}

/* Mic Calibrator Styles (Discord-inspired) */
.mic-calibrator {
  background: #2f3136;
  border-radius: 8px;
  padding: 20px;
  margin-top: 15px;
  color: white;
}

.calibrator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 16px;
}

.calibrator-close {
  background: none;
  border: none;
  color: #b9bbbe;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calibrator-close:hover {
  background: #40444b;
  color: white;
}

.volume-display {
  margin-bottom: 20px;
}

.volume-bar-container {
  position: relative;
  background: #40444b;
  height: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  overflow: hidden;
}

.volume-bar {
  height: 100%;
  background: linear-gradient(90deg, #43b581 0%, #faa61a 70%, #f04747 100%);
  width: 0%;
  transition: width 0.1s ease-out;
  border-radius: 4px;
}

.threshold-line {
  position: absolute;
  top: 0;
  height: 100%;
  width: 2px;
  background: #7289da;
  left: 20%; /* Default position */
  box-shadow: 0 0 4px rgba(114, 137, 218, 0.8);
}

.volume-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #b9bbbe;
}

.threshold-controls {
  margin-bottom: 15px;
}

.threshold-controls label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #b9bbbe;
}

.threshold-controls input[type="range"] {
  width: 100%;
  margin-right: 10px;
  accent-color: #7289da;
}

.threshold-controls span {
  color: #7289da;
  font-weight: 600;
}

.calibrator-instructions {
  margin-bottom: 15px;
  font-size: 13px;
  color: #b9bbbe;
  line-height: 1.4;
}

.calibrator-instructions p {
  margin-bottom: 5px;
}

.test-threshold-btn, .calibrate-mic-btn {
  background: #7289da;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.test-threshold-btn:hover, .calibrate-mic-btn:hover {
  background: #677bc4;
}

.calibrate-mic-btn {
  margin-top: 10px;
  font-size: 12px;
  padding: 6px 12px;
}

/* Login Screen */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

input {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  transition: border-color 0.3s;
}

input:focus {
  outline: none;
  border-color: #667eea;
}

button {
  padding: 12px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

button:hover {
  background: #5a67d8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.status {
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  margin: 15px 0;
  transition: all 0.3s;
}

.status.success {
  background: #d4edda;
  color: #155724;
}

.status.error {
  background: #f8d7da;
  color: #721c24;
}

/* Settings Screen */
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.user-info {
  font-weight: 600;
  color: #333;
}

.logout-btn {
  background: #6c757d;
  padding: 8px 16px;
  font-size: 12px;
}

.logout-btn:hover {
  background: #5a6268;
}

.progress-section {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 25px;
  margin: 25px 0;
}

.progress-bar {
  background: #e0e0e0;
  height: 30px;
  border-radius: 15px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-fill {
  background: linear-gradient(90deg, #667eea, #764ba2);
  height: 100%;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.progress-fill.flash-correct {
  background: linear-gradient(90deg, #4caf50, #667eea);
}

.progress-fill.flash-wrong {
  background: linear-gradient(90deg, #f44336, #667eea);
}

.stats {
  display: flex;
  justify-content: space-around;
  text-align: center;
  margin: 20px 0;
}

.stat {
  padding: 15px;
  background: white;
  border-radius: 10px;
  flex: 1;
  margin: 0 5px;
}

.stat-value {
  font-size: 2em;
  font-weight: bold;
  color: #667eea;
}

.stat-label {
  color: #666;
  margin-top: 5px;
}

.mode-controls {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 25px;
  margin: 25px 0;
  text-align: center;
}

.mode-toggle {
  display: flex;
  background: #e0e0e0;
  border-radius: 25px;
  padding: 4px;
  margin: 15px auto;
  width: fit-content;
}

.mode-option {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
  color: #666;
}

.mode-option.active {
  background: #667eea;
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-description {
  font-size: 0.8em;
  color: #666;
  margin-top: 8px;
  line-height: 1.3;
}

.voice-controls {
  margin-top: 15px;
  opacity: 0;
  transition: opacity 0.3s;
}

.voice-controls.visible {
  opacity: 1;
}

.voice-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
}

.voice-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #667eea;
}

.settings-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.start-session-btn {
  background: #28a745;
  flex: 2;
}

.start-session-btn:hover {
  background: #218838;
}

.reset-btn {
  background: #dc3545;
  flex: 1;
}

.reset-btn:hover {
  background: #c82333;
}

/* Session Screen */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 10px;
}

.session-progress-section {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 20px;
  margin: 15px 0;
}

.session-title {
  font-weight: 600;
  color: #333;
}

.exit-session-btn {
  background: #dc3545;
  padding: 8px 16px;
  font-size: 12px;
}

.exit-session-btn:hover {
  background: #c82333;
}

.practice-content {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
  min-height: 150px;
}

.sentence {
  font-size: 1.1em;
  margin: 12px 0;
  line-height: 1.4;
}

.sentence-label {
  font-weight: 600;
  color: #667eea;
  display: block;
  margin-bottom: 5px;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.translation-section {
  display: none;
}

.timeline {
  text-align: center;
  color: #666;
  font-size: 0.9em;
  margin: 10px 0;
  min-height: 20px;
}

.buttons {
  display: none;
  gap: 15px;
  margin: 20px 0;
  min-height: 55px;
  align-items: center;
}

.buttons button {
  flex: 1;
}

.correct-btn {
  background: #28a745;
}

.correct-btn:hover {
  background: #218838;
}

.correct-btn.listening {
  background: #6c757d;
  color: white;
}

.correct-btn.listening:hover {
  background: #6c757d;
}

.wrong-btn {
  background: #dc3545;
}

.wrong-btn:hover {
  background: #c82333;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #666;
}

.loading::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

  0%,
  20% {
    content: '';
  }

  40% {
    content: '.';
  }

  60% {
    content: '..';
  }

  80%,
  100% {
    content: '...';
  }
}

.listening-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

.hidden-audio {
  display: none;
}