@import url("https://fonts.googleapis.com/css2?family=Parkinsans:wght@400;600;700&display=swap");

/* Frasers / Sports Direct Energy League tokens — from org brand sheet */
:root {
  --brand: #0000ed; /* Sports Direct main */
  --brand-dark: #00354d; /* Midnight (shared Energy League) */
  --brand-mid: #1458a1; /* Uniform secondary */
  --brand-soft: #e4e2f7; /* Pale brand accent */
  --brand-secondary: #ed0000; /* Secondary brand */
  --uniform-main: #eb0a1a;
  --uniform-secondary: #1458a1;
  --contrast: #fdfefe;
  --accent: #ffc539; /* Sunbeam */
  --accent-text: #00354d;
  --sand: #ffebd0;
  --lichen: #def8ab; /* positive / captured — Energy League lichen */
  --aurora: #ffc4c2; /* negative */
  --page-bg: #fdfbf6; /* Pearl */
  --card-bg: #ffffff;
  --ink: #00354d;
  --muted: #5a6270;
  --section-bar: #e4e2f7;
  --logo-bg: #fdfbf6;
  --font: "Parkinsans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius-card: 10px;
  --radius-pill: 999px;

  /*
   * Bjorn layout standard — measured from Poundland home @ 1080×2400.
   * Image top-left is (+6px, +210px) from .screen bottom-left; image is
   * 210×210 so feet sit on the screen bottom edge. Do not tune per org.
   */
  --el-bjorn-img-size: 210px;
  --el-bjorn-anchor-left: 6px;
  --el-bjorn-anchor-rise: 210px;
  --el-bjorn-disc-size: clamp(336px, 96vw, 460px);
  --el-bjorn-disc-shift-x: -45%;
  --el-bjorn-disc-shift-y: 45%;
  --el-bjorn-screen-offset-x: -25px;
  --page-body-pad-x: 0.7em;
  --page-back-bottom: calc(1em + 45px);
  --page-back-right: 0.75em;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: #111;
  font-family: var(--font);
  color: var(--ink);
  /* iOS standalone / PWA */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Desktop: show storefront preview + mobile-only message */
.desktop-viewport-message {
  display: none;
}

@media (min-width: 481px) {
  .desktop-viewport-message {
    display: flex;
    flex-direction: column;
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    background: var(--page-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  }

  .mobile-demo {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .desktop-viewport-message {
    display: none !important;
  }
}

.desktop-hero-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  line-height: 0;
  background: var(--page-bg);
}

.desktop-hero-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.desktop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2em 1.5em 2.25em;
  background: rgba(0, 53, 77, 0.62);
  color: #fff;
  text-align: center;
}

.desktop-overlay-message {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.desktop-overlay p {
  margin: 0;
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 700;
  line-height: 1.35;
  max-width: 18em;
}

.desktop-overlay-trophy {
  flex: 0 0 auto;
  display: block;
  width: clamp(72px, 18vw, 96px);
  height: auto;
  object-fit: contain;
  margin-top: 1.25em;
}

.desktop-viewport-message .league-bar {
  grid-template-columns: 1fr;
}

.desktop-viewport-message .league-bar .trophy-tile {
  display: none;
}

.phone {
  position: relative;
  width: min(calc(100vw - 24px), calc((100vh - 24px) * 1080 / 2400));
  aspect-ratio: 1080 / 2400;
  height: auto;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  background: var(--page-bg);
  border-radius: calc(min(calc(100vw - 24px), calc((100vh - 24px) * 1080 / 2400)) * 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 8px #1f1f1f, 0 18px 48px rgba(0, 0, 0, 0.45);
}

/* Full-bleed on mobile / installed PWA / matching tall phone aspect */
@media (max-width: 720px),
  (display-mode: standalone),
  (display-mode: fullscreen),
  (hover: none) and (pointer: coarse),
  (min-aspect-ratio: 1080/2400) and (max-aspect-ratio: 1080/2390),
  (width: 1080px) and (min-height: 2340px) {
  html,
  body {
    background: var(--page-bg);
    overflow: hidden;
    overscroll-behavior: none;
  }

  .phone {
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    /* notch / home indicator */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0
      env(safe-area-inset-left);
  }
}

.screen {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 1 — full hero visible (native aspect, never cropped) */
.hero {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1080 / 603;
  background: var(--page-bg);
  line-height: 0;
  overflow: hidden;
}

.hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* League bar: trophies flanking ENERGY LEAGUE + store rows */
.league-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  background: var(--brand-dark);
  color: #fff;
  padding: 0.15em 0.1em;
  column-gap: 0.15em;
  min-height: clamp(52px, 14vw, 64px);
}

.league-bar .trophy-tile {
  display: grid;
  place-items: center;
  /* Half of previous ~113px size */
  width: clamp(48px, 13vw, 59px);
  align-self: stretch;
  background: transparent;
  padding: 0;
  box-sizing: border-box;
}

.league-bar .trophy {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

.league-bar-center {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.2em;
  min-width: 0;
  padding: 0.25em 0.15em 0.3em;
}

.league-bar-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.league-bar .league-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-width: 0;
}

.league-bar .logo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--logo-bg);
  padding: 3px 5px;
  border-radius: 2px;
  width: max-content;
  flex: 0 0 auto;
  line-height: 0;
}

.league-bar .logo {
  /* Slightly larger than store row */
  height: clamp(16px, 4.4vw, 20px);
  width: auto;
  object-fit: contain;
}

.league-bar .league-title {
  display: flex;
  align-items: center;
  /* ENERGY LEAGUE larger than store details */
  font-size: clamp(14px, 4.2vw, 18px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  white-space: nowrap;
}

.league-bar .league-title .org {
  display: none;
}

.league-bar .league-title .product {
  color: var(--accent);
}

.store-line {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  font-size: clamp(11px, 3.1vw, 13px);
  font-weight: 400;
  color: var(--page-bg);
  line-height: 1.25;
  background: transparent;
  text-align: center;
}

.store-line .store-id {
  font-weight: 700;
}

/* Greeting — slightly taller */
.greeting {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--brand);
  color: var(--contrast);
  padding: 0 0 0 0.65em;
  height: clamp(32px, 8.2vw, 38px);
  overflow: hidden;
}

.greeting .hello {
  font-size: clamp(13px, 3.5vw, 16px);
  font-weight: 700;
  line-height: 1.1;
  z-index: 1;
}

.greeting .phase-wrap {
  position: absolute;
  right: 0.1em;
  bottom: 0;
  height: 72%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  max-width: 28%;
  pointer-events: none;
  line-height: 0;
}

.greeting .phase {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: right bottom;
}

.section-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.35em 0.7em;
  background: var(--section-bar);
  color: var(--brand);
  font-size: clamp(10px, 3.1vw, 13px);
  font-weight: 700;
  letter-spacing: 0.06em;
  position: relative;
  z-index: 2;
  width: 100%;
  box-sizing: border-box;
}

