:root {
  --bg0: #f3f6f8;
  --bg1: #ffffff;
  --ink: #14181c;
  --muted: #5b6670;
  --line: rgba(20, 24, 28, 0.1);
  --blood: #e10600;
  --hi-vis: #ffc300;
  --night: #0f1b2d;
  --clinic: #00a896;
  --accent: var(--blood);
  --accent-2: var(--hi-vis);
  --danger: #e10600;
  --ok: #00a896;
  --radius: 18px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Syne", "Arial Black", sans-serif;
  --shadow: 0 12px 28px rgba(15, 27, 45, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(255, 195, 0, 0.28), transparent 55%),
    radial-gradient(700px 380px at -10% 20%, rgba(225, 6, 0, 0.12), transparent 50%),
    linear-gradient(180deg, #f7fafc 0%, #eef3f6 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background:
    repeating-linear-gradient(
      -45deg,
      #0f1b2d 0 10px,
      #ffc300 10px 20px,
      #0f1b2d 20px 30px,
      #e10600 30px 40px
    );
  z-index: 0;
}
body.mobile-emulate {
  display: flex;
  justify-content: center;
  padding: 16px 0 28px;
  background: #d9e1e8;
}
body.mobile-emulate .device-shell {
  width: 390px;
  max-width: 100%;
  height: 844px;
  max-height: 844px;
  min-height: 0;
  border: 1px solid rgba(15, 27, 45, 0.12);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 50px rgba(15, 27, 45, 0.18);
  background: var(--bg1);
}
.device-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,250,252,0.96));
}
.hidden { display: none !important; }

.chrome-top {
  position: sticky;
  top: 0;
  z-index: 8;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(15, 27, 45, 0.06);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 3px solid var(--hi-vis);
  position: relative;
  z-index: 1;
  background: transparent;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background:
    linear-gradient(135deg, var(--blood) 0 48%, var(--hi-vis) 48% 100%);
  box-shadow: 0 6px 0 var(--night);
}
.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.brand-sub { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top-actions > .profile-chip {
  min-height: 44px;
  min-width: 7.75rem;
  padding: 10px 14px;
  box-sizing: border-box;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 14px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.top-actions > .chrome-icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  color: var(--ink);
}
.top-actions > .chrome-icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}
.top-actions > .chrome-icon-btn .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
  width: 22px;
  height: 22px;
}
.top-actions > .chrome-icon-btn.active {
  border-color: var(--blood);
  color: var(--blood);
  background: #fff5f4;
  box-shadow: 0 4px 0 #b00400;
}

.music-mute-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
}
.music-mute-btn .material-symbols-outlined {
  font-size: 1.25rem;
  line-height: 1;
}
.music-mute-btn.active {
  border-color: var(--blood);
  color: var(--blood);
  background: #fff5f4;
  box-shadow: 0 4px 0 #b00400;
}

.ghost-btn, .primary-btn, .answer-btn, .text-btn {
  font: inherit; cursor: pointer; border: 0;
}
.ghost-btn, .text-btn {
  background: #fff;
  color: var(--ink);
  border: 2px solid rgba(15, 27, 45, 0.12);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.12);
  transition: transform .12s ease, box-shadow .12s ease;
}
.ghost-btn:active, .text-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(15, 27, 45, 0.12);
}
.ghost-btn.active {
  border-color: var(--blood);
  color: var(--blood);
  background: #fff5f4;
  box-shadow: 0 4px 0 #b00400;
}
.primary-btn {
  background: var(--blood);
  color: #fff;
  font-weight: 800;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 6px 0 #8f0400;
  transition: transform .12s ease, box-shadow .12s ease;
}
.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #8f0400;
}
.primary-btn.block { width: 100%; }
.primary-btn.ghost-fill {
  background: var(--hi-vis);
  color: var(--night);
  box-shadow: 0 6px 0 #c49200;
}
.primary-btn.ghost-fill:active { box-shadow: 0 3px 0 #c49200; }
.learner-chip {
  font-size: 0.72rem;
  color: var(--muted);
  border: 2px solid rgba(15, 27, 45, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #fff;
  font-weight: 700;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.12);
}
.profile-chip {
  max-width: none;
}
.profile-chip-photo {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #ffe8e6 center/cover no-repeat;
  display: inline-block;
}
.profile-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9ch;
}
.field textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.12);
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
  font-weight: 500;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.12);
}
.field textarea:focus {
  outline: none;
  border-color: var(--blood);
  box-shadow: 0 4px 0 #b00400;
}
.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}
.ok-text { color: var(--clinic); font-weight: 800; }

