* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --gold: #FFD700;
  --gold-light: #FFF3B0;
  --purple: #7B2D8E;
  --purple-light: #B44AC7;
  --green: #4CAF50;
  --green-light: #81C784;
  --red: #E53935;
  --red-light: #EF5350;
  --blue: #42A5F5;
  --dark: #1a1a2e;
  --card-bg: #ffffff;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --child-bg: linear-gradient(180deg, #FFE082 0%, #FFB74D 50%, #FF8A65 100%);
  --shadow: 0 4px 20px rgba(0,0,0,0.15);
  --radius: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--child-bg);
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--dark);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

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

@keyframes shootingStar {
  0% { transform: translate(0, 0) rotate(-35deg) scale(1); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(300px, 200px) rotate(-35deg) scale(0); opacity: 0; }
}
@keyframes shootingStarGlow {
  0% { box-shadow: 0 0 0 0 rgba(255,215,0,0); }
  20% { box-shadow: 0 0 6px 2px rgba(255,215,0,0.6), 0 0 20px 6px rgba(255,215,0,0.3); }
  100% { box-shadow: 0 0 0 0 rgba(255,215,0,0); }
}
.shooting-star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #FFD700;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  animation: shootingStarGlow 0.6s ease-out, shootingStar 1.5s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
@keyframes confettiSway {
  0% { transform: translateY(-10vh) translateX(0) rotate(0deg); opacity: 1; }
  50% { transform: translateY(50vh) translateX(60px) rotate(360deg); opacity: 0.7; }
  100% { transform: translateY(110vh) translateX(-30px) rotate(720deg); opacity: 0; }
}
@keyframes confettiBurst {
  0% { transform: translate(0, 0) scale(0); opacity: 1; }
  50% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0.8; }
  100% { transform: translate(var(--dx2), var(--dy2)) scale(0.3); opacity: 0; }
}

.hidden { display: none !important; }

/* ========== CHILD DASHBOARD ========== */
#child-dashboard {
  background: var(--child-bg);
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 100px;
  min-height: 100vh;
  position: relative;
  transition: filter 0.5s ease;
}
#child-dashboard.sync-flash {
  animation: sparkleGlow 0.8s ease;
}
@keyframes sparkleGlow {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.25) saturate(1.4); }
  100% { filter: brightness(1); }
}

#child-dashboard.active {
  display: flex;
}

.child-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  animation: slideUp 0.5s ease;
}

.child-avatar {
  font-size: 48px;
  animation: float 3s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.2s;
  border-radius: 50%;
  padding: 8px;
  line-height: 1;
}
.child-avatar:active { transform: scale(0.9); }

.child-name {
  font-size: 28px;
  font-weight: 800;
  color: #5D4037;
  text-shadow: 2px 2px 0 rgba(255,255,255,0.5);
}

.stars-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  animation: slideUp 0.5s ease 0.1s both;
}

.stars-bg {
  position: absolute;
  width: 200px;
  height: 200px;
  pointer-events: none;
}

.star-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.9);
  padding: 16px 40px;
  border-radius: 60px;
  box-shadow: var(--shadow);
  border: 4px solid var(--gold);
  position: relative;
  z-index: 1;
}

.star-emoji {
  font-size: 40px;
  animation: pulse 2s ease-in-out infinite;
}

.star-count {
  font-size: 64px;
  font-weight: 900;
  color: #E65100;
  line-height: 1;
  min-width: 80px;
  text-align: center;
  transition: all 0.3s ease;
}

.star-count.pop {
  animation: bounce 0.4s ease;
  color: var(--gold);
}

.star-label {
  font-size: 18px;
  font-weight: 700;
  color: #8D6E63;
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-top: 8px;
}

.progress-container {
  width: 100%;
  margin-bottom: 20px;
  animation: slideUp 0.5s ease 0.2s both;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: #6D4C41;
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-light), var(--gold), #FFA000);
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.mood-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  animation: slideUp 0.5s ease 0.3s both;
}

.mood-emoji {
  font-size: 64px;
  transition: all 0.5s ease;
  animation: float 4s ease-in-out infinite;
}

.mood-message {
  font-size: 18px;
  font-weight: 600;
  color: #5D4037;
  margin-top: 8px;
  text-align: center;
}

.recent-actions {
  width: 100%;
  animation: slideUp 0.5s ease 0.4s both;
}

.recent-actions h3 {
  font-size: 16px;
  color: #6D4C41;
  margin-bottom: 8px;
}

.actions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.8);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  animation: slideUp 0.3s ease;
  backdrop-filter: blur(10px);
}