/* Home + subpage banners: full bleed, flush with element above */
.screen > .section-head {
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
}

.newsfeed + .section-head {
  margin-top: 0;
}

.section-head + .highlights {
  padding-top: calc(0.35em + 10px);
}

.newsfeed {
  flex: 0 0 auto;
  padding: 0.4em 0.55em 0;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  min-height: 0;
  position: relative;
  z-index: 2;
}

.feed-card {
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: var(--card-bg);
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  padding: 0.45em 0.5em 0.45em 0.6em;
  min-height: 0;
}

/* 6 — top action border = Sunbeam / TAKE ACTION yellow */
.feed-card.feed-accent {
  border-color: var(--accent);
}

.feed-card p {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: clamp(10px, 2.9vw, 12px);
  line-height: 1.3;
  color: var(--ink);
}

.feed-card p strong {
  font-weight: 700;
  color: var(--brand-dark);
}

.btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-family: var(--font);
  font-size: clamp(7.5px, 2.1vw, 9.5px);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  padding: 0.65em 0.5em;
  border-radius: 7px;
  line-height: 1.15;
  /* 7 — room for SUGGESTED ACTIONS */
  width: 7.6em;
  max-width: 40%;
  box-sizing: border-box;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-brand {
  background: var(--brand);
  color: #fff;
}

.more {
  flex: 0 0 auto;
  display: block;
  text-align: right;
  padding: 0.2em 0.55em 0.35em;
  margin-bottom: 0.55em;
  font-size: clamp(10px, 2.9vw, 12px);
  font-style: italic;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  position: relative;
  z-index: 2;
}