.verify-stage {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 0 24px;
}
.verify-mail {
  position: relative;
  background: #fff;
  border: 3px solid var(--night);
  border-radius: 22px;
  padding: 22px 18px 18px;
  box-shadow: 10px 10px 0 var(--hi-vis);
  overflow: hidden;
}
.verify-mail-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px dashed var(--blood);
  color: var(--blood);
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(12deg);
  background: #fff5f4;
}
.verify-mail-from {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
  padding-right: 64px;
}
.verify-mail h1 {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
.verify-mail p {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}
.verify-graphic {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(90deg, #fff7d6, #ffe8e6 55%, #e8fffb);
  border: 2px solid rgba(15, 27, 45, 0.08);
  margin-bottom: 14px;
  font-weight: 800;
  font-family: var(--display);
  font-size: 0.95rem;
}
.verify-graphic .material-symbols-outlined {
  color: var(--blood);
  font-size: 28px;
}
.verify-note { margin-top: 12px; font-size: 0.82rem; }
.verify-success {
  position: relative;
  text-align: center;
  background: #fff;
  border: 3px solid var(--night);
  border-radius: 22px;
  padding: 28px 18px 20px;
  box-shadow: 10px 10px 0 var(--clinic);
  overflow: hidden;
}
.verify-success-burst {
  position: absolute;
  inset: -40% -20% auto;
  height: 180px;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 195, 0, 0.35), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(225, 6, 0, 0.22), transparent 42%),
    radial-gradient(circle at 50% 30%, rgba(0, 168, 150, 0.25), transparent 45%);
  pointer-events: none;
}
.verify-success-icon {
  position: relative;
  font-size: 56px;
  color: var(--clinic);
  margin-bottom: 8px;
}
.verify-success h1 {
  position: relative;
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
.verify-success p {
  position: relative;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 16px;
}

.forgot-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  box-shadow: none;
  border: 0;
  background: transparent;
  color: var(--blood);
  font-weight: 700;
  text-decoration: underline;
  padding: 8px;
}
.person-name.presence-online {
  color: #1a7f37;
  font-weight: 700;
}
.presence-btn.unavailable {
  color: var(--muted);
}
.presence-btn .presence-icon {
  width: 22px;
  height: 22px;
  display: block;
}
.auth-switch-btn {
  margin-top: 12px;
}
.auth-panel .forgot-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
}
.home-btn {
  /* sticky chrome home — same slot forever */
}
.reset-mail { box-shadow: 10px 10px 0 var(--clinic); }
.page-actions {
  margin-top: 18px;
  justify-content: flex-start;
}
.page-actions .ghost-btn {
  min-width: 7.75rem;
}
.inbox-page .page-actions,
.profile-page .page-actions,
.group-home .page-actions {
  margin-top: 22px;
  padding-top: 4px;
}
.profile-page-top {
  margin-bottom: 28px;
}
.profile-photo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.profile-hero-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(15, 27, 45, 0.14);
  border: 3px solid #fff;
  background: #f3f6f8;
}
.profile-photo-btn {
  font-size: 0.75rem;
  padding: 8px 10px;
  cursor: pointer;
}
.profile-secrets {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.secret-reveal {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafb;
  border: 2px solid rgba(15, 27, 45, 0.08);
  word-break: break-all;
}
.secret-reveal code { font-weight: 700; }
.pass-panel {
  padding: 12px;
  border-radius: 14px;
  background: #f8fafb;
  border: 2px solid rgba(15, 27, 45, 0.08);
}
.profile-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 0 0 18px;
  padding: 0;
  background: transparent;
}
.profile-hero-copy { min-width: 0; }
.profile-hero h1 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}
.profile-hero-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #eef3f6;
  color: var(--night);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2rem;
  box-shadow: 0 4px 14px rgba(15, 27, 45, 0.12);
  border: 3px solid #fff;
  flex-shrink: 0;
}
.profile-edit h2,
.profile-meta h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-edit { margin-bottom: 12px; }
.profile-edit .row { margin-top: 4px; }

.profile-coach {
  margin-bottom: 12px;
}
.profile-coach h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.persona-lead {
  margin: 0 0 12px;
  font-size: 0.9rem;
}
.persona-actions {
  margin-top: 12px;
}
.persona-actions .primary-btn {
  min-width: 160px;
}
#persona-ok {
  margin-bottom: 10px;
}
.persona-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 720px) {
  .persona-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.persona-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #fff8f6);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.persona-card:hover {
  border-color: #f0b4a8;
  transform: translateY(-1px);
}
.persona-card.selected {
  border-color: var(--blood);
  box-shadow: 0 0 0 1px rgba(176, 32, 32, 0.12);
  background: linear-gradient(180deg, #fff, #ffeae6);
}
.persona-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.persona-icon {
  grid-row: 1 / span 2;
  font-size: 28px;
  color: var(--blood);
  margin-top: 2px;
}
.persona-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
}
.persona-blurb {
  grid-column: 2;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}
.session-inbox-hint {
  margin: 8px 0 10px;
  font-size: 0.82rem;
}

.global-ribbon {
  display: flex;
  gap: 0;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #fff7d6, #ffe8e6 55%, #e8fffb);
  font-size: 0.82rem;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  font-weight: 600;
}
.global-ribbon .ribbon-icon {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--blood);
  padding: 9px 10px 9px 14px;
  background: #fff7d6;
  position: relative;
  z-index: 2;
}
.global-ribbon .ribbon-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 9px 14px 9px 0;
}
.global-ribbon .ribbon-track {
  display: inline-block;
  animation: ribbon-marquee 22s linear infinite;
  will-change: transform;
}
.global-ribbon .ribbon-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 28px;
}
.global-ribbon .ribbon-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--blood);
}
@keyframes ribbon-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.app {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 28px;
  -webkit-overflow-scrolling: touch;
}

.promo-hero {
  padding: 10px 4px 8px;
}
.promo-hero .eyebrow {
  display: inline-block;
  color: var(--night);
  background: var(--hi-vis);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  transform: rotate(-1.5deg);
}
.promo-hero h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 14px 0 12px;
  max-width: 14ch;
}
.promo-hero p {
  color: var(--muted);
  max-width: 34rem;
  line-height: 1.45;
  margin: 0 0 18px;
  font-size: 1.02rem;
  font-weight: 500;
}
.auth-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.auth-row .primary-btn { flex: 1; min-width: 140px; text-align: center; }

.promo-grid {
  display: grid;
  gap: 12px;
}
@media (min-width: 720px) {
  body:not(.mobile-emulate) .promo-grid { grid-template-columns: 1fr 1fr; }
}
.promo-card {
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.promo-card:nth-child(1) { border-top: 5px solid var(--blood); }
.promo-card:nth-child(2) { border-top: 5px solid var(--hi-vis); }
.promo-card:nth-child(3) { border-top: 5px solid var(--clinic); }
.promo-card:nth-child(4) { border-top: 5px solid var(--night); }
.promo-card .material-symbols-outlined {
  font-size: 30px;
  color: var(--blood);
  margin-bottom: 8px;
}
.promo-card:nth-child(2) .material-symbols-outlined { color: #b88600; }
.promo-card:nth-child(3) .material-symbols-outlined { color: var(--clinic); }
.promo-card:nth-child(4) .material-symbols-outlined { color: var(--night); }
.promo-card h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.promo-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 500;
}

.auth-panel {
  max-width: 420px;
  margin: 0 auto;
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.auth-panel h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
.auth-panel p { color: var(--muted); margin: 0 0 14px; font-weight: 500; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.field input,
.field select {
  width: 100%;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.12);
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.12);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--blood) 50%),
    linear-gradient(135deg, var(--blood) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
  cursor: pointer;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--blood);
  background-color: #fff;
  box-shadow: 0 4px 0 #b00400;
}
.field select:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(15, 27, 45, 0.12);
}
.auth-error { color: var(--danger); font-size: 0.85rem; margin: 0 0 10px; font-weight: 700; }

