/* HARIT portal — shared styles. Plain CSS, no build step, mobile-first. */

:root {
  --green-dark: #145c34;
  --green: #1f8b4c;
  --green-light: #e7f7ec;
  --orange: #f6921e;
  --orange-dark: #d97600;
  --ink: #1c2b22;
  --ink-soft: #4a5b50;
  --cream: #fffaf1;
  --white: #ffffff;
  --danger: #b3261e;
  --radius: 16px;
  --max-width: 480px; /* mobile-first: content stays narrow even on desktop, per Android-first priority */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}

.screen {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

h1, h2, h3 { color: var(--green-dark); margin: 0 0 12px; }
p { color: var(--ink-soft); margin: 0 0 16px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
}

.brand { font-weight: 800; color: var(--green-dark); font-size: 1.2rem; }

.lang-toggle {
  display: flex;
  flex-shrink: 0; /* was unprotected — the only topbar item without this, so it silently got crushed to ~4px on narrow phones */
}
.lang-toggle button {
  border: 2px solid var(--green);
  border-radius: 999px;
  background: var(--white);
  color: var(--green-dark);
  font-weight: 700;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.lang-toggle button:active { background: var(--green-light); }

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 6px 20px rgba(20, 92, 52, 0.1);
  margin-bottom: 16px;
}

label { font-weight: 700; font-size: 0.9rem; display: block; margin: 12px 0 6px; }

input, select, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid #dfe7e1;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  margin-top: 12px;
}
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:active { background: var(--orange-dark); }
.btn-secondary { background: var(--white); color: var(--green-dark); border: 2px solid var(--green); }
.btn-secondary:active { background: var(--green-light); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg { color: var(--danger); font-weight: 700; font-size: 0.9rem; margin: 8px 0; }
.success-msg { color: var(--green-dark); font-weight: 700; font-size: 0.9rem; margin: 8px 0; }

/* flex-wrap so a row with many buttons (e.g. the 5-tab admin dashboard nav)
   wraps onto a second line on narrow screens instead of overflowing the
   viewport — flex items default to min-width: auto, which refuses to
   shrink a button below its own text width, so without wrapping the row
   just pushes past the screen edge instead of shrinking. */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs button {
  flex: 1 1 auto;
  min-width: fit-content;
  padding: 10px;
  border-radius: 999px;
  border: 2px solid var(--green-light);
  background: var(--white);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.tabs button.active { background: var(--green); color: var(--white); border-color: var(--green); }

.stat-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--green-light); }
.stat-row:last-child { border-bottom: none; }

.leaderboard-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--green-light); }
.leaderboard-rank { font-weight: 800; color: var(--orange-dark); width: 28px; }

.badge-pill {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  margin: 2px 4px 2px 0;
}

.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 2px solid #dfe7e1;
  background: var(--white);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
/* Neutral "you picked this" feedback — NOT green/red. The server withholds
   correct_index until final submit (anti-cheat: a student can't read the
   answer key out of the network tab one question at a time), so the
   client genuinely can't know per-question correctness here. .correct/
   .wrong below are unused by design — kept only for a future "review your
   answers" screen after submission, when the real results ARE known. */
.quiz-option.selected { border-color: var(--orange); background: #fef3e7; }
.quiz-option.correct { border-color: var(--green); background: var(--green-light); }
.quiz-option.wrong { border-color: var(--danger); background: #fdecea; }

.id-card {
  border: 3px dashed var(--orange);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  background: var(--white);
}
.id-card .code {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--green-dark);
  margin: 12px 0;
}

table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.admin-table th, table.admin-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--green-light); }

