/* Elemenop Kids — core styles: shell, home, dialogs, gallery, settings */

@font-face {
  font-family: 'Fredoka';
  src: url(../fonts/fredoka-latin.woff2) format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --font: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  --ink: #2b2d42;
  --ink-soft: #5c5f7a;
  --ink-faint: #8e90a8;
  --card: #ffffff;
  --line: #e7e3f5;
  --bg-a: #dff1ff;
  --bg-b: #f3e8ff;
  --bg-c: #ffe9f3;
  --purple: #7c4dff; --purple-d: #5b34d6;
  --pink: #ff4f9a; --pink-d: #d6307a;
  --orange: #ff8a1c; --orange-d: #d86a00;
  --yellow: #ffc61a; --yellow-d: #d9a000;
  --green: #22b573; --green-d: #178a56;
  --teal: #12b5cb; --teal-d: #0b8c9e;
  --blue: #3a86ff; --blue-d: #1f63d6;
  --red: #ff5a5f; --red-d: #d63b40;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 4px 0 rgba(43, 45, 66, 0.08), 0 10px 28px rgba(80, 60, 160, 0.10);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --appbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; background: #f3e8ff; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 55%, var(--bg-c) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
a { color: var(--purple-d); }
[hidden] { display: none !important; }
:focus-visible { outline: 4px solid rgba(124, 77, 255, 0.55); outline-offset: 2px; border-radius: 12px; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 14px; border-radius: 12px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── App bar ─────────────────────────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(14px + var(--safe-right)) 0 calc(14px + var(--safe-left));
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2px 0 rgba(124, 77, 255, 0.08);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.logo-mark img { width: 40px; height: 40px; border-radius: 12px; display: block; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08); }
.logo-word { font-weight: 700; font-size: 1.45rem; letter-spacing: 0.3px; white-space: nowrap; }
.logo-word b { color: var(--c); font-weight: 700; }
.logo-kids { background: var(--ink); color: #fff; font-weight: 600; font-size: 0.85rem; border-radius: 999px; padding: 2px 10px; }
.appbar-title { flex: 1; min-width: 0; margin: 0; font-size: 1.25rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar.sub .logo { display: none; }
.appbar:not(.sub) .appbar-title { visibility: hidden; }
.appbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 48px; height: 48px; flex: 0 0 48px;
  border: 0; border-radius: 16px; background: #fff; color: var(--ink);
  font-size: 1.35rem; font-family: var(--emoji), var(--font); text-decoration: none;
  box-shadow: 0 3px 0 rgba(43, 45, 66, 0.1);
  transition: transform 0.08s;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(43, 45, 66, 0.1); }
.back-btn { font-family: var(--font); font-weight: 700; font-size: 1.5rem; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #fff; font: 700 0.75rem/22px var(--font); text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.star-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 14px;
  border-radius: 999px; background: #fff7d6; color: #7a5600; text-decoration: none; font-weight: 600;
  box-shadow: 0 3px 0 rgba(217, 160, 0, 0.25); font-size: 1.05rem;
}
.star-pill span { font-family: var(--emoji); }
.star-pill.bump { animation: bump 0.5s; }
@keyframes bump { 30% { transform: scale(1.25); } 60% { transform: scale(0.95); } }
@media (max-width: 520px) {
  .logo-word { font-size: 1.15rem; }
  .logo-kids { display: none; }
  .appbar { gap: 6px; padding-left: calc(10px + var(--safe-left)); padding-right: calc(10px + var(--safe-right)); }
  .appbar-actions { gap: 6px; }
  .icon-btn { width: 44px; height: 44px; flex-basis: 44px; }
  .star-pill { padding: 0 10px; }
}
@media (max-width: 380px) { .logo-word { display: none; } }

body.immersive .appbar { display: none; }
body.immersive { overflow: hidden; }

main { outline: none; padding-bottom: calc(40px + var(--safe-bottom)); }
#view:focus, #view:focus-visible { outline: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 18px calc(16px + var(--safe-right)) 24px calc(16px + var(--safe-left)); }
.page-narrow { max-width: 760px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border: 0; border-radius: 18px;
  background: #fff; color: var(--ink); font-weight: 600; font-size: 1.05rem; text-decoration: none;
  box-shadow: 0 4px 0 rgba(43, 45, 66, 0.13);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(43, 45, 66, 0.13); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.primary { background: var(--purple); color: #fff; box-shadow: 0 4px 0 var(--purple-d); }
.btn.pink { background: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-d); }
.btn.green { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-d); }
.btn.orange { background: var(--orange); color: #fff; box-shadow: 0 4px 0 var(--orange-d); }
.btn.blue { background: var(--blue); color: #fff; box-shadow: 0 4px 0 var(--blue-d); }
.btn.red { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-d); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-soft); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 0.95rem; border-radius: 14px; }
.btn.big { min-height: 64px; font-size: 1.25rem; padding: 12px 28px; border-radius: 22px; }
.btn .e { font-family: var(--emoji); font-size: 1.2em; line-height: 1; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.center { justify-content: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 16px;
  border: 0; border-radius: 999px; background: #fff; color: var(--ink-soft); font-weight: 500;
  box-shadow: 0 3px 0 rgba(43, 45, 66, 0.08); white-space: nowrap; text-decoration: none;
}
.chip .e { font-family: var(--emoji); }
.chip.on { background: var(--ink); color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

/* ── Home ────────────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: stretch; margin-bottom: 8px; }
.hello { display: flex; align-items: center; gap: 16px; padding: 20px 22px; }
.hello-avatar {
  flex: 0 0 auto; width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center;
  font: 3rem/1 var(--emoji); background: linear-gradient(135deg, #fff1b8, #ffd6ec); border: 0; box-shadow: 0 4px 0 rgba(43, 45, 66, 0.1);
}
.hello h2 { margin: 0; font-size: 1.7rem; font-weight: 600; line-height: 1.15; }
.hello p { margin: 4px 0 0; color: var(--ink-soft); }
.challenge {
  position: relative; overflow: hidden; display: flex; gap: 16px; align-items: center;
  padding: 20px 22px; color: #fff; text-decoration: none;
  background: linear-gradient(120deg, #7c4dff 0%, #b14dff 50%, #ff4f9a 100%);
  border-radius: var(--radius); box-shadow: 0 5px 0 #5b34d6, 0 12px 30px rgba(124, 77, 255, 0.3);
}
.challenge::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.challenge-emoji { flex: 0 0 auto; width: 84px; height: 84px; display: grid; place-items: center; font: 3.1rem/1 var(--emoji); background: rgba(255, 255, 255, 0.2); border-radius: 26px; }
.challenge small { display: block; text-transform: uppercase; letter-spacing: 1.5px; font-size: 0.8rem; opacity: 0.85; font-weight: 600; }
.challenge b { display: block; font-size: 1.25rem; font-weight: 600; line-height: 1.25; margin: 2px 0 8px; }
.challenge .go { display: inline-block; background: #fff; color: var(--purple-d); border-radius: 14px; padding: 6px 14px; font-weight: 600; font-size: 0.95rem; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hello h2 { font-size: 1.45rem; } .hello-avatar { width: 70px; height: 70px; font-size: 2.5rem; } }

.banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin: 14px 0 4px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
}
.banner .e { font: 2rem/1 var(--emoji); }
.banner p { margin: 0; flex: 1; min-width: 0; }
.banner p b { display: block; }
.banner p span { color: var(--ink-soft); font-size: 0.95rem; }
@media (max-width: 560px) { .banner { flex-wrap: wrap; } .banner .btn-row { width: 100%; } .banner .btn-row .btn { flex: 1; } }

.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 4px 12px; font-size: 1.45rem; font-weight: 600; }
.section-title .e { font-family: var(--emoji); }
.section-title small { margin-left: auto; font-size: 0.95rem; font-weight: 500; color: var(--ink-soft); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  min-height: 150px; padding: 16px; border-radius: 26px; text-decoration: none; color: #fff; overflow: hidden;
  background: var(--c, var(--purple)); box-shadow: 0 6px 0 var(--cd, var(--purple-d));
  transition: transform 0.1s, box-shadow 0.1s;
}
.tile::before { content: ''; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--cd, var(--purple-d)); }
.tile-emoji { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.95); font: 2.3rem/1 var(--emoji); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1); }
.tile b { font-size: 1.2rem; font-weight: 600; line-height: 1.15; display: block; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); }
.tile span.sub { font-size: 0.88rem; opacity: 0.95; display: block; line-height: 1.25; margin-top: 2px; }
.tile.dark { color: var(--ink); }
.tile.dark b { text-shadow: none; }
.tile .tag { position: absolute; top: 12px; right: 12px; background: rgba(255, 255, 255, 0.9); color: var(--ink); font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
@media (max-width: 430px) { .tiles { grid-template-columns: 1fr 1fr; gap: 12px; } .tile { min-height: 138px; padding: 14px; } .tile-emoji { width: 56px; height: 56px; font-size: 2rem; } .tile b { font-size: 1.08rem; } }

.progress { height: 14px; border-radius: 999px; background: #efeaff; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffc61a, #ff8a1c); transition: width 0.5s; }

.home-foot { margin: 34px 0 10px; text-align: center; color: var(--ink-soft); font-size: 0.95rem; }
.home-foot a { color: var(--ink-soft); }

/* ── Dialogs ─────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(43, 45, 66, 0.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.18s;
}
.modal.out { animation: fadeOut 0.2s forwards; }
.modal-card {
  position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: #fff; border-radius: 28px; padding: 26px 22px 22px; text-align: center;
  box-shadow: 0 8px 0 rgba(43, 45, 66, 0.12), 0 30px 80px rgba(43, 45, 66, 0.3); animation: popIn 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.modal-card.wide { width: min(720px, 100%); }
.modal-x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 14px; background: #f3f0fb; font-size: 1.1rem; color: var(--ink-soft); }
.modal-emoji { font: 3.4rem/1 var(--emoji); margin-bottom: 6px; }
.modal-title { margin: 0 0 6px; font-size: 1.5rem; font-weight: 600; }
.modal-text { margin: 0 0 8px; color: var(--ink-soft); }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.modal-actions .btn { flex: 1 1 140px; }
.modal-card label.field { display: block; text-align: left; font-weight: 600; margin: 14px 0 6px; }
.modal-card .hint { text-align: left; font-size: 0.9rem; color: var(--ink-soft); margin: 4px 0 0; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } }

input.text, textarea.text, select.text {
  width: 100%; min-height: 52px; padding: 10px 16px; border: 3px solid var(--line); border-radius: 16px; background: #fff; font-size: 1.1rem;
}
input.text:focus, textarea.text:focus, select.text:focus { outline: none; border-color: var(--purple); }

/* Grown-up check */
.gate-q { font-size: 1.3rem; font-weight: 600; margin: 10px 0 6px; }
.gate-display { font-size: 2rem; font-weight: 700; letter-spacing: 4px; min-height: 52px; border-radius: 16px; background: #f5f2ff; display: grid; place-items: center; margin: 8px auto; width: 160px; }
.gate-msg { min-height: 1.4em; margin: 0 0 6px; color: var(--red-d); font-weight: 500; }
.gate-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 280px; margin: 0 auto; }
.gate-key { min-height: 56px; border: 0; border-radius: 16px; background: #f1edff; font-size: 1.4rem; font-weight: 600; box-shadow: 0 3px 0 rgba(124, 77, 255, 0.2); }
.gate-key:active { transform: translateY(2px); box-shadow: none; }
.gate-key.ok { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); }

/* Toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(18px + var(--safe-bottom)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 520px; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); font-weight: 500; animation: toastIn 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.toast.out { animation: fadeOut 0.3s forwards; }
.toast-emoji { font: 1.5rem/1 var(--emoji); }
@keyframes toastIn { from { transform: translateY(20px) scale(0.9); opacity: 0; } }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* Celebration */
.celebrate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(124, 77, 255, 0.35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn 0.2s; }
.celebrate.out { animation: fadeOut 0.2s forwards; }
.celebrate-card { width: min(440px, 100%); background: #fff; border-radius: 32px; padding: 28px 22px 22px; text-align: center; box-shadow: 0 10px 0 rgba(91, 52, 214, 0.25); animation: popIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.celebrate-emoji { font: 4.5rem/1 var(--emoji); animation: wiggle 1.2s ease-in-out infinite; }
.celebrate h2 { margin: 8px 0 4px; font-size: 2rem; font-weight: 700; color: var(--purple-d); }
.celebrate p { margin: 0; color: var(--ink-soft); font-size: 1.1rem; }
.celebrate-stars { display: flex; justify-content: center; gap: 6px; margin: 14px 0 2px; font: 2.6rem/1 var(--emoji); }
.celebrate-stars span { animation: starPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.celebrate-earned { font-weight: 600; color: #b37b00 !important; }
.celebrate-actions { display: flex; gap: 10px; margin-top: 20px; }
.celebrate-actions .btn { flex: 1; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.05); } }

/* Empty + loading */
.empty { text-align: center; padding: 40px 16px; color: var(--ink-soft); }
.empty-emoji { font: 4rem/1 var(--emoji); margin-bottom: 8px; }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 1.4rem; font-weight: 600; }
.empty p { margin: 0 0 16px; }
.spinner-wrap { display: grid; place-items: center; gap: 10px; padding: 70px 16px; color: var(--ink-soft); }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 7px solid #e8e0ff; border-top-color: var(--purple); border-right-color: var(--pink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Picker (coloring pages) ─────────────────────────────────────── */
.picker-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.picker-head h2 { margin: 0; font-size: 1.6rem; font-weight: 600; flex: 1; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.page-card {
  position: relative; display: flex; flex-direction: column; border: 0; padding: 10px; border-radius: 22px; background: #fff;
  box-shadow: 0 4px 0 rgba(43, 45, 66, 0.08); text-decoration: none; color: var(--ink); text-align: center; transition: transform 0.1s;
}
.page-card:active { transform: translateY(3px); }
.page-card .thumb { aspect-ratio: 1; border-radius: 14px; background: #fff; overflow: hidden; display: grid; place-items: center; border: 2px solid #f1eef9; }
.page-card .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.page-card .thumb .big { font: 3.5rem/1 var(--emoji); }
.page-card b { display: block; font-weight: 500; font-size: 1rem; margin-top: 8px; line-height: 1.2; }
.page-card .draft-tag { position: absolute; top: 14px; left: 14px; background: var(--yellow); color: #5c3f00; font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; }
.page-card.special { background: linear-gradient(135deg, #fff, #f6f0ff); }
@media (max-width: 430px) { .pages { grid-template-columns: 1fr 1fr; gap: 10px; } }
.book { margin: 0 0 24px; }
.book-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin: 0 4px 10px; }
.book-head h3 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.book-head small { color: var(--ink-soft); }
.name-maker { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 16px; }
.name-maker input { flex: 1 1 220px; }

/* ── Gallery ─────────────────────────────────────────────────────── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.art-card { border: 0; padding: 0; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; transition: transform 0.12s; color: var(--ink); }
.art-card:hover { transform: translateY(-2px) rotate(-0.4deg); }
.art-card .frame { aspect-ratio: 1; background: #fff; border-bottom: 1px solid #f0edf8; }
.art-card .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-card .info { padding: 10px 12px 12px; display: flex; align-items: center; gap: 8px; }
.art-card .info div { flex: 1; min-width: 0; }
.art-card .info b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-card .info small { display: block; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-card .hearts { font-weight: 600; color: var(--pink-d); white-space: nowrap; }
.art-card .status { position: absolute; margin: 10px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1); }
.art-card .ribbon { position: absolute; margin: 10px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--yellow); color: #5c3f00; }
.art-card { position: relative; }
@media (max-width: 430px) { .gallery-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .art-card .info { padding: 8px 10px 10px; } }

.viewer { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: rgba(26, 22, 48, 0.98); color: #fff; animation: fadeIn 0.2s; padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
.viewer-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.viewer-top .icon-btn { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: none; }
.viewer-top .grow { flex: 1; min-width: 0; }
.viewer-top b { display: block; font-size: 1.2rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-top small { opacity: 0.8; }
.viewer-img { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 16px 26px; container-type: size; }
.viewer-img img { position: absolute; inset: 16px 26px; width: calc(100% - 52px); height: calc(100% - 32px); object-fit: contain; border-radius: 18px; }
@supports (width: 1cqmin) {
  .viewer-img img { position: static; width: 100cqmin; height: 100cqmin; object-fit: cover; background: #fff; box-shadow: 0 0 0 10px #ffd23f, 0 20px 60px rgba(0, 0, 0, 0.5); }
}
.viewer-bar { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 14px 14px 18px; }
.heart-btn.on { background: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-d); }
.heart-btn.burst .e { animation: bump 0.5s; }
.report-link { background: none; border: 0; color: rgba(255, 255, 255, 0.6); font-size: 0.9rem; text-decoration: underline; padding: 10px; }

/* ── Lists (inbox, settings) ─────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: #fff; border-radius: 20px; box-shadow: 0 3px 0 rgba(43, 45, 66, 0.06); text-decoration: none; color: var(--ink); border: 0; text-align: left; width: 100%; }
.list-item .e { flex: 0 0 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font: 1.6rem/1 var(--emoji); background: #f4f0ff; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { display: block; font-weight: 600; }
.list-item p { margin: 2px 0 0; color: var(--ink-soft); }
.list-item small { color: var(--ink-faint); }
.list-item.unread { box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.35), 0 3px 0 rgba(43, 45, 66, 0.06); }

.settings-group { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 18px; margin-bottom: 16px; }
.settings-group h3 { margin: 14px 0 4px; font-size: 1.15rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.setting { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid #f0edf8; }
.setting:last-child { border-bottom: 0; }
.setting .grow { flex: 1; min-width: 0; }
.setting b { display: block; font-weight: 500; }
.setting p { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.toggle { position: relative; flex: 0 0 64px; width: 64px; height: 38px; border: 0; border-radius: 999px; background: #dcd6ee; transition: background 0.2s; }
.toggle::after { content: ''; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.toggle[aria-checked='true'] { background: var(--green); }
.toggle[aria-checked='true']::after { transform: translateX(26px); }
.checks { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.checks label { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.checks input { width: 24px; height: 24px; accent-color: var(--purple); }
.status-pill { display: inline-block; font-size: 0.8rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; background: #f0edfb; color: var(--ink-soft); }
.status-pill.on { background: #dff5ea; color: #136b43; }
.status-pill.warn { background: #fff2cc; color: #7a5600; }

.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; margin-top: 10px; }
.avatars button { aspect-ratio: 1; border: 3px solid transparent; border-radius: 20px; background: #f6f2ff; font: 2.2rem/1 var(--emoji); }
.avatars button.on { border-color: var(--purple); background: #ece4ff; }

/* ── Sticker book ────────────────────────────────────────────────── */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pack { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.pack h3 { margin: 0 0 8px; font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.pack .stickers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; font: 2rem/1 var(--emoji); text-align: center; }
.pack .stickers span { aspect-ratio: 1; display: grid; place-items: center; background: #faf8ff; border-radius: 12px; }
.pack.locked .stickers span { filter: grayscale(1) blur(1px); opacity: 0.35; }
.star-total { display: flex; align-items: center; gap: 16px; padding: 20px; margin-bottom: 16px; }
.star-total .big { font: 3.5rem/1 var(--emoji); }
.star-total b { font-size: 2rem; display: block; line-height: 1.1; }

/* ── Print: only the picture ─────────────────────────────────────── */
#print-area { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area img { width: 100%; max-height: 95vh; object-fit: contain; }
}

.noscript { max-width: 520px; margin: 80px auto; text-align: center; background: #fff; padding: 30px; border-radius: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
