@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&display=swap');

:root {
  --glacier-lightest: #212121;
  --glacier-light: #424242;
  --glacier-mid: #616161;
  --glacier-bright: #9E9E9E;
  --glacier-dark: #F5F5F5;
  --bg: #E0F7FA;
  --surface: #FFFFFF;
  --text-primary: #004D5A;
  --text-secondary: #00697A;
  --text-muted: #5F9EA0;
  --danger: #EF5350;
  --success: #66BB6A;
  --warning: #FFA726;
  --shadow-sm: 0 1px 3px rgba(0, 131, 143, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 131, 143, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 131, 143, 0.16);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

::selection {
  background: var(--glacier-bright);
  color: white;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden-input {
  display: none;
}

/* ===== APP SHELL ===== */
.app-shell {
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, var(--glacier-dark) 0%, var(--glacier-bright) 50%, var(--glacier-mid) 100%);
  padding: 1.5rem 1.25rem 1.25rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.header-content {
  position: relative;
  z-index: 1;
}

.header-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.25rem;
  animation: bounceIn 0.6s ease-out;
}

.header-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  color: white;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-subtitle {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

/* ===== TAB BAR ===== */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  justify-content: center;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: 2px solid var(--glacier-light);
  border-radius: 50px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn:hover {
  border-color: var(--glacier-bright);
  background: var(--glacier-lightest);
}

.tab-btn.active {
  background: var(--glacier-dark);
  color: white;
  border-color: var(--glacier-dark);
  box-shadow: var(--shadow-md);
}

.tab-icon {
  font-size: 1.1rem;
}

/* ===== MAIN CONTENT ===== */
.app-main {
  flex: 1;
  padding: 1rem;
}

/* ===== TOOLBAR ===== */
.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-count {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-add {
  padding: 0.5rem 1.1rem;
  background: var(--glacier-dark);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-add:hover {
  background: var(--text-secondary);
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  animation: fadeInUp 0.5s ease-out;
}

.empty-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  animation: bounceIn 0.6s ease-out;
}

.empty-state h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.empty-count {
  font-weight: 600;
  color: var(--glacier-dark);
}

.btn-add-big {
  margin-top: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: var(--glacier-dark);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.btn-add-big:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

/* ===== CARD GRID ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* ===== FLIP CARD ===== */
.flip-card-wrapper {
  perspective: 800px;
  cursor: pointer;
  animation: cardPopIn 0.4s ease-out both;
}

.flip-card-wrapper:nth-child(1) { animation-delay: 0s; }
.flip-card-wrapper:nth-child(2) { animation-delay: 0.05s; }
.flip-card-wrapper:nth-child(3) { animation-delay: 0.1s; }
.flip-card-wrapper:nth-child(4) { animation-delay: 0.15s; }
.flip-card-wrapper:nth-child(5) { animation-delay: 0.2s; }
.flip-card-wrapper:nth-child(6) { animation-delay: 0.25s; }
.flip-card-wrapper:nth-child(7) { animation-delay: 0.3s; }
.flip-card-wrapper:nth-child(8) { animation-delay: 0.35s; }
.flip-card-wrapper:nth-child(n+9) { animation-delay: 0.4s; }

.flip-card {
  position: relative;
  width: 100%;
  min-height: 220px;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.flip-front {
  background: var(--surface);
  border: 2px solid var(--glacier-light);
}

.flip-front:hover {
  border-color: var(--glacier-bright);
}

.flip-back {
  background: linear-gradient(145deg, var(--glacier-dark), var(--text-secondary));
  color: white;
  transform: rotateY(180deg);
}

.card-image-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 3px solid var(--glacier-mid);
  box-shadow: var(--shadow-sm);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-word {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--glacier-dark);
  margin-bottom: 0.25rem;
}

.card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

.card-word-back {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  opacity: 0.9;
}

.card-definition {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.card-example {
  font-size: 0.8rem;
  font-style: italic;
  opacity: 0.85;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.delete-btn {
  padding: 0.35rem 0.75rem;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  font-size: 0.75rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 77, 90, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0.75rem;
}

.modal-header h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  color: var(--glacier-dark);
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--glacier-lightest);
  border-radius: 50%;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: var(--danger);
  color: white;
}

.modal-body {
  padding: 0.5rem 1.25rem 1rem;
}

.field-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  margin-top: 0.75rem;
}

.field-input,
.field-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--glacier-light);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--glacier-lightest);
  transition: border-color 0.2s ease;
  resize: vertical;
}

