/* Chủ đề theo bé, thẻ sưu tập, đổi quà, phụ huynh, hình minh họa. */

body[data-theme="speed"] {
  --bg: #f3f5f8; --paper: #ffffff; --line: #dde3ea;
  --accent: #1f4e8c; --accent-soft: #e4ecf7; --hot: #e53935;
  background:
    repeating-linear-gradient(115deg, transparent 0 46px, rgba(31, 78, 140, .025) 46px 52px),
    var(--bg);
}
body[data-theme="cloud"] {
  --bg: #f2f8ff; --paper: #ffffff; --line: #dbe8f5;
  --accent: #4a9ad8; --accent-soft: #e3f1fc; --hot: #ff8fab;
  background:
    radial-gradient(circle at 12% 18%, #ffffff 0 40px, transparent 41px),
    radial-gradient(circle at 88% 8%, #ffffff 0 56px, transparent 57px),
    radial-gradient(circle at 70% 92%, #ffeef4 0 70px, transparent 71px),
    var(--bg);
  background-attachment: fixed;
}
body[data-theme="speed"] .topbar { background: rgba(243, 245, 248, .92); }
body[data-theme="cloud"] .topbar { background: rgba(242, 248, 255, .92); }
body[data-theme="cloud"] .card,
body[data-theme="cloud"] .btn,
body[data-theme="cloud"] .opt { border-radius: 18px; }

.kidbar { display: flex; gap: 6px; flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; min-height: 34px;
  border-radius: 99px; background: var(--paper); border: 1px solid var(--line);
  font-size: 15px; color: var(--ink); text-decoration: none;
}
.pill.kid { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

.hero {
  position: relative; overflow: hidden; border-radius: 18px; margin: 4px 0 18px;
  min-height: 112px; padding: 18px 20px; display: flex; align-items: center;
}
body[data-theme="speed"] .hero { background: linear-gradient(120deg, #1f4e8c, #2e6bb8 60%, #e53935); color: #fff; }
body[data-theme="cloud"] .hero { background: linear-gradient(120deg, #bfe1fb, #e3f1fc 55%, #ffe3ec); color: #2b4a66; }
.hero .decor { position: absolute; right: 0; bottom: 0; height: 100%; width: auto; opacity: .95; }
.hero-text { position: relative; max-width: 60%; }
.hero-hi { font-size: 24px; font-weight: 800; }

.kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 18px; }
.kid-card {
  border: 0; border-radius: 22px; padding: 22px; cursor: pointer; text-align: center;
  box-shadow: var(--shadow); font: inherit; color: var(--ink); touch-action: manipulation;
}
.kid-card.speed { background: linear-gradient(150deg, #e4ecf7, #c9d9ee); }
.kid-card.cloud { background: linear-gradient(150deg, #eaf6ff, #ffe3ec); }
.kid-art svg { width: 100%; max-width: 220px; height: 130px; }
.kid-name { font-size: 24px; font-weight: 800; margin-top: 6px; }

/* ── Thẻ sưu tập ─────────────────────────────────────────── */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.tcard {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px; padding: 10px 8px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08); border: 3px solid #fff; overflow: hidden;
}
.tcard.rare { border-color: #f2c230; box-shadow: 0 0 0 2px #f2c230, 0 4px 14px rgba(242, 194, 48, .45); }
.tcard.locked { background: repeating-linear-gradient(135deg, #eef0f3 0 10px, #e6e9ee 10px 20px); border-style: dashed; border-color: #cfd6de; }
.tc-art { flex: 1; width: 100%; min-height: 0; display: grid; place-items: center; font-size: 40px; color: #b7c0c9; font-weight: 800; }
.tc-art svg { width: 100%; height: auto; max-height: 100%; }
.tcard.photo .tc-art img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.tc-name { font-size: 13px; font-weight: 700; text-align: center; line-height: 1.25; }
/* Thẻ ảnh: land (ngang), tall (dọc), full (thẻ in sẵn khung, lấp lánh) */
.tgrid.land { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tgrid.full { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tcard.land { aspect-ratio: 16 / 11; padding: 6px 6px 5px; }
.tcard.tall { padding: 6px 6px 5px; }
.tcard .tc-art { position: relative; }
.tcard .tc-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; display: block; }
.tcard.tall .tc-name, .tcard.land .tc-name { color: #24313b; padding-top: 3px; }
.tcard.full { padding: 0; border-width: 0; background: #111; }
.tcard.full .tc-art { position: absolute; inset: 0; }
.tcard.full .tc-art img { object-fit: cover; border-radius: 0; }
.tcard.full .tc-rare { display: none; }
.tcard.full.rare { box-shadow: 0 0 0 3px #f2c230, 0 6px 22px rgba(242, 194, 48, .55); }
.tc-holo {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; opacity: .55;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 120, 220, .55) 42%, rgba(120, 220, 255, .6) 50%, rgba(255, 240, 140, .55) 58%, transparent 70%);
  background-size: 250% 250%; animation: holo 3.2s ease-in-out infinite;
}
@keyframes holo { 0% { background-position: 100% 100%; } 50% { background-position: 0% 0%; } 100% { background-position: 100% 100%; } }
@media (prefers-reduced-motion: reduce) { .tc-holo { animation: none; } }
.rw-card:has(.land) { width: 250px; }
.rw-card:has(.full) { width: 180px; }
.tc-rare { position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 800; background: #f2c230; color: #5a4208; padding: 1px 6px; border-radius: 99px; z-index: 1; }
.tc-count { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 800; background: rgba(0, 0, 0, .55); color: #fff; padding: 1px 6px; border-radius: 99px; }
.tc-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px; cursor: pointer; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 18px; min-width: 110px; }
.stat-n { font-size: 24px; font-weight: 800; }
.stat-l { font-size: 13px; color: var(--ink-3); }

/* ── Popup ───────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 36, .55); display: grid; place-items: center; padding: 20px; animation: fade .2s ease; }
.modal-box { background: var(--paper); border-radius: 20px; padding: 24px; width: min(520px, 100%); max-height: 90vh; overflow: auto; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.rw-title { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.rw-cards { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.rw-card { width: 150px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.rw-lines { text-align: left; margin: 14px auto 6px; max-width: 360px; padding-left: 20px; }
.rw-coins { font-size: 18px; margin-top: 8px; }
.pin-in { font-size: 28px; letter-spacing: .4em; text-align: center; width: 220px; min-height: 56px; border: 1.5px solid var(--line); border-radius: 12px; }
@keyframes pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Đổi quà ─────────────────────────────────────────────── */
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.shop-item { text-align: center; margin: 0; }
.shop-icon { font-size: 44px; }
.shop-name { font-weight: 700; margin: 4px 0; }
.shop-price { color: var(--ink-2); margin-bottom: 10px; }

/* ── Phụ huynh ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 15px; color: var(--ink-2); margin: 8px 0; }
.field input, .field select, .cat-row input {
  min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 17px;
}
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.kid-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.kid-coins { min-height: 46px; display: flex; align-items: center; font-weight: 700; margin-bottom: 8px; }
.kid-row .btn { margin-bottom: 8px; }
.cat-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.cat-icon { width: 60px; text-align: center; }
.cat-name { flex: 1; min-width: 0; }
.cat-price { width: 90px; }
.add-card { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ── Hình minh họa mẹo ───────────────────────────────────── */
.illus { margin: 14px 0; text-align: center; }
.illus svg { width: 100%; max-width: 520px; height: auto; }
.illus figcaption { font-size: 15px; color: var(--ink-2); margin: 6px auto 0; max-width: 560px; }

@media (max-width: 560px) {
  .kidbar .pill:not(.kid) { display: none; }
  .hero-text { max-width: 100%; }
  .hero .decor { opacity: .35; }
  .tgrid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
