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

:root {
  --primary: #7c3aed;
  --primary-light: #8b5cf6;
  --accent: #f59e0b;
  --accent-dark: #ea580c;
  --success: #10b981;
  --bg: #f5f0ff;
  --bg-card: #ffffff;
  --bg-card-light: #ede9fe;
  --text: #1e1b4b;
  --text-dim: #6b7280;
  --cleared: #06b6d4;
  --waiting: #f59e0b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 768px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

.hidden {
  display: none !important;
}

/* Header */
.header {
  text-align: center;
  padding: 24px 0;
  border-bottom: 2px solid var(--bg-card-light);
  margin-bottom: 24px;
}

.header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.header-icon {
  font-size: 32px;
}

.header h1 {
  font-size: 28px;
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-sub {
  margin-top: 8px;
  color: var(--primary-light);
  font-size: 16px;
}

.child-name {
  margin-top: 6px;
  font-size: 18px;
  font-weight: bold;
  color: var(--cleared);
  letter-spacing: 2px;
}

.reward-cash-icon, .reward-item-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* Sunday Screen */
.sunday-screen {
  text-align: center;
  padding: 60px 20px;
}

.sunday-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.sunday-screen h2 {
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 12px;
}

.sunday-screen p {
  color: var(--text-dim);
  font-size: 18px;
}

/* Week Progress */
.week-progress {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-dim);
}

.progress-bar {
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

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

/* Quest Day Cards */
.quest-days {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.quest-day {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  border: 2px solid var(--bg-card-light);
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.quest-day.today {
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.25);
}

.quest-day.cleared {
  border-color: var(--success);
  background: #ecfdf5;
}

.quest-day.waiting {
  border-color: var(--waiting);
  background: #fffbeb;
}

.day-name {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.day-number {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 4px;
}

.day-status {
  font-size: 20px;
}

/* Today's Goal */
.today-goal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.goal-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.goal-text {
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Today Action */
.today-action {
  text-align: center;
  margin-bottom: 32px;
}

.complete-btn {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none;
  color: white;
  padding: 20px 48px;
  border-radius: 60px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

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

.btn-icon {
  font-size: 28px;
}

.action-hint {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 14px;
}

/* Waiting / Cleared States */
.waiting-parent, .today-cleared {
  text-align: center;
  padding: 24px;
  margin-bottom: 32px;
}

.waiting-icon, .cleared-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.waiting-parent p {
  color: var(--waiting);
  font-size: 18px;
}

.today-cleared p {
  color: var(--success);
  font-size: 18px;
  font-weight: bold;
}

/* Current Reward */
.current-reward-section {
  margin-bottom: 20px;
}

.current-reward-card {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}

.current-reward-badge {
  font-size: 16px;
  font-weight: bold;
  color: #92400e;
  margin-bottom: 12px;
}

.current-reward-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.current-reward-body .reward-image {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 8px;
}

.current-reward-body .reward-cash-icon,
.current-reward-body .reward-item-icon {
  font-size: 48px;
}

.current-reward-amount {
  font-size: 32px;
  font-weight: bold;
  color: #92400e;
}

.current-reward-unit {
  font-size: 16px;
  color: #a16207;
  font-weight: bold;
}

/* Next Target */
.next-target-section {
  margin-bottom: 20px;
}

.next-target-card {
  background: var(--bg-card);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.next-target-label {
  font-size: 14px;
  color: var(--text);
}

.next-target-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.next-target-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
}

.next-target-reward {
  font-size: 16px;
  font-weight: bold;
  color: var(--primary);
}

/* Rewards Section */
.rewards-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--accent);
}

.reward-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.reward-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  border: 2px solid var(--bg-card-light);
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.06);
}

.reward-card .reward-image {
  width: 44px;
  height: 44px;
  object-fit: contain;
  margin: 4px auto;
}

.reward-card .reward-cash-icon,
.reward-card .reward-item-icon {
  font-size: 28px;
  margin: 4px 0;
}

.reward-card.earned {
  border-color: var(--success);
  background: #ecfdf5;
}

.reward-card.next {
  border-color: var(--primary);
  border-style: dashed;
  background: #faf5ff;
}

.reward-card.locked {
  opacity: 0.4;
}

.reward-day {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.reward-status {
  font-size: 20px;
  margin-bottom: 4px;
}

.reward-amount-sm {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
}

.reward-image {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 8px;
}

.reward-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Monthly Section */
.monthly-section {
  margin-bottom: 32px;
}

.monthly-progress-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.monthly-target-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-dim);
}

.monthly-count {
  font-weight: bold;
  color: var(--primary-light);
}

.monthly-fill.achieved {
  background: linear-gradient(90deg, var(--success), var(--accent));
}

.monthly-achieved {
  margin-top: 12px;
  font-size: 16px;
  font-weight: bold;
  color: var(--success);
  text-align: center;
}

/* Wishlist */
.wishlist-title {
  font-size: 18px;
  color: var(--primary-light);
  margin-bottom: 12px;
}

.wishlist-input {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.wishlist-input input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  color: var(--text);
  font-size: 16px;
}

.wishlist-input button {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.wishlist-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wishlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: 12px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.06);
}

.wish-text {
  font-size: 16px;
  flex: 1;
}

.wish-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}

.wishlist-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 20px;
  font-size: 14px;
}

.granted-title {
  font-size: 16px;
  color: var(--accent);
  margin-top: 20px;
  margin-bottom: 8px;
}

.granted-item {
  padding: 12px 16px;
  background: #fffbeb;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  margin-bottom: 8px;
  color: #92400e;
}

/* Clear Overlay */
.clear-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 27, 75, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.clear-content {
  text-align: center;
  animation: popIn 0.5s ease;
}

.clear-stars {
  font-size: 60px;
  margin-bottom: 20px;
}

.clear-content h2 {
  font-size: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 6px;
  margin-bottom: 12px;
}

.clear-content p {
  font-size: 20px;
  color: var(--text);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

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

/* Parent Link */
.parent-link {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 12px;
  background: rgba(245, 240, 255, 0.95);
  border-top: 1px solid var(--bg-card-light);
}

.parent-link a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
}

/* Responsive for iPad */
@media (min-width: 768px) {
  .app {
    padding: 24px 32px;
  }

  .header h1 {
    font-size: 36px;
  }

  .quest-days {
    gap: 12px;
  }

  .quest-day {
    padding: 16px 12px;
  }

  .day-number {
    font-size: 24px;
  }

  .current-reward-body .reward-image {
    width: 120px;
    height: 120px;
  }

  .reward-card .reward-image {
    width: 52px;
    height: 52px;
  }

  .current-reward-amount {
    font-size: 40px;
  }

  .complete-btn {
    padding: 24px 60px;
    font-size: 26px;
  }
}