.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--glacier-bright);
  box-shadow: 0 0 0 3px rgba(77, 208, 225, 0.2);
}

.upload-area {
  margin-top: 0.35rem;
}

.upload-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 2px dashed var(--glacier-mid);
  border-radius: var(--radius-md);
  background: var(--glacier-lightest);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.upload-trigger:hover {
  border-color: var(--glacier-bright);
  background: var(--glacier-light);
}

.upload-icon {
  font-size: 1.75rem;
}

.upload-preview {
  position: relative;
  display: inline-block;
}

.preview-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--glacier-mid);
}

.remove-img-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem 1.25rem;
}

.btn-cancel {
  padding: 0.55rem 1.1rem;
  background: var(--glacier-lightest);
  color: var(--text-muted);
  border: 2px solid var(--glacier-light);
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel:hover {
  background: var(--glacier-light);
}

.btn-save {
  padding: 0.55rem 1.25rem;
  background: var(--glacier-dark);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-save:hover:not(:disabled) {
  background: var(--text-secondary);
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

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

/* ===== MATCHING GAME ===== */
.matching-game-view {
  animation: fadeInUp 0.4s ease-out;
}

.game-hud {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.hud-item {
  padding: 0.4rem 1rem;
  background: var(--surface);
  border: 2px solid var(--glacier-light);
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--glacier-dark);
}

.match-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.column-title {
  font-family: 'Fredoka', sans-serif;
  text-align: center;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  color: var(--glacier-dark);
}

.match-tile {
  display: block;
  width: 100%;
  padding: 0.75rem 0.6rem;
  margin-bottom: 0.6rem;
  border: 2px solid var(--glacier-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 52px;
  line-height: 1.3;
}

.match-tile:hover:not(.matched):not(.wrong) {
  border-color: var(--glacier-bright);
  transform: scale(1.03);
  box-shadow: var(--shadow-sm);
}

.match-tile.selected {
  border-color: var(--glacier-dark);
  background: var(--glacier-lightest);
  box-shadow: 0 0 0 3px rgba(0, 131, 143, 0.2);
  transform: scale(1.03);
}

.match-tile.matched {
  background: var(--success);
  border-color: var(--success);
  color: white;
  cursor: default;
  opacity: 0.8;
  transform: scale(0.97);
}

.match-tile.wrong {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  animation: shake 0.4s ease;
}

.word-tile {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
}

/* ===== GAME COMPLETE ===== */
.game-complete {
  text-align: center;
  padding: 2.5rem 1.5rem;
  animation: fadeInUp 0.5s ease-out;
}

.confetti-emoji {
  font-size: 3.5rem;
  animation: bounceIn 0.6s ease-out;
  margin-bottom: 0.5rem;
}

.game-complete h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.75rem;
  color: var(--glacier-dark);
  margin-bottom: 0.75rem;
}

.stars-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.star {
  font-size: 2rem;
  transition: transform 0.3s ease;
}

.star.earned {
  animation: starPop 0.4s ease-out both;
}

.star:nth-child(1) { animation-delay: 0.1s; }
.star:nth-child(2) { animation-delay: 0.25s; }
.star:nth-child(3) { animation-delay: 0.4s; }

.star.empty {
  filter: grayscale(1);
  opacity: 0.35;
}

.game-stats {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.btn-play-again {
  padding: 0.75rem 1.75rem;
  background: var(--glacier-dark);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.btn-play-again:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-lg);
}

/* ===== SKELETON LOADING ===== */
.loading-container {
  padding: 1rem 0;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, var(--glacier-lightest) 30%, var(--glacier-light) 50%, var(--glacier-lightest) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes cardPopIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.08); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes starPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .app-header {
    padding: 1.25rem 1rem 1rem;
  }

  .header-title {
    font-size: 1.4rem;
  }

  .header-icon {
    font-size: 1.6rem;
  }

  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .flip-card {
    min-height: 190px;
  }

  .flip-front,
  .flip-back {
    padding: 1rem;
  }

  .card-word {
    font-size: 1.15rem;
  }

  .match-columns {
    gap: 0.6rem;
  }

  .match-tile {
    padding: 0.6rem 0.4rem;
    font-size: 0.78rem;
    min-height: 48px;
  }

  .modal-content {
    max-height: 85vh;
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 380px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Focus styles */
.field-input:focus-visible,
.field-textarea:focus-visible,
.btn-add:focus-visible,
.btn-save:focus-visible,
.tab-btn:focus-visible,
.match-tile:focus-visible {
  outline: 2px solid var(--glacier-dark);
  outline-offset: 2px;
}


<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to Word Wonder! This is your personal vocabulary builder for kids. You'll see two tabs: My Cards for creating word cards, and Match Game for a fun matching challenge.", "view": "user", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Let's add your first word card. Tap the '+ New Word' button to open the card creator.", "view": "user", "highlight_selector": ".btn-add-big", "wait_for": "user_interaction"},
  {"step": 3, "narration": "Fill in the word, its definition, and an example sentence. You can also upload a picture to make the card more visual and fun!", "view": "user", "highlight_selector": ".modal-content", "wait_for": "user_interaction"},
  {"step": 4, "narration": "Great! Your word card is now in the grid. Tap any card to flip it and see the definition on the back.", "view": "user", "highlight_selector": ".flip-card-wrapper", "wait_for": "user_interaction"},
  {"step": 5, "narration": "Add at least 3 word cards, then switch to the Match Game tab for a fun challenge!", "view": "user", "highlight_selector": ".tab-btn:nth-child(2)", "wait_for": "user_interaction"},
  {"step": 6, "narration": "In the matching game, tap a word on the left and its matching definition on the right. Try to match them all with the fewest tries to earn 3 stars!", "view": "user", "highlight_selector": ".match-columns", "wait_for": "user_interaction"},
  {"step": 7, "narration": "When you match all pairs, you'll see your score and stars. Tap 'Play Again' to shuffle and try again. Keep adding new words to make the game more challenging!", "view": "user", "highlight_selector": ".game-complete", "wait_for": "tap_to_continue"}
]
-->

.game-board {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.reward-toast {
  background: linear-gradient(135deg, var(--glacier-dark), var(--glacier-bright));
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.25s ease-out;
}

.reward-toast-match {
  border: 2px solid rgba(255,255,255,0.25);
}

.reward-toast-round {
  border: 2px solid rgba(255,255,255,0.35);
}

.reward-badge {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--glacier-lightest);
  color: var(--glacier-dark);
  font-weight: 800;
  border: 2px solid var(--glacier-light);
}

.hud-item:last-child {
  background: linear-gradient(135deg, var(--glacier-lightest), #fff);
}

@media (max-width: 640px) {
  .game-board {
    gap: 0.75rem;
  }

  .reward-toast {
    font-size: 0.9rem;
  }
}

.child-switcher { padding: 16px 20px 8px; border-bottom: 1px solid rgba(0,0,0,0.08); background: rgba(255,255,255,0.65); backdrop-filter: blur(8px); }
.child-switcher-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.child-switcher-title { margin: 0; font-size: 1rem; }
.child-switcher-subtitle { margin: 4px 0 0; font-size: 0.92rem; opacity: 0.75; }
.child-badge { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.child-badge-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.child-badge-name { font-size: 0.95rem; }
.child-switcher-form { display: flex; gap: 10px; margin-bottom: 12px; }
.child-name-input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.12); }
.child-save-btn, .progress-complete-btn { padding: 12px 14px; border-radius: 12px; border: none; cursor: pointer; }
.child-list { display: flex; flex-wrap: wrap; gap: 8px; }
.child-pill { display: inline-flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.12); background: white; cursor: pointer; }
.child-pill.active { border-color: #7c5cff; box-shadow: 0 0 0 2px rgba(124,92,255,0.12); }
.child-pill-stars { opacity: 0.8; }
.child-empty { margin: 0; opacity: 0.7; }
.progress-summary { padding: 16px 20px; margin: 16px 20px; border-radius: 16px; background: rgba(124,92,255,0.08); }
.progress-title { margin: 0 0 6px; }
.progress-copy { margin: 0 0 10px; opacity: 0.8; }
.progress-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.progress-stat { padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.8); }
.progress-complete-btn { margin: 0 20px 16px; background: #7c5cff; color: white; }

.ai-workflow-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(224,247,250,0.92));
  border: 2px solid var(--glacier-light);
  box-shadow: var(--shadow-sm);
}

.ai-workflow-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.ai-workflow-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  color: var(--glacier-dark);
  margin-bottom: 0.25rem;
}