.pill-status { padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.pill-status.pending { background: #fff3e0; color: var(--orange-dark); }
.pill-status.fulfilled, .pill-status.approved, .pill-status.details_approved, .pill-status.received { background: var(--green-light); color: var(--green-dark); }
.pill-status.unclaimed, .pill-status.claimed { background: #fff3e0; color: var(--orange-dark); }
.pill-status.details_submitted { background: #e8f2ff; color: #245b91; }
.pill-status.dispatched { background: #f2e9ff; color: #65369b; }
.pill-status.rejected { background: #fdecea; color: var(--danger); }

.muted { color: var(--ink-soft); font-size: 0.85rem; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

@media (min-width: 700px) {
  :root { --max-width: 900px; }
  table.admin-table { font-size: 0.95rem; }
}

/* ===========================================================
   ADMIN — stat cards, charts, filter bar
   =========================================================== */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 700px) {
  .stat-cards-grid { grid-template-columns: repeat(4, 1fr); }
}
.logins-breakdown-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 700px) {
  .logins-breakdown-grid { grid-template-columns: repeat(3, 1fr); }
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 6px 20px rgba(20, 92, 52, 0.1);
  text-align: center;
}
.stat-card .stat-card-value { font-size: 1.6rem; font-weight: 800; color: var(--green-dark); }
.stat-card .stat-card-label { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }
.stat-card-clickable { cursor: pointer; border: 2px solid var(--green-light); }
.stat-card-clickable:active { background: var(--green-light); }

.filter-summary-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.filter-bar-btn { width: auto; padding: 6px 14px; margin-top: 0; font-size: 0.8rem; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 40, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-box > h3 { padding: 20px 20px 0; margin: 0 0 4px; }
.modal-scroll-body { padding: 0 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.filter-modal-section { margin-bottom: 16px; }
.filter-modal-section > label { margin-bottom: 6px; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; border: 1px solid var(--green-light); border-radius: 8px; padding: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 0.9rem; margin: 0; }
.checkbox-item input { width: auto; }
.modal-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px 20px;
  flex-shrink: 0;
  border-top: 1px solid var(--green-light);
}
.modal-actions .btn { margin-top: 0; }

/* Wider modal variant — the student-details drill-down table needs more
   room than the default 480px modal-box (used for filter pickers etc.). */
.modal-box-wide { max-width: 720px; }

/* A count that opens the drill-down details modal — styled as a link so
   it reads as clickable without needing a full button treatment inside a
   table cell. */
.count-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--green-dark);
  text-decoration: underline;
  cursor: pointer;
}
.count-link:hover { color: var(--green); }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--green-light);
  flex-shrink: 0;
  font-size: 0.85rem;
}
.pagination-bar .btn { margin-top: 0; padding: 8px 14px; font-size: 0.85rem; }
.admin-table-scroll { overflow-x: auto; }
.prize-table-item { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.prize-table-item img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; }
.admin-prize-catalogue { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.admin-prize-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: 14px; min-width: 0; padding: 14px; border: 1px solid #dceade; border-radius: 16px; background: #fff; box-shadow: 0 5px 16px rgba(27, 94, 55, 0.08); }
.admin-prize-card > img, .admin-prize-placeholder { display: block; width: 88px; height: 88px; max-width: 88px; border-radius: 12px; object-fit: cover; background: var(--green-light); }
.admin-prize-placeholder { display: grid; place-items: center; font-size: 2rem; }
.admin-prize-copy { min-width: 0; }
.admin-prize-copy .stat-row { align-items: flex-start; gap: 8px; }
.admin-prize-copy strong { overflow-wrap: anywhere; }
.admin-prize-copy p { margin: 6px 0; white-space: pre-wrap; }
.admin-prize-copy .btn { margin-top: 6px; }

.prize-grid { display: grid; gap: 16px; }
.prize-card { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 18px; text-align: left; }
.prize-card-image { width: 100%; aspect-ratio: 1; border-radius: 16px; object-fit: cover; background: var(--green-light); }
.prize-card-placeholder { display: grid; place-items: center; font-size: 3rem; }
.prize-card h3 { margin: 0 0 4px; }
.prize-card .pill-status { display: inline-block; margin-bottom: 8px; }
.prize-extra { padding: 9px 12px; border-radius: 10px; background: var(--cream); }
.prize-claim-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--green-light); }
.prize-popup { z-index: 300; }
.prize-popup-content { text-align: center; }
.prize-popup-content img { width: min(220px, 80%); max-height: 220px; object-fit: contain; border-radius: 18px; margin: 8px auto 14px; }
@media (max-width: 520px) {
  .admin-prize-catalogue { grid-template-columns: minmax(0, 1fr); }
  .admin-prize-card { grid-template-columns: 72px minmax(0, 1fr); }
  .admin-prize-card > img, .admin-prize-placeholder { width: 72px; height: 72px; max-width: 72px; }
  .prize-card { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; padding: 16px; }
}

.chart-pie-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.chart-legend { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.chart-legend-row { display: flex; align-items: center; gap: 8px; }
.chart-legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

.chart-bars { display: flex; flex-direction: column; gap: 8px; }
.chart-bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 8px; font-size: 0.85rem; }
.chart-bar-track { background: #eef3ee; border-radius: 999px; height: 14px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 999px; }
.chart-bar-value { font-weight: 700; text-align: right; min-width: 24px; }

.admin-filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (min-width: 700px) {
  .admin-filter-bar { grid-template-columns: repeat(5, 1fr); align-items: end; }
}
.admin-filter-bar label { margin: 0 0 4px; font-size: 0.8rem; }
.admin-filter-bar .filter-field { display: flex; flex-direction: column; }
.admin-filter-bar select, .admin-filter-bar input[type="date"] { padding: 10px; font-size: 0.9rem; }
.admin-filter-bar .btn { width: auto; padding: 10px 16px; margin-top: 0; }

/* ===========================================================
   SITE SHELL — shared top bar + left nav drawer, injected by
   public/js/layout.js on every page (marketing AND app pages).
   See public/js/layout.js for the markup this styles.
   =========================================================== */

:root {
  --site-max-width: 1140px;
  --shadow: 0 10px 30px rgba(20, 92, 52, 0.12);
}

/* Sticky belongs on #site-header (a direct child of body), not on .site-topbar:
   sticky can only travel within its parent's box, which for .site-topbar is
   just one topbar tall — so it scrolls away instantly. */
#site-header { position: sticky; top: 0; z-index: 200; }

.site-topbar {
  background: rgba(255, 250, 241, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(31, 139, 76, 0.15);
}

.site-topbar-inner {
  max-width: var(--site-max-width);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger-btn {
  border: none;
  background: none;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 3px;
  background: var(--green-dark);
  border-radius: 2px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--green-dark);
  font-size: 1.1rem;
  text-decoration: none;
  flex-shrink: 0;
}
.site-brand img { width: 30px; height: 30px; }

.site-brand-campaign {
  align-self: stretch;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  line-height: 1;
}
.site-brand-campaign .campaign-brand-logo {
  width: 58px;
  height: 44px;
  object-fit: contain;
}
.site-brand-campaign .site-brand-name {
  margin-top: -2px;
  color: var(--green-dark);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}
.site-brand-partners {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.site-partner {
  display: flex;
  align-items: center;
  gap: 5px;
}
.site-partner-label {
  max-width: 48px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.05;
  text-align: right;
  text-transform: uppercase;
}
.site-partner img {
  width: 34px;
  height: 36px;
  object-fit: contain;
}

.site-topbar-spacer { flex: 1; }

.site-games-tab {
  font-weight: 800;
  color: var(--white);
  background: var(--green);
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.site-games-tab:hover { background: var(--green-dark); }

/* Unlike the hamburger/brand/lang-toggle (fixed-size, always flex-shrink: 0),
   this one MUST be allowed to shrink — its content (a student's real name)
   is unbounded length, so it's the pressure valve when the topbar is tight.
   min-width: 0 overrides the flexbox default of min-width: auto, which
   otherwise refuses to shrink an item below its content's natural width —
   see #profile-chip-name below for where the actual truncation happens. */
.site-auth-area { display: flex; align-items: center; gap: 8px; min-width: 0; }

.btn-login-pill {
  background: var(--orange);
  color: var(--white);
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.profile-chip-wrap { position: relative; min-width: 0; }
.profile-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}
/* A real student name is unbounded length — truncate with an ellipsis
   instead of forcing the whole topbar to overflow horizontally (this was
   the actual root cause of the reported topbar overflow: nothing here
   shrank or truncated, so a longer name just pushed the topbar wider than
   the viewport on any screen narrower than the name's full text width). */
#profile-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
@media (max-width: 380px) {
  #profile-chip-name { max-width: 80px; }
}
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 180px;
  overflow: hidden;
  z-index: 250;
}
.profile-dropdown a, .profile-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: none;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
}
.profile-dropdown a:hover, .profile-dropdown button:hover { background: var(--green-light); }

/* Left nav drawer */
.nav-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 300;
}
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  max-width: 85vw;
  background: var(--white);
  z-index: 310;
  box-shadow: var(--shadow);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
.nav-drawer.open { transform: translateX(0); }
.nav-drawer-close {
  border: none;
  background: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--ink-soft);
  float: right;
}
.nav-drawer-list { list-style: none; margin: 20px 0 0; padding: 0; }
.nav-drawer-list li a {
  display: block;
  padding: 12px 8px;
  font-weight: 700;
  color: var(--green-dark);
  text-decoration: none;
  border-radius: 10px;
}
.nav-drawer-list li a:hover, .nav-drawer-list li a.active { background: var(--green-light); }
.nav-drawer-list li { border-bottom: 1px solid var(--green-light); }

/* ===========================================================
   MARKETING/CONTENT PAGES — wide container + sections, ported
   from the earlier informational-site design.
   =========================================================== */

.container { max-width: var(--site-max-width); margin: 0 auto; padding: 0 24px; }

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-dark);
  background: #fff3e0;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero {
  position: relative;
  padding: 48px 0 64px;
  background: radial-gradient(circle at 85% 20%, #d7f2e0 0%, transparent 55%),
              radial-gradient(circle at 10% 90%, #ffe8c9 0%, transparent 45%),
              var(--cream);
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 2.4rem; margin-bottom: 18px; }
.hero .lede { font-size: 1.1rem; max-width: 520px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 24px; }
.hero-actions .btn { width: auto; }

.page-hero {
  padding: 48px 0 56px;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: var(--white);
  text-align: center;
}
.page-hero h1 { color: var(--white); font-size: 2.2rem; }
.page-hero p { color: rgba(255,255,255,0.9); max-width: 640px; margin: 0 auto; }
.page-hero .eyebrow { background: rgba(255,255,255,0.18); color: var(--white); }

.section { padding: 56px 0; }
.section-alt { background: var(--green-light); }
.section-header { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.section-header h2 { font-size: 1.9rem; }

.content-grid { display: grid; gap: 20px; }
.content-grid-2 { grid-template-columns: repeat(2, 1fr); }
.content-grid-3 { grid-template-columns: repeat(3, 1fr); }
.content-grid-4 { grid-template-columns: repeat(4, 1fr); }

.content-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.content-card .icon-badge {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 1.4rem;
}

.mascot-callout {
  display: flex; align-items: center; gap: 20px;
  background: var(--white); border-radius: var(--radius);
  padding: 24px 28px; box-shadow: var(--shadow);
}
.mascot-callout img { width: 80px; flex-shrink: 0; }

.cta-band {
  background: linear-gradient(120deg, var(--green-dark), var(--green));
  border-radius: var(--radius);
  padding: 44px 32px;
  text-align: center;
  color: var(--white);
}
.cta-band h2 { color: var(--white); }
.cta-band p { color: rgba(255,255,255,0.9); }
.cta-band .hero-actions { justify-content: center; }

.state-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.state-card .state-head { padding: 16px 22px; color: var(--white); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.state-card.up .state-head { background: linear-gradient(120deg, var(--orange-dark), var(--orange)); }
.state-card.mp .state-head { background: linear-gradient(120deg, var(--green-dark), var(--green)); }
.state-card .state-body { padding: 20px 22px; }
.district-chip {
  background: var(--green-light); color: var(--green-dark); font-weight: 700;
  font-size: 0.85rem; padding: 6px 14px; border-radius: 999px; display: inline-block; margin: 4px;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 10px; }
.content-tag {
  background: var(--white); border: 2px solid var(--green-light); color: var(--green-dark);
  font-weight: 700; font-size: 0.9rem; padding: 8px 16px; border-radius: 999px;
}

.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 16px; padding-bottom: 24px; position: relative; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: var(--white);
  font-weight: 800; display: flex; align-items: center; justify-content: center; position: relative; z-index: 2;
}

.site-footer { background: var(--green-dark); color: rgba(255,255,255,0.85); padding: 40px 0 20px; margin-top: 32px; }
.site-footer h4 { color: var(--white); font-size: 0.95rem; margin-bottom: 12px; }
.site-footer a { color: rgba(255,255,255,0.75); text-decoration: none; }
.site-footer a:hover { color: var(--white); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 28px; padding-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.15); }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-disclosure { margin: 0; padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.92); font-size: 0.9rem; font-weight: 600; line-height: 1.6; text-align: center; }
.footer-bottom { padding-top: 16px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 0.8rem; }