.highlights {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.35em 0.55em 0;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  /* Allow large Bjorn disc to extend; .screen/.phone clip the rest */
  overflow: visible;
  position: relative;
  z-index: 2;
}

/* 8–10 — savings slider */
.prize-slider {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  position: relative;
  z-index: 2;
}

.prize-slider-row {
  display: flex;
  align-items: center;
  gap: 0.45em;
}

.prize-track {
  position: relative;
  flex: 1;
  min-width: 0;
  height: clamp(28px, 7.5vw, 34px);
  border-radius: var(--radius-pill);
  overflow: visible;
  /* Lichen (positive) left → Aurora (negative) right — brand sheet */
  background-color: var(--lichen);
  background-image: linear-gradient(
    to right,
    var(--lichen) 0%,
    var(--lichen) 78%,
    var(--aurora) 78%,
    var(--aurora) 100%
  );
}

.prize-captured {
  position: absolute;
  left: 0.7em;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  font-size: clamp(9px, 2.6vw, 11px);
  font-weight: 700;
  color: var(--brand-dark);
  max-width: calc(78% - 1.6em);
  line-height: 1.15;
  pointer-events: none;
}

.prize-captured strong {
  font-size: 1.15em;
}

/* Blob at 78% — empty handle, no £ on it */
.prize-blob {
  position: absolute;
  top: 50%;
  left: 78%;
  transform: translate(-50%, -50%);
  width: clamp(26px, 7.5vw, 32px);
  height: clamp(26px, 7.5vw, 32px);
  border-radius: 50%;
  background: var(--brand-dark);
  border: 2px solid var(--page-bg);
  box-shadow: 0 1px 3px rgba(0, 53, 77, 0.25);
  z-index: 2;
}

/* 9 — savings value to the right of the slider (not on the blob) */
.prize-value {
  flex: 0 0 auto;
  font-size: clamp(11px, 3.1vw, 13px);
  font-weight: 700;
  color: #c45a5a;
  border: 1.5px solid var(--aurora);
  background: #fff;
  border-radius: 6px;
  padding: 0.3em 0.45em;
  line-height: 1.1;
  white-space: nowrap;
}

.prize-caption {
  margin: 0;
  text-align: right;
  font-size: clamp(9px, 2.5vw, 11px);
  color: var(--ink);
  line-height: 1.2;
}

.highlights-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(130px, 38%) 1fr;
  grid-template-rows: 1fr;
  column-gap: 0.55em;
  align-items: stretch;
  /* No positioning context — Bjorn anchors to .screen */
  z-index: 1;
  margin-top: 0.1em;
  padding-top: 0.15em;
  padding-bottom: 0;
  overflow: visible;
  isolation: isolate;
}

.highlights-body::before {
  content: none;
}

.bjorn-spacer {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  pointer-events: none;
}

.bjorn-avatar {
  /* Anchored to .screen bottom-left — image position is independent of the disc */
  position: absolute;
  left: var(--el-bjorn-screen-offset-x);
  bottom: 0;
  z-index: 0;
  width: auto;
  height: auto;
  overflow: visible;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
  margin: 0;
  transform: none;
  pointer-events: none;
}

.bjorn-avatar::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 0;
  width: var(--el-bjorn-disc-size);
  height: var(--el-bjorn-disc-size);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--section-bar);
  transform: translate(var(--el-bjorn-disc-shift-x), var(--el-bjorn-disc-shift-y));
  pointer-events: none;
}

.bjorn-avatar .bjorn-link {
  position: absolute;
  left: var(--el-bjorn-anchor-left);
  bottom: 0;
  display: block;
  width: var(--el-bjorn-img-size);
  height: var(--el-bjorn-img-size);
  pointer-events: auto;
  z-index: 1;
}

.bjorn-avatar .bjorn-link img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  background: transparent;
}

.bjorn-avatar > img {
  position: absolute;
  left: var(--el-bjorn-anchor-left);
  bottom: 0;
  z-index: 1;
  display: block;
  width: var(--el-bjorn-img-size);
  height: var(--el-bjorn-img-size);
  max-width: none;
  object-fit: cover;
  object-position: center bottom;
  background: transparent;
}