.ai-workflow-copy {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.ai-form-grid {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 0.8fr;
  gap: 0.75rem;
}

.ai-error {
  margin-top: 0.75rem;
  color: var(--danger);
  font-weight: 700;
  font-size: 0.9rem;
}

.btn-ai-generate {
  margin-top: 0.9rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--glacier-dark), var(--glacier-bright));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.btn-ai-generate:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.btn-ai-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.generated-review-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 2px solid var(--glacier-light);
  box-shadow: var(--shadow-sm);
}

.generated-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.generated-review-header h3 {
  font-family: 'Fredoka', sans-serif;
  color: var(--glacier-dark);
}

.generated-review-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.generated-review-list {
  display: grid;
  gap: 0.75rem;
}

.generated-review-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--glacier-lightest);
  border: 1px solid var(--glacier-light);
}

.generated-review-item p,
.generated-review-item span {
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-size: 0.88rem;
}

.generated-review-item-actions,
.card-action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.edit-btn {
  padding: 0.35rem 0.75rem;
  background: var(--glacier-lightest);
  color: var(--glacier-dark);
  border: 1px solid var(--glacier-light);
  border-radius: 50px;
  font-size: 0.75rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-btn:hover {
  background: var(--glacier-light);
}

@media (max-width: 640px) {
  .ai-form-grid {
    grid-template-columns: 1fr;
  }

  .generated-review-header,
  .generated-review-item,
  .ai-workflow-header {
    flex-direction: column;
    align-items: stretch;
  }

  .generated-review-item-actions,
  .card-action-row {
    justify-content: flex-start;
  }
}

.progress-chart-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 2px solid var(--glacier-light);
  box-shadow: var(--shadow-sm);
}