/* Games — horizontal preview row (homepage) + full grid (games.html) */
.games-scroll-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.game-card {
  flex: 0 0 220px;
  scroll-snap-align: start;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.game-card .game-emoji { font-size: 2rem; margin-bottom: 10px; }
.game-card h4 { margin: 0 0 6px; color: var(--green-dark); font-size: 1rem; }
.game-card p { margin: 0; font-size: 0.85rem; }
.game-card.coming-soon { opacity: 0.6; cursor: default; }
.game-card .soon-pill {
  display: inline-block; background: var(--green-light); color: var(--green-dark);
  font-size: 0.7rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

/* ===========================================================
   "Sort It Out" wet/dry waste sorting game (public/sort-it-out.html).
   Emoji items = zero asset weight, already vector-quality — see
   sortItOutItems.js for why. All feedback is plain CSS, no libraries.
   =========================================================== */

.sort-screen { max-width: 640px; position: relative; }

.sort-mute-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  cursor: pointer;
}

.sort-duration-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 20px;
}
.sort-duration-picker button {
  border: 2px solid var(--green);
  background: var(--white);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.sort-duration-picker button:active { background: var(--green-light); }
.sort-duration-picker button:disabled { opacity: 0.4; cursor: not-allowed; }
#duration-display {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--green-dark);
  min-width: 64px;
  text-align: center;
}

