/* Study groups and friends (public/groups.js). Built for 375px first. */

.g-title { margin: 6px 0 12px; }
/* On the People screen the tab strip already says "Groups", so the screen heading is redundant. */
.ppl-body .g-title { display: none; }

.g-week {
  display: flex; gap: 8px; margin-bottom: 6px;
}
.g-week > div {
  flex: 1; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.g-week small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.g-week b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

.g-cards { display: flex; flex-direction: column; gap: 10px; }
.g-card {
  display: block; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
}
.g-card:active { transform: scale(.99); }
.g-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 17px; }
.g-card-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.g-card-line { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.g-flame { flex: none; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.g-flame-off { filter: grayscale(1); opacity: .6; background: var(--surface-2); }

.g-avatar {
  flex: none; display: inline-grid; place-items: center; width: var(--sz); height: var(--sz); border-radius: 50%;
  background: var(--av); color: #fff; font-weight: 800; font-size: calc(var(--sz) * .45); line-height: 1;
}

.g-mini { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.g-mini-row { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.g-mini-row span:not(.g-avatar):not(.g-num) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-num { display: inline-grid; place-items: center; width: 22px; font-weight: 800; color: var(--ink-3); font-size: 14px; }
.g-code-inline { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; color: var(--ink); user-select: all; }

/* ---------- one group ---------- */

.g-head {
  padding: 16px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 14px;
}
.g-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.g-head h1 { margin: 0; font-size: 24px; line-height: 1.15; word-break: break-word; }
.g-streak { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.g-streak b { display: block; font-size: 18px; }
.g-streak small { color: var(--ink-3); font-size: 13px; }
.g-streak-flame { font-size: 40px; line-height: 1; animation: g-flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.g-streak-off .g-streak-flame { filter: grayscale(1); opacity: .45; animation: none; }
@keyframes g-flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08, 1.12) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .g-streak-flame { animation: none; } }
.g-progress { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.g-progress span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #e8603c); transition: width .5s ease; }
.g-today { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }

.g-announce {
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}
.g-announce small { color: var(--ink-3); font-weight: 700; font-size: 12px; }
.g-announce p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.g-announce .btn-row { margin: 10px 0 0; }

.g-board .g-row { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.g-board .g-row:last-child { border-bottom: 0; }
.g-rank { flex: none; width: 26px; text-align: center; font-size: 20px; }
.g-me { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
.g-xp { flex: none; text-align: right; line-height: 1.1; }
.g-xp b { display: block; font-size: 18px; font-weight: 800; }
.g-xp small { font-size: 11px; color: var(--ink-3); font-weight: 700; }

.g-feed { display: flex; flex-direction: column; gap: 8px; }
.g-event { padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.g-event p { margin: 0; font-size: 14px; word-break: break-word; }
.g-event small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.g-reacts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.g-react {
  font: inherit; font-size: 14px; padding: 3px 9px; min-height: 30px; border-radius: 99px; cursor: pointer;
  background: var(--surface-2); border: 1px solid transparent; color: var(--ink-2);
}
.g-react.g-mine { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--ink); font-weight: 700; }

/* ---------- sheets ---------- */

.g-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.g-choice {
  display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; align-items: center; text-align: left; font: inherit; color: inherit;
  padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.g-choice b { font-size: 17px; }
.g-choice small { color: var(--ink-3); font-size: 13px; }
.g-choice:active { background: var(--surface-2); }

.g-bigcode {
  margin: 14px 0 4px; padding: 14px; text-align: center; border-radius: 16px; background: var(--surface-2);
  font: 800 34px/1 ui-monospace, Menlo, monospace; letter-spacing: .18em; user-select: all;
}
.g-sheet-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.g-person { display: flex; align-items: center; gap: 12px; }
.g-person h3 { margin: 0; }
.g-person small { color: var(--ink-3); font-size: 13px; }
.g-pokes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; }
.g-poke {
  display: flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; font-size: 14px; text-align: left; color: inherit;
  padding: 10px; min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.g-poke span { font-size: 22px; }
.g-poke.g-taunt { background: color-mix(in srgb, #e8603c 9%, var(--surface)); border-color: color-mix(in srgb, #e8603c 30%, var(--line)); }
.g-poke:disabled { opacity: .4; cursor: default; }
.g-poke:active:not(:disabled) { transform: scale(.97); }

/* ---------- invite pages ---------- */

.g-invite { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.g-invite h1 { margin: 8px 0 0; word-break: break-word; }
.g-invite p { margin: 0; color: var(--ink-2); }
.g-invite .hint { margin: 8px 0 14px; max-width: 32ch; }
.g-invite .btn { max-width: 340px; }
.g-invite-emoji { font-size: 64px; line-height: 1; }

/* ---------- home ---------- */

.g-strip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; text-decoration: none;
}
.g-strip .main { flex: 1; min-width: 0; }
.g-strip b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-strip small { display: block; color: var(--ink-3); font-size: 13px; }
.g-strip-icon { font-size: 26px; flex: none; }
.g-strip .chev { flex: none; width: 18px; height: 18px; }

/* "Kofi studied 3x more than you" */
.g-rival {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 14px; font-size: 14px;
  background: color-mix(in srgb, #e8603c 10%, var(--surface)); border: 1px solid color-mix(in srgb, #e8603c 30%, var(--line));
}
.g-rival a { font-weight: 700; color: inherit; }
/* Her own row under a class top 10: a dashed line says some places are skipped. */
.g-board .g-row.g-gap { border-top: 2px dashed var(--line); }

/* "Study with friends": a little squad of buddies instead of an emoji. */
.g-squad { display: flex; align-items: center; }
.g-squad > span {
  width: 34px; height: 34px; margin-left: -12px; border-radius: 50%; overflow: hidden; display: grid; place-items: end center;
  background: var(--surface-2); box-shadow: 0 0 0 2px var(--surface);
  animation: squad-hop 560ms var(--ease-bounce) both;
}
.g-squad > span:first-child { margin-left: 0; }
.g-squad > span:nth-child(2) { animation-delay: 70ms; }
.g-squad > span:nth-child(3) { animation-delay: 140ms; }
.g-squad svg { width: 36px; height: 36px; margin-bottom: -4px; }
@keyframes squad-hop { from { transform: translateY(10px) scale(.7); opacity: 0; } }

/* ---------- drawn icons in place of emoji (anti-slop pass) ---------- */
.g-flame { display: inline-flex; align-items: center; gap: 3px; }
.g-flame .ic, .g-streak-flame .ic, .g-rival .ic, .g-row .meta .ic, .g-person small .ic, .g-invite p .ic, .g-event .ic { color: #e8782a; }
.g-flame-off .ic { color: var(--ink-3); }
.g-streak-flame { display: grid; }
.g-streak-flame .ic { width: 40px; height: 40px; }
.g-streak-flame .ic .d { opacity: .4; }
.g-event .ic-megaphone, .g-event .ic-hand-waving, .g-event .ic-star { color: var(--brand); }
.g-choice > .ic { grid-row: span 2; width: 36px; height: 36px; justify-self: center; color: var(--brand); }
.g-invite-emoji { display: grid; place-items: center; color: var(--brand); }
.g-invite-emoji .ic { width: 64px; height: 64px; }
.g-strip-icon:not(.g-squad) { display: grid; place-items: center; color: var(--brand); }
.g-strip-icon > .ic { width: 28px; height: 28px; }
.g-card-line .ic, .g-today .ic, .g-announce .ic { color: var(--brand); vertical-align: -0.18em; }
.g-card-meta .chip .ic { width: 14px; height: 14px; vertical-align: -2px; }
/* Places 1-3: gold, silver, bronze discs instead of medal emoji. */
.g-rank { font-size: 14px; display: grid; place-items: center; }
.g-num-1, .g-num-2, .g-num-3 { width: 24px; height: 24px; border-radius: 50%; color: #3b2a06; font-size: 13px; box-shadow: inset 0 -2px 0 rgb(0 0 0 / .15); }
.g-num-1 { background: #f2c14e; }
.g-num-2 { background: #cfd5d9; color: #2c3338; }
.g-num-3 { background: #d99a6c; color: #3a1d08; }
/* Empty groups: the three buddies, bigger. */
.empty-art .g-crew { justify-content: center; margin: 0 auto 10px; }
.g-crew > span { width: 60px; height: 60px; margin-left: -16px; }
.g-crew svg { width: 62px; height: 62px; margin-bottom: -6px; }

/* ---------- group switcher ---------- */
.g-switch { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px 12px; padding: 2px 4px; }
.g-switch::-webkit-scrollbar { display: none; }
.g-switch-chip {
  position: relative; flex: none; display: flex; align-items: center; gap: 8px; max-width: 170px; padding: 4px 12px 4px 4px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 14px;
}
.g-switch-chip span:last-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-switch-on { border-color: var(--brand); color: var(--ink); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.g-dot { position: absolute; top: 2px; left: 26px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.g-tabs { margin: 4px 0 14px; }

/* ---------- class library (public/classroom.js) ---------- */
.cl-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.cl-actions .btn { flex: 1; }
.cl-search { margin-bottom: 12px; }
.cl-folder { margin-bottom: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.cl-folder-head {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.cl-folder-head b { font-size: 17px; display: inline-flex; align-items: center; gap: 6px; }
.cl-folder-head small { flex: 1; color: var(--ink-3); font-size: 13px; }
.cl-caret { display: grid; transition: transform .25s var(--ease-out, ease); }
.cl-open .cl-caret { transform: rotate(90deg); }
.cl-items { display: none; }
.cl-open .cl-items, .cl-pinned .cl-items { display: block; }
.cl-pinned { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.cl-pinned > .cl-folder-head { cursor: default; }
.cl-new { color: var(--danger); font-weight: 800; }

.cl-item, .cl-sugg { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.cl-kind { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--brand); }
.cl-kind svg { width: 24px; height: 24px; }
.cl-kind-pdf { color: #c4402f; background: color-mix(in srgb, #c4402f 12%, var(--surface)); }
.cl-kind-pptx { color: #c9682b; background: color-mix(in srgb, #c9682b 12%, var(--surface)); }
.cl-kind-docx { color: #2f63c4; background: color-mix(in srgb, #2f63c4 12%, var(--surface)); }
.cl-main { flex: 1; min-width: 0; }
.cl-main b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-main small { color: var(--ink-3); font-size: 12px; }
.cl-opens { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.cl-opens svg { width: 14px; height: 14px; }
.cl-btns { flex: none; display: flex; align-items: center; gap: 4px; }
.cl-save {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.cl-saved { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.cl-more { width: 32px; }

.cl-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.chip-on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.cl-all { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 700; }
.cl-ticks { max-height: 38vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; }
.cl-tick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cl-tick:last-child { border-bottom: 0; }
.cl-tick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-tick small { display: block; color: var(--ink-3); font-size: 12px; }
.cl-tick input, .cl-all input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }
.cl-done { opacity: .55; }
.cl-pickone small { color: var(--ink-3); margin-left: 6px; }
.cl-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 40vh; overflow-y: auto; }
.cl-person { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-size: 13px; }
.cl-person-done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.cl-person svg { width: 14px; height: 14px; }
.cl-roster { max-height: 50vh; overflow-y: auto; }
.cl-member { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cl-member b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-member small { color: var(--ink-3); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .cl-caret { transition: none; } }

/* ---------- class challenges (public/classroom.js) ---------- */
.ch-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ch-card {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px; border-radius: 18px; text-align: left; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer;
}
.ch-card:active { transform: scale(.99); }
.ch-ended { opacity: .7; box-shadow: none; }
.ch-mine { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.ch-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--brand); background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.ch-icon svg { width: 26px; height: 26px; }
.ch-icon-big { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 6px; }
.ch-icon-big svg { width: 38px; height: 38px; }
.ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ch-main b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-main small { color: var(--ink-3); font-size: 13px; }
.ch-bar { height: 8px; margin: 4px 0 0; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-chips .chip { min-height: 36px; padding: 0 14px; cursor: pointer; }
.ch-sheet { text-align: center; }
.ch-sheet h3 { margin: 4px 0; }
.ch-sheet h4 { text-align: left; margin: 16px 0 6px; }
.ch-board { text-align: left; }
.ch-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.ch-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-row-me { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); border-radius: 10px; }
.ch-remove { margin-top: 14px; color: var(--danger); }
.ch-reads { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; text-align: left; }
.ch-read { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.ch-read svg { width: 22px; height: 22px; flex: none; color: var(--ink-3); }
.ch-read-done svg { color: var(--ok); }

.ch-quiz {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom)); background: var(--bg);
}
.ch-quiz > .spinner { margin-top: 30vh; }
.ch-quiz-top { display: flex; align-items: center; gap: 10px; }
.ch-quiz-bar { flex: 1; height: 10px; }
.ch-q { font-size: 21px; line-height: 1.3; margin: 8px 0 4px; }
.ch-opts { display: flex; flex-direction: column; gap: 10px; }
.ch-opt {
  min-height: 54px; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  font: inherit; font-size: 16px; text-align: left; color: inherit; cursor: pointer;
}
.ch-opt:disabled { cursor: default; }
.ch-right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.ch-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.ch-why { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.ch-done { margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ch-score {
  display: flex; align-items: center; justify-content: center; gap: 2px; width: 132px; height: 132px; border-radius: 50%; font: 800 46px/1 var(--font-display, inherit);
  background: radial-gradient(circle, var(--surface) 58%, transparent 59%), conic-gradient(var(--ok), var(--accent), var(--ok));
}
.ch-score small { font-size: 18px; color: var(--ink-3); }
.ch-xp { margin: 0; font-weight: 800; font-size: 22px; color: var(--ok); }
.ch-done .btn { max-width: 340px; margin-top: 10px; }

/* ---------- comments under the board ---------- */
.g-comment-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.g-comment-box textarea { resize: none; min-height: 64px; font: inherit; }
.g-comment-bar { display: flex; align-items: center; justify-content: space-between; }
.g-comment-bar small { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.g-comments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.g-comment { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.g-comment-main { flex: 1; min-width: 0; }
.g-comment-head { display: flex; align-items: center; gap: 8px; }
.g-comment-head b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-comment-head small { color: var(--ink-3); font-size: 12px; }
.g-comment-del { margin-left: auto; width: 32px; height: 32px; color: var(--ink-3); }
.g-comment-del svg { width: 18px; height: 18px; }
.g-comment p { margin: 4px 0 0; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
