/* Plant Organelle Scavenger Hunt
   House style shared with BLOOD and the GTAC Calm Classroom Builder:
   GTAC hero colours, Figtree, eggshell page, cobalt buttons, sodium-flame header rule. */
:root {
  --eggshell: #F9F6E7;
  --sodium-flame: #FF6D3A;
  --cadmium-yellow: #FFCD1F;
  --chlorophyll-green: #00BC74;
  --aquamarine: #6BE7BE;
  --lavender: #C0ADFF;
  --cobalt-blue: #4C34E5;
  --onyx: #272A24;
  --panel: #FFFFFF;
  --line: rgba(39, 42, 36, 0.12);
  --touch: 48px;
  --leaf: #2f8f4e;
  --leaf-dark: #1f6b3a;
  --aeonium: #7a2b5e;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; touch-action: manipulation; }
body {
  font-family: 'Figtree', system-ui, sans-serif;
  background: var(--eggshell);
  color: var(--onyx);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, select, input, textarea { font: inherit; color: inherit; touch-action: manipulation; }
input, textarea { font-size: 16px; -webkit-user-select: text; user-select: text; }

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h2 { border-left: 5px solid var(--chlorophyll-green); padding-left: 10px; }

/* ---- header ---- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 4px solid var(--sodium-flame);
  background: var(--eggshell);
}
.top .gtac { height: 34px; width: auto; cursor: pointer; }
.top h1 { color: var(--cobalt-blue); font-size: 1.2rem; margin: 0 auto 0 0; }
.badge { font-weight: 700; background: #fff; border: 2px solid var(--leaf); color: var(--leaf-dark); border-radius: 12px; padding: 8px 14px; white-space: nowrap; }
.top-btn { min-height: 40px; padding: 0 12px; white-space: nowrap; }

/* wordmark: the O of ORGANELLE is a little plant cell */
.logo { display: inline-flex; align-items: center; font-weight: 700; letter-spacing: .03em; line-height: 1; color: var(--cobalt-blue); white-space: nowrap; }
.logo .o { height: .95em; width: auto; margin: 0 .03em; }
.logo .sub { color: var(--leaf-dark); margin-left: .35em; }
@media (max-width: 900px) { .logo .sub { display: none; } .top { gap: 8px; } .top-btn { padding: 0 10px; } }

/* ---- layout ---- */
main { max-width: 1120px; margin: 0 auto; padding: 14px 16px 24px; position: relative; z-index: 1; }
main.narrow { max-width: 640px; }

/* ---- surfaces ---- */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .08);
}
.card.accent { border-top: 6px solid var(--c, var(--cobalt-blue)); }
.leafy::after {
  content: ""; position: absolute; right: 10px; top: -22px; width: 92px; height: 62px; pointer-events: none;
  background: url("../img/sprig.svg") no-repeat center / contain;
}
.sheet {
  background: var(--eggshell);
  border: 1px solid var(--aquamarine);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .12);
}

/* ---- controls ---- */
.btn, button {
  min-height: var(--touch); padding: 0 16px; border-radius: 12px;
  border: 2px solid var(--cobalt-blue); background: #fff; color: var(--cobalt-blue);
  font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary, button.primary { background: var(--cobalt-blue); color: var(--eggshell); }
.btn.go, button.go { background: var(--chlorophyll-green); border-color: var(--chlorophyll-green); color: var(--onyx); }
button:active, .btn:active { transform: scale(.97); }
button:disabled { opacity: .4; cursor: default; transform: none; }
.btn { position: relative; overflow: hidden; }
.btn input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

input[type=text], textarea {
  width: 100%; min-height: var(--touch); padding: 8px 14px;
  border-radius: 12px; border: 2px solid var(--line); background: #fff;
}
input[type=text] { font-size: 1.15rem !important; font-weight: 700; }
textarea { font-size: 1rem; line-height: 1.4; resize: vertical; }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--cobalt-blue); }
.form-row { display: grid; gap: 8px; margin-top: 18px; }
.form-row label, .lbl { font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }

.pill {
  display: inline-block; font-weight: 700; font-size: .75rem;
  letter-spacing: .08em; text-transform: uppercase;
  background: var(--c, var(--lavender)); color: var(--onyx);
  border-radius: 999px; padding: 4px 12px;
}
.lead { font-size: 1.05rem; line-height: 1.45; }
.muted { opacity: .65; }
.error { color: var(--sodium-flame); font-weight: 700; min-height: 1.4em; }
.hidden { display: none !important; }
.mission { background: var(--eggshell); border-left: 6px solid var(--leaf); border-radius: 10px; padding: 10px 14px; font-size: 1.05rem; line-height: 1.4; }

