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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #ffffff;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  max-width: 560px;
  width: 100%;
  text-align: center;
}

@media (min-width: 1200px) {
  .container {
    max-width: 900px;
  }
  
  #quiz-container {
    padding: 35px;
  }
  
  .writing-textarea {
    min-height: 200px;
  }
  
  .writing-textarea-large {
    min-height: 400px;
  }
}

header {
  margin-bottom: 30px;
}

h1 {
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: 2px;
  color: #222;
  margin-bottom: 5px;
}

.subtitle {
  font-size: 1rem;
  color: #888;
  font-weight: 300;
}

#progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}

#quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 10px;
}

#quiz-top-bar .btn-link {
  font-size: 0.9rem;
}

#quiz-top-bar .btn-icon {
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
}

.icon-group {
  display: flex;
  gap: 4px;
}

#progress-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#category-badge {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

#progress-text {
  font-size: 0.85rem;
  color: #666;
  flex-shrink: 0;
}

#progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#progress-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#progress-bar-container {
  flex-grow: 1;
  height: 6px;
  background-color: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  max-width: calc(100% - 80px);
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 10px;
}

#home-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  background-color: #f0f0f0;
  color: #666;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

#home-btn:hover {
  background-color: #e0e0e0;
}

#quiz-container {
  background-color: #fff;
  padding: 25px;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  animation: fadeIn 0.5s ease;
}

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

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

#question-text {
  font-size: 1.3rem;
  line-height: 1.5;
  margin-bottom: 20px;
  color: #222;
}

#options-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  padding: 10px 20px;
  background-color: #f8f9fa;
  border: 2px solid transparent;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option:hover:not(.disabled) {
  background-color: #e9ecef;
  transform: translateX(5px);
}

.option.selected {
  border-color: #667eea;
  background-color: #f0f2ff;
}

.option.correct {
  border-color: #4a90d9;
  background-color: #e3f2fd;
  color: #1565c0;
  font-weight: 500;
}

.option.incorrect {
  border-color: #ccc;
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  opacity: 0.7;
}

.option.disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background-color: #fff;
  border-radius: 50%;
  font-weight: 600;
  color: #666;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.option.selected .option-letter {
  background-color: #667eea;
  color: #fff;
}

.option.correct .option-letter {
  background-color: #4a90d9;
  color: #fff;
}

#feedback-container {
  margin-top: 15px;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

#feedback-container.correct {
  background-color: #e3f2fd;
  color: #1565c0;
}

#feedback-container.incorrect {
  background-color: #fff3cd;
  color: #856404;
}

#controls {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-center {
  display: flex;
  gap: 12px;
}

#prev-btn {
  position: absolute;
  left: 0;
}

#next-btn {
  margin-left: 0;
}

#skip-btn {
  position: absolute;
  right: 0;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background-color: #f0f0f0;
  color: #666;
}

.btn-secondary:hover {
  background-color: #e0e0e0;
}

.hidden {
  display: none !important;
}

#results-container {
  animation: fadeIn 0.5s ease;
}

.results-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.results-buttons .btn {
  width: 100%;
}

#results-container h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 20px;
  color: #222;
}

#score-display {
  font-size: 2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 30px;
}

#results-breakdown {
  text-align: left;
  margin-bottom: 30px;
}

.result-category {
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-category-name {
  font-weight: 500;
  color: #333;
}

.result-category-score {
  font-weight: 600;
  color: #667eea;
}

#category-select h2 {
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 25px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#category-buttons {
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.section-row {
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.section-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.part-btn {
  flex: 1;
  min-width: 140px;
}

.category-btn {
  padding: 15px 20px;
  background-color: #f8f9fa;
  border: 2px solid transparent;
  border-radius: 14px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-btn:hover {
  border-color: #667eea;
  background-color: #f0f2ff;
}

.category-btn span {
  display: block;
  font-size: 0.85rem;
  color: #999;
  margin-top: 5px;
}

@media (max-width: 600px) {
  h1 {
    font-size: 1.6rem;
  }

  #question-text {
    font-size: 1.15rem;
  }

  .option {
    font-size: 0.95rem;
    padding: 8px 15px;
  }

  .btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
}

#audio-container {
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 14px;
}

.audio-title {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 10px;
  font-weight: 500;
}

#audio-container audio {
  width: 100%;
  max-width: 400px;
  height: 36px;
  border-radius: 18px;
}