.session-summary {
  border: 3px solid var(--night);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
  box-shadow: 8px 8px 0 var(--hi-vis);
  margin-bottom: 14px;
}
.session-summary h2 {
  font-family: var(--display);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.session-summary .ai-note {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: #f0fbf9;
  border: 2px solid rgba(0, 168, 150, 0.25);
}
.session-summary .ai-note .who {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--clinic);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.session-summary textarea {
  width: 100%;
  min-height: 64px;
  border-radius: 12px;
  border: 2px solid rgba(15, 27, 45, 0.12);
  background: #f7fafc;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  margin: 8px 0;
}
.trait-tune {
  margin: 10px 0 14px;
  display: grid;
  gap: 12px;
}
.trait-tune-title {
  margin: 14px 0 0;
  font-family: var(--display);
  font-size: 1.05rem;
}
.trait-tune-lead {
  margin: 0;
  font-size: 0.88rem;
}
.trait-row {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
}
.trait-label { font-weight: 700; }
.trait-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.trait-row input[type="range"] {
  width: 100%;
  accent-color: var(--blood);
}
.trait-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  justify-self: end;
}
.page-lead { color: var(--muted); margin: 0 0 14px; line-height: 1.4; font-weight: 500; }

.bank-card, .panel {
  background: #fff;
  border: 2px solid rgba(15, 27, 45, 0.07);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.bank-card h2, .panel h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.bank-card p, .panel p { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.card-grid { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .ghost-btn, .row .primary-btn { flex: 1; text-align: center; }

.groups-blob {
  margin-top: 18px;
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: 22px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.groups-blob h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.15rem;
}
.groups-empty { margin: 0 0 12px; font-weight: 500; }
.groups-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.groups-actions .primary-btn,
.groups-actions .ghost-btn {
  width: 100%;
  text-align: center;
}
.group-chip-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.group-chip {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: #fff5f4;
  color: var(--blood);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 4px 0 #b00400;
}
.group-chip:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b00400;
}
.groups-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f0fbf9;
  border: 2px solid rgba(0, 168, 150, 0.25);
  color: var(--night);
  font-weight: 600;
  font-size: 0.9rem;
}
.groups-panel { margin-top: 12px; }
.groups-panel-inner {
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: 16px;
  padding: 12px;
  background: #f8fafb;
}
.groups-panel-inner h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.05rem;
}
.groups-panel-inner h4 {
  margin: 14px 0 8px;
  font-family: var(--display);
  font-size: 0.95rem;
}
.groups-back { margin-bottom: 8px; padding-left: 0; border: 0; box-shadow: none; }
.group-card {
  background: #fff;
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.group-card h4 { margin: 0 0 4px; font-family: var(--display); font-size: 1rem; }
.group-card .row { margin-top: 8px; }
.find-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 2px solid rgba(15, 27, 45, 0.08);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.1);
  font-weight: 700;
}
.find-row:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(15, 27, 45, 0.1);
}
.find-row .material-symbols-outlined { color: var(--blood); }
.find-row .meta {
  margin: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.member-list li { margin: 0 0 4px; }

.group-collapse {
  padding-top: 10px;
  padding-bottom: 10px;
}
.group-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: left;
  cursor: pointer;
}
.group-collapse-toggle .group-chevron {
  font-size: 1.35rem;
  transition: transform 0.18s ease;
  color: var(--blood);
}
.group-collapse.is-open .group-collapse-toggle .group-chevron {
  transform: rotate(180deg);
}
.group-collapse-body {
  margin-top: 12px;
}
.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  width: 100%;
}
.member-name-btn {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  pointer-events: none;
  opacity: 1;
  color: var(--ink);
}
.member-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.member-actions .reply-icon-btn {
  color: var(--blood);
}
.member-actions .danger-icon {
  color: var(--blood);
}
.member-leave-btn {
  width: 100%;
  border-radius: 999px;
  min-height: 44px;
  font-weight: 700;
}
.bief-action-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.bief-action-row .ghost-btn {
  width: 100%;
  text-align: center;
  border-radius: 999px;
  min-height: 44px;
}
.bief-wizard,
.bief-panel {
  margin-top: 4px;
}
.bief-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}
.bief-pick-list .bief-pick {
  width: 100%;
  pointer-events: auto;
  white-space: normal;
  text-align: left;
  min-height: 48px;
}
.bief-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bief-list li {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(15, 27, 45, 0.08);
}
.bief-list li:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.groups-panel-inner select,
.group-section select {
  width: 100%;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.12);
  background: #fff;
  color: var(--ink);
  padding: 12px 36px 12px 14px;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.12);
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--blood) 50%),
    linear-gradient(135deg, var(--blood) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.groups-panel-inner select:focus,
.group-section select:focus {
  outline: none;
  border-color: var(--blood);
  box-shadow: 0 4px 0 #b00400;
}
.invite-friends-box {
  margin-top: 4px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafb;
  border: 2px solid rgba(15, 27, 45, 0.08);
}
.invite-friends-box .field { margin-bottom: 10px; }
.invite-friends-box .primary-btn {
  width: 100%;
  text-align: center;
}

.group-home-top {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.group-home-header h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  letter-spacing: -0.03em;
}
.group-section {
  margin: 16px 0;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid rgba(15, 27, 45, 0.08);
  box-shadow: var(--shadow);
}
.group-section h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.12rem;
}
.group-section h3 {
  margin: 12px 0 8px;
  font-family: var(--display);
  font-size: 0.98rem;
}
.group-feed {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 280px;
  overflow: auto;
}
.group-msg {
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f8fafb;
}
.group-ach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.group-ach-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff5f4;
  color: var(--blood);
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 4px 0 #b00400;
}
.group-ach-pill .material-symbols-outlined { font-size: 18px; }
.member-chip {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid rgba(15, 27, 45, 0.1);
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.12);
  font-weight: 700;
  font-size: 0.88rem;
}

