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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: white;
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px;
  text-align: center;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1em;
  opacity: 0.9;
}

.section {
  padding: 40px;
}

.upload-area {
  border: 3px dashed #667eea;
  border-radius: 15px;
  padding: 60px 20px;
  text-align: center;
  background: #f8f9ff;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.upload-area .btn {
  position: relative;
  z-index: 20;
  pointer-events: auto;
}

.upload-area:hover {
  border-color: #764ba2;
  background: #f0f2ff;
}

.upload-area.dragover {
  border-color: #764ba2;
  background: #e8ebff;
  transform: scale(1.02);
}

.upload-content svg {
  color: #667eea;
  margin-bottom: 20px;
}

.upload-content h3 {
  font-size: 1.5em;
  margin-bottom: 10px;
  color: #333;
}

.upload-content p {
  color: #666;
  margin-bottom: 20px;
}

.sample-info-area {
  margin-bottom: 50px;
  padding: 25px;
  background: #f0f8ff;
  border-radius: 10px;
  border: 2px solid #667eea;
}

.sample-info-area h3 {
  color: #333;
  margin-bottom: 15px;
  text-align: center;
}

.format-guide {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-top: 15px;
}

.format-guide p {
  margin: 10px 0;
  color: #555;
  line-height: 1.6;
}

.format-guide strong {
  color: #667eea;
}

.example-table {
  margin-top: 15px;
}

.example-table summary {
  cursor: pointer;
  color: #667eea;
  font-weight: 600;
  padding: 10px;
  background: #f8f9ff;
  border-radius: 5px;
  user-select: none;
}

.example-table summary:hover {
  background: #e8ebff;
}

.example-table table {
  width: 100%;
  margin-top: 15px;
  border-collapse: collapse;
  background: white;
}

.example-table table th,
.example-table table td {
  padding: 10px;
  border: 1px solid #e0e0e0;
  text-align: center;
}

.example-table table th {
  background: #667eea;
  color: white;
  font-weight: 600;
}

.example-table table tr:nth-child(even) {
  background: #f8f9ff;
}

.data-preview {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9ff;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
}

.data-preview h4 {
  margin-bottom: 15px;
  color: #333;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-table th,
.preview-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid #e0e0e0;
}

.preview-table th {
  background: #667eea;
  color: white;
  font-weight: 600;
}

.preview-table tr:nth-child(even) {
  background: #f8f9ff;
}

.preview-table tr:hover {
  background: #f0f2ff;
}

.preview-note {
  margin-top: 10px;
  color: #666;
  font-size: 0.9em;
  font-style: italic;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-top: 20px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  width: 0%;
  transition: width 0.3s ease;
  animation: progress 1s ease-in-out infinite;
}

.progress-text {
  margin-top: 10px;
  text-align: center;
  color: #667eea;
  font-weight: 600;
  font-size: 0.9em;
}

@keyframes progress {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.btn {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

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

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

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

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.saved-data-item {
  background: #f8f9ff;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.saved-data-item:hover {
  border-color: #667eea;
  transform: translateX(5px);
}

.saved-data-info h3 {
  margin-bottom: 5px;
  color: #333;
}

.saved-data-info p {
  color: #666;
  font-size: 0.9em;
}

.saved-data-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-delete {
  background: #dc3545;
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-delete:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.quiz-header h2 {
  color: #333;
  font-size: 2em;
}

.quiz-stats {
  display: flex;
  gap: 20px;
  font-weight: 600;
  color: #667eea;
}

.quiz-content {
  min-height: 400px;
}

.question {
  font-size: 1.5em;
  font-weight: 600;
  color: #333;
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f9ff;
  border-radius: 10px;
  border-left: 5px solid #667eea;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.option {
  padding: 20px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1em;
  text-align: left;
}

.option:hover:not(.disabled) {
  border-color: #667eea;
  background: #f8f9ff;
  transform: translateX(5px);
}

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

.option.correct {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
}

.option.incorrect {
  border-color: #dc3545;
  background: #f8d7da;
  color: #721c24;
}

.option.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.feedback {
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 1.2em;
  font-weight: 600;
  text-align: center;
}

.feedback.correct {
  background: #d4edda;
  color: #155724;
  border: 2px solid #28a745;
}

.feedback.incorrect {
  background: #f8d7da;
  color: #721c24;
  border: 2px solid #dc3545;
}

.explanation {
  padding: 20px;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  margin-bottom: 20px;
  color: #856404;
}

.explanation h4 {
  margin-bottom: 10px;
  color: #856404;
}

.explanation table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.explanation table th,
.explanation table td {
  padding: 10px;
  border: 1px solid #ffc107;
  text-align: left;
}

.explanation table th {
  background: #fff3cd;
  font-weight: 600;
}

#next-btn {
  width: 100%;
  padding: 15px;
  font-size: 1.2em;
}

/* 모드 선택 */
.mode-description {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1em;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.mode-card {
  background: #f8f9ff;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  padding: 30px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.mode-card:hover {
  border-color: #667eea;
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
}

.mode-icon {
  font-size: 3em;
  margin-bottom: 15px;
}

.mode-card h3 {
  color: #333;
  margin-bottom: 10px;
  font-size: 1.3em;
}

.mode-card p {
  color: #666;
  font-size: 0.95em;
  margin-bottom: 20px;
  min-height: 60px;
}

.mode-btn {
  width: 100%;
}

/* 찰라 암기 */
.flashcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.flashcard-stats {
  display: flex;
  gap: 15px;
  align-items: center;
  font-weight: 600;
  color: #667eea;
}

.flashcard-content {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.flashcard-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #f8f9ff;
  border-radius: 15px;
  padding: 60px 40px;
  min-height: 350px;
}

.flashcard-title {
  font-size: 3em;
  font-weight: 700;
  color: #667eea;
  text-align: center;
  animation: fadeIn 0.5s ease-in;
}

.flashcard-row {
  width: 100%;
  margin-top: 30px;
  animation: fadeIn 0.5s ease-in;
}

.flashcard-row table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.flashcard-row table th,
.flashcard-row table td {
  padding: 15px;
  border: 1px solid #e0e0e0;
  text-align: center;
  font-size: 1.2em;
}

.flashcard-row table th {
  background: #667eea;
  color: white;
  font-weight: 600;
}

.flashcard-timer {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  width: 100%;
  transition: width linear;
}

.flashcard-actions,
.quiz-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

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

@media (max-width: 768px) {
  header h1 {
    font-size: 1.8em;
  }

  .section {
    padding: 20px;
  }

  .saved-data-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .saved-data-actions {
    width: 100%;
    flex-direction: column;
  }

  .saved-data-actions .btn,
  .saved-data-actions .btn-delete {
    width: 100%;
  }

  .quiz-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .question {
    font-size: 1.2em;
  }

  .option {
    font-size: 1em;
    padding: 15px;
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }

  .flashcard-title {
    font-size: 2em;
  }

  .flashcard-row table th,
  .flashcard-row table td {
    font-size: 1em;
    padding: 10px;
  }

  .flashcard-actions .btn,
  .quiz-actions .btn {
    font-size: 0.85em;
    padding: 10px 15px;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .flashcard-actions {
    flex-wrap: wrap;
  }
}

