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

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --green: #22c55e;
  --red: #ef4444;
  --bg: #f0f4ff;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(79, 70, 229, 0.10);
}

html {
  font-size: 18px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Screens */
.screen {
  display: none;
  min-height: 100dvh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* Start / Finish Screen */
.start-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.logo {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: bounce 2s ease infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}
.start-container h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.subtitle {
  font-size: 1.15rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.75rem 1.5rem;
  transition: all 0.2s;
  touch-action: manipulation;
}
.btn:active {
  transform: scale(0.96);
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-light);
}
.btn-primary:disabled {
  background: #c7d2fe;
  cursor: default;
  transform: none;
}
.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}
.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover {
  background: var(--accent-dark);
}
.btn-large {
  font-size: 1.25rem;
  padding: 1rem 2.5rem;
  border-radius: 16px;
}
.btn-small {
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.task-title {
  font-size: 1.1rem;
  color: var(--primary);
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.5rem;
}
.badge {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-gold {
  background: var(--accent);
}

/* Main content */
main {
  flex: 1;
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Text box */
.text-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
  border-left: 5px solid var(--primary);
}

/* Questions */
.questions-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}
.question-text {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.option-btn {
  background: #f1f5f9;
  border: 3px solid transparent;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
  word-break: break-word;
}
.option-btn:hover {
  background: #e2e8f0;
}
.option-btn.selected {
  border-color: var(--primary);
  background: #eef2ff;
}
.option-btn.correct {
  border-color: var(--green);
  background: #dcfce7;
}
.option-btn.wrong {
  border-color: var(--red);
  background: #fee2e2;
}
.option-btn.disabled {
  pointer-events: none;
}

/* Actions bar */
.actions {
  text-align: center;
  padding: 1.25rem 0;
}

/* Result banner */
.result-banner {
  display: none;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}
.result-banner.visible {
  display: block;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-content {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
#result-emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.3rem;
}

/* Menu / Task list */
.menu-container {
  flex: 1;
  padding: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.menu-container h2 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 1rem;
}
.task-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  margin-bottom: 1rem;
}
.task-item {
  background: var(--card);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.task-item:hover {
  background: #eef2ff;
}
.task-item.completed {
  border-left: 4px solid var(--green);
}
.task-item.current {
  border-left: 4px solid var(--primary);
  background: #eef2ff;
}
.task-item-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.task-item-num {
  background: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.task-item.completed .task-item-num {
  background: var(--green);
}
.task-item .status-icon {
  font-size: 1.2rem;
}
.menu-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(240, 244, 255, 0.92);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.loading-overlay.visible {
  display: flex;
}
.spinner {
  width: 56px;
  height: 56px;
  border: 5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-overlay p {
  font-size: 1.1rem;
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .options {
    grid-template-columns: 1fr;
  }
  .task-title {
    display: none;
  }
  header {
    justify-content: space-between;
  }
  .start-container h1 {
    font-size: 2rem;
  }
  .logo {
    font-size: 4rem;
  }
}

@media (min-width: 1024px) {
  main {
    padding: 1.5rem 2rem;
  }
}
