/* Study Planner — challenges, side quests, Memory Wall. */
.ch { display: grid; gap: 14px; }
.ch-tabs { position: static; max-width: 560px; }

/* page banner */
.ch-banner {
  position: relative; overflow: hidden; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  min-height: 230px; padding: 22px 0 0 20px; border-radius: 26px; color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c3) 75%, transparent) 0, transparent 55%),
    radial-gradient(90% 120% at 0% 100%, color-mix(in srgb, var(--c2) 85%, transparent) 0, transparent 60%),
    linear-gradient(135deg, var(--c1), color-mix(in srgb, var(--c1) 55%, var(--c2)));
  box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--c1) 80%, transparent);
}
.ch-banner::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .18;
  background-image: radial-gradient(#fff 1.2px, transparent 1.6px); background-size: 18px 18px;
}
.ch-banner-text { display: grid; gap: 8px; align-content: start; padding-bottom: 20px; position: relative; z-index: 2; }
.ch-kicker { margin: 0; font-family: var(--font-hand); font-size: 1.35rem; opacity: .9; }
.ch-title { margin: 0; font-family: var(--font-head); font-weight: var(--head-weight); font-size: clamp(1.8rem, 6vw, 3.1rem); line-height: .98; letter-spacing: -.01em; }
.ch-lead { margin: 0; max-width: 40ch; font-size: .92rem; opacity: .88; }
.ch-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ch-stats span { display: grid; padding: 7px 12px; border-radius: 14px; background: rgba(255, 255, 255, .16); backdrop-filter: blur(6px); font-size: .72rem; font-weight: 600; line-height: 1.2; }
.ch-stats b { font-family: var(--font-head); font-size: 1.35rem; line-height: 1.1; }
.ch-stats small { font-size: .7em; opacity: .75; }
.ch-banner-char { position: relative; z-index: 1; width: clamp(120px, 30vw, 230px); height: auto; align-self: end; margin-right: 6px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35)); }
.ch-st { position: absolute; z-index: 1; width: 64px; height: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); pointer-events: none; }
.st-1 { top: 10px; right: 30%; transform: rotate(-12deg); }
.st-2 { top: 18px; right: 12px; width: 54px; transform: rotate(10deg); }
.st-3 { bottom: 16px; right: calc(clamp(120px, 30vw, 230px) - 10px); width: 58px; transform: rotate(-8deg); }
.st-4 { top: 46%; right: 36%; width: 44px; transform: rotate(14deg); opacity: .9; }
@media (max-width: 560px) {
  .ch-banner { padding-left: 16px; min-height: 0; }
  .st-1, .st-4 { display: none; }
  .ch-stats span { padding: 6px 9px; }
  .ch-stats b { font-size: 1.1rem; }
  .ch-lead { display: none; }
}
@media (min-width: 900px) { .ch-banner { min-height: 280px; padding: 30px 0 0 34px; } .ch-banner-text { padding-bottom: 30px; } }