.action-item .emoji {
  font-size: 20px;
}

.action-item .label {
  flex: 1;
  font-weight: 500;
}

.action-item .points {
  font-weight: 700;
  font-size: 16px;
}

.action-item .points.positive { color: var(--green); }
.action-item .points.negative { color: var(--red); }

.action-item .time {
  font-size: 11px;
  color: #999;
}

/* ========== PARENT BUTTON ========== */
.parent-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  border: 2px solid #ddd;
  padding: 12px 32px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 10;
  transition: all 0.2s;
  color: #666;
}

.parent-btn:active {
  transform: translateX(-50%) scale(0.95);
}

/* ========== PARENT LOGIN ========== */
#parent-login {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#parent-login.active {
  display: flex;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 360px;
}

.login-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 4px;
  color: var(--dark);
}

.login-card p {
  color: #888;
  margin-bottom: 24px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #ddd;
  transition: all 0.2s;
}

.pin-dot.filled {
  background: var(--purple);
  border-color: var(--purple);
  animation: pulse 0.3s ease;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-btn {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-btn:active {
  background: #e0e0e0;
  transform: scale(0.92);
}

.pin-btn.blank {
  background: transparent;
  cursor: default;
}

.delete-btn {
  font-size: 22px;
  color: var(--red);
}

.back-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #666;
  cursor: pointer;
  padding: 12px 0;
  font-weight: 500;
}

/* ========== PARENT DASHBOARD ========== */
#parent-dashboard {
  background: #f5f5f5;
  display: none;
  padding: 0 16px 100px;
  min-height: 100vh;
}

#parent-dashboard.active {
  display: block;
}

.parent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  background: white;
  margin: 0 -16px 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.parent-header h2 {
  font-size: 18px;
  flex: 1;
  text-align: center;
}

.parent-header .back-btn {
  font-size: 14px;
  color: var(--blue);
}

.icon-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}


