:root {
  --ink: #3b2a5a;
  --accent: #ff6fa8;
  --bg1: #ffe4f1;
  --bg2: #e4dcff;
  --card: #fffdf8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: "Fredoka", "Baloo 2", "Segoe UI", system-ui, sans-serif; font-weight: 500;
  background:
    radial-gradient(circle at 1px 1px, #ffffff99 1.4px, transparent 1.8px) 0 0 / 18px 18px,
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
}
a { color: inherit; }
#petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.petal { position: absolute; top: -30px; font-size: 18px; opacity: .8; animation: fall linear infinite; }
@keyframes fall { to { transform: translate3d(var(--dx, 60px), 110vh, 0) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .petal { display: none; } * { animation: none !important; transition: none !important; } }

header { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 14px 18px; max-width: 980px; margin: 0 auto; }
.brand { flex: 1; font-weight: 700; font-size: 1.25rem; letter-spacing: .3px; }
.brand span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-6deg); } }
main { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 4px 18px 70px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
  font: inherit; font-weight: 700; font-size: .95rem; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 8px 18px;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-1px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.pri { background: var(--accent); color: #fff; text-shadow: 1px 1px 0 #0003; }

h1 { font-size: clamp(1.7rem, 5vw, 2.5rem); line-height: 1.15; margin: 8px 0 4px; text-shadow: 3px 3px 0 #fff; }
.sub { margin: 0 0 20px; font-size: 1.1rem; opacity: .8; }
.crumbs { font-size: .9rem; opacity: .8; margin: 4px 0 2px; }
.crumbs a { text-decoration: none; font-weight: 700; }

/* ---------- login ---------- */
.login { text-align: center; padding-top: 6px; }
.mascot-row { display: flex; align-items: flex-end; justify-content: center; gap: 4px; flex-wrap: wrap; }
.mascot { width: 150px; height: 150px; animation: bob 3s ease-in-out infinite; }
.bubble {
  position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 26px; padding: 14px 22px; margin-bottom: 52px;
  font-weight: 700; font-size: clamp(1.2rem, 4.5vw, 1.8rem); box-shadow: 5px 5px 0 var(--ink); max-width: 420px;
}
.bubble::before { content: ""; position: absolute; left: -17px; bottom: 18px; width: 0; height: 0; border: 10px solid transparent; border-right: 14px solid var(--ink); }
.bubble::after { content: ""; position: absolute; left: -10px; bottom: 21px; width: 0; height: 0; border: 7px solid transparent; border-right: 11px solid #fff; }
.who { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; max-width: 640px; margin: 18px auto 0; }
.hero {
  position: relative; display: block; text-decoration: none; background: var(--card); border: 3px solid var(--ink); border-radius: 30px;
  padding: 20px 14px 18px; box-shadow: 7px 7px 0 var(--ink); transition: transform .15s, box-shadow .15s; overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0 0 55% 0; background: var(--c); opacity: .35; }
.hero:hover { transform: translate(-3px, -5px) rotate(-1deg); box-shadow: 10px 10px 0 var(--ink); }
.hero .av { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.hero .nm { position: relative; font-weight: 700; font-size: 1.8rem; margin-top: 2px; }
.hero .tag { position: relative; font-size: .95rem; opacity: .75; }
.hero .go { position: relative; display: inline-block; margin-top: 10px; background: var(--c); color: #fff; font-weight: 700; padding: 6px 18px; border: 3px solid var(--ink); border-radius: 999px; text-shadow: 1px 1px 0 #0003; }

/* ---------- child home ---------- */
.profile { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.profile .av { width: 96px; height: 96px; flex: none; }
.stars-total { display: inline-flex; align-items: center; gap: 6px; background: #fff7c2; border: 3px solid var(--ink); border-radius: 999px; padding: 4px 16px; font-weight: 700; box-shadow: 3px 3px 0 var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; margin-top: 14px; }
.card {
  position: relative; display: block; text-decoration: none; text-align: center; background: var(--card); border: 3px solid var(--ink); border-radius: 26px;
  padding: 22px 14px 18px; box-shadow: 6px 6px 0 var(--ink); transition: transform .15s, box-shadow .15s; overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 62% 0; background: var(--c); opacity: .4; }
.card:hover { transform: translate(-3px, -5px) rotate(-1deg); box-shadow: 9px 9px 0 var(--ink); }
.card .big { position: relative; font-size: 3.4rem; line-height: 1.1; filter: drop-shadow(2px 3px 0 #0002); }
.card .name { position: relative; font-weight: 700; font-size: 1.3rem; margin-top: 6px; }
.card .meta { position: relative; font-size: .9rem; opacity: .8; margin-top: 2px; }
.card .chip { position: absolute; top: 10px; right: 10px; z-index: 1; background: #fff7c2; border: 2px solid var(--ink); border-radius: 999px; padding: 1px 10px; font-size: .85rem; font-weight: 700; }

/* ---------- missions ---------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.row {
  display: flex; align-items: center; gap: 14px; text-decoration: none; background: var(--card); border: 3px solid var(--ink); border-radius: 22px;
  padding: 12px 16px; box-shadow: 5px 5px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.row:hover { transform: translate(-2px, -3px); box-shadow: 8px 8px 0 var(--ink); }
.row .date { flex: none; width: 66px; text-align: center; background: var(--c); color: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 4px 0; line-height: 1.05; text-shadow: 1px 1px 0 #0003; }
.row .date b { display: block; font-size: 1.6rem; }
.row .date small { font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.row .info { flex: 1; min-width: 0; }
.row .t { font-weight: 700; font-size: 1.1rem; }
.row .d { font-size: .85rem; opacity: .7; }
.row .st { font-size: 1.25rem; letter-spacing: 2px; white-space: nowrap; }
.row .st .off { filter: grayscale(1); opacity: .35; }
.row .go { flex: none; font-weight: 700; background: var(--accent); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 5px 14px; text-shadow: 1px 1px 0 #0003; }
@media (max-width: 520px) { .row .go { display: none; } .row .st { font-size: 1.05rem; } }
.empty { text-align: center; background: #ffffffcc; border: 3px dashed var(--ink); border-radius: 24px; padding: 30px 18px; font-weight: 600; }
.empty .em { display: block; font-size: 3rem; }

/* ---------- worksheet viewer ---------- */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.viewer { background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 7px 7px 0 var(--ink); overflow: hidden; }
.viewer iframe, .viewer embed { width: 100%; height: 80vh; border: 0; display: block; }
.viewer img { max-width: 100%; display: block; margin: 0 auto; }

/* ---------- twinkling "new" star ---------- */
.new-star { position: absolute; top: 8px; left: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 2px; pointer-events: none; }
.new-star i { font-style: normal; font-size: 1.9rem; line-height: 1; filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(1px 2px 0 #3b2a5a); animation: twinkle 1.3s ease-in-out infinite; }
.new-star b { font-size: .72rem; font-weight: 700; color: #fff; background: #ff4f8b; border: 2px solid var(--ink); border-radius: 999px; padding: 0 7px; transform: rotate(-6deg); text-shadow: 1px 1px 0 #0003; }
.new-star::before, .new-star::after { content: "✦"; position: absolute; color: #ffd84d; text-shadow: 0 0 4px #fff; animation: twinkle 1.3s ease-in-out infinite; }
.new-star::before { left: 24px; top: -4px; font-size: .8rem; animation-delay: -.4s; }
.new-star::after { left: -4px; top: 22px; font-size: .65rem; animation-delay: -.8s; }
@keyframes twinkle { 0%, 100% { transform: scale(.85) rotate(-10deg); opacity: .75; } 50% { transform: scale(1.2) rotate(12deg); opacity: 1; } }
.row .t .new-star { position: relative; top: auto; left: auto; display: inline-flex; vertical-align: middle; margin-left: 6px; }
.row .t .new-star i { font-size: 1.2rem; }
.row .t .new-star::before, .row .t .new-star::after { display: none; }
@media (prefers-reduced-motion: reduce) { .new-star i, .new-star::before, .new-star::after { animation: none !important; opacity: 1; } }

/* ---------- progress ---------- */
.prog { position: relative; margin: 10px auto 0; max-width: 190px; text-align: center; }
.prog .bar { height: 14px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.prog .bar i { display: block; height: 100%; border-radius: 999px; background: #ffb44d; transition: width .6s; }
.prog .ptxt { margin-top: 4px; font-size: .9rem; font-weight: 700; }
.prog.p0 .bar i { background: #c9c3d8; } .prog.p0 .ptxt { opacity: .7; }
.prog.pmid .bar i { background: repeating-linear-gradient(135deg, #ffb44d 0 10px, #ffc978 10px 20px); } .prog.pmid .ptxt { color: #b86a00; }
.prog.pall .bar { background: #d9ffe9; } .prog.pall .bar i { background: #38c98a; } .prog.pall .ptxt { color: #11805a; }
.prog.big { max-width: 420px; margin: 12px 0 0; text-align: left; }
.prog.big .bar { height: 20px; }
.card:has(.prog.pall) { background: #f1fff8; }
.card:has(.prog.pall)::before { background: #38c98a; opacity: .45; }
.row.done { background: #f1fff8; }
.row.done .date { background: #38c98a; }
.row.done .go { background: #38c98a; }
.row.tried .go { background: #ffb44d; }