.achievements-home {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.trophy-shelf {
  padding: 14px;
  overflow: hidden;
}
.trophy-shelf-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}
.trophy-shelf-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.trophy-stats-btn {
  margin-inline-start: auto;
  color: var(--clinic);
  border-color: rgba(0, 168, 150, 0.35);
  background: linear-gradient(160deg, #e7fffb 0%, #fff 70%);
}
.trophy-stats-btn:hover,
.trophy-stats-btn:focus-visible {
  color: var(--night);
  border-color: var(--clinic);
}
.trophy-shelf-icon {
  color: var(--blood);
  font-size: 1.45rem;
}
.trophy-shelf-lead { margin: 0 0 10px; }
.trophy-empty { margin: 8px 0 0; }
.ach-collapse { margin-top: 0; padding: 0; overflow: hidden; }
.future-achievements .ach-collapse-toggle span:first-child {
  line-height: 1.25;
}
.ach-collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 14px;
  font: inherit;
  font-family: var(--display);
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
}
.ach-collapse-toggle .ach-chevron {
  transition: transform .18s ease;
  color: var(--muted);
  flex: 0 0 auto;
}
.ach-collapse-toggle.open .ach-chevron { transform: rotate(180deg); }
.ach-collapse-body { padding: 0 14px 14px; }

.community-blob {
  margin-top: 18px;
  border: 2px solid rgba(15, 27, 45, 0.08);
  border-radius: 22px;
  padding: 14px;
  background:
    radial-gradient(420px 180px at 15% 0%, rgba(255, 195, 0, 0.22), transparent 70%),
    radial-gradient(380px 160px at 90% 10%, rgba(225, 6, 0, 0.1), transparent 65%),
    #fff;
  box-shadow: var(--shadow);
}
.community-blob h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 1.15rem;
}
.composer {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.composer-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}
.composer-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
}
.composer-tools .icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}
.composer textarea {
  width: 100%;
  height: 88px; /* 40 + 8 + 40 — flush with image + mic stack */
  min-height: 88px;
  max-height: 88px;
  resize: none;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.1);
  background: #f7fafc;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  box-sizing: border-box;
}
.composer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.composer-actions .primary-btn {
  flex: 1 1 auto;
  min-width: 120px;
}
.composer-voice-status,
.composer-image-name {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
}
.composer-voice-preview,
.feed-audio {
  width: 100%;
  max-width: 100%;
  height: 36px;
}
.composer-image-frame,
.feed-image-frame {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0 2px;
}
.composer-image-preview,
.feed-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: #f0f3f5;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 12px;
  border: 2px solid rgba(15, 27, 45, 0.12);
  background: #fff;
  color: var(--blood);
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(15, 27, 45, 0.06);
}
.icon-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}
.icon-btn svg {
  display: block;
}
.icon-btn .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
  width: 22px;
  height: 22px;
}
.composer-mic.recording {
  background: #ffe8e6;
  border-color: rgba(225, 6, 0, 0.45);
  color: var(--blood);
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 6, 0, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(225, 6, 0, 0); }
}
.feed-actions .reply-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--blood);
}
.feed-actions .reply-icon-btn svg {
  width: 20px;
  height: 20px;
}
.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
.feed-item {
  border: 2px solid rgba(15, 27, 45, 0.07);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f8fafb;
}
.feed-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.feed-author { color: var(--ink); font-weight: 800; }
.feed-group {
  display: inline-block;
  margin-left: 6px;
  color: var(--blood);
  font-weight: 700;
}
.feed-body { font-size: 0.95rem; line-height: 1.4; white-space: pre-wrap; font-weight: 500; }
.feed-actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.feed-actions .text-btn { padding: 5px 10px; font-size: 0.75rem; }
.feed-actions .like-btn,
.feed-actions .like-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.feed-actions .like-btn .material-symbols-outlined,
.feed-actions .like-count .material-symbols-outlined {
  font-size: 18px;
  text-decoration: none;
}
.feed-actions .like-btn.liked {
  color: var(--blood);
  border-color: rgba(225, 6, 0, 0.35);
  background: #ffe8e6;
  text-decoration: none;
}
.feed-actions .like-count {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 8px;
}
.reply-box {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.reply-box textarea {
  width: 100%;
  min-height: 52px;
  border-radius: 10px;
  border: 2px solid rgba(15, 27, 45, 0.1);
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  margin-bottom: 8px;
}
.reply-context {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  padding: 6px 8px;
  border-left: 3px solid var(--hi-vis);
  background: #fff8df;
  font-weight: 600;
}
.private-tag {
  color: var(--blood);
  font-size: 0.72rem;
  margin-left: 6px;
  font-weight: 800;
}

.quiz-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-weight: 700; }
.progress-bar {
  height: 10px; background: rgba(15, 27, 45, 0.08); border-radius: 999px; overflow: hidden; margin-bottom: 14px;
}
.progress-bar > span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blood), var(--hi-vis));
}
.quiz-play {
  direction: ltr;
}
.quiz-play .stem[dir="rtl"],
.quiz-play .answer-btn[dir="rtl"] {
  text-align: right;
}
.quiz-play .stem[dir="ltr"],
.quiz-play .answer-btn[dir="ltr"],
.quiz-play #feedback,
.quiz-play .page-actions,
.quiz-play .quiz-head,
.quiz-play .topics {
  text-align: left;
}
.quiz-stem-image {
  margin: 0 0 12px;
}
.quiz-stem-image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 12px;
  background: #f3f5f7;
}

