* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #F5F6FA;
  color: #2B2D42;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hidden {
  display: none !important;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
}

/* ---------- Top bar ---------- */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  flex-shrink: 0;
}

.home-title {
  font-size: 19px;
  font-weight: 800;
}

.gear-btn {
  background: #E9ECEF;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn {
  background: rgba(255,255,255,0.3);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.primary-btn {
  background: #4DABF7;
  color: white;
  font-size: 18px;
  font-weight: 700;
  padding: 16px 32px;
  border-radius: 24px;
}

/* ---------- Kid checklist panels ---------- */

.card-scroller {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  touch-action: pan-x;
  padding: 0 6vw 12px 6vw;
  gap: 4vw;
}

.card-scroller::-webkit-scrollbar {
  display: none;
}

.kid-panel {
  scroll-snap-align: center;
  flex: 0 0 88vw;
  width: 88vw;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,0.15);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 8px 16px;
  flex-shrink: 0;
  color: white;
}

.panel-header .kid-avatar {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

.kid-avatar {
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.kid-name {
  font-size: 16px;
  font-weight: 800;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 0 10px 0;
  flex-shrink: 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #CED4DA;
  transition: background 0.2s, transform 0.2s;
}

.dot.active {
  background: #495057;
  transform: scale(1.3);
}

.reward-card {
  position: relative;
  margin: 0 16px 16px 16px;
  background: #FFFFFF;
  padding: 8px;
  border-radius: 20px;
  text-align: center;
  flex-shrink: 0;
  height: 136px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  animation: rewardPop 0.25s ease;
}

.reward-jar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: rgba(0,0,0,0.045);
  border-radius: 14px;
  padding: 4px 1px;
  width: 100%;
}

.reward-slot {
  font-size: 38px;
  line-height: 1;
  text-align: center;
  opacity: 0.2;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.reward-slot.filled {
  opacity: 1;
}

.reward-overflow-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #2B2D42;
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 10px;
}

.reward-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #868E96;
}

.reward-card.celebrating {
  border: 3px solid var(--task-done-accent, #40C057);
}

.celebration-line1 {
  font-size: 16px;
  font-weight: 800;
  color: var(--task-done-accent, #40C057);
  margin-top: 2px;
}

@keyframes rewardPop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.task-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  touch-action: pan-y;
  padding: 0 16px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-card {
  background: white;
  border-radius: 16px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  position: relative;
  transition: transform 0.15s ease;
}

.task-card:active {
  transform: scale(0.97);
}

.task-card.done {
  background: var(--task-done-bg, #EBFBEE);
}

.task-emoji {
  font-size: 28px;
  width: 38px;
  text-align: center;
}

.task-label {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
}

.task-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #CED4DA;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.task-card.done .task-check {
  background: var(--task-done-accent, #40C057);
  border-color: var(--task-done-accent, #40C057);
  color: white;
}


/* ---------- Parent mode ---------- */

.parent-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: #343A40;
  color: white;
}

.parent-header .title {
  font-size: 20px;
  font-weight: 800;
  flex: 1;
}

.parent-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px 40px 18px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #868E96;
  margin-bottom: 12px;
}

.field-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #868E96;
  margin-bottom: 10px;
}

.list-row {
  background: white;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: transform 0.15s ease;
}

.list-row.dragging {
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  transition: none;
}

.task-manage-list {
  position: relative;
}

.drag-handle {
  font-size: 20px;
  color: #ADB5BD;
  flex-shrink: 0;
  padding: 4px 2px;
  touch-action: none;
}

.list-row .swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
}

.list-row .emoji {
  font-size: 22px;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: #F1F3F5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-row .label {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
}

.icon-btn {
  background: #F1F3F5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.add-row-btn {
  width: 100%;
  background: #E7F5FF;
  color: #1971C2;
  font-weight: 700;
  font-size: 16px;
  padding: 16px;
  border-radius: 18px;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: white;
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.stepper-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #E7F5FF;
  color: #1971C2;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.stepper-value {
  font-size: 22px;
  font-weight: 800;
  min-width: 64px;
  text-align: center;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #868E96;
  margin-bottom: 8px;
}

.field input[type="text"], .field input[type="number"] {
  width: 100%;
  font-size: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid #DEE2E6;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.field input[type="text"]:focus, .field input[type="number"]:focus {
  outline: none;
  border-color: #4DABF7;
}

.field-error {
  color: #E03131;
  font-size: 14px;
  font-weight: 700;
  margin: -10px 0 16px 0;
}

.swatch-grid, .emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.swatch-grid {
  grid-template-columns: repeat(6, 1fr);
}

.swatch-grid .swatch-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
}

.swatch-grid .swatch-option.selected {
  border-color: #2B2D42;
}

.emoji-grid button {
  background: #F1F3F5;
  font-size: 26px;
  aspect-ratio: 1;
  border-radius: 16px;
}

.emoji-grid button.selected {
  background: #4DABF7;
}

.currency-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.currency-option {
  background: white;
  font-size: 24px;
  aspect-ratio: 1;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.currency-option.selected {
  background: #4DABF7;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}

.modal-sheet {
  background: #F5F6FA;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 28px 28px 0 0;
  padding: 14px 20px calc(20px + env(safe-area-inset-bottom)) 20px;
}

.modal-handle {
  width: 40px;
  height: 5px;
  background: #DEE2E6;
  border-radius: 3px;
  margin: 0 auto 18px auto;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
}

.modal-text {
  font-size: 15px;
  color: #495057;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.modal-actions .primary-btn, .modal-actions .secondary-btn, .modal-actions .danger-btn {
  flex: 1;
  text-align: center;
  padding: 14px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
}

.secondary-btn {
  background: #E9ECEF;
  color: #495057;
}

.danger-btn {
  width: 100%;
  background: #FFF0F0;
  color: #E03131;
  font-weight: 700;
  font-size: 16px;
  padding: 16px;
  border-radius: 18px;
}

.danger-btn:disabled {
  opacity: 0.5;
}

.onboard-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  gap: 16px;
  text-align: center;
}

.onboard-wrap .big-emoji {
  font-size: 60px;
}
