/* ===========================
   COLOR FOR ME! — Kids App CSS
   =========================== */

:root {
  --pink:    #FF6B9D;
  --yellow:  #FFD93D;
  --green:   #6BCB77;
  --blue:    #4D96FF;
  --purple:  #C77DFF;
  --orange:  #FF9A3C;
  --red:     #FF6B6B;
  --teal:    #00C9B1;

  --header-bg: #FF6B9D;
  --bg-main: #FFF9F0;
  --bg-card: #FFFFFF;
  --text-dark: #2D2D2D;
  --text-mid:  #5A5A5A;
  --text-light: #9A9A9A;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --shadow-fun: 0 6px 0 rgba(0,0,0,0.12);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.08);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ==================
   SCREENS & LAYOUT
   ================== */

.screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.hidden { display: none; }

#splash.hidden { display: none; }

/* ==================
   SPLASH SCREEN
   ================== */

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #FFE5F0 0%, #FFF5D6 50%, #E5F5FF 100%);
  overflow: hidden;
}

.splash-bg { position: absolute; inset: 0; pointer-events: none; }

.splash-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.blob1 { width: 280px; height: 280px; background: #FFB3D1; top: -80px; right: -60px; animation: float 6s ease-in-out infinite; }
.blob2 { width: 220px; height: 220px; background: #B3E5FF; bottom: -60px; left: -40px; animation: float 8s ease-in-out infinite reverse; }
.blob3 { width: 180px; height: 180px; background: #FFE599; bottom: 100px; right: 20px; animation: float 7s ease-in-out infinite 1s; }

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

.splash-content {
  position: relative;
  text-align: center;
  padding: 2rem;
  z-index: 1;
}

.splash-icon {
  font-size: 80px;
  display: block;
  margin-bottom: 0.5rem;
  animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.splash-title {
  font-family: 'Baloo 2', cursive;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #FF6B9D, #FF9A3C, #FFD93D);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
}

.splash-sub {
  font-size: 18px;
  color: var(--text-mid);
  font-weight: 600;
  margin-bottom: 2rem;
}

.crayon-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}
.crayon {
  font-size: 36px;
  display: inline-block;
  transform: rotate(var(--r));
  animation: wiggle 3s ease-in-out infinite;
}
.crayon:nth-child(2) { animation-delay: 0.3s; }
.crayon:nth-child(3) { animation-delay: 0.6s; }
.crayon:nth-child(4) { animation-delay: 0.9s; }

@keyframes wiggle {
  0%, 100% { transform: rotate(var(--r)) translateY(0); }
  50% { transform: rotate(calc(var(--r) + 5deg)) translateY(-5px); }
}

.btn-start {
  display: inline-block;
  font-family: 'Baloo 2', cursive;
  font-size: 24px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #FF6B9D, #FF9A3C);
  border: none;
  border-radius: 999px;
  padding: 16px 48px;
  box-shadow: 0 8px 0 #d44a7a, 0 12px 20px rgba(255,107,157,0.4);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  letter-spacing: 0.02em;
}
.btn-start:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #d44a7a, 0 6px 12px rgba(255,107,157,0.3);
}

/* ==================
   SETUP SCREEN
   ================== */

.setup-bg {
  background: linear-gradient(145deg, #FFF0F8 0%, #FFFBE8 100%);
}

.screen-inner {
  padding: 0 1.25rem 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.back-btn-wrap {
  padding: 1rem 0 0.5rem;
}
.back-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-mid);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px 8px 0;
}

.setup-emoji {
  font-size: 64px;
  text-align: center;
  margin: 1rem 0 0.5rem;
}

.screen-title {
  font-family: 'Baloo 2', cursive;
  font-size: 36px;
  font-weight: 800;
  text-align: center;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.screen-sub {
  font-size: 16px;
  color: var(--text-mid);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ==================
   FORM ELEMENTS
   ================== */

.form-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  border: 3px solid #F0E8FF;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  width: 100%;
  background: #FAFAFA;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus { border-color: var(--purple); background: white; }
.form-input::placeholder { color: #CCC; font-weight: 600; }

/* Age picker */
.age-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.age-option {
  font-family: 'Baloo 2', cursive;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-mid);
  background: #F5F5F5;
  border: 3px solid transparent;
  border-radius: var(--radius-sm);
  width: 54px;
  height: 54px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.age-option:active { transform: scale(0.92); }
.age-option.selected {
  background: #FFE5F0;
  border-color: var(--pink);
  color: var(--pink);
}

/* Primary button */
.btn-primary {
  font-family: 'Baloo 2', cursive;
  font-size: 22px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border: none;
  border-radius: 999px;
  padding: 15px;
  width: 100%;
  box-shadow: 0 6px 0 #8B4DC9, 0 10px 20px rgba(199,125,255,0.35);
  cursor: pointer;
  margin-top: 0.5rem;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #8B4DC9, 0 5px 10px rgba(199,125,255,0.25);
}

/* ==================
   MAIN SCREEN
   ================== */

#mainScreen {
  background: var(--bg-main);
}

.main-header {
  background: var(--header-bg);
  padding-top: env(safe-area-inset-top, 12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 1.25rem 0;
}

.header-wave {
  width: 100%;
  height: 40px;
  display: block;
  margin-top: -1px;
}
.header-wave svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Profile switcher */
.profile-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.profile-switcher::-webkit-scrollbar { display: none; }

.profile-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.25);
  border: 2.5px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
}
.profile-chip.active {
  background: white;
  border-color: white;
}
.profile-chip .chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  font-family: 'Baloo 2', cursive;
}
.profile-chip .chip-name {
  font-size: 16px;
  color: white;
}
.profile-chip.active .chip-name { color: var(--text-dark); }

.community-chip { border-color: rgba(255,255,255,0.5); }
.community-chip-icon { font-size: 18px; line-height: 1; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 2.5px solid rgba(255,255,255,0.4);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Main content */
.main-content {
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* Age tag */
.age-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  align-self: flex-start;
}
.age-tag.simple { background: #E8FFE5; color: #2E7D32; border: 2px solid #A5D6A7; }
.age-tag.medium { background: #E5F4FF; color: #1565C0; border: 2px solid #90CAF9; }
.age-tag.detailed { background: #FFF3E0; color: #E65100; border: 2px solid #FFCC80; }

/* Prompt section */
.prompt-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prompt-label {
  font-family: 'Baloo 2', cursive;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.textarea-wrap {
  position: relative;
}

.prompt-textarea {
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  border: 3px solid #E8E0FF;
  border-radius: var(--radius-md);
  padding: 16px;
  width: 100%;
  min-height: 120px;
  resize: none;
  background: white;
  box-shadow: var(--shadow-card);
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
}
.prompt-textarea:focus { border-color: var(--purple); }
.prompt-textarea::placeholder { color: #CCC; font-weight: 600; font-size: 16px; }

/* Suggestion chips */
.suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.suggestions::-webkit-scrollbar { display: none; }

.suggestion-chip {
  flex-shrink: 0;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-mid);
  background: white;
  border: 2.5px solid #EEE;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.suggestion-chip:active { transform: scale(0.95); background: #FFF0F8; border-color: var(--pink); color: var(--pink); }

/* Generate button */
.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: 'Baloo 2', cursive;
  font-size: 26px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #FF6B9D, #FF9A3C);
  border: none;
  border-radius: 999px;
  padding: 18px 24px;
  width: 100%;
  box-shadow: 0 8px 0 #c94a70, 0 12px 28px rgba(255,107,157,0.4);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  letter-spacing: 0.01em;
}
.btn-generate:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #c94a70, 0 6px 14px rgba(255,107,157,0.3);
}
.btn-generate:disabled {
  background: #DDD;
  box-shadow: 0 6px 0 #BBB;
  cursor: not-allowed;
}
.btn-generate-icon { font-size: 28px; }

@media (max-width: 390px) {
  .btn-generate {
    font-size: 18px;
    padding: 13px 16px;
    gap: 8px;
  }
  .btn-generate-icon { font-size: 20px; }
}

@media (max-width: 320px) {
  .btn-generate {
    font-size: 15px;
    padding: 11px 12px;
    gap: 6px;
  }
  .btn-generate-icon { font-size: 17px; }
}

/* Generating state */
.generating {
  text-align: center;
  padding: 2rem 1rem;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.pencil-anim {
  font-size: 48px;
  display: block;
  margin-bottom: 1rem;
  animation: draw 1.2s ease-in-out infinite alternate;
}
@keyframes draw {
  from { transform: rotate(-15deg) translateX(-10px); }
  to { transform: rotate(15deg) translateX(10px); }
}

.generating-text {
  font-family: 'Baloo 2', cursive;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 1rem;
}

.progress-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.progress-dots span {
  width: 12px; height: 12px;
  background: var(--pink);
  border-radius: 50%;
  animation: dot-pulse 1.4s ease-in-out infinite;
}
.progress-dots span:nth-child(2) { animation-delay: 0.2s; background: var(--orange); }
.progress-dots span:nth-child(3) { animation-delay: 0.4s; background: var(--purple); }

@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Gallery */
.gallery-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery-title {
  font-family: 'Baloo 2', cursive;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.gallery-card {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}
.gallery-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
}
.gallery-card:active { transform: scale(0.97); }

.gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #f9f9f9;
}

.gallery-card-footer {
  padding: 7px 10px 8px;
  background: white;
}
.gallery-card-date {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.gallery-card-desc {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.gallery-card-author {
  font-size: 11px;
  font-weight: 700;
  color: #9C6FD6;
  margin-top: 2px;
}

.gallery-card-age-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  margin-top: 4px;
}
.gallery-card-age-tag.simple  { background: #E8FFE5; color: #2E7D32; border: 1.5px solid #A5D6A7; }
.gallery-card-age-tag.medium  { background: #E5F4FF; color: #1565C0; border: 1.5px solid #90CAF9; }
.gallery-card-age-tag.detailed { background: #FFF3E0; color: #E65100; border: 1.5px solid #FFCC80; }

.community-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #aaa;
  font-weight: 700;
  padding: 2rem 0;
}

.gallery-card-new-badge {
  position: absolute;
  top: 7px; right: 7px;
  background: var(--green);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Admin delete button on community cards */
.admin-delete-btn {
  position: absolute;
  top: 7px; left: 7px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.gallery-card:hover .admin-delete-btn { opacity: 1; }
.admin-delete-btn:hover { background: #FFE0E0; }

/* ==================
   MODALS
   ================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.25s;
}
.modal-overlay.hidden { display: none; }

.modal-sheet {
  background: white;
  border-radius: 28px 28px 0 0;
  padding: 1rem 1.5rem 2rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: sheet-up 0.3s ease;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px; height: 5px;
  background: #E0E0E0;
  border-radius: 999px;
  margin: 0 auto 1.25rem;
}

.modal-title {
  font-family: 'Baloo 2', cursive;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 1.25rem;
}

/* Settings modal content */
.settings-section {
  background: #FAFAFA;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-section-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
}

.api-key-row {
  display: flex;
  gap: 8px;
}

.api-key-input {
  flex: 1;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  border: 2.5px solid #EEE;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  background: white;
  transition: border-color 0.2s;
}
.api-key-input:focus { border-color: var(--purple); }

.btn-save-key {
  font-family: 'Baloo 2', cursive;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: var(--purple);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  cursor: pointer;
  box-shadow: 0 4px 0 #9B4DC9;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-save-key:active { transform: translateY(2px); box-shadow: 0 2px 0 #9B4DC9; }

.key-status {
  font-size: 14px;
  font-weight: 700;
  min-height: 20px;
}
.key-status.ok { color: var(--green); }
.key-status.err { color: var(--red); }

.settings-hint {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
}

/* Profile list in settings */
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 2px dashed #F0F0F0;
}
.profile-row:last-child { border-bottom: none; }

.profile-row-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Baloo 2', cursive;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.profile-row-info { flex: 1; }
.profile-row-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-dark);
}
.profile-row-age {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 2px;
  line-height: 1.8;
}
.birth-year-select {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #555;
  background: #EDEDFD;
  border: 2px solid #D0CEFB;
  border-radius: 999px;
  padding: 1px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.color-swatches {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, border-color 0.12s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected {
  border-color: #333;
  transform: scale(1.2);
}

.profile-row-delete {
  flex-shrink: 0;
  background: #FFF0F0;
  border: 2px solid #FFCDD2;
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 14px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
}

.btn-add-profile {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--purple);
  background: #F5EDFF;
  border: 2.5px dashed var(--purple);
  border-radius: var(--radius-md);
  padding: 14px;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-add-profile:active { background: #EDE0FF; }

.btn-done {
  font-family: 'Baloo 2', cursive;
  font-size: 22px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  border: none;
  border-radius: 999px;
  padding: 16px;
  width: 100%;
  box-shadow: 0 6px 0 #2E9E6E, 0 10px 20px rgba(107,203,119,0.35);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-done:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #2E9E6E;
}

/* Preview modal */
.preview-sheet {
  background: white;
  border-radius: 28px 28px 0 0;
  padding: 1rem 1.25rem;
  width: 100%;
  height: 95vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: sheet-up 0.3s ease;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  overflow: hidden;
}

.preview-img-wrap {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: #F5F5F5;
  border: 3px solid #F0E8FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.preview-desc {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-mid);
  text-align: center;
  font-style: italic;
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.btn-print, .btn-download {
  flex: 1;
  font-family: 'Baloo 2', cursive;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 12px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-print {
  background: linear-gradient(135deg, var(--blue), #5E97FF);
  color: white;
  box-shadow: 0 6px 0 #1E6FC9, 0 10px 20px rgba(77,150,255,0.35);
}
.btn-print:active { transform: translateY(3px); box-shadow: 0 3px 0 #1E6FC9; }

.btn-download {
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: white;
  box-shadow: 0 6px 0 #2E9E50, 0 10px 20px rgba(107,203,119,0.35);
}
.btn-download:active { transform: translateY(3px); box-shadow: 0 3px 0 #2E9E50; }

.btn-close-preview {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-light);
  background: #F5F5F5;
  border: none;
  border-radius: 999px;
  padding: 14px;
  width: 100%;
  cursor: pointer;
}

/* ==================
   COLORS FOR AVATARS
   ================== */

.avatar-pink   { background: #FFE5F0; color: #C94878; }
.avatar-blue   { background: #E5F0FF; color: #1A65C9; }
.avatar-green  { background: #E5FFE8; color: #2E7D32; }
.avatar-orange { background: #FFF3E0; color: #C96500; }
.avatar-purple { background: #F3E5FF; color: #7B1FA2; }
.avatar-teal   { background: #E0FFF9; color: #00796B; }

/* ==================
   AUTH SCREEN
   ================== */

#authScreen {
  background: linear-gradient(145deg, #FFE5F0 0%, #FFF5D6 50%, #E5F5FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.auth-icon {
  font-size: 64px;
  animation: bounce 2s ease-in-out infinite;
  margin-bottom: 0.25rem;
}

.auth-sub {
  font-size: 16px;
  color: var(--text-mid);
  font-weight: 600;
  margin: 0.5rem 0 2rem;
  text-align: center;
}

.auth-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 999px;
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-google {
  background: white;
  color: var(--text-dark);
  box-shadow: 0 4px 0 #CCC, 0 8px 20px rgba(0,0,0,0.1);
}
.btn-google:active { transform: translateY(2px); box-shadow: 0 2px 0 #CCC; }

.btn-apple {
  background: #111;
  color: white;
  box-shadow: 0 4px 0 #000, 0 8px 20px rgba(0,0,0,0.25);
}
.btn-apple:active { transform: translateY(2px); box-shadow: 0 2px 0 #000; }

.social-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: #E8E8E8;
  border-radius: 999px;
}

.auth-email-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-input {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
  border: 3px solid #F0E8FF;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  width: 100%;
  background: white;
  outline: none;
  transition: border-color 0.2s;
  box-shadow: var(--shadow-card);
}
.auth-input:focus { border-color: var(--purple); }
.auth-input::placeholder { color: #CCC; }

.btn-email-submit {
  font-family: 'Baloo 2', cursive;
  font-size: 20px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border: none;
  border-radius: 999px;
  padding: 15px;
  width: 100%;
  box-shadow: 0 6px 0 #8B4DC9, 0 10px 20px rgba(199,125,255,0.35);
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-email-submit:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #8B4DC9;
}

.auth-magic-hint {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 2px;
}

.auth-error {
  background: #FFF0F0;
  border: 2px solid #FFCDD2;
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  text-align: center;
}

.auth-success {
  background: #F0FFF4;
  border: 2px solid #A5D6A7;
  border-radius: var(--radius-sm);
  color: #2E7D32;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  text-align: center;
}

.auth-toggle {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
  text-align: center;
  margin-top: 4px;
}

.auth-link {
  background: none;
  border: none;
  color: var(--purple);
  font-weight: 800;
  font-size: 14px;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Sign out button in settings */
.btn-signout {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--red);
  background: #FFF0F0;
  border: 2px solid #FFCDD2;
  border-radius: 999px;
  padding: 14px;
  width: 100%;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s;
}
.btn-signout:active { background: #FFE0E0; }

/* ==================
   RESPONSIVE CHIPS
   ================== */

@media (max-width: 480px) {
  .profile-chip .chip-name {
    display: none;
  }
  .profile-chip {
    padding: 8px;
  }
}

/* ==================
   UTILITY
   ================== */

.hidden { display: none !important; }

/* iOS notch support */
@supports (padding-top: env(safe-area-inset-top)) {
  .main-header { padding-top: calc(env(safe-area-inset-top) + 4px); }
}
