/* ============================================================
   HubberU — styles
   Palette pulled from the Hubber Digital brand sheet.
   One signature element: glossy "bubble" orbs (the mascot's floating
   bubbles) mark points. Everything else stays quiet so lessons read well.
   ============================================================ */

/* self-hosted fonts (no Google Fonts request) */
@font-face { font-family: 'Quicksand'; src: url('../fonts/quicksand-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Quicksand'; src: url('../fonts/quicksand-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* brand */
  --wine:        #690522;
  --wine-2:      #4E0319;
  --flame:       #E87021;
  --flame-deep:  #E25E1E;
  --amber:       #FCB941;
  --amber-2:     #FAAF2A;
  --orange:      #EF8E20;
  --red:         #DD2D2D;
  --sand:        #C8AB8E;
  --blush:       #C18679;
  --white:       #FFFFFF;

  /* derived surfaces + ink */
  --paper:       #FFF8F1;      /* page */
  --paper-2:     #FCEFE2;      /* sunk areas, tracks */
  --line:        rgba(105, 5, 34, 0.13);
  --line-strong: rgba(105, 5, 34, 0.28);
  --ink:         #3A0414;      /* body text: wine, darkened for contrast */
  --ink-2:       #7A4A54;      /* secondary text */
  --ok:          #2F8F5B;

  /* type */
  --font-display: 'Quicksand', 'Nunito', ui-rounded, system-ui, sans-serif;
  --font-body:    'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --step--1: 0.8125rem;
  --step-0:  1rem;
  --step-1:  1.1875rem;
  --step-2:  1.5rem;
  --step-3:  2rem;
  --step-4:  2.625rem;

  /* shape */
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --rail-w: 232px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
/* inline icons default to text size; nav/task/tabbar icons override below */
svg { width: 1.25em; height: 1.25em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--flame-deep); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--wine); line-height: 1.15; margin: 0; font-weight: 700; }
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 0.75em; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

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

/* ============================================================
   BUBBLE ORB — the signature element
   ============================================================ */
.orb {
  --size: 22px;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #FFE3A0 0 10%, var(--amber) 26%, var(--orange) 55%, var(--red) 100%);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3.5px var(--wine);
}
.orb::after {
  content: ''; position: absolute;
  left: 22%; top: 18%; width: 34%; height: 22%;
  border-radius: 50%; background: rgba(255,255,255,.9);
  transform: rotate(-24deg);
}
.orb.lg { --size: 64px; box-shadow: 0 0 0 4px var(--white), 0 0 0 7px var(--wine); }
.orb.md { --size: 36px; box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--wine); }
.orb.sm { --size: 14px; box-shadow: 0 0 0 1.5px var(--white), 0 0 0 2.5px var(--wine); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 1.15em;
  border-radius: 999px;
  border: 2px solid var(--wine);
  background: var(--white); color: var(--wine);
  font-family: var(--font-display); font-weight: 700; font-size: 0.975rem;
  cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #F08A32 0%, var(--flame) 55%, var(--flame-deep) 100%);
  color: var(--white);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);   /* the mascot's white inner stroke */
  text-shadow: 0 1px 0 rgba(105,5,34,.25);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #F29441 0%, #EB7A2A 55%, var(--flame-deep) 100%); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--paper-2); }
.btn-sm { min-height: 36px; padding: 0 .9em; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-danger { border-color: var(--red); color: var(--red); }
.link-btn { background: none; border: 0; padding: 0; color: var(--flame-deep); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   FORMS
   ============================================================ */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-weight: 600; font-size: .925rem; color: var(--wine); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--white);
  font-size: 16px; /* prevents iOS zoom on focus */
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--flame); box-shadow: 0 0 0 3px rgba(232,112,33,.2); }
.hint { font-size: var(--step--1); color: var(--ink-2); }
.form-error { background: #FDECEC; color: #8E1A1A; border: 1px solid #F4C2C2; border-radius: var(--r-sm); padding: 10px 12px; font-size: .925rem; margin-bottom: 14px; }
.form-note { background: #FFF3DC; border: 1px solid #F6D9A0; color: var(--ink); border-radius: var(--r-sm); padding: 10px 12px; font-size: .925rem; margin-bottom: 14px; }

/* ============================================================
   AUTH
   ============================================================ */
#auth-root { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  background: url('../img/bg.webp') center/cover no-repeat, var(--paper-2);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px;
}
.auth-art .mascot { width: min(420px, 70%); position: absolute; right: 8%; top: 12%; filter: drop-shadow(0 18px 24px rgba(105,5,34,.15)); }
.auth-wordmark { font-family: var(--font-display); font-weight: 700; color: var(--wine); font-size: clamp(3rem, 7vw, 5.5rem); line-height: .9; letter-spacing: -0.02em; position: relative; }
.auth-tag { font-family: var(--font-display); font-weight: 600; color: var(--wine); font-size: var(--step-1); margin-top: 10px; max-width: 26ch; position: relative; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px calc(40px + var(--safe-b)); background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); margin-bottom: 22px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--ink-2); font-size: .95rem; }
.auth-by { display: flex; align-items: center; gap: 8px; margin-top: 28px; justify-content: center; color: var(--ink-2); font-size: var(--step--1); }
.auth-by img { height: 44px; width: auto; }