/* ===========================================================
   Generic games framework (public/js/gamesCommon.js) — shared mute
   button + duration picker for any game built on it. Reuses the exact
   same visual language as Sort It Out's .sort-mute-btn/.sort-duration-picker
   (which predate this and keep their own copy, not refactored onto this).
   =========================================================== */
.games-mute-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 1.2rem;
  cursor: pointer;
}

.games-duration-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 20px;
}
.games-duration-picker button {
  border: 2px solid var(--green);
  background: var(--white);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.games-duration-picker button:active { background: var(--green-light); }
.games-duration-picker button:disabled { opacity: 0.4; cursor: not-allowed; }
.games-duration-display {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--green-dark);
  min-width: 64px;
  text-align: center;
}

.sort-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.sort-hud span { display: flex; align-items: center; gap: 4px; }

.sort-item-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  position: relative;
}
.sort-item-emoji {
  font-size: 7rem;
  line-height: 1;
  /* --float-duration is set inline per-item by nextItem() in
     sort-it-out.html, tightening as the difficulty tier climbs (see
     DIFFICULTY_TIERS) — falls back to the Easy-tier speed if unset. */
  animation: sort-float var(--float-duration, 2.2s) ease-in-out infinite;
  filter: drop-shadow(0 10px 14px rgba(20, 92, 52, 0.18));
}
.sort-item-name { font-weight: 700; font-size: 1.15rem; color: var(--ink); margin-top: 14px; text-align: center; }

.sort-item-stage.correct .sort-item-emoji { animation: sort-drop 0.5s ease-in forwards; }
.sort-item-stage.wrong .sort-item-emoji { animation: sort-shake 0.4s ease; }

.sort-feedback {
  position: absolute;
  top: 0;
  font-weight: 800;
  font-size: 1.1rem;
  opacity: 0;
}
.sort-feedback.correct { color: var(--green-dark); animation: sort-feedback-pop 0.8s ease forwards; }
.sort-feedback.wrong { color: var(--danger); animation: sort-feedback-pop 0.8s ease forwards; }

