:root {
  --bg-primary: #FDF2F2;
  --bg-secondary: #FEE2E2;
  --bg-card: #FFFFFF;
  --text-primary: #1F2937;
  --text-secondary: #4B5563;
  --accent-orange: #DC2626;
  --accent-amber: #B91C1C;
  --accent-blue: #16A34A;
  --accent-teal: #15803D;
  --border-color: #FECACA;
  --shadow-color: rgba(220, 38, 38, 0.15);
  --success: #16A34A;
  --danger: #DC2626;
  --christmas-red: #DC2626;
  --christmas-green: #16A34A;
  --christmas-gold: #F59E0B;
}

.dark {
  --bg-primary: #1C1917;
  --bg-secondary: #292524;
  --bg-card: #3D3028;
  --text-primary: #FEF2F2;
  --text-secondary: #D6D3D1;
  --border-color: #7F1D1D;
  --shadow-color: rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Bricolage Grotesque', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--christmas-red) 0%, #991B1B 50%, var(--christmas-green) 100%);
  padding: 1.5rem;
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 4px solid var(--christmas-gold);
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.app-title {
  font-size: 1.75rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 1.25rem;
  opacity: 0.9;
}

.current-date {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

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

/* Step Indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  opacity: 0.4;
  transition: all 0.3s;
}

.step-item.completed,
.step-item.active {
  opacity: 1;
}

.step-item.active .step-circle {
  box-shadow: 0 0 0 4px var(--christmas-red), 0 0 20px rgba(220, 38, 38, 0.4);
  transform: scale(1.1);
}

.step-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.3s;
}

.step-label {
  display: none;
}

.step-line {
  width: 20px;
  height: 2px;
  background: var(--border-color);
}

@media (min-width: 640px) {
  .step-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
  
  .step-line {
    width: 40px;
  }
}

/* Phase Container */
.phase-container {
  animation: fadeIn 0.4s ease-out;
}

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

/* Mascot */
.mascot-container {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 16px;
}

.mascot-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  flex-shrink: 0;
}

.mascot-bubble {
  font-family: 'Caveat', cursive;
  font-size: 1.25rem;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 2px 8px var(--shadow-color);
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow-color);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* Inputs */
.text-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  resize: vertical;
  transition: border-color 0.2s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent-orange);
}

.text-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Mood Selector */
.mood-section {
  margin-top: 1rem;
}

.mood-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mood-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mood-btn:hover {
  transform: scale(1.1);
}

.mood-btn.selected {
  border-color: var(--christmas-green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.3);
  transform: scale(1.1);
}

/* Buttons */
.btn {
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--christmas-red) 0%, #991B1B 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}

.next-btn {
  margin-top: 1.5rem;
  width: 100%;
}

/* Observations */
.observations-list {
  margin-top: 1.5rem;
}

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

.observation-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.obs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.obs-mood {
  font-size: 1.25rem;
}

.obs-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.obs-text {
  font-size: 0.9rem;
}

/* Chips */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: var(--christmas-green);
}

.chip.selected {
  background: var(--christmas-green);
  color: white;
  border-color: var(--christmas-green);
}

/* Evidence Card */
.evidence-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
}

.evidence-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.evidence-list {
  list-style: none;
}

.evidence-list li {
  font-size: 0.85rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.evidence-list li:last-child {
  border-bottom: none;
}

/* Examples Grid */
.examples-section {
  margin-top: 1.5rem;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.example-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.example-card:hover {
  border-color: var(--christmas-green);
  transform: translateY(-2px);
}

.example-card.selected {
  border-color: var(--christmas-green);
  background: rgba(22, 163, 74, 0.1);
}

.example-icon {
  font-size: 1.5rem;
}

.example-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Repetitions */
.repetitions-section {
  margin-top: 1.5rem;
}

.repetition-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.rep-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.rep-btn:hover {
  border-color: var(--christmas-red);
}

.rep-btn.selected {
  background: var(--christmas-red);
  color: white;
  border-color: var(--christmas-red);
}

.launch-btn {
  font-size: 1.1rem;
}

/* Experiment Header */
.experiment-header {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 2px solid var(--christmas-red);
}

.experiment-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.experiment-text {
  font-size: 1.1rem;
  font-weight: 600;
  display: block;
  margin-top: 0.25rem;
}

.progress-bar {
  margin-top: 1rem;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--christmas-red), var(--christmas-green));
  border-radius: 12px;
  transition: width 0.5s ease;
}