#reading-text {
  margin-bottom: 20px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 14px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #444;
  max-height: 400px;
  max-width: 100%;
  width: 100%;
  overflow-y: auto;
  border-left: 4px solid #667eea;
}

#reading-text::-webkit-scrollbar {
  width: 6px;
}

#reading-text::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 3px;
}

#reading-text::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 3px;
}

#transcription-toggle {
  margin-bottom: 12px;
}

#transcription-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background-color: #f0f0f0;
  border: none;
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

#transcription-btn:hover {
  background-color: #e0e0e0;
  color: #333;
}

#transcription-btn.active {
  background-color: #667eea;
  color: #fff;
}

#transcription-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  background-color: #333;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 400;
  white-space: nowrap;
  border-radius: 5px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: 6px;
}

#transcription-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

#transcription-text {
  margin-bottom: 15px;
  padding: 15px;
  background-color: #fffbf0;
  border-radius: 14px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #555;
  border-left: 4px solid #f5a623;
  animation: fadeIn 0.3s ease;
}

.transcription-header {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#transcription-text.hidden {
  display: none;
}

.guide-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #667eea;
}

.guide-section {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 14px;
  text-align: left;
}

.guide-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 10px;
}

.guide-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #555;
  margin: 0;
}

.guide-example {
  margin-top: 12px;
  padding: 12px;
  background-color: #fff;
  border-radius: 10px;
  border-left: 4px solid #764ba2;
}

.guide-example-label {
  font-weight: 600;
  color: #764ba2;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.guide-example-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #444;
  font-style: italic;
  margin: 0;
}

.guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide-list-item {
  padding: 12px;
  background-color: #fff;
  border-radius: 10px;
  margin-bottom: 8px;
}

.guide-list-item:last-child {
  margin-bottom: 0;
}

.guide-list-item strong {
  color: #333;
  display: block;
  margin-bottom: 4px;
}

.guide-list-item p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.guide-navigation {
  margin-top: 25px;
  text-align: center;
}

#quiz-view {
  animation: fadeIn 0.5s ease;
}

#quiz-footer {
  margin-top: 35px;
  padding: 12px;
  font-size: 0.8rem;
  color: #999;
}

#quiz-footer p {
  margin: 0;
}

#category-select {
  animation: fadeIn 0.5s ease;
}

#category-select header {
  margin-bottom: 15px;
}

#category-select .subtitle {
  font-size: 1.1rem;
  margin-bottom: 20px;
  font-family: Georgia, serif;
}

#home-logo-top {
  display: block;
  max-width: 80px;
  height: auto;
  margin: 0 auto 15px;
}

#results-logo {
  display: block;
  max-width: 80px;
  height: auto;
  margin: 0 auto 20px;
}

#home-footer {
  margin-top: 30px;
  padding: 15px;
}

#home-logo {
  max-width: 120px;
  height: auto;
  opacity: 0.7;
}

/* User Info Header */
#header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #666;
}

#user-name {
  font-weight: 500;
  text-decoration: underline;
}

.user-link:hover {
  color: #333;
}

.user-link {
  cursor: pointer;
  text-decoration: underline;
  color: #667eea;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.btn-link {
  background: none;
  border: none;
  color: #667eea;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #764ba2;
}

/* Icon Buttons */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #f0f0f0;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon:hover {
  background-color: #667eea;
  color: #fff;
}

#help-btn-home {
  width: 32px;
  height: 32px;
  font-size: 1rem;
}