.cardsets-page .cset-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}
.cset-card-edit {
  padding: 12px;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.08);
  background: #fff;
}
.cset-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.cset-img-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  display: block;
  margin-bottom: 6px;
}
.cset-train-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 700;
}
.cset-flip-stage {
  perspective: 1200px;
  width: 100%;
  min-height: 240px;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}
.cset-flip-inner {
  position: relative;
  width: 100%;
  min-height: 240px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cset-flip-stage.is-flipped .cset-flip-inner {
  transform: rotateY(180deg);
}
.cset-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: 18px;
  border: 2px solid rgba(15, 27, 45, 0.12);
  background: linear-gradient(160deg, #fff 0%, #f7fafc 100%);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.cset-face-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fff8f7 0%, #ffe8e6 100%);
  border-color: rgba(225, 6, 0, 0.22);
}
.cset-flip-text {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.cset-flip-hint { font-size: 0.85rem; }
.cset-front-img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 10px;
}
.cset-train-actions { margin-top: 12px; }
.cset-star-btn.starred,
.cset-train-actions .starred {
  color: var(--hi-vis);
}
.cset-star-btn svg {
  display: block;
}
.cset-star-btn:not(.starred) {
  color: var(--ink);
  opacity: 1;
}
.cset-star-note {
  margin: 8px 0 0;
  font-size: 0.9rem;
}
.member-icon-slot {
  opacity: 0.22;
  pointer-events: none;
  cursor: default;
}
.analytics-side {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 27, 45, 0.08);
}
.analytics-side summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 8px;
}

.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.topic {
  font-size: 0.72rem; color: var(--night); border: 0;
  border-radius: 999px; padding: 4px 8px; background: #eef3f6; font-weight: 700;
}
.answers { display: grid; gap: 8px; }
.answer-btn {
  text-align: left; background: #fff; color: var(--ink);
  border: 2px solid rgba(15, 27, 45, 0.1); border-radius: 14px; padding: 12px; line-height: 1.35;
  font-weight: 600; box-shadow: 0 4px 0 rgba(15, 27, 45, 0.06);
}
.answer-btn.correct { border-color: var(--ok); background: #e7fffb; }
.answer-btn.wrong { border-color: var(--danger); background: #ffe8e6; }
.answer-btn:disabled { cursor: default; }
.feedback {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: #fff8df; border: 2px solid rgba(255, 195, 0, 0.45); font-size: 0.9rem; font-weight: 700;
}

.ach-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.ach-tile {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.08);
  background: #eef3f6;
  color: #8a96a1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 4px;
}
.ach-tile .material-symbols-outlined { font-size: 28px; }
.ach-tile-label {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ach-tile.unlocked {
  color: var(--blood);
  border-color: rgba(225, 6, 0, 0.35);
  background: #ffe8e6;
  box-shadow: 0 4px 0 rgba(176, 4, 0, 0.18);
}
.trophy-board .ach-tile.unlocked {
  background:
    linear-gradient(160deg, #fff7e8 0%, #ffe8e6 100%);
  border-color: rgba(255, 195, 0, 0.55);
}
.ach-detail {
  padding: 12px; border-radius: 14px; border: 2px solid rgba(15, 27, 45, 0.08); background: #f8fafb;
}
.ach-detail h2 { margin: 0 0 4px; font-size: 1rem; font-family: var(--display); }
.tone-pill {
  display: inline-block; font-size: 0.7rem; border: 0;
  border-radius: 999px; padding: 3px 8px; color: var(--night); margin-bottom: 8px;
  background: var(--hi-vis); font-weight: 800;
}

.study-hub {
  margin: 0 0 4px;
}
.study-hub-eyebrow {
  display: inline-block;
  color: var(--night);
  background: var(--hi-vis);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 14px;
  margin-bottom: 12px;
  transform: rotate(-1.2deg);
}
.study-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 16px;
}
.study-nav-btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: #fff5f4;
  color: var(--blood);
  border-radius: 18px;
  padding: 26px 16px 24px;
  min-height: 132px;
  box-shadow: 0 7px 0 #b00400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  touch-action: manipulation;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.study-nav-btn .material-symbols-outlined {
  font-size: 2.6rem;
  line-height: 1;
  color: var(--blood);
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 48;
}
.study-nav-btn:active,
.study-nav-btn.active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 #b00400;
  background: #ffe3df;
}
.study-lead { margin-top: 2px; }

.muted { color: var(--muted); }
.stat-list { list-style: none; padding: 0; margin: 0; }
.stat-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; font-weight: 600;
}