.progress-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Trial Card */
.trial-card {
  position: relative;
}

.trial-number {
  position: absolute;
  top: -12px;
  left: 1rem;
  width: 32px;
  height: 32px;
  background: var(--christmas-red);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.trial-title {
  margin-left: 2rem;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.notes-input {
  margin-top: 1rem;
}

/* Results List */
.results-list {
  margin-top: 1.5rem;
}

.result-card {
  display: flex;
  gap: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.result-index {
  width: 32px;
  height: 32px;
  background: var(--christmas-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.result-content {
  flex: 1;
}

.result-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.result-mood {
  font-size: 1.25rem;
}

.result-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.result-text {
  font-size: 0.9rem;
}

.result-notes {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.5rem;
}

/* Summary Card */
.summary-card {
  background: linear-gradient(135deg, var(--christmas-green) 0%, #166534 100%);
  color: white;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 3px solid var(--christmas-gold);
}

.summary-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.summary-stat:last-child {
  border-bottom: none;
}

.stat-label {
  opacity: 0.9;
}

.stat-value {
  font-weight: 600;
}

/* Lesson Section */
.lesson-section {
  margin-bottom: 1.5rem;
}

.lesson-section:last-child {
  margin-bottom: 0;
}

.lesson-label {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.complete-btn {
  font-size: 1.1rem;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  padding: 1.5rem;
  text-align: center;
  margin-top: auto;
}

.quote {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.privacy-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.remix-link {
  color: var(--christmas-green);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

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

/* History Modal */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.history-modal {
  background: var(--bg-card);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.history-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-list {
  overflow-y: auto;
  padding: 1rem;
}

.empty-history {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-top: 1rem;
}

.history-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.history-item-header {
  padding: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.case-number {
  font-weight: 600;
  font-size: 0.9rem;
}

.case-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
}

.case-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.expand-icon {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.history-item-details {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border-color);
}

.detail-section {
  margin-top: 1rem;
}

.detail-section h5 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.detail-section p {
  font-size: 0.85rem;
}

.history-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2000;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Results Table Modal */
.results-table-modal {
  background: var(--bg-card);
  border-radius: 20px;
  width: 95%;
  max-width: 1400px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-container {
  overflow: auto;
  padding: 1rem;
  max-height: calc(90vh - 80px);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 1000px;
}

.results-table th {
  background: linear-gradient(135deg, var(--christmas-red) 0%, #991B1B 100%);
  color: white;
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.results-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.results-table tbody tr:hover {
  background: var(--bg-secondary);
}

.case-cell {
  text-align: center;
}

.case-badge {
  background: var(--christmas-green);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
}

.date-cell {
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

.table-list li {
  padding: 0.25rem 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.8rem;
  line-height: 1.4;
}

.table-list li:last-child {
  border-bottom: none;
}

.mood-badge {
  font-size: 1rem;
  vertical-align: middle;
}

.insights-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.mini-chip {
  background: var(--christmas-green);
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.insight-text {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-secondary);
}

.experiment-cell {
  font-weight: 500;
  max-width: 150px;
}

.trials-cell {
  text-align: center;
  font-weight: 600;
  color: var(--christmas-red);
}

.result-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.lessons-cell p,
.forward-cell p {
  margin: 0.25rem 0;
  font-size: 0.8rem;
}

.lessons-cell strong,
.forward-cell strong {
  font-size: 0.9rem;
}

.empty-cell {
  color: var(--text-secondary);
  opacity: 0.5;
}

.observations-cell,
.results-cell,
.lessons-cell {
  max-width: 200px;
}

.forward-cell {
  max-width: 150px;
}

/* Responsive */
@media (max-width: 480px) {
  .header {
    padding: 1rem;
  }
  
  .app-title {
    font-size: 1.35rem;
  }
  
  .app-subtitle {
    font-size: 1rem;
  }
  
  .main {
    padding: 1rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .mascot-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .examples-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}