#quiz-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#quiz-user-name {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

#user-name {
  color: #333;
}

#user-name:hover,
.user-link:hover {
  text-decoration: underline;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background-color: #fff;
  border-radius: 20px;
  padding: 30px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 0.95rem;
  color: #888;
  margin-bottom: 25px;
  line-height: 1.5;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #aaa;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.modal .btn {
  width: 100%;
  margin-top: 5px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 5px;
}

.modal-buttons .btn {
  flex: 1;
}

.modal-buttons .btn-secondary {
  background-color: #f5f5f5;
}

.email-input-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.email-input-group input {
  flex: 1;
}

.email-at {
  color: #666;
  font-weight: 500;
}

/* Writing Section Styles */
#writing-instructions-panel {
  text-align: left;
  margin-bottom: 20px;
}

#writing-instructions-panel.hidden {
  display: none;
}

.writing-instructions {
  text-align: left;
  margin-bottom: 20px;
}

.instructions-toggle {
  margin-bottom: 10px;
}

.btn-toggle {
  background: none;
  border: none;
  color: #667eea;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: #f0f2ff;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.btn-toggle:hover {
  background-color: #e0e4ff;
}

.toggle-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.instructions-content {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 12px;
  line-height: 1.7;
  color: #555;
  font-size: 0.95rem;
  text-align: left;
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.instructions-content:not(.hidden) {
  max-height: 500px;
  padding: 15px;
  opacity: 1;
}

.instructions-content.hidden {
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.writing-question {
  text-align: left;
}

.writing-question-text {
  font-size: 0.83rem;
  line-height: 1.6;
  color: #333;
  margin-bottom: 15px;
  font-weight: 500;
}

.writing-task-prompt {
  font-size: 0.71rem;
  color: #666;
  margin-bottom: 15px;
  font-style: italic;
}

.writing-textarea {
  width: 100%;
  min-height: 150px;
  padding: 15px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 0.75rem;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.writing-textarea:focus {
  outline: none;
  border-color: #667eea;
}

.writing-textarea-large {
  min-height: 300px;
}

.char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: #999;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.char-counter.visible {
  opacity: 1;
  color: #f5a623;
}

.char-counter.warning {
  color: #d32f2f;
}

/* Carousel Styles */
.carousel-container {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.carousel-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.edit-link {
  font-size: 0.9rem;
  color: #6366f1;
  cursor: pointer;
  margin-left: 10px;
}

.edit-link:hover {
  text-decoration: underline;
}

.carousel-viewer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.carousel-slide {
  flex: 1;
  background-color: #f8f9fa;
  border-radius: 16px;
  padding: 20px;
}

.slide-header {
  font-size: 0.85rem;
  color: #667eea;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.slide-question {
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.slide-response {
  font-size: 0.85rem;
  color: #888;
  line-height: 1.6;
}

.carousel-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #f0f0f0;
  border: none;
  font-size: 1.2rem;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.carousel-btn-left,
.carousel-btn-right {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}

.carousel-btn:hover {
  background-color: #667eea;
  color: #fff;
}

.edit-section {
  text-align: center;
  margin-bottom: 15px;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #e0e0e0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator.active {
  background-color: #667eea;
  transform: scale(1.2);
}

.indicator:hover {
  background-color: #764ba2;
}

.carousel-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #aaa;
  margin-top: 10px;
}

.btn-edit {
  display: block;
  width: 100%;
  margin: 15px auto 0;
  padding: 10px 20px;
  background-color: #f0f2ff;
  border: none;
  border-radius: 10px;
  color: #667eea;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-edit:hover {
  background-color: #667eea;
  color: #fff;
}

/* Timer Styles */
#timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#timer-display {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  font-variant-numeric: tabular-nums;
}

#timer-container.warning {
  color: #dc3545;
}
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 600;
  color: #333;
}

#timer-ring.warning #timer-display {
  color: #dc3545;
}