.ranks-col {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.4em;
  min-height: 0;
  align-self: start;
  padding-top: 0.05em;
  padding-bottom: 0;
  padding-right: 1em;
  /* Room for the 1st badge’s left contour nudge */
  padding-left: 0.35em;
  margin-left: -0.35em;
  /* Allow left nudge; paint above Bjorn disc and other layers */
  overflow: visible;
  position: relative;
  z-index: 10;
}

.ranks {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.5em;
  min-height: 0;
  position: relative;
  z-index: 10;
  width: 100%;
  overflow: visible;
}

.rank {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5em;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
}

/* Follow the circle’s right-hand contour: upper badge left, lower badge right */
.rank:nth-child(1) {
  margin-left: -14px;
  width: calc(100% + 14px);
  max-width: none;
}

.rank:nth-child(2) {
  /* Mild right nudge for contour; keep clear of the screen edge */
  margin-left: 6px;
  width: calc(100% - 6px);
  max-width: calc(100% - 6px);
}

.rank img {
  width: clamp(42px, 12vw, 54px);
  height: clamp(42px, 12vw, 54px);
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
  position: relative;
  z-index: 10;
}

.rank p {
  margin: 0;
  font-size: clamp(10px, 2.9vw, 13px);
  line-height: 1.25;
  color: var(--ink);
  min-width: 0;
  flex: 1 1 auto;
}

.rank p strong {
  font-weight: 700;
}

.more.more-highlights {
  align-self: flex-end;
  padding: 0.15em 0 0;
  flex-shrink: 0;
}

.stub-note {
  margin: 1.2em 0.9em;
  padding: 1em;
  background: #fff;
  border-radius: 12px;
  font-size: clamp(12px, 3.4vw, 14px);
  line-height: 1.4;
}

.stub-note a {
  color: var(--brand);
  font-weight: 700;
}

.bjorn-interim {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1em 0.9em;
  display: flex;
  flex-direction: column;
  gap: 0.85em;
  background: var(--sand);
}

.bjorn-interim img.bjorn-hero {
  width: min(42%, 160px);
  height: auto;
  align-self: center;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
}

.bjorn-interim h1 {
  margin: 0;
  font-size: clamp(16px, 4.5vw, 20px);
  line-height: 1.2;
  color: var(--brand-dark);
  font-weight: 700;
}

.bjorn-interim p {
  margin: 0;
  font-size: clamp(12px, 3.3vw, 14px);
  line-height: 1.4;
  color: var(--ink);
}

.bjorn-interim .cta-row {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: auto;
}

.bjorn-interim .cta-primary {
  display: block;
  text-align: center;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  padding: 0.75em 1em;
  border-radius: var(--radius-pill);
  font-size: clamp(12px, 3.4vw, 14px);
}

.bjorn-interim .cta-secondary {
  display: block;
  text-align: center;
  text-decoration: none;
  color: var(--brand);
  font-weight: 700;
  font-size: clamp(12px, 3.2vw, 13px);
  padding: 0.4em;
}

/* —— Subpages: shared chrome (banner + hero + Bjorn) —— */
.screen.subpage {
  position: relative;
}

.page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 var(--page-body-pad-x) 1.2em;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.65em;
}

.page-body > .section-head {
  margin-top: 0;
  margin-left: calc(-1 * var(--page-body-pad-x));
  margin-right: calc(-1 * var(--page-body-pad-x));
  width: calc(100% + 2 * var(--page-body-pad-x));
  flex-shrink: 0;
}

.page-title {
  margin: 0;
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.25;
}

.page-lead {
  margin: 0;
  font-size: clamp(12px, 3.3vw, 14px);
  line-height: 1.4;
  color: var(--ink);
}

.page-back {
  position: absolute;
  right: var(--page-back-right);
  bottom: var(--page-back-bottom);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  margin: 0;
  padding: 0.85em 1.25em;
  min-height: 44px;
  font-family: var(--font);
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 700;
  line-height: 1;
  color: var(--accent-text);
  background: var(--accent);
  text-decoration: none;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 53, 77, 0.28);
  pointer-events: auto;
}

.page-back:active {
  transform: translateY(1px);
}

.subpage .bjorn-avatar {
  z-index: 0;
  pointer-events: none;
}

.subpage .page-body {
  /* Room so content isn’t hidden under the back button */
  padding-bottom: 5.5em;
}

