/* Data Giraffe – shared styles */
:root {
  --blue: #211a52;
  --blue-600: #3a3192;
  --blue-50: #eef0fa;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c1b2e;
  --muted: #565a70;
  --border: #dcdfeb;

  --good: #1f7a45; --good-bg: #e3f4ea;
  --bad: #b3261e;  --bad-bg: #fbe5e3;
  --ok: #8a6100;   --ok-bg: #fff3d1;

  /* Level colours: this game's convention, always paired with the number + name */
  --l1: #2e7d4f; --l1-ink: #fff;     --l1-bg: #e4f3ea;
  --l2: #e0aa00; --l2-ink: #1c1b2e;  --l2-bg: #fdf3d3;
  --l3: #c9540f; --l3-ink: #fff;     --l3-bg: #fde6d8;
  --l4: #b3202a; --l4-ink: #fff;     --l4-bg: #f8dfe1;

  --radius: 14px;
  --shadow: 0 2px 12px rgba(33, 26, 82, .08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

.l1 { --c: var(--l1); --ci: var(--l1-ink); --cb: var(--l1-bg); }
.l2 { --c: var(--l2); --ci: var(--l2-ink); --cb: var(--l2-bg); }
.l3 { --c: var(--l3); --ci: var(--l3-ink); --cb: var(--l3-bg); }
.l4 { --c: var(--l4); --ci: var(--l4-ink); --cb: var(--l4-bg); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue-600); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #6f8cff; outline-offset: 2px; }

/* ---------- Top bar & footer ---------- */
.topbar { background: var(--blue); color: #fff; }
.topbar .inner, footer .inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand-mark { width: 36px; height: 36px; background: #fff; border-radius: 50%; padding: 3px; display: grid; place-items: center; }
.brand-mark { overflow: hidden; }
.brand-mark svg { width: 100%; height: 100%; overflow: hidden; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #fff; opacity: .85; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { background: rgba(255, 255, 255, .15); opacity: 1; }
@media (max-width: 640px) { .topbar nav { display: none; } }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; }
footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; background: #fff; }
footer .inner { display: block; padding: 16px; }
footer p { margin: 0; }

/* ---------- Type ---------- */
h1 { font-size: clamp(1.7rem, 2.6vw + 1rem, 2.5rem); line-height: 1.15; margin: .1em 0 .4em; color: var(--blue); }
h2 { color: var(--blue); line-height: 1.25; margin: .2em 0 .5em; font-size: 1.35rem; }
h3 { color: var(--blue); margin: 0 0 .3em; font-size: 1.05rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--blue-600); margin: 0 0 4px; }
.muted { color: var(--muted); }

/* ---------- Components ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

.btn {
  appearance: none; border: 1.5px solid var(--blue); border-radius: 10px;
  padding: 10px 18px; min-height: 44px;
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--blue); }
.btn.secondary:hover { background: var(--blue-50); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.lvl {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: .88rem; color: var(--text);
  background: var(--cb); border-radius: 999px; padding: 3px 12px 3px 3px; white-space: nowrap;
}
.lvl .n {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--c); color: var(--ci);
  display: grid; place-items: center; font-size: .8rem; font-weight: 800;
}

.hud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat small { display: block; font-weight: 600; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hud .spacer { flex: 1; }

.feedback { border-radius: 12px; padding: 14px 16px; border-left: 5px solid; background: #fff; }
.feedback p { margin: .3em 0; }
.feedback.good { background: var(--good-bg); border-color: var(--good); }
.feedback.bad { background: var(--bad-bg); border-color: var(--bad); }
.feedback.ok { background: var(--ok-bg); border-color: var(--ok); }
.verdict { font-weight: 800; font-size: 1.05rem; }
.feedback.good .verdict { color: var(--good); }
.feedback.bad .verdict { color: var(--bad); }
.feedback.ok .verdict { color: var(--ok); }

.rule-tip { background: var(--blue-50); border-radius: 10px; padding: 10px 14px; font-size: .95rem; }

/* Intro & end screens */
.intro { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center; }
.intro .giraffe-wrap svg { width: 100%; height: auto; }
.intro ul { padding-left: 1.2em; margin: .5em 0; }
@media (max-width: 640px) {
  .intro { grid-template-columns: 1fr; }
  .intro .giraffe-wrap { width: 120px; }
}
.end-score { font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 800; color: var(--blue); line-height: 1; margin: 8px 0; font-variant-numeric: tabular-nums; }
.review { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.review li { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.review li p { margin: .25em 0 0; font-size: .93rem; color: var(--muted); }

/* Giraffe animations */
.giraffe { display: block; width: 100%; height: auto; overflow: visible; }
.anim-bounce { animation: bounce .5s ease; }
.anim-shake { animation: shake .45s ease; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } 70% { transform: translateY(2px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Acacia trees */
.tree-svg .trunk { stroke: #7a5230; stroke-width: 7; stroke-linecap: round; fill: none; }
.tree-svg .canopy { fill: var(--c); }
.tree-svg .canopy-shadow { fill: var(--c); opacity: .35; }
.tree-svg .canopy-hl { fill: #fff; opacity: .2; }
.tree-svg .sign { fill: #fff; stroke: var(--c); stroke-width: 2.5; }
.tree-svg .sign-n { fill: var(--text); font: 800 15px var(--font); }

.leaf-icon { width: 20px; height: 20px; flex: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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