/* ---- the checklist ---- */
.hunt-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.leaf-meter { display: flex; gap: 6px; }
.leaf-meter svg { width: 34px; height: 34px; transition: transform .4s cubic-bezier(.2,.9,.3,1.4); }
.leaf-meter .off { filter: grayscale(1); opacity: .3; }
.leaf-meter .on { transform: rotate(-12deg) scale(1.1); }
.hunt-grid { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 820px) { .hunt-grid { grid-template-columns: 1fr 1fr; } }
.quest {
  display: grid; grid-template-columns: 54px 1fr; gap: 14px; align-items: center; text-align: left;
  min-height: 132px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line);
  background: #fff; color: var(--onyx); justify-content: stretch; position: relative; overflow: hidden;
}
.quest:hover { border-color: var(--cobalt-blue); }
.quest .box { width: 46px; height: 46px; border-radius: 12px; border: 3px solid var(--cobalt-blue); display: grid; place-items: center; font-size: 1.6rem; background: var(--eggshell); }
.quest .q { font-size: 1.12rem; line-height: 1.3; font-weight: 700; display: block; }
.quest .meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: .9rem; font-weight: 700; flex-wrap: wrap; }
.quest .task { font-weight: 400; opacity: .75; }
.quest.started { border-color: var(--cadmium-yellow); }
.quest.done { border-color: var(--chlorophyll-green); background: #effbf5; }
.quest.done .box { border-color: var(--chlorophyll-green); background: var(--chlorophyll-green); color: #fff; }
.quest.done .box::after { content: "✓"; font-weight: 700; animation: tick-in .5s cubic-bezier(.2,.9,.3,1.5); }
.quest.done .box span { display: none; }
.quest .deco { position: absolute; right: -14px; bottom: -18px; width: 86px; opacity: .18; pointer-events: none; transform: rotate(-20deg); }
@keyframes tick-in { from { transform: scale(0) rotate(-40deg); } }
.hunt-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ---- activity screen ---- */
.act-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.act-head h2 { margin: 0; flex: 1; min-width: 240px; font-size: 1.3rem; }
.act-pill { --c: var(--leaf); color: #fff; }
.act-body { display: grid; gap: 12px; margin-top: 10px; }
@media (min-width: 820px) { .act-body { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.act-tip { background: var(--cadmium-yellow); border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 1.05rem; line-height: 1.35; margin: 0 0 10px; }
.act-tip.pop { animation: tip-pop .35s ease-out; }
@keyframes tip-pop { from { transform: scale(.96); opacity: .4; } }
.act-side h3 { margin: 12px 0 6px; font-size: 1rem; }
.act-won { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.act-badge { display: grid; grid-template-columns: 2.2em 1fr; gap: 8px; background: var(--eggshell); border: 2px solid var(--chlorophyll-green); border-radius: 12px; padding: 8px 10px; line-height: 1.3; animation: badge-in .5s cubic-bezier(.2,.9,.3,1.3); cursor: pointer; }
.act-badge .ic2 { font-size: 1.7rem; text-align: center; }
.act-badge b { display: block; color: #00875a; }
@keyframes badge-in { from { transform: scale(.6); opacity: 0; } }
.act-done { width: 100%; margin-top: 8px; }

/* step list (from BLOOD's three steps for every smear) */
.steps { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 6px; list-style: none; counter-reset: st; padding: 0; margin: 0 0 8px; }
.steps li { counter-increment: st; border-radius: 10px; padding: 6px 8px; background: #fff; border: 2px solid var(--line); font-weight: 700; font-size: .85rem; line-height: 1.15; opacity: .55; }
.steps li::before { content: counter(st) ". "; }
.steps li.on { opacity: 1; border-color: var(--cobalt-blue); background: #eeeafd; }
.steps li.done { opacity: 1; border-color: var(--chlorophyll-green); background: #e3f8ef; }
.steps li.done::before { content: "✓ "; }

/* label chips: tap to choose, or drag onto the photo */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--leaf); color: var(--leaf-dark); background: #fff; touch-action: none; }
.chip.on { background: var(--leaf); color: #fff; }
.chip.own { border-style: dashed; }
.chip-ghost { position: fixed; z-index: 50; pointer-events: none; transform: translate(-50%, -130%); background: var(--leaf); color: #fff; font-weight: 700; padding: 8px 14px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* ---- annotator ---- */
.ann { display: grid; gap: 8px; }
.ann-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ann-bar button { min-height: 44px; padding: 0 12px; font-size: .95rem; }
.ann-bar button.on { background: var(--cobalt-blue); color: var(--eggshell); }
.ann-sws { display: inline-flex; gap: 6px; margin-left: auto; }
.sw { width: 36px; height: 36px; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; border: 2px solid var(--line) !important; }
.sw.on { outline: 3px solid var(--cobalt-blue); outline-offset: 1px; }
.ann-hint { margin: 0; font-size: .9rem; opacity: .7; min-height: 1.2em; }
.act-stage { background: #f2f7ee; border: 2px solid var(--line); border-radius: 16px; padding: 6px; min-height: 280px; display: grid; place-items: center; position: relative; }
.ann-host { width: 100%; }
.ann-wrap { position: relative; display: inline-block; line-height: 0; justify-self: center; }
.ann canvas { display: block; max-width: 100%; max-height: calc(100dvh - 330px); min-height: 200px; touch-action: none; border-radius: 10px; background: #000; cursor: crosshair; }
.ann textarea.ann-ta { position: absolute; display: none; margin: 0; resize: none; overflow: auto; min-height: 0; font-weight: 600; line-height: 1.2; border: 2px solid var(--cobalt-blue); border-radius: 6px; padding: 3px 6px; background: rgba(255,255,255,.94); color: #111; }
.ann-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ann-foot button, .ann-foot .btn { min-height: 44px; font-size: .95rem; }
.photo-start { text-align: center; padding: 24px 12px; line-height: 1.4; }
.photo-start svg.big { width: 120px; height: auto; display: block; margin: 0 auto 10px; }
.photo-start .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* counting */
.counter { display: flex; align-items: baseline; gap: 10px; background: var(--eggshell); border-radius: 12px; padding: 8px 14px; font-weight: 700; }
.counter b { font-size: 2.4rem; color: var(--cobalt-blue); line-height: 1; font-variant-numeric: tabular-nums; }
.counter.bump b { animation: tip-pop .35s ease-out; }
.slider { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-weight: 700; font-size: .85rem; margin-top: 8px; }
.slider input { width: 100%; accent-color: var(--cobalt-blue); height: 36px; }

/* pigment */
.swatch-row { display: flex; gap: 12px; align-items: center; }
.swatch { width: 54px; height: 54px; flex: none; border-radius: 50%; border: 3px solid var(--onyx); background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.colour-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.colour-list button { min-height: 42px; padding: 0 8px; font-size: .92rem; justify-content: flex-start; border-color: var(--line); color: var(--onyx); }
.colour-list button i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.3); flex: none; }
.colour-list button.on { border-color: var(--cobalt-blue); background: #eeeafd; }
.inspect { background: var(--eggshell); border: 1px solid var(--aquamarine); border-radius: 14px; padding: 12px 14px; animation: flip .4s ease-out; margin-top: 10px; line-height: 1.4; }
.inspect b.good { color: #00875a; }
@keyframes flip { from { transform: perspective(600px) rotateY(80deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- achievement badges (as BLOOD) ---- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bdg { display: grid; grid-template-columns: 2.2em 1fr; gap: 8px; align-items: start; background: #fff; border: 2px solid var(--cadmium-yellow); border-radius: 12px; padding: 8px 10px; font-size: .9rem; line-height: 1.3; }
.bdg[data-id] { cursor: pointer; }
.bdg .ic2 { font-size: 1.6rem; line-height: 1.1; text-align: center; }
.bdg b { display: block; font-size: .98rem; }
.bdg.locked { border: 2px dashed var(--line); background: transparent; opacity: .6; }
.bdg.locked .ic2 { filter: grayscale(1); opacity: .5; }
.badge-grid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 8px 0 12px; }
.badge-grid.small .bdg { align-items: center; padding: 4px 8px; font-size: .8rem; }
.badge-grid.small .bdg b { font-size: .85rem; }
.badge-grid.small .bdg .ic2 { font-size: 1.1rem; }
.book { position: fixed; inset: 0; z-index: 30; background: rgba(39,42,36,.5); display: grid; place-items: center; padding: 16px; }
.book .sheet { width: min(760px, 100%); max-height: 100%; overflow: auto; }
.book-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bdg-sheet { width: min(640px, 100%) !important; }
.bdg-card { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.bdg-card .art { background: #fff; border-radius: 16px; border: 2px solid var(--line); padding: 10px; }
.bdg-card .art svg { display: block; width: 100%; height: auto; }
.bdg-ring { fill: none; stroke: var(--sodium-flame); stroke-width: 3; stroke-dasharray: 6 3; animation: hint-ring 1.2s ease-in-out infinite; }
@keyframes hint-ring { 50% { stroke-width: 5; } }
.bdg-card h2 { margin-top: 0; }
.bdg-card ul { margin: 8px 0 0; padding-left: 1.2em; line-height: 1.45; }
@media (max-width: 560px) { .bdg-card { grid-template-columns: 1fr; } .bdg-card .art { max-width: 210px; } }

.toast { position: fixed; left: 50%; top: max(70px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 40; background: var(--onyx); color: var(--eggshell); padding: 10px 18px; border-radius: 12px; font-weight: 700; text-align: center; max-width: min(560px, 90vw); animation: toast-in .35s cubic-bezier(.2,.9,.3,1.3); cursor: pointer; }
@keyframes toast-in { from { transform: translate(-50%, -16px); opacity: 0; } }

/* ---- summary ---- */
.fin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.fin-stats div { background: var(--eggshell); border-radius: 12px; padding: 10px; text-align: center; }
.fin-stats b { display: block; font-size: 1.8rem; color: var(--cobalt-blue); line-height: 1.1; }
.fin-stats span { font-size: .85rem; font-weight: 700; opacity: .7; }
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.evidence figure { margin: 0; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 8px; display: grid; gap: 6px; align-content: start; }
.evidence figure.fav { border-color: var(--cadmium-yellow); box-shadow: 0 0 0 4px rgba(255,205,31,.35); }
.evidence img { width: 100%; border-radius: 10px; background: #eee; aspect-ratio: 4 / 3; object-fit: contain; }
.evidence .none { aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 10px; background: var(--eggshell); font-weight: 700; opacity: .6; text-align: center; padding: 10px; }
.evidence figcaption { font-size: .9rem; line-height: 1.35; }
.evidence figcaption b { display: block; }
.fav-btn { min-height: 40px; font-size: .9rem; border-color: var(--cadmium-yellow); color: var(--onyx); }
.fav .fav-btn { background: var(--cadmium-yellow); }
.save-box { margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--eggshell); border-radius: 14px; padding: 12px 14px; }
.save-box p { margin: 0; flex: 1; min-width: 220px; }

/* ---- background leaves ---- */
.bg-leaves { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-leaves svg { position: absolute; opacity: .13; }

/* ---- intro: leaves swoosh apart ---- */
.intro { position: fixed; inset: 0; z-index: 60; overflow: hidden; background: radial-gradient(circle at 50% 45%, #e9f6df 0, #bfe0b0 55%, #8cc57f 100%); display: grid; place-items: center; }
.intro .lf { position: absolute; transform-origin: 50% 90%; transition: transform 1.15s cubic-bezier(.55,0,.25,1), opacity 1.15s ease-in; will-change: transform; }
.intro .lf svg { display: block; width: 100%; height: auto; animation: sway var(--sw, 4s) ease-in-out infinite alternate; transform-origin: 50% 95%; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(4deg); } }
.intro .title { position: relative; z-index: 3; text-align: center; background: rgba(249,246,231,.95); border-radius: 22px; padding: 26px 30px; box-shadow: 0 16px 50px rgba(0,0,0,.25); max-width: min(560px, 88vw); transition: transform .5s ease-in, opacity .5s ease-in; }
.intro .title h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); color: var(--leaf-dark); margin: 10px 0 6px; }
.intro .title p { font-size: 1.1rem; margin: 0 0 18px; line-height: 1.4; }
.intro .title button { font-size: 1.15rem; min-height: 56px; padding: 0 26px; }
.intro.part .title { transform: scale(.85); opacity: 0; }
.intro.part .lf { transform: translate(var(--tx), var(--ty)) rotate(var(--tr)) !important; }
.intro.part { background-color: transparent; transition: opacity .6s .75s; opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .intro .lf svg { animation: none; }
  .intro .lf { transition: opacity .5s; }
  .intro.part .lf { transform: none !important; opacity: 0; }
}