.subpage.impact-page .page-body,
.impact-page .page-body {
  flex: 1 1 auto;
  padding-bottom: 6.75em;
}

/* —— Action checklists (TAKE ACTION / SUGGESTED ACTIONS) —— */
.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  position: relative;
  z-index: 2;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65em;
  background: var(--card-bg);
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  padding: 0.7em 0.75em;
}

.action-item.is-done {
  border-color: var(--lichen);
  background: #f7fcef;
}

.action-check {
  flex-shrink: 0;
  width: 1.45em;
  height: 1.45em;
  margin-top: 0.1em;
  accent-color: var(--brand);
  cursor: pointer;
}

.action-item label {
  flex: 1;
  min-width: 0;
  font-size: clamp(12px, 3.3vw, 14px);
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
}

.action-item.is-done label {
  text-decoration: line-through;
  color: var(--muted);
}

.btn-feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 50%;
  margin: 0;
  padding: 0.95em 1em;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font);
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 53, 77, 0.18);
  text-decoration: none;
}

.feedback-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-top: 0.35em;
}

.btn-feedback:active {
  transform: translateY(1px);
}

/* —— IMPACT: chart left, stats right, month/year toggle —— */
.impact-controls {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
}

.impact-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35em;
  background: var(--section-bar);
  border-radius: 10px;
  padding: 0.25em;
}

.impact-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: clamp(12px, 3.3vw, 14px);
  font-weight: 700;
  color: var(--brand);
  padding: 0.55em 0.4em;
  border-radius: 8px;
  cursor: pointer;
}

.impact-mode-btn.is-active {
  background: var(--brand);
  color: #fff;
}

.impact-period-select {
  width: 100%;
}

.impact-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 0.4em;
  align-items: stretch;
  min-height: 0;
  flex: 1 1 auto;
}

.impact-chart {
  grid-column: 1;
  grid-row: 1 / 3;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.impact-stats {
  display: contents;
}

.impact-stats .stat-card {
  grid-column: 2;
  min-height: 0;
  padding: 0.45em 0.5em;
  min-width: 0;
}

.impact-stats .stat-card:nth-child(1) {
  grid-row: 1;
}

.impact-stats .stat-card:nth-child(2) {
  grid-row: 2;
}

.impact-stats .stat-card:nth-child(3) {
  grid-row: 3;
}

.impact-stats .stat-card:nth-child(4) {
  grid-row: 4;
}

.impact-page .chart-panel {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.4em 0.4em 0.45em;
  gap: 0.3em;
  display: flex;
  flex-direction: column;
}

.impact-page .bar-chart {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  max-height: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5em;
}

.stat-card {
  background: var(--card-bg);
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  padding: 0.5em 0.55em;
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  justify-content: center;
}

.stat-card.stat-wide {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #e8f6f4, #fff);
}

.stat-value {
  font-size: clamp(15px, 4.2vw, 20px);
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.1;
}

.stat-label {
  font-size: clamp(9px, 2.5vw, 11px);
  color: var(--muted);
  line-height: 1.2;
}

.chart-panel {
  background: var(--card-bg);
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  padding: 0.55em 0.5em 0.6em;
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  flex: 1 1 auto;
  min-height: 0;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
}

.chart-head h3 {
  margin: 0;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 700;
  color: var(--brand-dark);
}

.unit-select {
  font-family: var(--font);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--section-bar);
  border: 1px solid #b7d4d8;
  border-radius: 7px;
  padding: 0.35em 0.5em;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.2em;
  height: 72px;
  flex: 0 0 auto;
  min-height: 64px;
  max-height: 80px;
  padding-top: 0.15em;
}

.impact-page .bar-chart {
  height: auto;
  min-height: 120px;
  max-height: none;
}

.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25em;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: var(--brand);
  min-height: 3px;
  transition: height 0.2s ease;
}

.bar-col.is-current .bar-fill {
  background: var(--accent);
}

.bar-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}

/* —— ACHIEVEMENTS —— */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35em;
  background: var(--section-bar);
  border-radius: 10px;
  padding: 0.25em;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: clamp(12px, 3.3vw, 14px);
  font-weight: 700;
  color: var(--brand);
  padding: 0.55em 0.4em;
  border-radius: 8px;
  cursor: pointer;
}

.tab.is-active {
  background: var(--brand);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.achieve-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  position: relative;
  z-index: 2;
}