.sort-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.sort-bin {
  border: none;
  border-radius: var(--radius);
  padding: 36px 12px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--white);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.1s ease;
}
.sort-bin:active { transform: scale(0.96); }
.sort-bin-wet { background: linear-gradient(160deg, var(--green), var(--green-dark)); }
.sort-bin-dry { background: linear-gradient(160deg, #2f7fd1, #1b5490); }
.sort-bin-recyclable { background: linear-gradient(160deg, var(--green), var(--green-dark)); }
.sort-bin-not-recyclable { background: linear-gradient(160deg, #c0392b, #922b21); }
.sort-bin .bin-emoji { font-size: 2.6rem; }
.sort-bin.glow-correct { box-shadow: 0 0 0 4px #ffd66b, 0 0 24px 4px rgba(255, 214, 107, 0.7); }

/* Phone screens: use full width, bigger tap targets, bigger everything */
@media (max-width: 480px) {
  .sort-screen { padding-left: 0; padding-right: 0; }
  .sort-screen .card { border-radius: 0; box-shadow: none; }
  .sort-item-emoji { font-size: 8rem; }
  .sort-item-stage { min-height: 300px; }
  .sort-bin { padding: 44px 10px; font-size: 1.3rem; }
  .sort-bin .bin-emoji { font-size: 3rem; }
}

/* Larger screens: this game gets more room than the site's usual narrow
   mobile-first max-width — it's meant to fill the viewport, not sit in a
   small centered card with empty space on both sides. */
@media (min-width: 700px) {
  .sort-screen { max-width: 820px; }
  .sort-item-emoji { font-size: 9rem; }
  .sort-item-stage { min-height: 320px; }
  .sort-bin { padding: 48px 16px; font-size: 1.35rem; }
  .sort-bin .bin-emoji { font-size: 3.2rem; }
}

.sort-confetti-piece {
  position: absolute;
  top: 40%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: sort-confetti 0.7s ease-out forwards;
}

@keyframes sort-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes sort-drop {
  to { transform: translateY(120px) scale(0.4); opacity: 0; }
}
@keyframes sort-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}
@keyframes sort-feedback-pop {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  30% { transform: translateY(-10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-40px) scale(1); opacity: 0; }
}
@keyframes sort-confetti {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx, 40px), var(--dy, -60px)) rotate(360deg); opacity: 0; }
}

/* ===========================================================
   Memory Match (public/memory-match.html) — a different UI paradigm
   than the tap-a-bin games, still on the generic games framework.
   =========================================================== */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.memory-card {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease;
}
.memory-card:active { transform: scale(0.94); }
.memory-card .card-face { display: none; }
.memory-card.flipped, .memory-card.matched {
  background: var(--white);
  border-color: var(--green-light);
  cursor: default;
}
.memory-card.flipped .card-back, .memory-card.matched .card-back { display: none; }
.memory-card.flipped .card-face, .memory-card.matched .card-face { display: block; }
.memory-card.matched { opacity: 0.7; animation: memory-pop 0.3s ease; }
.memory-card.matched.matched-wet { border-color: var(--green-dark); box-shadow: inset 0 0 0 3px var(--green-dark); }
.memory-card.matched.matched-dry { border-color: #1b5490; box-shadow: inset 0 0 0 3px #1b5490; }
.memory-card.mismatch { animation: sort-shake 0.4s ease; }

@keyframes memory-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@media (max-width: 480px) {
  .memory-card { font-size: 1.6rem; }
}
@media (min-width: 700px) {
  .memory-card { font-size: 2.6rem; }
}

/* ===========================================================
   Odd One Out (public/odd-one-out.html) — a third UI paradigm on the
   games framework: 4 items shown at once, tap the one that doesn't
   belong (vs. Sort It Out's 2-bin classification and Memory Match's
   card-flip pairs).
   =========================================================== */
.oddoneout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}
.oddoneout-item {
  border: 2px solid #dfe7e1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.oddoneout-item:active { transform: scale(0.96); }
.oddoneout-item .item-emoji { font-size: 2.6rem; }
.oddoneout-item .item-name { font-weight: 700; font-size: 0.85rem; text-align: center; color: var(--ink); }
.oddoneout-item.correct { border-color: var(--green); background: var(--green-light); animation: memory-pop 0.3s ease; }
.oddoneout-item.wrong { border-color: var(--danger); background: #fdecea; animation: sort-shake 0.4s ease; }
.oddoneout-item.reveal-correct { border-color: var(--green); box-shadow: 0 0 0 3px #ffd66b; }
.oddoneout-item.cat-wet { box-shadow: inset 0 0 0 3px var(--green-dark); }
.oddoneout-item.cat-dry { box-shadow: inset 0 0 0 3px #1b5490; }
.oddoneout-item.reveal-correct.cat-wet, .oddoneout-item.reveal-correct.cat-dry { box-shadow: 0 0 0 3px #ffd66b; }

@media (min-width: 700px) {
  .oddoneout-grid { grid-template-columns: repeat(4, 1fr); }
  .oddoneout-item .item-emoji { font-size: 3.2rem; }
}

/* ===========================================================
   The Path of My Trash (public/path-of-my-trash.html) — tap-to-order
   sequencing. Reuses .oddoneout-item/.oddoneout-grid for the tappable
   tile pool (same "card with emoji + name" shape), adds a progress bar
   showing the sequence assembled so far.
   =========================================================== */
.path-assembled {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 56px;
  margin-bottom: 16px;
  padding: 10px;
  background: var(--green-light);
  border-radius: 12px;
}
.path-assembled .path-slot { font-size: 1.7rem; }
.path-assembled .path-arrow { color: var(--green-dark); font-weight: 800; }
.path-assembled .path-empty { color: var(--ink-soft); font-size: 0.85rem; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .content-grid-2, .content-grid-3, .content-grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .content-grid-2, .content-grid-3, .content-grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.9rem; }
  .site-games-tab span.games-label-full { display: none; }
}

/* Most current phones (390-430px) sit in the range where the games pill
   already drops its label (see the 640px query above) but the "HARIT"
   wordmark was still full-width — that's what left almost no room for a
   real student's name in the auth area and forced it down to 1-2 letters.
   Dropping the wordmark (mascot icon alone still reads as the brand) at
   this wider breakpoint fixes that for the large majority of phones, not
   just the smallest ones. */
@media (max-width: 700px) {
  .site-brand-partners { gap: 5px; }
  .site-partner { gap: 0; }
  .site-partner-label { display: none; }
  .site-partner img { width: 28px; height: 30px; }
}

@media (max-width: 480px) {
  .site-brand:not(.site-brand-campaign) span { display: none; }
  .site-brand-campaign .campaign-brand-logo { width: 44px; height: 34px; }
  .site-brand-campaign .site-brand-name { display: block; font-size: 0.58rem; }
  .campaign-topbar .site-games-tab { display: none; }
}

/* Small phones (~5" screens, ~320-380px wide): the topbar has 5 flex items
   (hamburger, brand, games pill, lang toggle, auth area) competing for very
   little room. Trim padding/font-size rather than letting anything get
   silently crushed by flexbox shrinking (see .lang-toggle's flex-shrink fix
   above — this is the same underlying issue, one tier down). */
@media (max-width: 380px) {
  .site-topbar-inner { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .site-brand-partners { gap: 2px; }
  .site-partner img { width: 24px; height: 27px; }
  .site-brand-campaign .campaign-brand-logo { width: 40px; height: 31px; }
  .site-games-tab { padding: 8px 10px; }
  .lang-toggle button { padding: 6px 9px; font-size: 0.78rem; }
  .btn-login-pill { padding: 8px 12px; font-size: 0.8rem; }
  .profile-chip { padding: 6px 9px; font-size: 0.78rem; }
}

/* Unified top-center game toast (GamesCommon.showToast — see CLAUDE.md's
   "unified game toast" note). One shared element #games-toast created on
   first use and identical in every game, so feedback popups read as one
   consistent pattern across the app (previously each game hand-rolled its
   own copy). Sits above the sticky topbar (z-index 400 > #site-header's
   200) — same overlap the per-game toasts had. text-align center + the
   fixed-ish top placement suit short bilingual lines; keep them under ~10
   words so they don't crowd the tab bar. */
#games-toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-130%);
  z-index: 400;
  max-width: 90vw;
  padding: 10px 18px;
  border-radius: 14px;
  background: linear-gradient(145deg, #eaf6fb, #bfeff5);
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s ease;
  pointer-events: none;
}
#games-toast.show { transform: translateX(-50%) translateY(0); }

/* Learnings recap — a titled "What you learned" card holding a 2-column
   grid of compact learning cards (emoji circle + marker line + correct
   answer, optional longer lesson). No mascot image — a plain data recap
   any game reads consistently. Rendered by GamesCommon.renderEndScreen()
   inline (the `learnings` option — the path every game takes) or, for a
   standalone container, GamesCommon.renderLearningsBox() (gamesCommon.js). */
#learnings-box { max-width: 560px; margin: 18px auto 0; }
.learning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.learning-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #eff9ef;
  border-radius: 12px;
  min-width: 0;
  box-shadow: 0 2px 0 rgba(19, 65, 36, 0.08);
}
.learning-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(19, 65, 36, 0.08);
}
.learning-content { min-width: 0; }
.learning-content strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.9rem;
  color: var(--ink);
}
.learning-content .l-correct { font-size: 0.85rem; }
.learning-content .l-exp { font-size: 0.82rem; color: var(--ink-soft); }
.learnings-perfect {
  margin: 0;
  padding: 10px 14px;
  background: var(--green-light);
  border-radius: 10px;
  color: var(--green-dark);
  font-weight: 700;
  text-align: center;
}
.l-correct { display: block; color: var(--green-dark); font-weight: 700; }
.l-exp { display: block; margin-top: 2px; }

/* ---- Result "scoreboard" — shared by EVERY framework game, rendered by
   GamesCommon.renderEndScreen() (gamesCommon.js). A colorful celebration
   screen that keeps everything on one page (phones included): a green
   gradient hero with confetti, the headline stat in a conic score ring,
   the rest of the stats as pastel color-coded tiles, a rewards row
   (+points pill + new badges), the Learnings recap, and a compact
   icon-button action row (replay = 🔄 refresh icon, not a fat pill).
   Palette/structure loosely inspired by a client-side result mockup;
   deliberately NOT collapsible on mobile — all info stays visible. ---- */
/* The `.shell-result-screen.card` strip below used to live in
   gameShell.css (only linked by shell games); it moved here so EVERY game
   gets the identical flat scoreboard regardless of whether the page
   links that stylesheet. */
.shell-result-screen { text-align: center; }
.shell-result-screen.card {
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin-bottom: 0;
}
.games-result { max-width: 600px; margin: 0 auto; }

/* ---- hero ---- */
.games-result-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 86px;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(115deg, #f0f9ea 0%, #f7fff6 45%, #e9f8e9 100%);
  border: 1px solid #e6f1e4;
  box-shadow: 0 6px 18px rgba(19, 65, 36, 0.08);
  overflow: hidden;
}
.games-result-hero h2 { margin: 0; color: var(--green); font-size: 1.4rem; line-height: 1.15; }
.games-result-hero p { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.85rem; }
.games-result-hero-visual {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  height: 62px;
}
.games-result-hero-trophy {
  font-size: 40px;
  line-height: 1;
  transform: rotate(8deg);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.14));
  animation: games-trophy-pop 0.5s ease-out;
}
@keyframes games-trophy-pop {
  0% { transform: rotate(8deg) scale(0.5); opacity: 0; }
  60% { transform: rotate(8deg) scale(1.18); }
  100% { transform: rotate(8deg) scale(1); }
}
.games-confetti span {
  position: absolute;
  width: 7px;
  height: 12px;
  border-radius: 3px;
  pointer-events: none;
}
.games-confetti span:nth-child(1) { top: 6%; left: 8%; background: #ff5a76; transform: rotate(30deg); }
.games-confetti span:nth-child(2) { top: 34%; left: 0; background: #2294ec; transform: rotate(-20deg); }
.games-confetti span:nth-child(3) { top: 10%; right: 30%; background: #f7b325; }
.games-confetti span:nth-child(4) { top: 52%; right: 4%; background: #5ac778; transform: rotate(-28deg); }
.games-confetti span:nth-child(5) { top: 78%; left: 22%; background: #f45d48; transform: rotate(18deg); }
.games-confetti span:nth-child(6) { top: 20%; left: 52%; background: #995bd5; transform: rotate(40deg); scale: 0.85; }

/* guest warning banner — always the very first thing on the result
   screen, red + centered so a guest can't miss that their score won't
   be saved */
.games-result-guest {
  margin: 0 0 10px;
  color: #d64545;
  font-weight: 600;
  font-size: 0.88rem;
  text-align: center;
}
/* high-score pill — lives INSIDE the hero's "Well done" text block */
.games-result-moti {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eff9ef, #f6fbef);
  border: 1px solid #dcefda;
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.82rem;
}
/* ---- "Your Performance" card — a single white box wrapping the score
   ring (first stat) + the pastel stat tiles, like the client mock's
   performance panel ---- */
.games-result-card {
  background: var(--white);
  border: 1px solid #e8ede9;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(19, 65, 36, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
}
.games-result-card-title {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--green-dark);
}
.games-result-perf { padding: 12px 16px; margin-top: 12px; text-align: left; }
.games-result-perf-grid {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
/* ---- share the perf box's card skin with the Learnings card ---- */
.learnings-card { margin-top: 12px; padding: 12px 16px; text-align: left; }
.games-result-score {
  width: 132px;
  height: 132px;
  margin: auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--green) 0deg var(--fill, 360deg), #e8ece9 var(--fill, 0deg));
  box-shadow: 0 6px 16px rgba(19, 65, 36, 0.14);
}
.games-result-score::before {
  content: "";
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--white);
}
.games-result-score-content { position: relative; z-index: 2; text-align: center; }
.games-result-score-content strong {
  display: block;
  font-size: 27px;
  line-height: 1;
  color: var(--green);
  font-weight: 800;
}
.games-result-score-content span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.games-result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.games-result-tile {
  min-height: 76px;
  padding: 10px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
}
.games-result-tile-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.games-result-tile-text strong { display: block; font-size: 22px; line-height: 1; }
.games-result-tile-text span { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.games-result-tile.is-green { color: var(--green-dark); background: var(--green-light); }
.games-result-tile.is-green .games-result-tile-icon { background: #54c66d; }
.games-result-tile.is-red { color: #b3261e; background: #fff0f0; }
.games-result-tile.is-red .games-result-tile-icon { background: #ef4444; }
.games-result-tile.is-blue { color: #1b5fa8; background: #edf6ff; }
.games-result-tile.is-blue .games-result-tile-icon { background: #2586e9; }
.games-result-tile.is-orange { color: #b35f00; background: #fff3e7; }
.games-result-tile.is-orange .games-result-tile-icon { background: #ff9223; }

/* ---- rewards row ---- */
.games-result-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}
.points-pill {
  background: linear-gradient(135deg, #ff9223, #ffb347);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(246, 146, 30, 0.35);
}
.games-result-rewards .badge-pill { background: var(--cream); border: 2px solid var(--green-light); }

/*
 * Small "🏆 game leaderboard" button injected by layout.js onto every
 * catalog game card (`.game-card-new[data-game-key]` on harit.html /
 * games.html / dashboard.html). Mirrors the `.game-badge` pill but sits
 * top-right; opens the same per-game leaderboard popup as a result
 * screen's "View Leaderboard" link (GamesCommon.openGameLeaderboard).
 */
.lb-card-btn {
  position: absolute;
  z-index: 6;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 16px rgba(4, 24, 18, 0.16);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.15s;
  user-select: none;
}
.lb-card-btn:hover { transform: scale(1.12); }
.game-card-new.coming-soon .lb-card-btn,
.game-card-new.hidden .lb-card-btn { display: none; }

/* Learnings recap card rendered inline inside the end screen
   (renderEndScreen's `learnings` option) — a titled card, no mascot. */
.games-result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}
.games-result-action {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--green-light);
  background: var(--white);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 rgba(24, 58, 51, 0.12);
  transition: transform 0.08s ease;
}
.games-result-action:hover { transform: translateY(-1px); }
.games-result-action:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(24, 58, 51, 0.12); }
.games-result-action.is-primary { background: var(--green); border-color: var(--green); }
.games-result-action.is-next { background: #eaf3ff; border-color: #c9e0ff; }
.games-result-action.is-home { background: var(--green-light); border-color: #cde9d5; }

/* Per-game leaderboard — the result screen's "View Leaderboard" link
   (leaderboardGameKey in renderEndScreen) + the popup modal it opens. */
.games-lb-open {
  display: block;
  margin: 14px auto 0;
  padding: 9px 22px;
  border-radius: 999px;
  border: 2px solid var(--green);
  background: var(--white);
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s ease;
}
.games-lb-open:active { background: var(--green-light); }

.games-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 30, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: gamesLbFade 0.18s ease-out;
}
.games-lb-overlay.hidden { display: none; }
.games-lb-box {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: gamesLbPop 0.22s ease-out;
}
.games-lb-head {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: var(--white);
  padding: 18px 44px 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.games-lb-trophy { font-size: 2rem; line-height: 1; }
.games-lb-title { color: var(--white); margin: 0; font-size: 1.1rem; line-height: 1.25; }
.games-lb-sub { margin: 3px 0 0; font-size: 0.78rem; color: rgba(255, 255, 255, 0.85); }
.games-lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.games-lb-close:active { background: rgba(255, 255, 255, 0.32); }
.games-lb-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px 0;
  border-bottom: 1px solid #eceff1;
}
.games-lb-tab {
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--green-light);
  background: var(--white);
  color: var(--green-dark);
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}
.games-lb-tab.is-active { background: var(--green); border-color: var(--green); color: var(--white); }
.games-lb-body { overflow-y: auto; padding: 14px 16px 18px; }
.games-lb-list { display: flex; flex-direction: column; gap: 8px; }
.games-lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f7faf8;
  border: 1px solid #e6efe9;
}
.games-lb-row.is-pod-1 { background: linear-gradient(180deg, #fff7d6, #fbefc0); border-color: #f3df93; }
.games-lb-row.is-pod-2 { background: linear-gradient(180deg, #f5f6f8, #e9ebef); border-color: #d8dce3; }
.games-lb-row.is-pod-3 { background: linear-gradient(180deg, #fcead9, #f6d8bb); border-color: #ecbf95; }
.games-lb-row.is-you { outline: 2px solid var(--green); outline-offset: -1px; }
.games-lb-rank {
  min-width: 32px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--green-dark);
}
.games-lb-meta { flex: 1; overflow: hidden; }
.games-lb-meta strong {
  display: block;
  font-size: 0.92rem;
  color: #263238;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.games-lb-meta span {
  display: block;
  font-size: 0.72rem;
  color: #78909c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.games-lb-score {
  flex: none;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--green);
  background: var(--white);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #dcebe1;
}
.games-lb-you-chip {
  flex: none;
  background: var(--green);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
}
.games-lb-youcard {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--green-light);
  border: 1px dashed var(--green);
}
.games-lb-youcard strong { display: block; font-size: 0.8rem; color: var(--green-dark); }
.games-lb-youcard > span { color: var(--green-dark); font-size: 1.2rem; }
.games-lb-youcard div span { font-size: 0.85rem; color: var(--green-dark); font-weight: 600; }
.games-lb-empty { text-align: center; color: #78909c; padding: 40px 16px; font-size: 0.95rem; }
.games-lb-empty-icon { font-size: 3rem; display: block; margin-bottom: 8px; }
.games-lb-empty.is-error { color: #d64545; }
@keyframes gamesLbFade { from { opacity: 0; } }
@keyframes gamesLbPop {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
}

@media (max-width: 460px) {
  .games-result-perf-grid { grid-template-columns: 1fr; gap: 8px; }
  .games-result-score { width: 122px; height: 122px; }
  .games-result-score::before { width: 96px; height: 96px; }
  .games-result-score-content strong { font-size: 25px; }
  .games-result-hero { grid-template-columns: 1fr 56px; padding: 12px 14px; }
  .games-result-hero h2 { font-size: 1.2rem; }
  .games-result-hero-trophy { font-size: 30px; }
  .games-result-tile { min-height: 68px; padding: 9px; }
  .games-result-tile-text strong { font-size: 20px; }
  .games-result-action { width: 40px; height: 40px; font-size: 17px; }
  .games-result-card { padding: 12px; }
  .learning-grid { grid-template-columns: 1fr; }
}