.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.action-btn {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.action-btn:active {
  transform: scale(0.96);
}

.good-btn {
  background: linear-gradient(135deg, var(--green), #388E3C);
  color: white;
}

.bad-btn {
  background: linear-gradient(135deg, var(--red), #C62828);
  color: white;
}

.summary-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.summary-row {
  display: flex;
  justify-content: space-around;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-icon {
  font-size: 24px;
}

.summary-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  transition: all 0.3s ease;
}
.summary-value.pop {
  animation: bounce 0.4s ease;
  color: var(--gold);
}

.summary-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.week-chart {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 120px;
  padding: 8px 4px;
}
.week-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}
.week-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
  position: relative;
}
.week-bar.pos { background: linear-gradient(180deg, #4CAF50, #66BB6A); }
.week-bar.neg { background: linear-gradient(180deg, #EF5350, #E53935); }
.week-bar-label {
  font-size: 10px;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
}
.week-bar-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--dark);
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.month-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  background: #f5f5f5;
  color: #bbb;
}
.month-day.has-data {
  color: white;
}
.month-day.great { background: #4CAF50; }
.month-day.good { background: #81C784; }
.month-day.ok { background: #FFB74D; }
.month-day.bad { background: #EF5350; }
.month-day.today {
  box-shadow: 0 0 0 2px var(--dark);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 16px;
}

.small-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f9f9f9;
  border-radius: 10px;
  font-size: 14px;
  animation: slideUp 0.2s ease;
}

.history-item .h-emoji { font-size: 20px; }
.history-item .h-label { flex: 1; font-weight: 500; }
.history-item .h-points { font-weight: 700; }
.history-item .h-points.pos { color: var(--green); }
.history-item .h-points.neg { color: var(--red); }
.history-item .h-time { font-size: 11px; color: #aaa; }
.history-item .h-delete {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.4;
  padding: 4px;
}

.empty-state {
  text-align: center;
  color: #bbb;
  padding: 32px 16px;
  font-size: 14px;
}

/* ========== SETTINGS ========== */
#settings-screen {
  background: #f5f5f5;
  display: none;
  min-height: 100vh;
}

#settings-screen.active {
  display: block;
}

.settings-section {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.settings-section h3 {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.setting-row {
  margin-bottom: 12px;
}

.setting-row:last-child {
  margin-bottom: 0;
}

.setting-row label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #555;
}

.setting-row input[type="text"],
.setting-row input[type="number"],
.setting-row input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #eee;
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.setting-row input:focus {
  outline: none;
  border-color: var(--blue);
}

.actions-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.action-edit-row input {
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid #eee;
  border-radius: 8px;
  font-size: 14px;
}
.action-edit-row input.edit-action-emoji,
.action-edit-row input.edit-reward-emoji,
.action-edit-row input.edit-routine-emoji { width: 40px; flex: none; text-align: center; }
.action-edit-row input.edit-action-label,
.action-edit-row input.edit-reward-label,
.action-edit-row input.edit-routine-label { flex: 1; min-width: 80px; }
.action-edit-row input.edit-action-points,
.action-edit-row input.edit-reward-points,
.action-edit-row input.edit-routine-points { width: 50px; flex: none; }
.action-edit-row input.edit-ha-action { width: 100px; flex: none; font-size: 11px; }

.action-edit-row input:focus {
  outline: none;
  border-color: var(--blue);
}

.action-edit-row .remove-action {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--red);
  padding: 4px;
}

.ha-test-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.2s;
}
.ha-test-btn:active { background: #eee; }

.add-action-btn {
  background: none;
  border: 2px dashed #ddd;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  color: #888;
  cursor: pointer;
  margin-top: 6px;
  width: 100%;
}

.danger-btn {
  width: 100%;
  padding: 14px;
  border: none;
  background: #fff0f0;
  color: var(--red);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #ffcdd2;
  transition: all 0.2s;
}

.danger-btn:active {
  background: #ffcdd2;
}

.save-btn {
  width: 100%;
  padding: 16px;
  border: none;
  background: linear-gradient(135deg, var(--blue), #1E88E5);
  color: white;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.save-btn:active {
  transform: scale(0.97);
}

/* ========== MODAL ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  animation: slideUp 0.3s ease;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-content h3 {
  font-size: 20px;
  margin-bottom: 16px;
  text-align: center;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-action-btn {
  padding: 14px 10px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.modal-action-btn .ma-emoji { font-size: 28px; }
.modal-action-btn .ma-label { font-size: 13px; }
.modal-action-btn .ma-points { font-size: 11px; opacity: 0.8; }

.modal-action-btn:active {
  transform: scale(0.95);
}

.modal-action-btn.good {
  background: #E8F5E9;
  color: #2E7D32;
}

.modal-action-btn.bad {
  background: #FFEBEE;
  color: #C62828;
}

.modal-custom {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.modal-custom input {
  flex: 1;
  padding: 12px;
  border: 2px solid #eee;
  border-radius: 10px;
  font-size: 14px;
}

.modal-custom button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}

.modal-custom .good-btn { background: var(--green); color: white; }
.modal-custom .bad-btn { background: var(--red); color: white; }

.cancel-btn {
  width: 100%;
  padding: 12px;
  border: none;
  background: #f5f5f5;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
}

/* ========== CELEBRATION ========== */
#celebration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
}

#celebration.hidden {
  display: none;
}

.confetti-container {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  top: -20px;
  animation: confettiFall 3s ease-in forwards;
}

.celebration-text {
  text-align: center;
  z-index: 1;
  animation: bounce 0.6s ease;
}

.big-emoji {
  font-size: 80px;
  margin-bottom: 12px;
  display: block;
}

.big-message {
  font-size: 36px;
  font-weight: 900;
  color: white;
  text-shadow: 2px 2px 20px rgba(0,0,0,0.3);
}
.big-emoji.firework {
  animation: fireworkPop 1s ease;
}
.big-emoji.firework-mini {
  animation: fireworkPop 0.6s ease;
}
@keyframes fireworkPop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  40% { transform: scale(1.8) rotate(10deg); opacity: 1; }
  60% { transform: scale(0.9) rotate(-5deg); }
  80% { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ========== AVATAR PICKER ========== */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px 0;
}
.avatar-option {
  font-size: 36px;
  padding: 10px;
  border: 3px solid transparent;
  border-radius: 16px;
  background: #f0f0f0;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.avatar-option:active { transform: scale(0.9); }
.avatar-option.selected { border-color: var(--gold); background: #FFF3B0; }
.avatar-bg-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.avatar-bg-opt {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.avatar-bg-opt:active { transform: scale(0.9); }
.avatar-bg-opt.selected { border-color: var(--dark); }

/* ========== SHOP BUTTON (Child) ========== */
.shop-btn {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FF6F00, #FF8F00);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255,111,0,0.4);
  z-index: 10;
  transition: all 0.2s;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-btn:active {
  transform: translateX(-50%) scale(0.95);
}

/* Total stars on child dashboard */
.total-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  background: rgba(255,255,255,0.6);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
}

.total-stars .ts-icon { font-size: 16px; }
.total-stars .ts-count {
  font-weight: 800;
  font-size: 18px;
  color: #E65100;
  min-width: 20px;
  text-align: center;
  transition: all 0.3s ease;
}
.total-stars .ts-count.pop {
  animation: bounce 0.4s ease;
}
.total-stars .ts-label {
  font-size: 11px;
  color: #8D6E63;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========== SHOP MODAL ========== */
.shop-content h3 {
  margin-bottom: 8px;
}

.shop-balance {
  text-align: center;
  font-size: 16px;
  margin-bottom: 16px;
  padding: 8px;
  background: #FFF8E1;
  border-radius: 12px;
  color: #E65100;
}

.shop-balance strong {
  font-size: 22px;
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.shop-item.affordable {
  background: #E8F5E9;
  color: #2E7D32;
  box-shadow: 0 2px 8px rgba(76,175,80,0.15);
}

.shop-item.affordable:active {
  transform: scale(0.95);
}

.shop-item.locked {
  background: #f5f5f5;
  color: #bbb;
  cursor: default;
}

.shop-item .si-emoji {
  font-size: 36px;
  line-height: 1;
}

.shop-item .si-label {
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  line-height: 1.2;
}

.shop-item .si-cost {
  font-size: 14px;
  font-weight: 800;
}

.shop-item.locked .si-cost {
  color: #ccc;
}

.shop-item .si-lock {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 14px;
  opacity: 0.5;
}

/* ========== HISTORY EXCHANGE ROW ========== */
.history-item.exchange-row {
  background: #FFF3E0;
  border-left: 4px solid #FF9800;
}

.history-item .h-badge {
  font-size: 10px;
  background: #FF9800;
  color: white;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
}

.history-item .h-badge.bonus {
  background: #7B1FA2;
}

/* ========== ACTION ITEM EXCHANGE ========== */
.action-item .points.exchange {
  color: #FF9800;
}

/* ========== ROUTINE BLOCKS (Child) ========== */
.routine-block {
  width: 100%;
  margin-bottom: 16px;
  animation: slideUp 0.5s ease 0.3s both;
}

.routine-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.routine-header .rh-icon {
  font-size: 20px;
}

.routine-header .rh-title {
  font-size: 15px;
  font-weight: 700;
  color: #5D4037;
  flex: 1;
}

.routine-header .rh-count {
  font-size: 13px;
  font-weight: 600;
  color: #8D6E63;
  background: rgba(255,255,255,0.6);
  padding: 2px 10px;
  border-radius: 10px;
}

.routine-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.routine-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 14px;
  background: rgba(255,255,255,0.75);
  transition: all 0.2s;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  backdrop-filter: blur(4px);
}

#child-dashboard .routine-item {
  cursor: default;
}

#parent-dashboard .routine-item {
  cursor: pointer;
}

#parent-dashboard .routine-item:active {
  transform: scale(0.97);
}

.routine-item.done {
  background: rgba(200,230,201,0.8);
  border-color: var(--green);
}

.routine-item .ri-check {
  font-size: 18px;
  flex-shrink: 0;
}

.routine-item .ri-emoji {
  font-size: 22px;
}

.routine-item .ri-label {
  flex: 1;
  font-weight: 600;
  color: #4E342E;
}

.routine-item.done .ri-label {
  text-decoration: line-through;
  opacity: 0.6;
}

.routine-item .ri-points {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}

/* ========== HISTORY ROUTINE ROW ========== */
.history-item.routine-row {
  background: #E8F5E9;
  border-left: 4px solid var(--green);
}

/* ========== TOAST / NOTIFICATION ========== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  animation: slideUp 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-width: 90%;
}

.toast.good {
  background: var(--green);
}

.toast.bad {
  background: var(--red);
}

/* ========== RESPONSIVE ========== */
@media (min-width: 480px) {
  #child-dashboard {
    padding: 40px 24px 120px;
  }

  .star-count {
    font-size: 80px;
  }

  .child-avatar {
    font-size: 56px;
  }

  .child-name {
    font-size: 32px;
  }

  .quick-actions {
    gap: 16px;
  }

  .action-btn {
    padding: 20px;
    font-size: 18px;
  }
}

@media (max-width: 360px) {
  .star-count {
    font-size: 48px;
    min-width: 60px;
  }

  .star-counter {
    padding: 12px 24px;
  }

  .child-name {
    font-size: 22px;
  }

  .modal-actions {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .modal-action-btn {
    padding: 10px 8px;
    font-size: 14px;
  }

  .modal-action-btn .ma-emoji {
    font-size: 22px;
  }
}
