:root {
  --primary: #1a365d;
  --primary-light: #2c5282;
  --success: #38a169;
  --error: #e53e3e;
  --accent: #3182ce;
  --bg-light: #f7fafc;
  --text-dark: #1a202c;
  --text-gray: #4a5568;
  --white: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: "Microsoft YaHei", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-light) 0%, #e2e8f0 100%);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 10px;
  font-weight: 700;
}

.header p {
  font-size: 1.1rem;
  color: var(--text-gray);
}

.mode-selection {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

.mode-card {
  background: var(--white);
  border-radius: 12px;
  padding: 30px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.mode-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.mode-card h2 {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.mode-card p {
  color: var(--text-gray);
  font-size: 1rem;
}

.stats {
  background: var(--white);
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--shadow);
  margin-top: 30px;
}

.stats h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-gray);
  margin-top: 5px;
}

.practice-container {
  max-width: 800px;
  margin: 0 auto;
}

.progress-bar {
  background: #e2e8f0;
  height: 12px;
  border-radius: 6px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 6px;
  transition: width 0.3s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 1.1rem;
  color: var(--text-gray);
}

.question-card {
  background: var(--white);
  border-radius: 12px;
  padding: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.question-type {
  display: inline-block;
  padding: 5px 15px;
  background: var(--primary);
  color: var(--white);
  border-radius: 20px;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.question-stem {
  font-size: 1.2rem;
  color: var(--text-dark);
  margin-bottom: 25px;
  line-height: 1.8;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: var(--bg-light);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-item:hover {
  background: #edf2f7;
  border-color: var(--accent);
}

.option-item.selected {
  background: #ebf8ff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.option-item input[type="radio"] {
  margin-right: 15px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.option-item label {
  cursor: pointer;
  flex: 1;
  font-size: 1.1rem;
  color: var(--text-dark);
  text-align: left;
  word-wrap: break-word;
  word-break: break-all;
}

.option-item .option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  font-weight: 600;
  margin-right: 12px;
  font-size: 0.95rem;
}

.navigation {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 30px;
}

.btn {
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e0;
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-success:hover {
  background: #2f855a;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.result-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: var(--shadow-lg);
}

.score-display {
  font-size: 4rem;
  font-weight: 700;
  margin: 15px 0;
}

.score-display .correct {
  color: #68d391;
}

.score-display .total {
  color: rgba(255, 255, 255, 0.8);
}

.accuracy {
  font-size: 1.5rem;
  opacity: 0.9;
}

.filter-section {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.filter-section label {
  font-size: 1.1rem;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-section input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.result-card {
  background: var(--white);
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--success);
}

.result-card.wrong {
  border-left-color: var(--error);
}

.result-card .question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.result-card .question-number {
  font-weight: 600;
  color: var(--text-gray);
  font-size: 0.95rem;
}

.result-card .result-badge {
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.result-badge.correct {
  background: #c6f6d5;
  color: var(--success);
}

.result-badge.wrong {
  background: #fed7d7;
  color: var(--error);
}

.result-card .question-stem {
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.result-card .answer-info {
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
  margin-top: 15px;
}

.result-card .answer-row {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 1rem;
  text-align: left;
}

.result-card .answer-row .option-item-result {
  display: flex;
  align-items: flex-start;
  margin-bottom: 5px;
}

.result-card .answer-row .option-letter {
  font-weight: 600;
  color: var(--primary);
  min-width: 25px;
  text-align: left;
}

.result-card .answer-row .option-text {
  flex: 1;
  text-align: left;
  word-wrap: break-word;
  word-break: break-all;
}

.result-card .answer-row:last-child {
  margin-bottom: 0;
}

.result-card .answer-label {
  color: var(--text-gray);
}

.result-card .answer-value {
  font-weight: 600;
}

.result-card .answer-value.correct {
  color: var(--success);
}

.result-card .answer-value.wrong {
  color: var(--error);
}

.result-card .your-answer.wrong {
  text-decoration: line-through;
  opacity: 0.7;
}

.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 40px;
}

.no-questions {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-gray);
}

.no-questions h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

  .question-card {
    padding: 20px;
  }

  .question-stem {
    font-size: 1.1rem;
  }

  .option-item label {
    font-size: 1rem;
  }

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

  .navigation {
    flex-direction: column;
  }

  .action-buttons {
    flex-direction: column;
  }

  .score-display {
    font-size: 3rem;
  }
}

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

.view.active {
  animation: fadeIn 0.3s ease-out;
}

.practice-layout {
  display: flex;
  gap: 25px;
  max-width: 1200px;
  margin: 0 auto;
}

.question-status-panel {
  width: 280px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.question-grid-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #e2e8f0;
  color: var(--text-gray);
}

.question-grid-item:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.question-grid-item.answered {
  background: var(--success);
  color: var(--white);
}

.question-grid-item.current {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.3);
}

.practice-main {
  flex: 1;
  min-width: 0;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--white);
  border-radius: 12px;
  padding: 30px;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out;
}

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

@media (orientation: portrait) {
  .practice-layout {
    flex-direction: column;
  }

  .question-status-panel {
    width: 100%;
    position: static;
  }

  .question-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .practice-main > div:first-of-type,
  .practice-main > div:nth-of-type(2) {
    display: none;
  }

  .keyboard-hint {
    display: none !important;
  }
}