@media (max-width: 860px) {
  #auth-root { grid-template-columns: 1fr; }
  .auth-art { min-height: 250px; padding: 24px 22px; padding-top: calc(24px + var(--safe-t)); }
  .auth-art .mascot { width: 170px; right: 6%; top: auto; bottom: 14px; }
  .auth-wordmark { font-size: 3rem; }
  .auth-tag { font-size: 1rem; max-width: 18ch; }
  .auth-panel { align-items: flex-start; padding-top: 28px; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app-root { min-height: 100dvh; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail-w);
  background: var(--wine); color: #FBE6D9;
  display: flex; flex-direction: column; padding: 22px 14px;
  z-index: 20;
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; color: var(--white); text-decoration: none; }
.rail-brand img { width: 46px; height: 46px; }
.rail-brand span { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.01em; }
.nav { display: grid; gap: 4px; }
.nav a, .nav button.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: #FBE6D9; text-decoration: none; font-weight: 600;
  background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
}
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.active { background: var(--white); color: var(--wine); }
.nav a.active svg { color: var(--flame); }
.nav .soon { margin-left: auto; font-size: .72rem; font-weight: 700; background: rgba(255,255,255,.14); padding: 2px 8px; border-radius: 99px; }
.nav a.disabled { opacity: .6; pointer-events: none; }
.nav svg { width: 22px; height: 22px; flex: none; }
.rail-foot { margin-top: auto; display: grid; gap: 10px; }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; text-decoration: none; color: inherit; }
.rail-user:hover { background: rgba(255,255,255,.08); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--amber); color: var(--wine);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  box-shadow: 0 0 0 2px var(--white); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.rail-user .name { font-weight: 600; font-size: .92rem; line-height: 1.2; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user .email { font-size: .76rem; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { margin-left: var(--rail-w); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 32px; padding-top: calc(12px + var(--safe-t));
  background: rgba(255,248,241,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .mobile-brand { display: none; }
.account-btn { display: none; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.school-picker { display: flex; align-items: center; gap: 8px; min-width: 0; }
.school-picker .select { min-height: 38px; padding: 6px 34px 6px 12px; width: auto; max-width: 260px; font-weight: 600; color: var(--wine); border-radius: 99px; }
.school-name { font-family: var(--font-display); font-weight: 700; color: var(--wine); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.points-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px; border-radius: 99px;
  background: var(--white); border: 1.5px solid var(--line-strong);
  font-family: var(--font-display); font-weight: 700; color: var(--wine); text-decoration: none;
  white-space: nowrap;
}
.points-pill small { font-family: var(--font-body); font-weight: 500; color: var(--ink-2); font-size: .8rem; }

#view { flex: 1; width: 100%; max-width: 1080px; padding: 28px 32px 64px; outline: none; }

.tabbar { display: none; }

@media (max-width: 900px) {
  .rail { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  .topbar { padding: 10px 16px; padding-top: calc(10px + var(--safe-t)); }
  .topbar .mobile-brand { display: block; width: 34px; height: 34px; flex: none; }
  .account-btn { display: block; flex: none; }
  .school-picker .select { max-width: 42vw; }
  .points-pill { padding: 5px 12px 5px 7px; }
  .points-pill small { display: none; }
  #view { padding: 20px 16px 40px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: var(--white); border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--ink-2); text-decoration: none; font-size: .72rem; font-weight: 600;
    background: none; border: 0; cursor: pointer;
  }
  .tabbar a.active { color: var(--wine); }
  .tabbar a.active svg { color: var(--flame); }
  .tabbar a.disabled { opacity: .45; pointer-events: none; }
  .tabbar svg { width: 24px; height: 24px; }
}

/* ============================================================
   COMMON VIEW PIECES
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { color: var(--ink-2); margin: 6px 0 0; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; margin-bottom: 12px; }
.crumb:hover { color: var(--wine); }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 14px; font-size: var(--step-1); }
.muted { color: var(--ink-2); }
.panel { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.empty {
  display: grid; justify-items: center; text-align: center; gap: 8px;
  padding: 36px 20px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--ink-2);
}
.empty img { width: 96px; opacity: .9; }
.empty strong { color: var(--wine); font-family: var(--font-display); font-size: var(--step-1); }
.loading { display: grid; place-items: center; padding: 80px 0; }
.loading .orb { animation: bob 1.1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .loading .orb { animation: none; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--paper-2); color: var(--wine); }
.chip.due-soon { background: #FFF1D6; }
.chip.overdue { background: #FDE2E2; color: #8E1A1A; }
.chip.done { background: #E2F3E8; color: #1E6A40; }

.bar { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--amber), var(--flame)); }

/* ============================================================
   HOME
   ============================================================ */
.hello {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px;
  padding: 26px 28px; border-radius: var(--r-lg);
  background: url('../img/bg.webp') center 30%/cover no-repeat, var(--paper-2);
  border: 1.5px solid var(--line);
  position: relative; overflow: hidden;
}
.hello h1 { font-size: clamp(1.75rem, 4vw, var(--step-4)); }
.hello p { margin: 8px 0 0; color: var(--ink); max-width: 44ch; }
.hello-stats { display: flex; gap: 22px; align-items: center; }
.stat { text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: var(--step-3); color: var(--wine); line-height: 1; }
.stat span { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.stat-orb { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.stat-orb .stat { text-align: left; }

.task-list { display: grid; gap: 12px; }
.task {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 16px 18px; border-radius: var(--r-md);
  background: var(--white); border: 1.5px solid var(--line);
  color: inherit; text-decoration: none;
}
.task:hover { border-color: var(--line-strong); }
.task .kind {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--paper-2); color: var(--wine);
}
.task .kind svg { width: 22px; height: 22px; }
.task h3 { font-size: 1.05rem; margin-bottom: 4px; }
.task .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); }
.task .progress { width: 140px; display: grid; gap: 4px; justify-items: end; font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.task .progress .bar { width: 100%; }
.task.is-done { opacity: .7; }
@media (max-width: 640px) {
  .task { grid-template-columns: auto 1fr; }
  .task .progress { grid-column: 1 / -1; width: 100%; justify-items: stretch; }
  .hello { grid-template-columns: 1fr; padding: 22px 20px; }
}

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.course {
  display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden;
  background: var(--white); border: 1.5px solid var(--line); text-decoration: none; color: inherit;
}
.course:hover { border-color: var(--line-strong); }
.course .cover { aspect-ratio: 16 / 7; background: url('../img/bg.webp') var(--cover-pos, 20% 80%) / 260% auto no-repeat, var(--paper-2); position: relative; }
.course .cover img { width: 100%; height: 100%; object-fit: cover; }
.course .cover .orb { position: absolute; right: 14px; bottom: -14px; }
.course .body { padding: 18px 16px 16px; display: grid; gap: 8px; }
.course .body p { font-size: .9rem; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============================================================
   CURRICULUM / PLAYLIST
   ============================================================ */
.hero-course { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; margin-bottom: 28px; }
.hero-course .summary { color: var(--ink-2); max-width: 60ch; margin-top: 10px; }
.side-card { position: sticky; top: 90px; }
.side-card .big { font-family: var(--font-display); font-weight: 700; font-size: var(--step-3); color: var(--wine); line-height: 1; }
.bonus { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .9rem; }
@media (max-width: 820px) { .hero-course { grid-template-columns: 1fr; } .side-card { position: static; } }

.lesson-list { display: grid; gap: 0; background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.lesson-list h3.section-label { padding: 14px 20px 6px; font-size: .9rem; color: var(--ink-2); font-family: var(--font-body); font-weight: 700; background: var(--paper); border-top: 1px solid var(--line); }
.lesson-list h3.section-label:first-child { border-top: 0; }
.lesson-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--line); color: inherit; text-decoration: none;
}
.lesson-list .lesson-row:first-child { border-top: 0; }
.lesson-row:hover { background: #FFFBF6; }
.lesson-row .num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line-strong); font-family: var(--font-display); font-weight: 700; color: var(--wine); font-size: .9rem;
}
.lesson-row.done .num { background: var(--ok); border-color: var(--ok); color: var(--white); }
.lesson-row.progress .num { border-color: var(--flame); color: var(--flame-deep); }
.lesson-row .t { font-weight: 600; }
.lesson-row .m { font-size: .83rem; color: var(--ink-2); }
.lesson-row .pts { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--wine); font-size: .9rem; }

/* ============================================================
   LESSON PLAYER
   ============================================================ */
.lesson-head { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; margin-bottom: 26px; }
.lesson-head .summary { color: var(--ink-2); margin-top: 8px; max-width: 62ch; }
.lesson-meter { display: grid; gap: 6px; min-width: 200px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
@media (max-width: 700px) { .lesson-head { grid-template-columns: 1fr; } }

.steps { display: grid; gap: 18px; counter-reset: step; }
.step { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.step-head {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 16px 20px; width: 100%; background: none; border: 0; text-align: left; cursor: default;
}
.step.is-done .step-head { cursor: pointer; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper-2); color: var(--wine); font-family: var(--font-display); font-weight: 700;
}
.step.is-done .step-num { background: var(--ok); color: var(--white); }
.step-head .k { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.step-head h3 { font-size: 1.1rem; }
.step-body { padding: 0 20px 20px 74px; }
.step.is-done.collapsed .step-body { display: none; }
@media (max-width: 640px) { .step-body { padding: 0 16px 18px; } .step-head { padding: 14px 16px; } }
.step-note { background: #FFF3DC; border-left: 4px solid var(--amber); padding: 10px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin-bottom: 16px; }
.step-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.done-note { display: inline-flex; align-items: center; gap: 8px; color: #1E6A40; font-weight: 700; }

.video-wrap { position: relative; aspect-ratio: 16/9; border-radius: var(--r-md); overflow: hidden; background: #1a0209; }
.video-wrap iframe, .video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.reading { max-width: 68ch; }
.reading h1, .reading h2, .reading h3 { margin: 1.2em 0 .5em; }
.reading h1 { font-size: var(--step-2); }
.reading h2 { font-size: var(--step-1); }
.reading img { border-radius: var(--r-sm); margin: 12px 0; }
.reading ul, .reading ol { padding-left: 1.3em; }
.reading li { margin: .25em 0; }
.reading blockquote { margin: 1em 0; padding: 8px 16px; border-left: 4px solid var(--sand); background: var(--paper); }
.reading code { background: var(--paper-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.reading table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.reading th, .reading td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }

/* quiz */
.q { padding: 18px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; padding-top: 4px; }
.q-prompt { font-weight: 700; margin-bottom: 12px; display: flex; gap: 10px; }
.q-prompt .n { color: var(--flame-deep); font-family: var(--font-display); }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line-strong); background: var(--white); cursor: pointer;
}
.opt:hover { border-color: var(--flame); }
.opt input { width: 20px; height: 20px; accent-color: var(--flame); flex: none; }
.opt:has(input:checked) { border-color: var(--flame); background: #FFF6EE; }
.seq { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; counter-reset: seq; }
.seq li {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 8px 8px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); background: var(--white);
  counter-increment: seq;
}
.seq li::before { content: counter(seq); font-family: var(--font-display); font-weight: 700; color: var(--flame-deep); }
.seq .mv { display: flex; gap: 4px; }
.seq .mv button { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--paper); cursor: pointer; color: var(--wine); }
.seq .mv button:disabled { opacity: .3; cursor: default; }
.match { display: grid; gap: 10px; }
.match-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.3fr); gap: 12px; align-items: center; }
.match-row .l { font-weight: 600; padding: 10px 14px; border-radius: var(--r-sm); background: var(--paper); }
@media (max-width: 560px) { .match-row { grid-template-columns: 1fr; gap: 6px; } }

.q-result { margin-top: 10px; padding: 10px 14px; border-radius: var(--r-sm); font-size: .925rem; }
.q-result.good { background: #E2F3E8; color: #16532F; }
.q-result.part { background: #FFF1D6; color: #6B4304; }
.q-result.bad  { background: #FDE8E8; color: #7D1717; }
.q-result .ans { margin-top: 4px; }
.score-banner { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--r-md); margin-bottom: 8px; }
.score-banner.pass { background: #E2F3E8; }
.score-banner.fail { background: #FFF1D6; }
.score-banner b { font-family: var(--font-display); font-size: var(--step-2); color: var(--wine); }

/* ============================================================
   WALLET + STORE
   ============================================================ */
.wallet-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center;
  padding: 26px; border-radius: var(--r-lg); background: var(--white); border: 1.5px solid var(--line);
}
.wallet-hero .big { font-family: var(--font-display); font-weight: 700; color: var(--wine); font-size: clamp(2.5rem, 6vw, 3.5rem); line-height: 1; }
.wallet-hero .expiring { margin-top: 8px; font-size: .92rem; }
.ledger-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.ledger-sum div { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.ledger-sum b { display: block; font-family: var(--font-display); font-size: var(--step-2); color: var(--wine); line-height: 1.1; }
.ledger-sum span { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
@media (max-width: 560px) { .wallet-hero { padding: 20px; gap: 18px; align-items: start; } .wallet-hero .orb.lg { --size: 44px; box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--wine); margin-top: 6px; } .ledger-sum { gap: 8px; } .ledger-sum div { padding: 10px 12px; } .prize .img { aspect-ratio: 16/9; } }

.history { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.h-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); align-items: center; }
.h-row:first-child { border-top: 0; }
.h-row .what { font-weight: 600; }
.h-row .when { font-size: .82rem; color: var(--ink-2); }
.h-row .amt { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.amt.plus { color: #1E6A40; }
.amt.minus { color: var(--wine); }
.amt.expired { color: var(--ink-2); text-decoration: line-through; }

.prize-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.prize { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; }
.prize .img { aspect-ratio: 4/3; background: var(--paper-2); display: grid; place-items: center; }
.prize .img img { width: 100%; height: 100%; object-fit: cover; }
.prize .img img.ph { width: 96px; height: auto; object-fit: contain; opacity: .9; }
.prize .body { padding: 14px 16px 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.prize .body p { font-size: .9rem; color: var(--ink-2); margin: 0; }
.prize .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }
.cost { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; color: var(--wine); }

.status { font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.status.requested { background: #FFF1D6; color: #6B4304; }
.status.approved  { background: #E4EEFB; color: #1D4A85; }
.status.fulfilled { background: #E2F3E8; color: #1E6A40; }
.status.cancelled { background: var(--paper-2); color: var(--ink-2); }

/* ============================================================
   DIALOG + TOAST + CONFETTI
   ============================================================ */
dialog.modal {
  border: 0; padding: 0; border-radius: var(--r-lg); max-width: min(440px, calc(100vw - 32px)); width: 100%;
  box-shadow: 0 30px 80px rgba(58,4,20,.3); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(58,4,20,.45); }
.modal-body { padding: 24px; }
.modal-body h2 { font-size: var(--step-1); margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 140%);
  background: var(--wine); color: var(--white); padding: 12px 18px; border-radius: 99px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(58,4,20,.3); z-index: 100; transition: transform .25s ease, visibility 0s linear .25s; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease, visibility 0s; }
@media (max-width: 900px) { #toast { bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* ============================================================
   ADMIN
   ============================================================ */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.subnav a, .subnav .soon-tab { padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: .92rem; text-decoration: none; color: var(--ink-2); }
.subnav a:hover { background: var(--paper-2); color: var(--wine); }
.subnav a.active { background: var(--wine); color: var(--white); }
.subnav .soon-tab { opacity: .5; cursor: default; }
.section h2 .count { font-family: var(--font-body); font-size: .8rem; font-weight: 700; background: var(--paper-2); color: var(--wine); padding: 2px 9px; border-radius: 99px; vertical-align: middle; margin-left: 6px; }

.admin-list { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.admin-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.admin-row:first-child, .person:first-child { border-top: 0; }
.admin-row:hover { background: #FFFBF6; }
.admin-row .grow { flex: 1; min-width: 0; }
.admin-row .t { font-weight: 700; color: var(--wine); font-family: var(--font-display); font-size: 1.05rem; }
.admin-row .nums { display: flex; gap: 18px; color: var(--ink-2); font-size: .9rem; white-space: nowrap; }
.admin-row .nums b { color: var(--wine); font-family: var(--font-display); font-size: 1.1rem; }

.person { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.person[data-inv] { grid-template-columns: 36px minmax(0, 1fr) auto auto; }
.person .who .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.person .who .m { font-size: .83rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.person.off { opacity: .6; }
.avatar.pending { background: var(--paper-2); color: var(--ink-2); box-shadow: none; }
.avatar.pending svg { width: 18px; height: 18px; }
.select-sm { min-height: 36px; padding: 4px 30px 4px 10px; font-size: .9rem; width: auto; max-width: 190px; }
@media (max-width: 760px) {
  .person, .person[data-inv] { grid-template-columns: 36px minmax(0, 1fr); }
  .person > select, .person > .btn { grid-column: 2; justify-self: start; }
  .person > select { max-width: 100%; width: 100%; }
  .admin-row { flex-wrap: wrap; }
  .admin-row .nums { width: 100%; }
}

dialog.modal.wide { max-width: min(600px, calc(100vw - 32px)); }
dialog.modal form { margin: 0; }
.link-list { display: grid; gap: 12px; max-height: 50vh; overflow: auto; margin: 6px 0 10px; }
.link-item .t { font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.link-box { display: flex; gap: 8px; }
.link-box .input { min-height: 38px; font-size: .85rem; color: var(--ink-2); background: var(--paper); }

/* ---------- admin: lists, filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input { flex: 1 1 220px; min-height: 42px; }
.filters .select { width: auto; min-height: 42px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--flame); }
.kind-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--paper-2); color: var(--wine); flex: none; }
.kind-ic svg { width: 20px; height: 20px; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.kind-grid .opt { align-items: flex-start; }
.kind-grid .opt input { margin-top: 3px; }

/* ---------- admin: editors ---------- */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.editor-main { display: grid; gap: 18px; min-width: 0; }
.editor-side { display: grid; gap: 14px; position: sticky; top: 84px; }
.editor-side h3, .panel > h3 { font-size: 1.05rem; margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
ul.plain a { font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.savebar {
  position: sticky; bottom: 0; z-index: 10; margin: 22px -32px -64px; padding: 12px 32px calc(12px + var(--safe-b));
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  background: rgba(255,248,241,.95); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
@media (max-width: 1000px) { .editor-grid { grid-template-columns: 1fr; } .editor-side { position: static; } }
@media (max-width: 900px) { .savebar { bottom: calc(var(--tabbar-h) + var(--safe-b)); margin: 22px -16px -40px; padding: 10px 16px; } }

.md-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.md-split .field { margin: 0; }
.textarea.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 14px; line-height: 1.55; }
.reading.preview { border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); padding: 4px 16px; min-height: 200px; background: var(--paper); margin-top: 6px; overflow: auto; max-height: 540px; }
@media (max-width: 1100px) { .md-split { grid-template-columns: 1fr; } }

.quiz-settings { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
@media (max-width: 640px) { .quiz-settings, .two-col { grid-template-columns: 1fr; } }
.qcard { border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; background: #FFFCF8; display: grid; gap: 10px; }
.qhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--wine); color: var(--white); font-family: var(--font-display); font-weight: 700; font-size: .9rem; flex: none; }
.qn.sm { width: 26px; height: 26px; background: var(--paper-2); color: var(--wine); }
.qkind { font-weight: 700; color: var(--wine); font-size: .92rem; }
.pts { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-left: auto; }
.pts .input { width: 72px; min-height: 36px; padding: 4px 10px; }
.mv-group { display: inline-flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--white); color: var(--wine); display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn:hover:not(:disabled) { border-color: var(--flame); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn svg { width: 18px; height: 18px; }
.optlist { display: grid; gap: 8px; }
.optrow { display: flex; align-items: center; gap: 8px; }
.optrow .input { min-height: 40px; }
.optrow input[type=radio], .optrow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ok); flex: none; cursor: pointer; }
.optrow.pair .input { flex: 1; }
.pair-arrow { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.qfoot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.add-q { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.add-q .select { width: auto; }
.err-list { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.chip-check { display: inline-flex; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { padding: 6px 12px; border-radius: 99px; border: 1.5px solid var(--line-strong); font-weight: 600; font-size: .85rem; background: var(--white); }
.chip-check input:checked + span { background: var(--wine); border-color: var(--wine); color: var(--white); }
.chip-check input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }

.step-ed { display: grid; grid-template-columns: 30px 38px minmax(0, 1fr) auto auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.step-ed:first-child { border-top: 0; padding-top: 0; }
.step-ed .t { font-weight: 700; color: var(--wine); }
.step-ed .m { font-size: .83rem; color: var(--ink-2); margin: 2px 0 8px; }
.step-ed .check { margin-top: 6px; }
.step-ed.warn { background: #FDF3F3; border-radius: var(--r-sm); padding: 12px; }
.input-sm { min-height: 38px; font-size: .9rem; }
@media (max-width: 640px) {
  .step-ed { grid-template-columns: 30px minmax(0, 1fr); }
  .step-ed .kind-ic { display: none; }
  .step-ed > .check, .step-ed > .mv-group { grid-column: 2; }
}
.pick-list { max-height: 50vh; overflow: auto; border: 1.5px solid var(--line); border-radius: var(--r-md); }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.pick-row:first-child { border-top: 0; }
.pick-row .grow { flex: 1; min-width: 0; }
.pick-row .t { font-weight: 600; }
.pick-row .m { font-size: .8rem; color: var(--ink-2); }

/* ---------- admin: rewards ---------- */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 99px; margin-bottom: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 99px; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--white); color: var(--wine); box-shadow: 0 1px 3px rgba(58,4,20,.12); }
.admin-row .m { font-size: .85rem; color: var(--ink-2); margin-top: 2px; }
.prize-row.off { opacity: .6; }
.thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--paper-2); display: grid; place-items: center; flex: none; font-size: .7rem; color: var(--ink-2); text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb img.ph { width: 70%; height: auto; object-fit: contain; }
.req-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.img-field { display: flex; gap: 10px; align-items: center; }
@media (max-width: 760px) {
  .req-row, .prize-row { flex-wrap: wrap; }
  .req-acts { width: 100%; justify-content: flex-start; }
}

/* ---------- admin: courses & paths ---------- */
.inline-input { display: flex; align-items: center; gap: 10px; }
.inline-input .input { max-width: 120px; }
.inline-input span { color: var(--ink-2); font-size: .9rem; }

/* ---------- admin: progress ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat-card { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.stat-card b { display: block; font-family: var(--font-display); font-size: var(--step-2); color: var(--wine); line-height: 1.1; }
.stat-card span { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.stat-card.bad { border-color: #F4C2C2; background: #FFF6F6; }
.stat-card.bad b { color: #8E1A1A; }
.stat-card.warn { border-color: #F6D9A0; background: #FFFAF0; }
@media (max-width: 760px) { .stat-row { grid-template-columns: 1fr 1fr; } }
.prog-cell { width: 150px; display: grid; gap: 4px; font-size: .8rem; color: var(--ink-2); font-weight: 600; flex: none; }
@media (max-width: 760px) { .prog-cell { width: 100%; } }
.ans-list { display: grid; gap: 10px; max-height: 45vh; overflow: auto; }
.ans-block { background: var(--paper); border-radius: var(--r-sm); padding: 10px 14px; }
.ans-block .q { font-weight: 700; color: var(--wine); font-size: .9rem; margin-bottom: 2px; }

/* ---------- uploads ---------- */
.upload-btn { position: relative; cursor: pointer; }
.upload-btn.busy { opacity: .6; pointer-events: none; }
.upload-btn:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }

.danger-zone { border-top: 1px solid #F4C2C2; padding-top: 22px; }
.danger-zone h2 { color: #8E1A1A; }

/* ============================================================
   THE LOUNGE
   ============================================================ */
.lounge-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.seg a { display: inline-block; padding: 7px 16px; border-radius: 99px; font-weight: 600; font-size: .92rem; color: var(--ink-2); text-decoration: none; }
.seg a.on { background: var(--white); color: var(--wine); box-shadow: 0 1px 3px rgba(58,4,20,.12); }

.chat { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  height: calc(100dvh - 230px); min-height: 440px; }
.chan-list { border-right: 1px solid var(--line); background: var(--paper); padding: 10px 6px; overflow-y: auto; display: flex; flex-direction: column; }
.chan-list a { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.chan-list a:hover { background: var(--paper-2); }
.chan-list a.on { background: var(--wine); color: var(--white); }
.chan-list a.on .chip { background: rgba(255,255,255,.18); color: var(--white); }
.chan-list .hash { opacity: .55; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-top h2 { font-size: 1.15rem; }
.chat-top p { margin: 2px 0 0; font-size: .88rem; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 8px 12px 0; overscroll-behavior: contain; }
.msg { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 6px 12px 6px 0; }
.msg.grouped { padding-top: 1px; }
.msg:hover { background: #FFFBF6; }
.msg-av { justify-self: center; text-decoration: none; }
.msg-gutter { text-align: center; }
.msg-gutter time { font-size: .7rem; color: var(--ink-2); opacity: 0; }
.msg:hover .msg-gutter time { opacity: 1; }
.msg-meta { display: flex; gap: 8px; align-items: baseline; }
.msg-meta .who { font-weight: 700; color: var(--wine); text-decoration: none; }
.msg-meta time { font-size: .76rem; color: var(--ink-2); }
.msg .text { margin: 1px 0 0; overflow-wrap: anywhere; }
.msg .gone { margin: 0; color: var(--ink-2); font-style: italic; font-size: .92rem; }
.edited { font-size: .75rem; color: var(--ink-2); }
.msg-tools { position: absolute; right: 12px; top: -12px; display: none; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: 0 2px 8px rgba(58,4,20,.08); }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
@media (hover: none) { .msg:hover .msg-tools { display: none; } .msg.tapped .msg-tools { display: flex; position: static; grid-column: 2; justify-self: start; margin-top: 4px; box-shadow: none; } }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; font-size: .95rem; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.rx { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.rx-chip { border: 1.5px solid var(--line-strong); background: var(--white); border-radius: 99px; padding: 1px 9px; font-size: .88rem; cursor: pointer; }
.rx-chip.mine { border-color: var(--flame); background: #FFF3EA; }
.rx-chip b { font-size: .78rem; color: var(--wine); }
.rx-pop { position: absolute; right: 12px; top: 22px; z-index: 5; display: flex; gap: 2px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: 0 6px 20px rgba(58,4,20,.15); }
.rx-pop button { border: 0; background: none; font-size: 1.25rem; width: 38px; height: 38px; border-radius: 8px; cursor: pointer; }
.rx-pop button:hover, .rx-pop button:focus { background: var(--paper-2); }
.day-div { display: flex; align-items: center; gap: 10px; margin: 14px 16px 8px; color: var(--ink-2); font-size: .78rem; font-weight: 700; }
.day-div::before, .day-div::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.load-more { display: block; margin: 4px auto 10px; }
.chat-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 60px 20px; color: var(--ink-2); }
.chat-empty img { width: 90px; }
.chat-empty strong { color: var(--wine); font-family: var(--font-display); font-size: 1.15rem; }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px 4px; border-top: 1px solid var(--line); }
.composer .textarea { min-height: 46px; max-height: 180px; resize: none; }
.composer-hint { padding: 0 16px 10px; margin: 0; font-size: .75rem; }
.composer-off { padding: 16px; border-top: 1px solid var(--line); color: var(--ink-2); background: var(--paper); text-align: center; font-weight: 600; }
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100dvh - var(--tabbar-h) - var(--safe-b) - var(--safe-t) - 205px); min-height: 360px; }
  .lounge-head { margin-bottom: 10px; gap: 8px; }
  .lounge-head h1 { font-size: 1.5rem; }
  .lounge-head p { display: none; }
  .chan-list { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; gap: 4px; }
  .chan-list a { white-space: nowrap; flex-wrap: nowrap; padding: 6px 12px; }
  .chan-list a .chip { display: none; }
  .composer-hint { display: none; }
}

/* co-work */
.cw-list { display: grid; gap: 12px; }
.cw { display: flex; gap: 18px; padding: 18px; background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); }
.cw.live { border-color: var(--flame); box-shadow: 0 0 0 3px rgba(232,112,33,.12); }
.cw-when { width: 64px; flex: none; text-align: center; border-radius: 14px; background: var(--paper-2); padding: 8px 4px; align-self: flex-start; }
.cw-when b { display: block; font-size: .75rem; text-transform: uppercase; color: var(--flame-deep); }
.cw-when span { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; color: var(--wine); line-height: 1.1; }
.cw-when small { font-size: .78rem; color: var(--ink-2); font-weight: 600; }
.cw h3 { font-size: 1.15rem; }
@media (max-width: 560px) { .cw { flex-direction: column; gap: 10px; } .cw-when { display: flex; gap: 6px; align-items: baseline; width: auto; padding: 6px 12px; } .cw-when span { font-size: 1.1rem; } }

/* people */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.person-card { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 16px; display: grid; gap: 10px; align-content: start; }
.pc-link { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.pc-link .t { font-weight: 700; color: var(--wine); }
.pc-link .m { font-size: .85rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* profiles */
.prof-hero { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.prof-cover { height: 180px; background: url('../img/bg.webp') center/cover no-repeat; background-size: cover; background-position: center; }
.prof-head { display: flex; gap: 18px; align-items: flex-end; padding: 0 22px 20px; margin-top: -48px; flex-wrap: wrap; }
.prof-head .avatar { box-shadow: 0 0 0 4px var(--white); }
.prof-head .grow { flex: 1; min-width: 220px; padding-top: 52px; }
.prof-head .headline { margin: 4px 0 8px; color: var(--ink-2); font-size: 1.05rem; }
.prof-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; margin-top: 18px; align-items: start; }
.prof-grid > div, .prof-grid > aside { display: grid; gap: 16px; }
.prof-grid ul.plain a { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .prof-grid { grid-template-columns: 1fr; } .prof-cover { height: 130px; } }
.hl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.hl { display: flex; gap: 12px; background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.hl strong { color: var(--wine); }
.hl p { margin: 4px 0 0; font-size: .92rem; color: var(--ink-2); }
.hl .orb { margin-top: 4px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); }
.vid-grid { display: grid; gap: 14px; }
figure { margin: 0; }
figcaption { font-size: .85rem; color: var(--ink-2); margin-top: 6px; }
.photo-row { display: flex; gap: 18px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }
.photo-pick { display: grid; gap: 8px; justify-items: start; }
.photo-pick.grow { flex: 1; min-width: 220px; }
.cover-prev { width: 100%; height: 88px; border-radius: var(--r-sm); background: url('../img/bg.webp') center/cover no-repeat; background-size: cover; background-position: center; }
.link-ed { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; margin-bottom: 8px; }
@media (max-width: 1000px) { .link-ed { grid-template-columns: 1fr; } }
.media-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.media-card { position: relative; display: grid; gap: 6px; }
.media-card img, .vid-ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); }
.vid-ph { display: grid; place-items: center; align-content: center; gap: 4px; background: var(--wine); color: var(--white); font-weight: 600; font-size: .85rem; }
.vid-ph svg { width: 30px; height: 30px; }
.media-card .icon-btn { position: absolute; top: 6px; right: 6px; }

/* ---------- rich text editor (Jodit) in brand colors ---------- */
.jodit-container.jodit { border: 1.5px solid var(--line-strong) !important; border-radius: var(--r-sm) !important; overflow: hidden; font-family: var(--font-body); }
.jodit-toolbar__box { background: var(--paper) !important; border-bottom: 1px solid var(--line) !important; }
.jodit-toolbar-button_personalize .jodit-toolbar-button__text { font-weight: 700; color: var(--wine); }
.jodit-toolbar-button:hover:not([disabled]), .jodit-toolbar-button__button:hover:not([disabled]) { background: var(--paper-2) !important; }
.jodit-toolbar-button_is-active .jodit-toolbar-button__button, .jodit-toolbar-button__button[aria-pressed=true] { background: #FCE3CF !important; }
.jodit-wysiwyg { padding: 14px 18px !important; line-height: 1.6; }
.jodit-wysiwyg h2, .jodit-wysiwyg h3, .jodit-wysiwyg h4 { font-family: var(--font-display); color: var(--wine); }
.jodit-wysiwyg blockquote, .reading blockquote { margin: 1em 0; padding: 8px 16px; border-left: 4px solid var(--amber); background: #FFF6E6; }
.jodit-wysiwyg table td, .jodit-wysiwyg table th { border: 1px solid var(--line-strong); padding: 6px 8px; }
.jodit-wysiwyg .video-wrap { max-width: 560px; }
.jodit-status-bar { display: none !important; }
/* learner side: things the editor can produce */
.reading hr { border: 0; border-top: 2px solid var(--line); margin: 1.5em 0; }
.reading pre { background: var(--paper-2); padding: 12px 14px; border-radius: var(--r-sm); overflow-x: auto; }
.reading .video-wrap { margin: 14px 0; }
.reading sup, .reading sub { font-size: .75em; }

/* ============================================================
   WHITE LABEL (html.white-label, variables set by HU.theme.apply)
   HubberU's own look above stays untouched; these only kick in for branded client schools.
   ============================================================ */
.white-label .rail { background: var(--bar-bg); color: var(--bar-text-dim); }
.white-label .rail-brand, .white-label .rail-user .name { color: var(--bar-text); }
.white-label .rail-user .email { color: var(--bar-text-dim); opacity: 1; }
.white-label .nav a, .white-label .nav button.nav-item { color: var(--bar-text-dim); }
.white-label .nav a:hover { background: rgba(127,127,127,.14); }
.white-label .nav a.active { background: var(--white); color: var(--wine); }
.white-label .nav a.active svg { color: var(--flame); }
.white-label .nav .soon { background: rgba(127,127,127,.2); }
.white-label .btn-primary { background: var(--flame); color: var(--on-accent); text-shadow: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); border-color: var(--flame-deep); }
.white-label .btn-primary:hover:not(:disabled) { background: var(--flame-deep); }
.white-label .hello, .white-label .auth-art, .white-label .prof-cover, .white-label .cover-prev { background: var(--hero-img); }
.white-label .course .cover { background: var(--hero-img); }
.white-label .bar > i { background: linear-gradient(90deg, var(--amber), var(--flame)); }
.white-label .auth-art .mascot { display: none; }
.rail-brand.logo { background: var(--white); border-radius: 14px; padding: 10px 12px; margin: 0 4px 18px; justify-content: center; }
.rail-brand.logo img { width: auto; height: auto; max-width: 100%; max-height: 52px; }
.brand-mono, .mobile-brand.mono { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--white); color: var(--wine); font-family: var(--font-display); font-weight: 700; flex: none; }
.mobile-brand.mono { width: 34px; height: 34px; font-size: .8rem; background: var(--paper-2); }
.powered { display: block; text-align: center; font-size: .72rem; color: var(--bar-text-dim, #FBE6D9); opacity: .8; text-decoration: none; padding: 6px 0 0; }
.powered strong { font-weight: 700; }
.auth-brand-logo { background: var(--white); border-radius: 16px; padding: 14px 18px; display: inline-block; margin-bottom: 18px; position: relative; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.auth-brand-logo img { max-height: 64px; max-width: 260px; width: auto; }

/* ---------- branding editor ---------- */
.brand-sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.brand-sum-grid .label { font-size: .8rem; font-weight: 700; color: var(--ink-2); display: block; margin-bottom: 4px; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 5px; vertical-align: -3px; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.brand-thumb { max-height: 36px; max-width: 140px; } .brand-thumb.sq { width: 36px; height: 36px; object-fit: contain; }
.brand-edit { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
@media (max-width: 700px) { .brand-edit { grid-template-columns: 1fr; } }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 46px; height: 42px; border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 2px; background: var(--white); cursor: pointer; }
.warn-contrast { color: #8E1A1A; font-weight: 600; }
.brand-prev { position: sticky; top: 0; margin-top: 6px; }
.bp { border-radius: 14px; overflow: hidden; border: 1.5px solid var(--line); display: grid; grid-template-columns: 110px 1fr; min-height: 230px; font-size: .8rem; background: var(--paper, #FFF8F1); }
.bp-bar { background: var(--bar-bg, #690522); color: var(--bar-text, #fff); padding: 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.bp-bar b { font-family: var(--font-display); font-size: .82rem; line-height: 1.15; }
.bp-bar small { margin-top: auto; opacity: .75; font-size: .62rem; }
.bp-logo { background: #fff; border-radius: 8px; padding: 5px; display: block; } .bp-logo img { max-height: 28px; max-width: 100%; margin: 0 auto; }
.bp-ic { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #fff; }
.bp-nav { padding: 4px 6px; border-radius: 6px; color: var(--bar-text-dim, #FBE6D9); } .bp-nav.on { background: #fff; color: var(--wine); font-weight: 700; }
.bp-main { padding: 14px 12px; display: grid; gap: 10px; align-content: start; background: var(--paper, #FFF8F1); }
.bp-h { font-family: var(--font-display); font-weight: 700; color: var(--wine); font-size: 1.05rem; }
.bp-bar2 { height: 8px; border-radius: 9px; background: var(--paper-2); overflow: hidden; } .bp-bar2 i { display: block; width: 60%; height: 100%; background: linear-gradient(90deg, var(--amber), var(--flame)); }
.bp-btn { display: inline-block; justify-self: start; padding: 6px 12px; border-radius: 99px; background: var(--flame); color: var(--on-accent, #fff); font-weight: 700; }

/* ============================================================
   ADMIN INDEX PAGES (HubSpot-style)
   ============================================================ */
.ix { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); }
.ix-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.ix-tab { position: relative; display: flex; align-items: center; flex: none; border-radius: 10px 10px 0 0; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.ix-tab > button[data-view] { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ix-tab.on { background: var(--white); border-color: var(--line); }
.ix-tab.on > button[data-view] { color: var(--wine); padding-right: 4px; }
.ix-tab-menu { border: 0; background: none; width: 26px; height: 26px; border-radius: 6px; margin-right: 6px; cursor: pointer; color: var(--wine); display: grid; place-items: center; }
.ix-tab-menu:hover { background: var(--paper-2); }
.ix-tab-menu svg { width: 14px; height: 14px; }
.ix-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--flame); display: inline-block; }
.ix-add { border: 0; background: none; color: var(--flame-deep); font-weight: 700; padding: 10px 12px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; flex: none; }
.ix-add svg { width: 16px; height: 16px; }
.ix-menu { position: absolute; top: 100%; right: 0; z-index: 30; min-width: 170px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(58,4,20,.15); padding: 6px; display: grid; }
.ix-menu button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--ink); }
.ix-menu button:hover, .ix-menu button:focus { background: var(--paper-2); }
.ix-menu button.danger { color: #8E1A1A; }
.ix-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ix-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ix-search { width: 220px; min-height: 38px; padding: 6px 12px; }
.ix-filter select { appearance: none; -webkit-appearance: none; min-height: 38px; padding: 6px 30px 6px 12px; border-radius: 99px; border: 1.5px solid var(--line-strong); background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; font-weight: 600; font-size: .88rem; color: var(--ink); cursor: pointer; max-width: 240px; }
.ix-filter.on select { border-color: var(--flame); background-color: #FFF3EA; color: var(--wine); }
.white-label .ix-filter.on select { background-color: var(--paper-2); }
.ix-actions { display: flex; gap: 8px; align-items: center; }
.ix-bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.ix-table-wrap { overflow-x: auto; }
.ix-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.ix-table th { text-align: left; padding: 0; background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ix-table th button { border: 0; background: none; padding: 10px 14px; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; width: 100%; }
.ix-table th[aria-sort="ascending"] button, .ix-table th[aria-sort="descending"] button { color: var(--wine); }
.ix-arrow { font-size: .7rem; }
.ix-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ix-table tr:last-child td { border-bottom: 0; }
.ix-table tbody tr:hover { background: #FFFBF6; }
.white-label .ix-table tbody tr:hover { background: var(--paper); }
.ix-table tr.sel { background: var(--paper-2) !important; }
.ix-table .num { text-align: right; } .ix-table th.num button { justify-content: flex-end; }
.ix-check { width: 42px; padding-left: 14px !important; padding-right: 0 !important; }
.ix-check input { width: 18px; height: 18px; accent-color: var(--flame); }
.ix-name { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--wine); font-weight: 700; }
.ix-name:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.ix-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--paper-2); display: grid; place-items: center; flex: none; }
.ix-ic svg { width: 16px; height: 16px; }
.ix-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: .88rem; }
.ix-pager { display: flex; gap: 8px; align-items: center; }
.col-list { display: grid; gap: 10px; }
@media (max-width: 700px) { .ix-search { width: 100%; } .ix-bar { flex-direction: column; } }