.ch-intro { display: grid; gap: 8px; }
.ch-intro p { margin: 0; }
.ch-cat > summary { flex-wrap: wrap; row-gap: 8px; }
.ch-cat .chapter-name { display: grid; }
.ch-cat-bar { order: 10; flex-basis: 100%; height: 5px; }
@media (min-width: 900px) {
  .ch-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (min-width: 1250px) { .ch-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ch-body { display: grid; gap: 12px; }
.ch-hero { position: relative; display: grid; gap: 8px; padding-top: 20px; }
.ch-hero .hand { font-size: 1.4rem; margin: 0; }
.ch-count { display: flex; align-items: baseline; gap: 8px; }
.ch-count b { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 2.6rem; line-height: 1; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border-radius: 999px; background: var(--surface); border: 1px dashed var(--line-strong); font-size: 1rem; filter: grayscale(1); opacity: .55; }
.badge small { font-size: .68rem; font-weight: 700; }
.badge.is-on { filter: none; opacity: 1; border-style: solid; border-color: #D9A441; background: #FBF0D2; color: #4A3505; }
.ch-cats { display: grid; gap: 8px; }
.ch-emoji { font-size: 1.3rem; }
.ch-items { list-style: none; margin: 0; padding: 0 8px 8px; display: grid; gap: 4px; }
.ch-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 8px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.ch-item:hover { background: var(--line); }
.ch-check { width: 24px; height: 24px; flex: none; border-radius: 7px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.ch-item.is-done .ch-check { background: #3F9B62; border-color: #3F9B62; color: #fff; }
.ch-item.is-done .ch-text { color: var(--muted); }
.ch-text { flex: 1; min-width: 0; }
.ch-thumb { width: 38px; height: 38px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.ch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.size { flex: none; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.size-S { background: #E3EEDC; color: #2C5530; }
.size-M { background: #E0E8F6; color: #26407A; }
.size-L { background: #F6E3A8; color: #4A3505; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); font-size: .7rem; font-weight: 600; white-space: nowrap; }
.tag--warn { background: #FBE3D6; color: #7A3410; }
.parents-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: #FBE3D6; color: #5E2A0C; font-size: .9rem; }

/* side quest */
.quest-card { display: grid; gap: 8px; padding: 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); transform: rotate(-.6deg); }
.quest-card.is-done { background: #E3EEDC; }
.quest-num { font-family: var(--font-hand); font-size: 1.1rem; color: var(--muted); }
.quest-text { margin: 0; font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.2rem; line-height: 1.3; }
.quest-empty { margin: 8px 0; font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.4rem; text-align: center; }
.side-all { padding: 0; }

/* memory wall */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 42vw), 1fr)); gap: 22px 16px; padding: 10px 4px; }
.polaroid { position: relative; margin: 0; padding: 10px 10px 12px; background: #fff; color: #222; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 10px 22px -12px rgba(0, 0, 0, .35); transform: rotate(var(--tilt)); }
.polaroid .tape { top: -12px; width: 70px; }
.polaroid-img { aspect-ratio: 1; background: #EEE9DF; display: grid; place-items: center; overflow: hidden; }
.polaroid-img img { width: 100%; height: 100%; object-fit: cover; }
.polaroid-emoji { font-size: 3rem; }
.polaroid figcaption { display: grid; gap: 3px; margin-top: 8px; font-size: .82rem; line-height: 1.3; }
.polaroid-note { font-family: var(--font-hand); font-size: 1.1rem; color: #444; }
.polaroid-date { font-family: var(--font-hand); font-size: 1rem; color: #888; }

/* share sheet */
.share-preview { display: grid; place-items: center; min-height: 200px; }
.share-preview img { width: min(100%, 300px); aspect-ratio: 9 / 16; border-radius: 16px; box-shadow: var(--shadow); }
.share-actions { display: grid; gap: 8px; margin-top: 14px; }
.ig-tip { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: .9rem; }
.ig-tip ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.hero-invite { margin: 6px 0 4px; }
.polaroid { cursor: pointer; }

/* referral */
.ref-progress { display: grid; gap: 6px; margin: 4px 0 10px; padding: 12px; border-radius: 14px; background: var(--surface); }
.ref-progress p { margin: 0; }
.ref-count { display: flex; align-items: baseline; gap: 6px; }
.ref-count b { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 2rem; line-height: 1; }
.ref-progress .bar { height: 10px; }
.ref-claim { margin-bottom: 10px; background: #3F9B62; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.consent input { width: 20px; height: 20px; accent-color: var(--c1); flex: none; margin-top: 2px; }
.ref-total { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px dashed var(--line-strong); }
.ref-total b { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 2rem; line-height: 1.1; color: #2F7A4A; }
.ref-count b { font-size: 1.5rem; }
.ref-history { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: .85rem; }
.ref-history li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.ref-history .ok { color: #2F7A4A; font-weight: 600; }
.ref-history .wait { color: #9A6A10; font-weight: 600; }
.ref-acct { margin: 0 0 8px; }
.linkish { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.ref-history .bad, p.bad { color: #A33A2B; font-weight: 600; }
.input--iban { font-variant-numeric: tabular-nums; letter-spacing: .04em; text-transform: uppercase; }
.iban-hint { margin-top: -6px; }
.card--ink .quest-card.is-done { background: #2F7A4A; }

/* side quest draw: cards shuffle, the picked one flips in */
.quest-slot { min-height: 140px; display: grid; align-items: center; perspective: 900px; }
.deck { position: relative; height: 150px; }
.deck i {
  position: absolute; left: 50%; top: 50%; width: 110px; height: 150px; margin: -75px 0 0 -55px; border-radius: 14px;
  background: repeating-linear-gradient(45deg, var(--c3) 0 8px, color-mix(in srgb, var(--c3) 70%, #fff) 8px 16px);
  border: 4px solid #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .3); animation: shuffle .6s ease-in-out 2;
}
.deck i:nth-child(1) { --dx: -90px; --rt: -14deg; }
.deck i:nth-child(2) { --dx: -30px; --rt: -5deg; animation-delay: .08s; }
.deck i:nth-child(3) { --dx: 30px; --rt: 5deg; animation-delay: .16s; }
.deck i:nth-child(4) { --dx: 90px; --rt: 14deg; animation-delay: .24s; }
@keyframes shuffle {
  0%, 100% { transform: translateX(0) rotate(0); }
  35% { transform: translateX(var(--dx)) translateY(-14px) rotate(var(--rt)); }
  70% { transform: translateX(calc(var(--dx) * -.5)) rotate(calc(var(--rt) * -1)); }
}
.quest-card.flip-in { animation: flip-in .55s cubic-bezier(.2, .9, .3, 1.2); transform-origin: 50% 50%; }
@keyframes flip-in { from { transform: rotateY(90deg) scale(.9); opacity: .4; } to { transform: rotateY(0) rotate(-.6deg); opacity: 1; } }

/* confetti + coins */
.celebrate { position: fixed; left: 50%; top: 55%; z-index: 200; pointer-events: none; }
.celebrate i { position: absolute; width: 9px; height: 14px; border-radius: 2px; opacity: 0; animation: confetti 1.4s cubic-bezier(.15, .7, .4, 1) var(--d) forwards; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 260px)) rotate(var(--r)); }
}
.celebrate b {
  position: absolute; left: 0; top: 0; transform: translate(-50%, 0); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 16px; border-radius: 999px; background: #FFE9A6; color: #4A3505; font: 800 1.3rem var(--font-body);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25); animation: coin-up 1.5s ease-out forwards;
}
@keyframes coin-up { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -120px) scale(1); } }
.wall-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.wall-head p { margin: 0; }
.share-boards { justify-content: center; margin-top: 12px; }
