/* GEPT Quiz System Modern Styling */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #06b6d4;
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --dark-bg: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --glass-bg: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-glow: 0 8px 32px 0 rgba(79, 70, 229, 0.25);
}

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

body {
  font-family: 'Outfit', 'Noto Sans TC', sans-serif;
  background-color: var(--dark-bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

.site-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.site-title {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #818cf8 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.site-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Glassmorphism Card */
.quiz-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-glow);
  transition: all 0.3s ease;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #e2e8f0;
}

/* Settings Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-select, .form-input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form-select:focus, .form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(51, 65, 85, 0.6);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(71, 85, 105, 0.8);
  border-color: #64748b;
}

/* Cumulative Score Dashboard */
.score-board {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.score-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.badge-elem { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-inter { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-high { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-percent {
  font-size: 0.9rem;
  color: var(--secondary);
  margin-top: 0.25rem;
}

/* Quiz Interface */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  width: 0%;
  transition: width 0.3s ease;
}

.question-prompt-box {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-align: center;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt-pos {
  display: inline-block;
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.prompt-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Options Grid for Multiple Choice */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.option-btn {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  font-size: 1.05rem;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.option-btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.option-btn.selected {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.15);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--success) !important;
  color: #6ee7b7 !important;
}

.option-btn.incorrect {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--danger) !important;
  color: #fca5a5 !important;
}

.option-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Spelling Input Field */
.spelling-box {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.spelling-box .form-input {
  font-size: 1.2rem;
  letter-spacing: 0.5px;
}

/* Feedback Banner */
.feedback-banner {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  display: none;
  animation: fadeIn 0.3s ease;
}

.feedback-banner.correct {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--success);
  color: #34d399;
}

.feedback-banner.incorrect {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #f87171;
}

.feedback-header {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedback-correct-answer {
  font-size: 0.95rem;
  color: #e2e8f0;
  margin-top: 0.4rem;
}

.feedback-correct-answer strong {
  color: var(--success);
}

/* Summary View & Export */
.summary-header-box {
  text-align: center;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.summary-score-large {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #34d399 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.summary-percentage {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.export-section {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.export-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-export {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-export:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Review Table */
.review-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.review-table th, .review-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.review-table th {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.review-table tr:last-child td {
  border-bottom: none;
}

.review-table tr {
  background: rgba(30, 41, 59, 0.4);
}

.review-table tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.3);
}

.status-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-tag.correct { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-tag.incorrect { background: rgba(239, 68, 68, 0.2); color: #f87171; }

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

.hidden {
  display: none !important;
}