.inbox-bell-btn .material-symbols-outlined {
  font-size: 1.25rem;
  line-height: 1;
}
.inbox-unread-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blood, #e10600);
  box-shadow: 0 0 0 2px #fff;
}
.inbox-unread-dot.blink {
  animation: inbox-blink 1.1s ease-in-out infinite;
}
@keyframes inbox-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}
.inbox-page .inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inbox-page .inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}
.inbox-page .inbox-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inbox-page .inbox-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.inbox-page .inbox-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 2px solid rgba(15, 27, 45, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.08);
  cursor: pointer;
}
.inbox-page .inbox-check {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  cursor: pointer;
}
.inbox-page .inbox-check input,
.inbox-page .inbox-select-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--blood);
}
.inbox-page .inbox-body {
  min-width: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.inbox-page .inbox-item.unread {
  border-color: rgba(225, 6, 0, 0.35);
  background: #fff8f7;
}
.inbox-page .inbox-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.inbox-page .inbox-subject {
  font-weight: 800;
  margin: 0 0 4px;
}
.blup-bubble.fly-to-bell::after {
  opacity: 0;
}
.blup-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}
.blup-bubble {
  pointer-events: none;
  position: fixed;
  background: #fff;
  color: var(--ink);
  border-radius: 22px;
  padding: 12px 14px;
  border: 3px solid var(--night);
  box-shadow: 8px 8px 0 var(--hi-vis);
  animation: blup-in .28s ease-out;
  transform-origin: center center;
  transition: transform .75s cubic-bezier(.2,.8,.2,1), opacity .75s ease;
  overflow-wrap: anywhere;
  word-break: normal;
}
.blup-bubble.flying {
  animation: none;
  box-shadow: 2px 2px 0 var(--hi-vis);
}
.blup-bubble::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -11px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-right: 3px solid var(--night);
  border-bottom: 3px solid var(--night);
  transform: rotate(45deg);
}
.blup-bubble .who {
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--blood);
}
.blup-bubble .msg {
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  font-weight: 600;
}
@keyframes blup-in {
  from { transform: scale(.9) rotate(-3deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.feed-item.arriving {
  animation: post-land .7s ease-out;
  border-color: var(--blood);
  background: #fff5f4;
}
@keyframes post-land {
  from { transform: scale(.92); opacity: 0.35; }
  to { transform: scale(1); opacity: 1; }
}

.ach-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 30;
  background: var(--night);
  border: 3px solid var(--hi-vis);
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  max-width: min(92vw, 360px);
  box-shadow: 0 12px 30px rgba(15, 27, 45, 0.25);
}

.ach-progress-label {
  margin: 10px 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--night);
}
.ach-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 27, 45, 0.08);
  overflow: hidden;
}
.ach-progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blood), var(--hi-vis));
}

.celebrate-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 27, 45, 0.55);
  backdrop-filter: blur(4px);
}
.celebrate-root.hidden { display: none !important; }
.celebrate-card {
  position: relative;
  width: min(100%, 380px);
  background: #fff;
  border: 3px solid var(--night);
  border-radius: 22px;
  padding: 22px 18px 18px;
  box-shadow: 10px 10px 0 var(--hi-vis);
  text-align: center;
  overflow: hidden;
  animation: cele-pop .28s ease-out;
}
.celebrate-card h2 {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.1;
}
.celebrate-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}
.celebrate-kicker {
  display: inline-block;
  background: var(--hi-vis);
  color: var(--night);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px !important;
}
.celebrate-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffe8e6;
  border: 3px solid var(--blood);
  color: var(--blood);
}
.celebrate-icon .material-symbols-outlined { font-size: 44px; }
.celebrate-points {
  color: var(--blood) !important;
  font-size: 1.05rem !important;
  font-weight: 800 !important;
}
.celebrate-burst {
  position: absolute;
  inset: -40% -20% auto;
  height: 180px;
  background:
    radial-gradient(circle at 30% 60%, rgba(255,195,0,.35), transparent 45%),
    radial-gradient(circle at 70% 40%, rgba(225,6,0,.2), transparent 40%);
  pointer-events: none;
}
@keyframes cele-pop {
  from { transform: scale(.92) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Personal notifications (Inbox) */
.inbox-bell-btn {
  position: relative;
}
.inbox-unread-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blood, #e10600);
  box-shadow: 0 0 0 2px #fff;
}
.inbox-unread-dot.blink {
  animation: inbox-blink 1.1s ease-in-out infinite;
}
@keyframes inbox-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}
.inbox-page .inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inbox-page .inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}
.inbox-page .inbox-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inbox-page .inbox-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.inbox-page .inbox-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 2px solid rgba(15, 27, 45, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(15, 27, 45, 0.08);
  cursor: pointer;
}
.inbox-page .inbox-check {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  cursor: pointer;
}
.inbox-page .inbox-check input,
.inbox-page .inbox-select-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--blood);
}
.inbox-page .inbox-body { min-width: 0; }
.inbox-page .inbox-item.unread {
  border-color: rgba(225, 6, 0, 0.35);
  background: #fff8f7;
}
.inbox-page .inbox-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.inbox-page .inbox-subject {
  font-weight: 800;
  margin: 0 0 4px;
}
.like-summary-toggle {
  margin-top: 8px;
  color: var(--blood);
}
.liker-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.liker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.avatar-chip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef3f6 center/cover no-repeat;
  border: 2px solid rgba(15, 27, 45, 0.12);
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar-chip.avatar-initials {
  background: #ffe8e6;
  color: var(--blood);
  font-size: 0.72rem;
  font-weight: 800;
}
.inbox-reply-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #f7fafc;
  border: 1px solid rgba(15, 27, 45, 0.08);
}
.inbox-reply-card p { margin: 4px 0 0; }
.blup-bubble.fly-to-bell::after { opacity: 0; }

/* Private talks in Personal notifications */
.private-talk-card {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #f7fafc;
  border: 1px solid rgba(15, 27, 45, 0.08);
}
.talk-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  max-height: 280px;
  overflow: auto;
}
.talk-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.talk-msg.mine {
  background: #fff5f4;
  border-radius: 12px;
  padding: 8px;
}
.talk-msg p { margin: 4px 0; }
.talk-composer {
  display: grid;
  gap: 8px;
}
.talk-composer textarea {
  width: 100%;
  border-radius: 10px;
  border: 2px solid rgba(15, 27, 45, 0.1);
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
  min-height: 52px;
}
.talk-toggle { margin-top: 6px; color: var(--blood); }
.continue-talk-btn {
  display: inline-block;
  margin-top: 6px;
  color: var(--blood);
  font-size: 0.92rem;
}
.admin-member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.admin-member-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7fafc;
  border: 1px solid rgba(15, 27, 45, 0.08);
}