.progress-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.progress-chart-title {
  font-family: 'Fredoka', sans-serif;
  color: var(--glacier-dark);
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.progress-chart-copy {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.progress-chart-toggle {
  display: inline-flex;
  border: 2px solid var(--glacier-light);
  border-radius: 999px;
  overflow: hidden;
  background: var(--glacier-lightest);
}

.progress-chart-toggle-btn {
  padding: 0.45rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.progress-chart-toggle-btn.active {
  background: var(--glacier-dark);
  color: white;
}

.progress-chart-legend {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.progress-chart-legend-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--glacier-bright);
  box-shadow: 0 0 0 3px rgba(77, 208, 225, 0.18);
}

.progress-chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 0.5rem;
  align-items: end;
  min-height: 180px;
}

.progress-chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.progress-chart-bar-value {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--glacier-dark);
  min-height: 1rem;
}

.progress-chart-bar-track {
  width: 100%;
  height: 110px;
  border-radius: 999px;
  background: var(--glacier-lightest);
  border: 1px solid var(--glacier-light);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 3px;
}

.progress-chart-bar-fill {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--glacier-bright), var(--glacier-dark));
  min-height: 8px;
  transition: height 0.25s ease;
}

.progress-chart-bar-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

@media (max-width: 640px) {
  .progress-chart-header {
    flex-direction: column;
    align-items: stretch;
  }

  .progress-chart-toggle {
    align-self: flex-start;
  }

  .progress-chart-bars {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-height: 160px;
  }

  .progress-chart-bar-track {
    height: 96px;
  }
}