.achieve-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5em;
  width: 100%;
  position: relative;
  z-index: 2;
}

.achieve-grid .achieve-item {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.65em 0.5em;
  gap: 0.45em;
  height: 100%;
}

.achieve-grid .achieve-item p {
  font-size: clamp(10px, 2.8vw, 12px);
}

.achieve-item {
  display: flex;
  align-items: center;
  gap: 0.55em;
  background: var(--card-bg);
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  padding: 0.55em 0.65em;
}

/* Real badge silhouette from supplied artwork (badge-shape.svg / blank PNGs) */
.achieve-badge {
  position: relative;
  flex-shrink: 0;
  width: clamp(48px, 13vw, 60px);
  height: clamp(48px, 13vw, 60px);
  display: grid;
  place-items: center;
}

.achieve-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.achieve-badge-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: #fff;
  pointer-events: none;
  padding-top: 0.1em;
}

.achieve-badge.rank-text-blue {
  background: transparent;
  overflow: visible;
}

.achieve-badge.rank-text-blue img {
  display: none;
}

.achieve-badge.rank-text-blue .achieve-badge-label {
  position: static;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--brand);
  font-size: clamp(15px, 4.2vw, 20px);
  font-weight: 700;
  padding-top: 0;
}

.achieve-badge.minimal-number {
  background: var(--brand);
  border-radius: 50%;
  overflow: hidden;
}

.achieve-badge.minimal-number img {
  display: none;
}

.achieve-badge.minimal-number .achieve-badge-label {
  color: #fff;
  font-size: clamp(16px, 4.5vw, 22px);
  padding-top: 0;
}

.achieve-badge.minimal-triangle {
  background: transparent;
}

.achieve-badge.minimal-triangle img {
  display: none;
}

.achieve-badge.minimal-triangle .achieve-badge-label {
  color: var(--brand-dark);
  font-size: clamp(22px, 6vw, 30px);
  padding-top: 0.15em;
  line-height: 0.85;
}

.achieve-badge.gold .achieve-badge-label {
  color: var(--brand-dark);
}

.achieve-item p {
  margin: 0;
  font-size: clamp(11px, 3.1vw, 13px);
  line-height: 1.3;
  color: var(--ink);
}

.leaderboard {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  position: relative;
  z-index: 2;
}

.leaderboard li {
  display: grid;
  grid-template-columns: 2em 1fr auto;
  align-items: center;
  gap: 0.45em;
  background: var(--card-bg);
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  padding: 0.55em 0.7em;
  font-size: clamp(12px, 3.2vw, 14px);
}

.leaderboard li.is-you {
  border-color: var(--brand);
  background: #eef8f9;
}

.leaderboard .lb-rank {
  font-weight: 700;
  color: var(--brand-dark);
  display: inline-grid;
  place-items: center;
  width: 1.65em;
  height: 1.65em;
  border-radius: 50%;
  line-height: 1;
}

.leaderboard li:nth-child(1) .lb-rank {
  background: #e8c547;
  color: var(--brand-dark);
}

.leaderboard li:nth-child(2) .lb-rank {
  background: #c8c8c8;
  color: var(--brand-dark);
}

.leaderboard li:nth-child(3) .lb-rank {
  background: #d4a574;
  color: var(--brand-dark);
}

.leaderboard .lb-name {
  color: var(--ink);
  min-width: 0;
}

.leaderboard .lb-score {
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.subhead {
  margin: 0.35em 0 0;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* —— Report anomaly —— */
.report-form {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  position: relative;
  z-index: 2;
}

.report-textarea {
  width: 100%;
  min-height: 8em;
  padding: 0.75em;
  border: 1.5px solid #b7d4d8;
  border-radius: var(--radius-card);
  font-family: var(--font);
  font-size: clamp(12px, 3.3vw, 14px);
  line-height: 1.4;
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}

.report-textarea:focus {
  outline: 2px solid var(--brand);
  border-color: var(--brand);
}

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.95em 1em;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font);
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 700;
  cursor: pointer;
}

.report-thanks {
  margin: 0;
  padding: 1em;
  background: var(--lichen);
  border-radius: var(--radius-card);
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 700;
  color: var(--brand-dark);
  text-align: center;
  display: none;
}

.report-thanks.is-visible {
  display: block;
}