/* Super Admin / Instructor / DM */
.admin-page .tab-row,
.chip-row { display:flex; flex-wrap:wrap; gap:0.5rem; margin:0.75rem 0 1rem; }
.admin-member-list,
.admin-group-list { list-style:none; padding:0; margin:0 0 1rem; }
.admin-member-list li,
.admin-group-list li { display:flex; flex-direction:column; gap:0.15rem; padding:0.55rem 0; border-bottom:1px solid rgba(0,0,0,.08); }
.admin-card { margin-top:1rem; }
.admin-notice { background:#fff4f2; border-left:3px solid var(--blood); padding:0.6rem 0.75rem; }
.admin-progress.hidden { display:none; }
.admin-timeline-graph,
.tl-bar-row { display:flex; align-items:flex-end; gap:3px; min-height:48px; margin:0.5rem 0 1rem; }
.admin-timeline-graph .tl-bar,
.tl-bar { width:8px; min-height:8px; height:28px; background:#c9c3bc; border-radius:2px; }
.admin-timeline-graph .tl-bar.ok,
.tl-bar.ok { background:#1f7a4c; height:36px; }
.admin-timeline-graph .tl-bar.miss,
.tl-bar.miss { background:#c0392b; height:18px; }
.danger-btn { color:#9b1c1c !important; }
.check-row { display:flex; align-items:center; gap:0.5rem; }
.dm-page .dm-layout { display:grid; grid-template-columns:1fr; gap:1rem; }
@media (min-width:720px) {
  .dm-page .dm-layout { grid-template-columns:220px 1fr; }
}
.dm-peers ul { list-style:none; padding:0; margin:0; }
.dm-peers li { margin:0.25rem 0; }
.dm-msg { padding:0.5rem 0.65rem; margin:0.35rem 0; background:rgba(0,0,0,.04); border-radius:8px; }
.dm-msg.mine { background:#ffe8e6; }
.instructor-analytics .chip-btn.active,
.chip-btn.active { border-color:var(--blood); color:var(--blood); }
.ghost-block { border:1px dashed rgba(0,0,0,.25); padding:0.75rem; border-radius:8px; }
.member-list li.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.text-btn { background:none; border:none; color:var(--blood); cursor:pointer; padding:0.15rem 0.35rem; font:inherit; text-decoration:none; }
.analytics-list { padding-left:1.1rem; }

/* Games shell + Settings */
.game-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: calc(100dvh - 120px);
}
.game-shell-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.game-shell-bar .ghost-btn { margin-inline-start: auto; }
.game-frame {
  width: 100%;
  flex: 1;
  min-height: 70dvh;
  border: 0;
  background: #0b0f14;
  border-radius: 0;
}
.settings-page .admin-card { margin-top: 0.75rem; }
.game-card .meta { font-weight: 600; }

/* DoNoHarm — landscape iPhone 17 Pro frame when embedded on desktop */
.game-shell.game-shell-phone {
  align-items: center;
}
.game-shell-bar { width: min(920px, 96vw); }
.iphone-landscape {
  --iphone-w: min(920px, 96vw);
  width: var(--iphone-w);
  aspect-ratio: 874 / 402;
  max-height: min(72dvh, 520px);
  position: relative;
  border-radius: 36px;
  padding: 12px 18px;
  background: linear-gradient(145deg, #2a2d32 0%, #0c0d10 55%, #1a1c20 100%);
  box-shadow:
    0 0 0 2px #3a3d44,
    0 18px 40px rgba(0,0,0,.45),
    inset 0 0 0 1px rgba(255,255,255,.08);
}
.iphone-landscape::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  transform: translateY(-50%);
  width: 4px;
  height: 64px;
  border-radius: 2px;
  background: #111;
  box-shadow: 0 -78px 0 #111, 0 78px 0 #111;
}
.iphone-landscape::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 4px;
  height: 96px;
  border-radius: 2px;
  background: #111;
}
.iphone-landscape-screen {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255,255,255,.06);
}
.iphone-landscape-screen .game-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: #000;
}
@media (max-width: 700px), (orientation: portrait) and (max-width: 900px) {
  .iphone-landscape {
    width: 100%;
    max-height: none;
    aspect-ratio: auto;
    min-height: 70dvh;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    background: #000;
  }
  .iphone-landscape::before,
  .iphone-landscape::after { display: none; }
  .iphone-landscape-screen { border-radius: 0; border: 0; min-height: 70dvh; }
}
.feed-game-invite {
  margin-top: 8px;
}
.feed-game-invite .primary-btn { width: 100%; }

/* Learner climb / stats popup */
.stats-root {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    max(8px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  background:
    radial-gradient(600px 280px at 80% 0%, rgba(255, 195, 0, 0.28), transparent 55%),
    radial-gradient(500px 260px at 10% 100%, rgba(0, 168, 150, 0.22), transparent 50%),
    rgba(15, 27, 45, 0.52);
  backdrop-filter: blur(5px);
  overflow: hidden;
}
.stats-root.hidden { display: none !important; }
.stats-panel {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4fbf9 42%, #fff8e8 100%);
  border: 3px solid var(--night);
  border-radius: 18px;
  padding: 16px 12px 18px;
  box-shadow: 0 8px 0 var(--hi-vis);
  animation: cele-pop .28s ease-out;
}
.stats-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.stats-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(15, 27, 45, 0.08);
}
.stats-hero {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-right: 28px;
}
.stats-hero-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0b6b5c;
  background: linear-gradient(145deg, #b8fff0, #fff3b0);
  border: 2px solid rgba(15, 27, 45, 0.12);
  box-shadow: 0 4px 0 rgba(0, 168, 150, 0.25);
}
.stats-kicker {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b88600;
}
.stats-hero h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.stats-hero-lead {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--night);
}
.stats-coach {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(120deg, #fff5f4, #eef8ff);
  border: 2px solid rgba(225, 6, 0, 0.14);
  margin-bottom: 14px;
}
.stats-coach .material-symbols-outlined {
  color: var(--blood);
  font-size: 22px;
}
.stats-coach p {
  margin: 0;
  font-weight: 650;
  line-height: 1.35;
}
.stats-coach-who {
  margin: 0 0 4px !important;
  font-size: 0.72rem;
  font-weight: 800 !important;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--blood);
}
.stats-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.stats-section-head h3 {
  margin: 0;
}
.stats-sort-btns {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}
.stats-sort-btn {
  width: 36px;
  height: 36px;
  color: var(--ink);
}
.stats-sort-btn.active {
  color: var(--blood);
  border-color: rgba(225, 6, 0, 0.45);
  background: #fff5f4;
  box-shadow: 0 3px 0 #b00400;
}
.stats-sort-btn svg {
  display: block;
  width: 20px;
  height: 20px;
}
.stats-section {
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(15, 27, 45, 0.06);
}
.stats-section h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.05rem;
}
.stats-section.fun {
  background: linear-gradient(160deg, #fff7d6, #e7fffb);
}
.stats-chart {
  --stats-cols: 14;
  margin-top: 10px;
  width: 100%;
  min-width: 0;
}
.stats-chart-bars,
.stats-axis-days {
  display: grid;
  grid-template-columns: repeat(var(--stats-cols), minmax(0, 1fr));
  gap: 3px;
  width: 100%;
}
.stats-chart-bars {
  align-items: end;
  min-height: 84px;
  padding: 4px 0 6px;
}
.stats-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.stats-climb-attempt {
  width: min(100%, 18px);
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #ffd36a, #ff9f43);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(184, 134, 0, 0.35);
}
.stats-climb-correct {
  width: 100%;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #5dffc8, #00a896);
}
.stats-quiz-bar {
  width: min(100%, 18px);
  min-height: 6px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #ff6b6b, #e10600);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
  box-shadow: 0 2px 0 #8f0400;
}
.stats-axis-days {
  margin-top: 2px;
}
.stats-day-mark {
  display: block;
  text-align: center;
  font-size: clamp(0.62rem, 2.4vw, 0.78rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
  min-width: 0;
}
.stats-axis-months {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  width: 100%;
}
.stats-month-span {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
}
.stats-month-line {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 27, 45, 0.18), rgba(0, 168, 150, 0.55), rgba(15, 27, 45, 0.18));
}
.stats-month-name {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.stats-list li {
  font-size: 0.9rem;
  font-weight: 650;
}
.stats-topic-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.stats-topic-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid rgba(15, 27, 45, 0.08);
  background: #fff;
}
.stats-topic-card.weak {
  background: linear-gradient(135deg, #fff5f4, #fff);
  border-color: rgba(225, 6, 0, 0.18);
}
.stats-topic-card.cards {
  background: linear-gradient(135deg, #f3f0ff, #fff);
  border-color: rgba(80, 70, 180, 0.18);
}
.stats-topic-card .primary-btn,
.stats-topic-card .ghost-btn {
  justify-self: start;
}
.stats-game-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 12px;
}
.stats-pill {
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 2px;
  border: 2px solid rgba(15, 27, 45, 0.08);
  background: #fff;
}
.stats-pill strong {
  font-family: var(--display);
  font-size: 1.25rem;
}
.stats-pill span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.2;
}
.stats-pill.game { background: #eef8ff; }
.stats-pill.ok { background: #e7fffb; }
.stats-pill.win { background: #fff4d6; }
.stats-pill.group { background: #ffe8e6; }
.stats-pill.muted-pill { background: #f3f6f8; }
.stats-momentum {
  height: 14px;
  border-radius: 999px;
  background: rgba(15, 27, 45, 0.08);
  overflow: hidden;
  margin: 8px 0;
}
.stats-momentum > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e10600, #ffc300, #00a896);
}
@media (min-width: 720px) {
  .stats-root {
    align-items: center;
    padding: 24px;
  }
  .stats-panel {
    width: min(92vw, 760px);
    max-width: min(92vw, 760px);
    max-height: min(88dvh, 820px);
    border-radius: 22px;
    padding: 20px 18px 22px;
    box-shadow: 12px 12px 0 var(--hi-vis);
  }
  .stats-day-mark {
    font-size: 0.82rem;
  }
  .stats-month-name {
    font-size: 0.75rem;
  }
  .stats-climb-attempt,
  .stats-quiz-bar {
    width: min(100%, 22px);
  }
  .stats-topic-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stats-game-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 419px) {
  .stats-hero h2 { font-size: 1.25rem; }
  .stats-hero-lead { font-size: 0.88rem; }
  .stats-section { padding: 10px; }
}

/* Site-styled dialogs (never native alert/confirm/prompt) */
body.site-dialog-open {
  overflow: hidden;
}
.site-dialog-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  background: rgba(15, 27, 45, 0.55);
  backdrop-filter: blur(4px);
  overflow: hidden;
}
.site-dialog-root.hidden { display: none !important; }
.site-dialog-panel {
  width: min(100%, 420px);
  max-height: min(88dvh, 560px);
  overflow: auto;
  box-sizing: border-box;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafb 100%);
  border: 3px solid var(--night);
  border-radius: 18px;
  padding: 18px 16px 16px;
  box-shadow: 0 8px 0 var(--blood);
  animation: cele-pop .22s ease-out;
}
.site-dialog-panel .stats-kicker {
  margin: 0 0 4px;
}
.site-dialog-panel h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.site-dialog-message {
  margin: 0 0 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.site-dialog-field {
  margin: 0 0 14px;
}
.site-dialog-field input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid rgba(15, 27, 45, 0.12);
  border-radius: 12px;
  padding: 12px 12px;
  font: inherit;
  font-weight: 600;
}
.site-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: stretch;
}
.site-dialog-actions .ghost-btn,
.site-dialog-actions .primary-btn {
  flex: 1;
  text-align: center;
}
.site-dialog-actions .site-dialog-danger {
  background: var(--blood);
  box-shadow: 0 6px 0 #8f0400;
}

