/* Shared compact layout, calibrated to the member's social-feed reference.
   14px body / 12px metadata / 24px action icons; 4, 8, 12, 16, 24px spacing. */
:root {
  --font-body: "Outfit", "Nirmala UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: var(--font-body);
  --font-display: "Bricolage Grotesque", "Outfit", "Nirmala UI", system-ui, sans-serif;
  --ui-text-caption: .75rem;
  --ui-text-body: 1rem;
  --ui-text-label: .875rem;
  --ui-text-heading: 1.125rem;
  --ui-radius-control: .5rem;
  --ui-radius-panel: .75rem;
  --ui-gap: .75rem;
  --ui-panel-padding: 1rem;
  --ui-control-height: 2.75rem;
  --compact-gutter: 1rem;
}
#app, #auth, body > dialog {
  font-family: var(--font-body);
  font-size: .9375rem;
  line-height: 1.55;
}
#app :is(h1, h2, h3, h4, .page-title, .lp-title, .post-title),
#auth :is(h1, h2, h3), body > dialog :is(h2, h3) { font-family: var(--font-display); }
#app :is(button, input, select, textarea), #auth :is(button, input, select, textarea), dialog :is(button, input, select, textarea) { font-family: inherit; }
#app .icon, dialog .icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
#app :is(.top-actions, .post-actions, .floating-nav) .icon { width: 1.5rem; height: 1.5rem; stroke-width: 1.8; }
#app :is(.icon-btn, .back-btn), dialog .icon-btn { min-width: 44px; min-height: 44px; }
#app .topbar { min-height: 56px; padding-block: 4px; padding-inline: var(--compact-gutter); gap: 8px; }
#app .top-actions { gap: 0; }
#app .topbar .top-brand { font-size: 1.25rem; line-height: 1.2; white-space: nowrap; letter-spacing: -.04em; }
#app .topbar .brand-mark { height: 22px; width: auto; }
#app #view-title { font-family: inherit; font-size: 1.125rem; font-weight: 600; letter-spacing: -.02em; }
#app .column:not(.feed-column), #app .feed-column { padding: 16px var(--compact-gutter) 24px; }
#app .page-title { margin: 0 0 16px; font-size: 1.5rem; line-height: 1.25; font-weight: 600; letter-spacing: -.025em; }
#app :is(.section-head, .section-row, .g-section-head, .inbox-heading, .m-toolbar) { gap: 8px 12px; margin-bottom: 12px; }
#app :is(.section-head, .section-row, .g-section-head) h2 { font-size: 1.125rem; line-height: 1.35; letter-spacing: -.015em; }
#app :is(.small, .muted.small, .ib-preview, .direction-description, .cc-desc, .ca-note) { font-size: .8125rem; line-height: 1.45; }
#app .g-kicker { font-size: .6875rem; letter-spacing: .05em; line-height: 1.4; }
#app :is(.card:not(.post), .cc, .compose-card, .g-settings, .p-card, .lp-card, .lj-card, .qa-item, .skills-listing, .match-card, .listing-card, .exchange-card, .m-me, .m-campaign, .m-progress, .m-propose, .m-stance, .m-request, .m-kudos, .m-role, .m-profile, .a-panel, .a-request) {
  padding: var(--ui-panel-padding); border-radius: var(--ui-radius-panel); box-shadow: none;
}
#app :is(.primary, .ghost, .g-cta, .seg button, .chip), dialog :is(.primary, .ghost) { font-size: .875rem; line-height: 1.35; padding: 8px 12px; font-weight: 600; }
#app :is(input, textarea, select), #auth :is(input, textarea, select), dialog :is(input, textarea, select) { font-size: 1rem; line-height: 1.5; }
#app :is(.auth-form, .m-form, .skills-form, .task-form), dialog form { gap: 12px; }
#app :is(.auth-form, .m-form, .skills-form, .task-form) label, dialog label { font-size: .875rem; line-height: 1.4; }
#app :is(.lp, .qa-list, .skills-content, .skills-section, .m-content, .m-list, .a-panel, .learning-directions) { gap: 12px; }
#app :is(.lp-title, .direction-title) { font-size: 1rem; line-height: 1.4; font-weight: 600; }
#app .learning-direction { padding: 16px; gap: 12px; border-radius: 12px; }
#app .direction-action { margin-top: 0; padding-top: 12px; font-size: .8125rem; }
#app .direction-topics > span { font-size: .75rem; }
#app .m-hero { padding: 16px; border-radius: 12px; }
#app #mission-body .m-hero .m-statement { font-size: 1.375rem; line-height: 1.35; letter-spacing: -.02em; }
#app :is(.m-stat strong, .a-tile strong, .p-stat strong) { font-family: inherit; font-size: 1.375rem; line-height: 1.25; }
#app :is(.m-stat span, .a-tile span, .p-stat span) { font-size: .75rem; line-height: 1.4; }
#app :is(.ib-row, .m-leader, .new-message-member, .share-member-row) { min-height: 64px; padding: 12px; gap: 12px; border-radius: 8px; }
#app .ib-name { font-size: .875rem; }
#app .main :is(th, td) { padding: 10px 12px; font-size: .8125rem; line-height: 1.45; }
#app .msg-text { font-size: .875rem; line-height: 1.5; }
#app .home-hero, #app .home-hero.has-daily-quote { min-height: 0; padding: 16px; margin: 0 0 16px; border-radius: 12px; }
#app .home-hero-text { gap: 8px; padding: 0; }
#app .home-hero .home-hero-text h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 600; letter-spacing: -.03em; }
#app .home-hero .home-hero-lead, #app .home-hero .daily-quote-inline blockquote { font-family: inherit; font-size: .875rem; line-height: 1.5; font-weight: 400; font-style: normal; }
#app .home-hero-text > p:last-child { font-size: .75rem; }
#app .stories { padding: 0 0 12px; gap: 16px; }
#app .stories .story-ring { width: 56px; height: 56px; padding: 2px; }
#app .story-label { font-size: .75rem; line-height: 1.35; margin-top: 4px; }
#app .compose-card { margin-bottom: 12px; }
#app .compose-row { gap: 8px; }
#app .compose-input { font-size: .875rem; line-height: 1.4; padding: 8px 12px; }
#app .compose-chips { margin-top: 8px; padding-top: 8px; gap: 4px; }
#app .compose-chips button { font-size: .75rem; gap: 4px; min-height: 44px; }
#app .compose-chips .icon { width: 18px; height: 18px; }
#app .feed-heading { padding: 8px 0 12px; gap: 12px; }
#app .feed-heading .g-kicker { margin: 0 0 4px; }
#app .feed-heading h2 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; letter-spacing: -.02em; }
#app .feed-heading > span { font-size: .75rem; }
#app .post-list { gap: 0; }
#app .card.post { padding: 0; background: var(--bg); border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
#app .post-head { min-height: 60px; padding: 8px 12px; gap: 10px; }
#app .post-head .avatar { width: 32px; height: 32px; min-width: 32px; font-size: .875rem; }
#app .post-who { gap: 2px; min-width: 0; }
#app .post-who :is(strong, .user-link) { font-size: .875rem; line-height: 1.35; font-weight: 600; }
#app .post-who .small { font-size: .75rem; line-height: 1.35; }
#app .post-head .track-chip { min-height: 32px; padding: 6px 12px; font-size: .8125rem; border-radius: 8px; }
#app .post-media { margin: 0; border-radius: 0; overflow: hidden; }
#app .post-img { display: block; width: 100%; height: auto; max-height: none; object-fit: contain; border-radius: 0; }
#app .post-media:hover .post-img { transform: none; }
#app .post-body { padding: 0 12px 12px; }
#app .post-actions { padding: 0; gap: 4px; min-height: 44px; }
#app .post-actions .icon-action { min-width: 44px; min-height: 44px; padding: 8px 4px; gap: 4px; font-size: .8125rem; }
#app .post-actions .save-post { margin-left: auto; }
#app .post-text { padding: 0; margin: 0 0 8px; background: transparent; border: 0; border-radius: 0; min-height: 0; }
#app .post-title { margin: 0; font-family: inherit; font-size: .875rem; line-height: 1.45; font-weight: 600; letter-spacing: 0; }
#app .post-desc { margin: 4px 0 0; font-size: .875rem; line-height: 1.45; font-weight: 400; }
#app .post:not(:has(.post-media)) .post-body { display: flex; flex-direction: column; }
#app .post:not(:has(.post-media)) .post-text { order: -1; margin-top: 4px; }
#app .post:not(:has(.post-media)) .post-actions { margin-top: 0; }
#app .comment-text, #app .post .comment-cloud > .comment-text { font-size: .875rem; line-height: 1.45; padding: 8px 12px; }
#app .comments { gap: 8px; margin: 8px 0; }
#app .comment-meta { gap: 6px; font-size: .8125rem; }
#app .comment-meta time { font-size: .75rem; }
#app .comment-form { margin-top: 8px; }
body > dialog { padding: 16px; border-radius: 12px; }
body > dialog :is(h2, h3) { font-size: 1.125rem; line-height: 1.35; margin-bottom: 12px; }
#auth .auth-card { padding: 24px; border-radius: 12px; }
#auth .auth-form h2 { font-size: 1.5rem; line-height: 1.25; }
@media (max-width: 999px) {
  #app .main { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  #app .tabbar.floating-nav {
    position: absolute; inset-inline: 0; bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px)); min-height: 56px;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)); gap: 4px;
    background: var(--bg); border: 0; border-top: 1px solid var(--border);
    border-radius: 0; box-shadow: none;
  }
  #app .floating-nav > button { min-height: 44px; padding: 4px 8px; gap: 2px; border-radius: 12px; color: var(--muted); }
  #app .floating-nav > button.active { color: var(--text); background: var(--hover); }
  #app .floating-nav > button .tab-label { display: block; font-size: .625rem; line-height: 1.2; font-weight: 600; }
  #app .mobile-feed-top { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  #app .app-update-notice { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 767px) {
  :root { --compact-gutter: 12px; --ui-panel-padding: 12px; }
  #app .feed-column { padding-inline: 0; }
  #app .feed-column > :not(.post-list) { width: calc(100% - 24px); margin-left: 12px; margin-right: 12px; }
  #app .feed-column > .post-list { width: 100%; }
  #app .post-actions .discussion-label { display: none; }
  #app .home-hero-art { display: none; }
  #app .home-hero { grid-template-columns: minmax(0, 1fr); }
  #app .feed-heading > span { display: none; }
  #app .page-title { font-size: 1.375rem; }
  #app .stories .story-ring { width: 52px; height: 52px; }
  #app :is(.card, .cc, .g-settings, .p-card, .lp-card, .a-panel) { overflow-wrap: anywhere; }
  body > dialog { padding: 16px; max-width: calc(100vw - 24px); }
}
@media (min-width: 1000px) {
  :root { --compact-gutter: 24px; }
  #app .workspace-rail { padding: 16px 12px; }
  #app :is(.workspace-links, .rail-bottom) button { font-family: inherit; min-height: 44px; padding: 10px 12px; font-size: .875rem; gap: 12px; }
  #app .workspace-links { gap: 4px; }
  #app .feed-column { display: grid; grid-template-columns: minmax(0, 640px); justify-content: center; gap: 12px; }
  #app .feed-column > * { grid-area: auto; width: 100%; }
  #app .column:not(.feed-column) { max-width: 1120px; }
  #app .post-img { max-height: 800px; }
}
@media (min-width: 1400px) {
  #app .feed-column { grid-template-columns: minmax(0, 640px) minmax(240px, 280px); gap: 12px 24px; }
  #app #feed-hero { grid-area: 1 / 1 / 2 / 3; }
  #app #feed-top { grid-area: 2 / 1 / 3 / 3; }
  #app #feed-mission { grid-area: 3 / 2 / 7 / 3; }
  #app .feed-column > .compose-card { grid-area: 3 / 1; }
  #app #feed-trends { grid-area: 4 / 1; }
  #app .feed-heading { grid-area: 5 / 1; }
  #app #feed-list { grid-area: 6 / 1; }
  #app #feed-empty { grid-area: 7 / 1; }
  #app #feed-more { grid-area: 8 / 1; }
  #app #feed-skills { grid-area: 7 / 2 / 9 / 3; }
  #app .feed-column > .g-footer { grid-column: 1 / -1; }
}

/* Profile: compact identity, real activity stats, highlights and a media-first grid. */
body[data-view="profile"] #app .topbar .top-brand { display: none; }
body[data-view="profile"] #app .topbar #view-title {
  display: block; visibility: visible; flex: 1; min-width: 0; margin: 0; font-size: .875rem;
  line-height: 1.4; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body[data-view="profile"] #app .view-actions { margin-left: auto; }
#app #profile-view .profile-column { display: grid; gap: 0; width: 100%; max-width: 960px; padding-top: 16px; }
#app #profile-head { display: grid; gap: 12px; margin-bottom: 12px; min-width: 0; }
#app #profile-view .p-card {
  display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center;
  gap: 12px 16px; padding: 0; border: 0; border-radius: 0; background: transparent;
}
#app #profile-view .p-photo { width: 80px; align-self: start; margin-top: 4px; }
#app #profile-view .p-ring { padding: 0; border: 0; background: transparent; }
#app #profile-view .p-ring .avatar.xl { width: 80px; height: 80px; min-width: 80px; font-size: 1.75rem; border-radius: 50%; }
#app #profile-view .p-cam {
  width: 44px; height: 44px; right: -10px; bottom: -8px;
  padding: 10px; border: 0; background: transparent; color: var(--text);
}
#app #profile-view .p-cam .icon { width: 24px; height: 24px; padding: 3px; background: var(--panel); border: 1px solid var(--border); border-radius: 50%; }
#app #profile-view .p-info { display: flex; flex-wrap: wrap; align-content: center; align-items: center; gap: 6px 8px; padding: 0; }
#app #profile-view .p-name { width: 100%; margin: 0; font-size: .875rem; line-height: 1.4; font-weight: 600; letter-spacing: 0; gap: 6px; }
#app #profile-view .p-online { width: 6px; height: 6px; }
#app #profile-view .p-pills { gap: 4px; }
#app #profile-view .p-pills .pill { padding: 2px 6px; font-size: .6875rem; line-height: 1.4; }
#app #profile-view .p-statbar { width: 100%; flex: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; gap: 8px; }
#app #profile-view .ps-item { display: block; padding: 0; border: 0; }
#app #profile-view .ps-text { display: grid; gap: 2px; justify-items: start; text-align: left; line-height: 1.3; }
#app #profile-view .ps-text strong { font-family: inherit; font-size: 1rem; font-weight: 600; }
#app #profile-view .ps-text span { font-size: .75rem; line-height: 1.4; white-space: normal; overflow: visible; }
#app #profile-view .p-bio-block { grid-column: 1 / -1; display: grid; gap: 4px; min-width: 0; }
#app #profile-view .p-handle { margin: 0; font-size: .75rem; }
#app #profile-view .p-bio { font-size: .875rem; line-height: 1.45; font-weight: 400; white-space: pre-wrap; }
#app #profile-view .p-joined { margin-top: 4px; font-size: .75rem; line-height: 1.4; gap: 6px; }
#app #profile-view :is(.p-level, .p-joined) .icon { width: 14px; height: 14px; color: var(--muted); }
#app #profile-view .p-level { padding: 0; margin: 0; gap: 6px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 400; }
#app #profile-view .access-badge { font-size: .6875rem; padding: 2px 6px; line-height: 1.4; }
#app #profile-view .access-detail { display: none; }
#app #profile-view .p-dashboard {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 56px; padding: 10px 12px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
#app #profile-view .p-dashboard > span { display: grid; gap: 2px; }
#app #profile-view .p-dashboard strong { font-size: .875rem; font-weight: 600; }
#app #profile-view .p-dashboard span span { font-size: .75rem; color: var(--muted); }
#app #profile-view .p-buttons { display: grid; margin: 0; gap: 8px; }
#app #profile-view .p-buttons-mine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#app #profile-view .p-buttons:has(> button:only-child) { grid-template-columns: minmax(0, 1fr); justify-items: end; }
#app #profile-view .p-btn { min-width: 0; min-height: 44px; padding: 8px 12px; gap: 6px; border-radius: 8px; font-size: .875rem; line-height: 1.35; }
#app #profile-view .p-btn .icon { width: 18px; height: 18px; }
#app #profile-view .p-shortcuts { display: flex; gap: 16px; overflow-x: auto; padding: 4px 0; scrollbar-width: thin; }
#app #profile-view .p-shortcut { display: grid; justify-items: center; flex: 0 0 68px; gap: 6px; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--text); font-size: .75rem; line-height: 1.35; }
#app #profile-view .p-shortcut-ring { display: grid; place-items: center; width: 64px; height: 64px; padding: 4px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--panel); }
#app #profile-view .p-shortcut-ring .icon { width: 24px; height: 24px; stroke-width: 1.8; }
#app #profile-view .profile-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 56px; border-bottom: 1px solid var(--border); }
#app #profile-view .profile-tabs button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px; border: 0; background: transparent; color: var(--muted); font-size: .75rem; }
#app #profile-view .profile-tabs .icon { width: 24px; height: 24px; }
#app #profile-view .profile-tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
#app #profile-view .profile-tabs button[aria-selected="true"]::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--text); }
#app #profile-view #profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 0; width: 100%; border-radius: 0; }
#app #profile-view .thumb { min-width: 0; min-height: 0; aspect-ratio: 3 / 4; border-radius: 0; }
#app #profile-view .thumb img { object-fit: cover; }
#app #profile-view .thumb-text { display: grid; align-content: center; padding: 12px; font-family: inherit; font-size: .8125rem; line-height: 1.4; font-weight: 500; }
#app #profile-view .thumb-stats { inset: auto 0 0; display: block; padding: 16px 8px 6px; background: linear-gradient(transparent, #0009); font-size: .6875rem; font-weight: 500; opacity: 1; text-align: left; }
#app #profile-view #profile-about-panel:not([hidden]) { display: grid; gap: 12px; padding-top: 16px; }
#app #profile-view #profile-about-panel > div:empty { display: none; }
#app #profile-view #profile-about-panel :is(.lj-card, .m-profile) { margin: 0; }
#app #profile-view #profile-more { margin-top: 16px; }
@media (max-width: 767px) {
  #app #profile-view .profile-column { padding: 12px 12px 24px; }
  #app #profile-view :is(.profile-tabs, #profile-posts-panel) { margin-inline: -12px; width: calc(100% + 24px); }
  #app #profile-view #profile-empty, #app #profile-view #profile-more { margin-inline: 12px; width: calc(100% - 24px); }
}
@media (min-width: 768px) {
  #app #profile-view .profile-column { padding-top: 24px; }
  #app #profile-view .p-card { grid-template-columns: 96px minmax(0, 1fr); gap: 16px 24px; }
  #app #profile-view .p-photo, #app #profile-view .p-ring .avatar.xl { width: 96px; height: 96px; }
  #app #profile-view .p-info { max-width: 480px; }
  #app #profile-view .p-name { font-size: 1rem; }
  #app #profile-view .ps-text strong { font-size: 1.125rem; }
  #app #profile-view .ps-text span { font-size: .875rem; }
  #app #profile-view .p-bio-block { max-width: 65ch; }
  #app #profile-view .p-dashboard { max-width: 560px; }
  #app #profile-view .p-buttons { max-width: 560px; }
  #app #profile-view .p-shortcuts { padding-block: 8px; }
  #app #profile-view #profile-about-panel:not([hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #app #profile-view #profile-impact { grid-column: 1 / -1; }
}

/* Light outline navigation keeps the chrome quiet in either theme. */
#app .top-actions .icon, #app .back-btn .icon { width: 22px; height: 22px; }
#app .floating-nav > button.active { background: transparent; color: var(--sage-deep); }
#app .floating-nav > button .tab-label { font-weight: 500; }
#app .floating-nav > button.active .tab-label { color: inherit; font-weight: 600; }
@media (hover: hover) {
  #app .floating-nav > button.active:hover { color: var(--sage-deep); background: var(--hover); }
}
/* Shared finishing rules preserve content spacing. */
#app :is(.post-text, .comment-text, .msg-text) > p:first-child,
body > dialog form > p:first-child { margin-top: 0; }
#app :is(.post-text, .comment-text, .msg-text) > p:last-child,
body > dialog form > p:last-child { margin-bottom: 0; }
#app :is(.post-title, .post-desc):empty { display: none; }
#app :is(.post-desc, .p-bio, .msg-text) { overflow-wrap: anywhere; }
body > dialog form > p { margin-block: 0; line-height: 1.5; }
body > dialog form { row-gap: 12px; }
.icon-attribution { color: inherit; font-size: .6875rem; text-underline-offset: 3px; }
.icon-attribution:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* Reference-aligned details across member, staff and onboarding surfaces. */
:root {
  --ui-radius-control: .625rem;
  --ui-radius-panel: .875rem;
  --ui-panel-padding: 1rem;
}

/* Keep alerts mounted for announcements, without painting an empty error box. */
.form-error:empty { min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; }
.form-error:not(:empty) { margin-top: 12px; padding: 10px 12px; }
#auth .auth-form { gap: 12px; }
#auth .auth-form > h2 { margin: 0 0 4px; }
#auth .auth-form label { display: grid; gap: 6px; }
#auth .auth-form .forgot-line { margin: 0; }
#auth .auth-card { box-shadow: none; }
#auth .auth-form :is(.primary, .google-btn) { min-height: 46px; }
#app .g-settings > h2 { display: flex; align-items: center; gap: 10px; }
#app .g-settings > h2 .settings-heading-icon { width: 20px; height: 20px; color: var(--muted); }

/* Use the same panel edges and text rhythm in secondary screens. */
#app :is(.skills-prompt, .skills-mine, .empty-moments, .feed-empty,
  .m-empty, .qa-empty, .a-request, .ca-card) { border-radius: var(--ui-radius-panel); }
#app :is(.skills-prompt, .skills-mine) { padding: 16px; }
#app :is(.skills-hero, .g-circle-head) { margin-bottom: 16px; }
#app :is(.skills-hero, .g-circle-head) h1 { margin-block: 0 6px; font-size: 1.5rem; line-height: 1.25; }
#app :is(.skills-hero, .g-circle-head) > p { margin-block: 0; }
#app :is(.empty-moments, .feed-empty, .m-empty, .qa-empty) { padding: 24px 16px; }
#app :is(.empty-moments, .feed-empty, .m-empty, .qa-empty) :is(h2, h3) { margin: 0 0 8px; line-height: 1.35; }
#app :is(.empty-moments, .feed-empty, .m-empty, .qa-empty) p { max-width: 48ch; margin: 0 auto 12px; line-height: 1.5; }
#app :is(.card, .g-settings, .m-me, .m-role, .qa-item, .a-panel, .ca-card) > p:first-child { margin-top: 0; }
#app :is(.card, .g-settings, .m-me, .m-role, .qa-item, .a-panel, .ca-card) > p:last-child { margin-bottom: 0; }
#app :is(.section-head, .section-row, .g-section-head) > .page-title { margin-bottom: 0; }
#app :is(.g-settings, .a-panel, .ca-card) :is(h2, h3) { margin-block: 0 8px; }
#app :is(.m-stat, .a-tile, .p-stat, .rc-tier-points) { font-variant-numeric: tabular-nums; }

/* Selection has one treatment; orange remains reserved for the next action. */
#app :is(.seg, .m-tabs) { border-radius: 12px; padding: 4px; gap: 4px; }
#app :is(.seg, .m-tabs) > button { border-radius: 8px; }
#app :is(.seg, .m-tabs) > button.on {
  background: var(--text); color: var(--bg); box-shadow: none; border-color: transparent;
}
#app :is(.seg, .m-tabs) > button:not(.on) { color: var(--muted); }

/* Dialogs share the same density, including dynamically created forms. */
body > dialog { padding: 20px; border-radius: 16px; }
body > dialog :is(form, .m-form, .skills-form) { min-width: 0; }
body > dialog :is(input, textarea, select) { border-radius: 10px; }
body > dialog .dialog-actions { gap: 8px; margin-top: 16px; }
body > dialog .dialog-actions > button { min-height: 44px; }
#app :is(button, a), #auth :is(button, a), dialog :is(button, a) { -webkit-tap-highlight-color: transparent; }

/* A clear row boundary and steady header make longer admin lists scannable. */
#app .main th { text-align: start; font-weight: 600; color: var(--muted); background: var(--panel-2); }
#app .main td { border-bottom: 1px solid var(--border); vertical-align: top; }
#app .main tr:last-child td { border-bottom: 0; }
#app .main :is(th, td) { overflow-wrap: anywhere; }

@media (hover: hover) {
  #app :is(.seg, .m-tabs) > button:not(.on):hover { background: var(--hover); color: var(--text); }
  #app :is(.ib-row, .new-message-member, .share-member-row):hover { background: var(--hover); }
}
@media (max-width: 767px) {
  :root { --ui-panel-padding: 12px; }
  #app :is(.skills-prompt, .skills-mine) { padding: 12px; }
  #app :is(.skills-hero, .g-circle-head) h1 { font-size: 1.375rem; }
  body > dialog { padding: 16px; }
  #app :is(.seg, .m-tabs) > button { min-height: 44px; }
}

/* One type hierarchy across member screens, staff tools and overlays.
   Font variables stay at the root so saved font choices can override them. */
#app :is(h1, h2, h3, h4, .page-title, .lp-title, .direction-title),
#auth :is(h1, h2, h3), body > dialog :is(h1, h2, h3, h4) {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.3;
}
#app .page-title { font-size: clamp(1.5rem, 2vw, 1.75rem); line-height: 1.2; }
#app #view-title { font-family: var(--font-display); font-size: 1.125rem; letter-spacing: -.02em; }
#app .home-hero .home-hero-text h1 { font-size: clamp(1.5rem, 2.4vw, 1.875rem); line-height: 1.2; }
#app #profile-view .p-name { font-family: var(--font-display); font-size: 1.125rem; line-height: 1.3; }
#app :is(.post-title, .post-desc, .msg-text, .comment-text),
#app .post .comment-cloud > .comment-text {
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6; letter-spacing: 0;
}
#app .post-title { font-weight: 500; }
#app :is(.post-desc, .msg-text, .comment-text) { font-weight: 400; }
#app :is(.small, .muted.small, .cc-desc, .direction-description, .ca-note) { font-size: .875rem; line-height: 1.55; }
#app :is(.g-kicker, .rail-section), #auth .g-kicker { font-size: .75rem; line-height: 1.5; letter-spacing: .07em; font-weight: 500; }
#app :is(.post-who .small, .ib-time, .p-joined), #app #profile-view .p-joined { font-size: .75rem; line-height: 1.5; }
#app :is(button, label), #auth :is(button, label), body > dialog :is(button, label) { letter-spacing: 0; }
#app :is(.primary, .ghost, .g-cta, .seg button),
#auth :is(.primary, .ghost), body > dialog :is(.primary, .ghost) { font-weight: 500; }
#app :is(.m-stat strong, .a-tile strong, .ps-text strong, .lj-value, .rc-number) {
  font-family: var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
#app :is(.prose, .lesson-body) { font-size: 1rem; line-height: 1.75; }
@media (max-width: 767px) {
  #app .floating-nav > button .tab-label { font-size: .6875rem; line-height: 1.25; }
  #app .topbar .top-brand { font-size: 1.1875rem; }
}

/* Message rows expose separate native buttons for opening and options. */
#app { overflow: hidden; overflow: clip; }
#app .ib-row { gap: 4px; padding: 8px; cursor: default; }
#app .ib-open {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  min-height: 56px; padding: 4px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; text-align: start;
}
#app .ib-open .ib-main { flex: 1; }
#app .ib-open:focus-visible { outline-offset: 0; }

/* Footer text shares the app's surface and contrast tokens. */
:root[data-theme] .g-footer, :root[data-theme] .g-footer .gf-inner {
  background: var(--panel); color: var(--text);
}
:root[data-theme] .g-footer :is(.gf-brand, .gf-tag, .gf-bottom, .gf-link, .icon-attribution, p) { color: var(--text); }
:root:not([data-theme="dark"]) #mission-body .m-hero :is(.g-kicker, .m-statement) { color: var(--sage-deep); }

/* Phone Home: compact introduction and composer, with real posts higher up. */
@media (max-width: 767px) {
  #app .home-hero, #app .home-hero.has-daily-quote { padding: 12px; margin-bottom: 12px; }
  #app .home-hero-text { gap: 6px; }
  #app .home-hero-text > .g-kicker { display: none; }
  #app .home-hero .home-hero-text h1 { font-size: 1.375rem; }
  #app .stories { gap: 12px; padding-bottom: 8px; }
  #app .stories .story-ring { width: 40px; height: 40px; }
  #app .story-label { margin-top: 4px; }
  #app .compose-card { padding: 12px; }
  #app .compose-row .avatar { width: 32px; height: 32px; min-width: 32px; }
  #app .compose-input { flex: 1 1 0%; width: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #app .stories .story-sk { width: 40px; height: 40px; }
  #app .compose-chips { gap: 0; margin-top: 4px; padding-top: 4px; }
  #app .feed-heading { padding-top: 4px; padding-bottom: 8px; }
  #app .post-actions .discussion-label {
    display: inline; position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}
/* Polish: name and time sit together, tile text stops above its counts, icons fill emoji tiles. */
#app .post-who { align-content: center; }
#app .post-who .user-link { display: flex; align-items: flex-end; }
#app #profile-view .thumb-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; box-sizing: border-box; height: calc(100% - 28px); padding: 12px 12px 0; }
#app #profile-view .thumb-stats { display: flex; gap: 10px; }
#app .thumb-stats > span { display: inline-flex; align-items: center; gap: 3px; }
#app .thumb-stats .icon { width: 12px; height: 12px; --duo: currentColor; }
#app :is(.chan-avatar, .cc-tile, .g-circle-emoji) > .icon { width: 50%; height: 50%; color: var(--accent); }
#app .circle-av > .icon { color: var(--accent); }
#app .main :is(.hashtag, .mention), #app :is(.hashtag, .mention) { display: inline; min-width: 0; min-height: 0; font-size: inherit; line-height: inherit; vertical-align: baseline; }
#app .home-facts:empty { display: none; }
/* Member invites: the profile card and its sheet. */
#app #profile-view .p-invite > .icon { color: var(--accent); }
.invite-sheet { display: grid; gap: 12px; }
.invite-sheet p { margin: 0; }
.invite-seats { font-weight: 600; }
.invite-links { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.invite-links li { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.invite-links input { width: 100%; min-width: 0; font-size: .8125rem; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-actions :is(a, button), .invite-sheet > .primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }

/* Signed-out visitors on a shared post link see a teaser above the sign-in form. */
.shared-teaser { display: grid; gap: 6px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line, rgba(127,127,127,.25)); border-left: 4px solid var(--accent, #ff7937); border-radius: 12px; background: var(--surface, transparent); }
.shared-teaser p { margin: 0; }
.shared-teaser-by { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--accent, #ff7937); }
.shared-teaser-by .icon { width: 16px; height: 16px; }
.shared-teaser-text { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.shared-teaser .link { justify-self: start; }

/* Suggestion cards: Message and Track as icons only. */
.suggest .g-person-actions button { gap: 0; padding: 0; }
.suggest .g-person-actions button > .icon { width: 20px; height: 20px; margin: 0; }

/* Share as image: the card preview with Share and Download. */
.share-card-dialog { display: grid; gap: 12px; }
.share-card-preview { display: block; width: min(100%, 320px); aspect-ratio: 4 / 5; justify-self: center; border-radius: 12px; border: 1px solid var(--border); }
.share-card-actions { display: flex; gap: 8px; }
.share-card-actions > button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* Learning screens: no text selection (answers can still be typed),
   and nothing to print. See learn.js. */
:is(#learn-view, #lesson-view, #review-view, #task-view, #course-view, #exam-view) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:is(#learn-view, #lesson-view, #review-view, #task-view, #course-view, #exam-view) :is(input, textarea, select, [contenteditable="true"]) { -webkit-user-select: text; user-select: text; }
:is(#learn-view, #lesson-view, #review-view, #task-view, #course-view, #exam-view) img { -webkit-user-drag: none; }
@media print { body:is([data-view="learn"], [data-view="lesson"], [data-view="review"], [data-view="task"], [data-view="course"]) #app { display: none !important; } }

/* Waitlist: the form, then your place in the queue and your share link. */
.waitlist-fields { display: grid; gap: 12px; }
.waitlist-fields[hidden], .waitlist-result[hidden] { display: none; }
.waitlist-result { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.waitlist-result p { margin: 0; }
.waitlist-place { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.waitlist-place strong { font-family: var(--font-display, inherit); font-size: 2.25rem; line-height: 1; color: var(--accent); }
.waitlist-share { display: flex; flex-wrap: wrap; gap: 8px; }
.waitlist-share > * { flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 640px) { .seg.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.a-place { min-width: 44px; font-size: 1.25rem; color: var(--accent); }
.a-subhead { margin: 16px 0 4px; font-size: 1rem; }
.a-digest { display: grid; gap: 8px; margin-bottom: 12px; padding: 16px; }
.a-digest p { margin: 0; }
.a-digest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.a-digest-head h2 { margin: 0; font-size: 1rem; }
.a-digest > button { justify-self: start; }
.a-waitlist-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px 12px; align-items: start; }
.a-waitlist-row .grow { min-width: 0; overflow-wrap: anywhere; }
.a-waitlist-row > .a-request-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- interactive courses (courses.js) ---------- */
.course-list { display: grid; gap: 10px; margin: 16px 0 20px; }
.course-list h2 { margin: 0; font-size: 1.05rem; }
.course-tile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--panel, var(--card, transparent)); color: inherit; font: inherit; cursor: pointer; }
.course-tile:hover { border-color: var(--accent); }
.course-tile-number { font-family: var(--font-display, inherit); font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.course-tile-text { display: grid; gap: 4px; min-width: 0; }
.course-tile > .small { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.course-tile-track { display: block; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.course-tile-track > span { display: block; height: 100%; background: var(--accent); }

#course-body { display: grid; gap: 14px; padding-bottom: 24px; }
.course-progress { display: flex; gap: 3px; }
.course-progress > span { flex: 1; height: 4px; border-radius: 4px; background: var(--border); transition: background .2s; }
.course-progress > span.on { background: var(--accent); }
.course-card { display: grid; gap: 14px; min-height: 52vh; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel, var(--card, transparent)); align-content: start; }
.course-card h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.course-card p { margin: 0; }
.course-cover { align-content: center; }
.course-title { margin: 0; font-size: 2.4rem; line-height: 1.05; }
.course-subtitle { font-size: 1.1rem; }
.course-route, .course-items, .course-steps, .course-takeaways { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.course-route li, .course-items li { display: grid; gap: 2px; padding: 12px 14px 12px 48px; position: relative; border-radius: 12px; background: var(--hover, rgba(127,127,127,.08)); counter-increment: step; }
.course-route li::before, .course-items li::before, .course-steps li::before { content: counter(step, decimal-leading-zero); position: absolute; left: 14px; top: 12px; font-weight: 700; color: var(--accent); }
.course-steps li { position: relative; padding-left: 40px; counter-increment: step; }
.course-steps li::before { top: 0; }
.course-big { display: grid; gap: 4px; }
.course-big strong { font-family: var(--font-display, inherit); font-size: 3rem; line-height: 1; color: var(--accent); }
.course-key-point { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--hover, rgba(127,127,127,.08)); font-weight: 600; }
.course-key-point .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
.course-rows { display: grid; gap: 10px; }
.course-row { display: grid; gap: 6px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--hover, rgba(127,127,127,.08)); }
.course-row dt { font-weight: 700; }
.course-row dd { display: grid; margin: 0; }

.course-tool { display: grid; gap: 14px; }
.course-slider { display: grid; gap: 6px; }
.course-slider-head { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.course-slider output { font-weight: 700; color: var(--accent); }
.course-slider input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 28px; }
.course-result { display: grid; gap: 4px; padding: 16px; border-radius: 14px; background: var(--hover, rgba(127,127,127,.08)); }
.course-result-value { font-family: var(--font-display, inherit); font-size: 2rem; line-height: 1.1; color: var(--accent); overflow-wrap: anywhere; }
.course-result-value.loss { color: var(--danger, #e5484d); }
.course-result-label { font-weight: 600; }
.course-result-warn { color: var(--danger, #e5484d); font-weight: 600; }
.course-figure { margin: 8px 0 0; }
.course-chart { width: 100%; height: auto; }
.course-line-0 { stroke: var(--muted, #93a49a); }
.course-line-1 { stroke: var(--accent); }
.course-legend { display: flex; gap: 14px; }
.course-key::before { content: ''; display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.course-key-0::before { background: var(--muted, #93a49a); }
.course-key-1::before { background: var(--accent); }
.course-book { width: 100%; margin-top: 8px; border-collapse: collapse; }
.course-book th, .course-book td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--border); }
.course-book tr.filled td { color: var(--accent); font-weight: 700; }
.course-bars { display: grid; gap: 8px; margin-top: 8px; }
.course-bar { display: grid; grid-template-columns: 90px minmax(0, 1fr) 64px; align-items: center; gap: 8px; }
.course-bar-track { height: 10px; border-radius: 6px; background: var(--border); overflow: hidden; }
.course-bar-fill { display: block; height: 100%; background: var(--accent); }

.course-options { display: grid; gap: 10px; }
.course-option { padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.course-option:hover:not(:disabled) { border-color: var(--accent); }
.course-option.right { border-color: var(--success, #3dd68c); background: color-mix(in srgb, var(--success, #3dd68c) 14%, transparent); }
.course-option.wrong { border-color: var(--danger, #e5484d); background: color-mix(in srgb, var(--danger, #e5484d) 12%, transparent); }
.course-explain { padding: 12px 14px; border-radius: 12px; background: var(--hover, rgba(127,127,127,.08)); }
.course-explain[hidden] { display: none; }
.course-takeaways li { display: flex; gap: 8px; align-items: flex-start; }
.course-takeaways .icon { flex: none; color: var(--accent); }
.course-finish-status { display: grid; gap: 8px; justify-items: start; }
.course-finish-status p { display: flex; align-items: center; gap: 6px; }

.course-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); }
.course-nav button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.course-nav button[hidden] { display: none; }

/* Course charts, candles, fill-in statements and reflections. */
.course-price, .course-candles { width: 100%; height: auto; border-radius: 12px; background: var(--hover, rgba(127,127,127,.08)); }
.course-price-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.course-hidden-line { fill: none; stroke: var(--danger, #e5484d); stroke-width: 2.5; stroke-dasharray: 5 4; opacity: 0; transition: opacity .4s; }
.course-price.revealed .course-hidden-line { opacity: 1; }
.course-level { stroke: var(--muted, #93a49a); stroke-width: 1; stroke-dasharray: 4 4; }
.course-level-label { fill: var(--muted, #93a49a); font-size: 10px; font-family: inherit; }
.course-dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; transition: r .15s; }
.course-dot.right { fill: var(--success, #3dd68c); stroke: var(--success, #3dd68c); r: 7; }
.course-dot.wrong { fill: var(--danger, #e5484d); stroke: var(--danger, #e5484d); r: 7; }
.course-hit { fill: transparent; cursor: pointer; }
.course-price.done .course-hit { cursor: default; }
.course-wick { stroke-width: 2; }
.course-wick.up, .course-body.up { stroke: var(--success, #3dd68c); fill: var(--success, #3dd68c); }
.course-wick.down, .course-body.down { stroke: var(--danger, #e5484d); fill: var(--danger, #e5484d); }
.course-fill { display: grid; gap: 2px; }
.course-fill-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.course-fill-row.blank { padding: 10px 4px; }
.course-fill-row > span:first-child { display: grid; gap: 2px; min-width: 0; }
.course-fill-value { font-variant-numeric: tabular-nums; font-weight: 600; }
#course-view .course-fill-input { flex: none; width: 96px; min-height: 40px; padding: 6px 10px; text-align: right; font: inherit; font-weight: 700; border: 1px solid var(--border-strong, var(--border)); border-radius: 10px; background: transparent; color: inherit; }
#course-view .course-fill-input.right { border-color: var(--success, #3dd68c); color: var(--success, #3dd68c); }
#course-view .course-fill-input.wrong { border-color: var(--danger, #e5484d); box-shadow: 0 0 0 1px var(--danger, #e5484d); }
.course-fill-hint[hidden] { display: none; }
.course-reflect { display: grid; gap: 6px; }
.course-reflect textarea { width: 100%; min-height: 64px; padding: 10px 12px; font: inherit; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: inherit; resize: vertical; }
.course-card > button { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }

/* Candle homework (Q&A). */
.course-candles .dim { opacity: .35; }
.course-zone { fill: var(--accent); opacity: .22; }
.course-zone-label { fill: var(--text, currentColor); font-size: 14px; font-weight: 600; font-family: inherit; }
.course-trendline { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.homework-tile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; margin: 4px 0 12px; padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--panel, transparent); color: inherit; font: inherit; cursor: pointer; }
.homework-tile:hover { border-color: var(--accent); }
.homework-tile > span:nth-child(2) { display: grid; gap: 2px; }
.homework-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.homework-dialog { display: grid; gap: 12px; }
.homework-form { display: grid; gap: 10px; }
.homework-form label { display: grid; gap: 4px; }
.homework-form label[hidden] { display: none; }
.homework-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.homework-verdict { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; }
.homework-verdict.right { border-color: var(--success, #3dd68c); }
.homework-verdict.wrong { border-color: var(--danger, #e5484d); }
.homework-verdict p { margin: 0; }
.homework-headline { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.homework-verdict.right .homework-headline .icon { color: var(--success, #3dd68c); }
.homework-verdict.wrong .homework-headline .icon { color: var(--danger, #e5484d); }
.homework-ohlc { font-variant-numeric: tabular-nums; }
.homework-rules { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.homework-rules li { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.homework-rules .icon { flex: none; width: 16px; height: 16px; margin-top: 3px; }
.homework-rules li.right .icon { color: var(--success, #3dd68c); }
.homework-rules li.wrong .icon { color: var(--danger, #e5484d); }
.homework-history { display: grid; gap: 6px; }
.homework-history h3 { margin: 4px 0 0; font-size: .95rem; }
.homework-past { display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.homework-past > span:last-child { display: grid; }
.homework-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.homework-mark.right { color: var(--success, #3dd68c); background: color-mix(in srgb, var(--success, #3dd68c) 16%, transparent); }
.homework-mark.wrong { color: var(--danger, #e5484d); background: color-mix(in srgb, var(--danger, #e5484d) 14%, transparent); }

.homework-account { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--hover, rgba(127,127,127,.08)); }
.homework-account p { margin: 0; }
.homework-account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.homework-connected { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.homework-connected .icon { color: var(--success, #3dd68c); }
.ghost-link { color: var(--accent); font-weight: 600; }
.referral-setting { display: grid; gap: 6px; }
.referral-setting[hidden] { display: none; }

/* ---------- active course cards: tap to reveal, match up, put in order ---------- */
.course-reveals { display: grid; gap: 10px; }
.course-reveal { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; width: 100%; padding: 14px; text-align: left; border: 1px dashed var(--border-strong, var(--border)); border-radius: 14px; background: transparent; color: inherit; font: inherit; cursor: pointer; transition: border-color .2s, background .2s; }
.course-reveal:hover { border-color: var(--accent); }
.course-reveal-num { font-weight: 700; color: var(--accent); }
.course-reveal-body { display: grid; gap: 4px; }
.course-reveal-text { display: none; color: var(--muted); }
.course-reveal-icon { width: 18px; height: 18px; color: var(--accent); transition: transform .2s; }
.course-reveal.open { border-style: solid; border-color: transparent; background: var(--hover, rgba(127,127,127,.08)); cursor: default; }
.course-reveal.open .course-reveal-text { display: block; }
.course-reveal.open .course-reveal-icon { transform: rotate(45deg); opacity: 0; }
.course-concept-foot { display: grid; gap: 10px; }
.course-concept-foot[hidden] { display: none; }
.course-match-board { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 10px; }
.course-match-col, .course-order-pool { display: grid; gap: 8px; align-content: start; }
.course-chip { min-height: 48px; padding: 10px 12px; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: var(--panel, transparent); color: inherit; font: inherit; font-size: .92rem; line-height: 1.35; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.course-chip:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.course-chip.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.course-chip.wrong { border-color: var(--danger, #e5484d); background: color-mix(in srgb, var(--danger, #e5484d) 12%, transparent); }
.course-chip.right { cursor: default; opacity: .95; color: inherit; }
.course-chip.right.pair-0 { border-color: #3dd68c; background: color-mix(in srgb, #3dd68c 14%, transparent); }
.course-chip.right.pair-1 { border-color: #5aa9ff; background: color-mix(in srgb, #5aa9ff 14%, transparent); }
.course-chip.right.pair-2 { border-color: #f5b74a; background: color-mix(in srgb, #f5b74a 14%, transparent); }
.course-chip.right.pair-3 { border-color: #c38bff; background: color-mix(in srgb, #c38bff 14%, transparent); }
.course-order-done { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.course-order-done:empty { display: none; }
.course-order-done li { position: relative; padding: 12px 14px 12px 46px; border-radius: 12px; background: color-mix(in srgb, #3dd68c 12%, transparent); border: 1px solid color-mix(in srgb, #3dd68c 45%, transparent); counter-increment: step; }
.course-order-done li::before { content: counter(step); position: absolute; left: 14px; top: 11px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #3dd68c; color: #0b1a12; font-size: .78rem; font-weight: 700; }
.course-win { color: #3dd68c !important; font-weight: 600; }
.course-zero { stroke: var(--border-strong, var(--border)); stroke-dasharray: 4 4; }
.course-strike { stroke: var(--border); }
.course-payoff-dot { stroke: var(--panel, #111); stroke-width: 2; }
.course-dot-0 { fill: var(--muted, #93a49a); }
.course-dot-1 { fill: var(--accent); }
.course-tile.done .course-tile-number { color: #3dd68c; }
.course-tile-number .icon { width: 26px; height: 26px; }
.course-match-col:first-child .course-chip { font-weight: 700; border-style: dashed; }
@media (max-width: 520px) {
  .course-match-board { grid-template-columns: 1fr; gap: 14px; }
  .course-match-col:first-child { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  .course-match-col:first-child .course-chip { min-height: 44px; padding: 8px 12px; border-radius: 999px; }
  .learn-home .learn-continue { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .learn-continue .learn-continue-go { display: none; }
}

/* ---------- Learning home and exam prep (exams.js) ---------- */
.learn-home { display: grid; gap: 14px; margin: 4px 0 22px; }
.learn-home:empty { display: none; }
.learn-continue { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; width: 100%; padding: 18px; text-align: left; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--panel, transparent)), var(--panel, transparent) 70%); color: inherit; font: inherit; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.learn-continue:hover { transform: translateY(-2px); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 18%, transparent); }
.learn-continue-text { display: grid; gap: 3px; min-width: 0; }
.learn-continue-text strong { font-size: 1.2rem; }
.learn-continue-go { display: inline-flex; align-items: center; gap: 4px; padding: 10px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent, #111); font-weight: 700; }
.learn-stats { margin: -4px 0 0; }
.exam-prep { display: grid; gap: 10px; }
.exam-prep h2, .exam-chapters h2 { margin: 0; font-size: 1.05rem; }
.exam-prep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.exam-prep-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 16px; background: var(--panel, transparent); color: inherit; font: inherit; cursor: pointer; }
.exam-prep-card:hover { border-color: var(--accent); }
.exam-prep-text { display: grid; gap: 2px; min-width: 0; }
.exam-prep-card > .icon, .exam-mode > .icon { color: var(--accent); }
.exam-ring-wrap { position: relative; display: inline-grid; place-items: center; width: 56px; height: 56px; flex: none; }
.exam-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.exam-ring circle { fill: none; stroke-width: 6; }
.exam-ring-track { stroke: var(--border); }
.exam-ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .8s ease-out; }
.exam-ring.ok .exam-ring-fill { stroke: #3dd68c; }
.exam-ring.warn .exam-ring-fill { stroke: #f5b74a; }
.exam-ring-label { position: absolute; font-size: .8rem; font-weight: 700; }
#exam-body { display: grid; gap: 16px; padding-bottom: 28px; }
.exam-hero, .exam-result { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; }
.exam-hero .exam-ring-wrap, .exam-result .exam-ring-wrap { width: 96px; height: 96px; }
.exam-hero .exam-ring-label, .exam-result .exam-ring-label { font-size: 1.25rem; }
.exam-hero .page-title, .exam-result .page-title { margin: 2px 0 6px; }
.exam-result { position: relative; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel, transparent); }
.exam-result.passed { border-color: color-mix(in srgb, #3dd68c 55%, var(--border)); }
.exam-modes { display: grid; gap: 10px; }
.exam-mode { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--panel, transparent); color: inherit; font: inherit; cursor: pointer; }
.exam-mode > .icon { grid-row: 1 / 3; grid-column: 2; }
.exam-mode > .small { color: var(--muted); }
.exam-mode:hover:not(:disabled) { border-color: var(--accent); }
.exam-mode:disabled { opacity: .55; cursor: not-allowed; }
.exam-mode.primary-mode { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent) 10%, var(--panel, transparent)); }
.exam-chapters { display: grid; gap: 8px; }
.exam-chapter { display: grid; gap: 6px; padding: 12px 14px; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.exam-chapter.static { cursor: default; }
.exam-chapter:not(.static):hover { border-color: var(--accent); }
.exam-chapter-head { display: flex; justify-content: space-between; gap: 10px; }
.exam-bar { display: block; height: 6px; border-radius: 6px; background: var(--border); overflow: hidden; }
.exam-bar > span { display: block; height: 100%; border-radius: 6px; background: #3dd68c; transition: width .6s ease-out; }
.exam-bar > span.weak { background: #f5b74a; }
.exam-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exam-timer { padding: 6px 12px; border-radius: 999px; background: var(--hover, rgba(127,127,127,.1)); font-variant-numeric: tabular-nums; font-weight: 700; }
.exam-timer.low { background: color-mix(in srgb, var(--danger, #e5484d) 18%, transparent); color: var(--danger, #e5484d); }
.exam-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.exam-map[hidden] { display: none; }
.exam-map-cell { min-height: 40px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.exam-map-cell.answered { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: transparent; }
.exam-map-cell.flagged { box-shadow: inset 0 -3px 0 #f5b74a; }
.exam-map-cell.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.exam-card { display: grid; gap: 14px; min-height: 46vh; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel, transparent); align-content: start; }
.exam-card h2 { margin: 0; font-size: 1.25rem; line-height: 1.35; }
.exam-option { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.exam-option.chosen { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.exam-letter { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--hover, rgba(127,127,127,.12)); font-size: .8rem; font-weight: 700; }
.exam-option.chosen .exam-letter { background: var(--accent); color: var(--on-accent, #111); }
.exam-case { padding: 12px 14px; border-radius: 12px; background: var(--hover, rgba(127,127,127,.08)); }
.exam-case summary { cursor: pointer; }
.exam-case p { margin: 8px 0 0; }
.course-nav .ghost.on { border-color: #f5b74a; color: #f5b74a; }
.exam-confirm { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--accent); border-radius: 16px; background: var(--panel, transparent); }
.exam-confirm h3, .exam-confirm p { margin: 0; }
.exam-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.exam-review { display: grid; gap: 12px; margin-top: 12px; }
.exam-review-item { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 14px; }
.exam-review-item.right { border-left-color: #3dd68c; }
.exam-review-item.wrong { border-left-color: var(--danger, #e5484d); }
.exam-review-item.skipped { border-left-color: #f5b74a; }
.exam-review-item h3, .exam-review-item p { margin: 0; }
.exam-review-item h3 { font-size: 1rem; line-height: 1.4; }
.exam-review-options { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.exam-review-options li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.exam-review-options li.right { background: color-mix(in srgb, #3dd68c 14%, transparent); }
.exam-review-options li.wrong { background: color-mix(in srgb, var(--danger, #e5484d) 14%, transparent); }
.confetti { position: absolute; left: 64px; top: 50%; pointer-events: none; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; background: var(--accent); animation: confetti 1.2s ease-out forwards; }
.confetti i:nth-child(3n+1) { background: #3dd68c; }
.confetti i:nth-child(3n+2) { background: #f5b74a; }
@keyframes confetti { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .learn-continue, .course-chip { transition: none; } .learn-continue:hover, .course-chip:hover { transform: none; } }

/* Chart Room (Q&A): one shared chart, marked up live by up to 5 members. */
.chart-rooms-dialog { display: grid; gap: 12px; }
.chart-room-list { display: grid; gap: 6px; }
.chart-picker { display: grid; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.chart-picker legend { padding: 0 4px; font-weight: 600; }
.chart-picker-list { display: grid; gap: 2px; max-height: 220px; overflow-x: hidden; overflow-y: auto; }
.chart-picker .chart-picker-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; cursor: pointer; }
.chart-picker .chart-picker-row input { flex: none; width: auto; margin: 0; }
.chart-picker-row > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-online { width: 8px; height: 8px; border-radius: 50%; background: var(--success, #3dd68c); }
.chart-room-dialog { display: grid; gap: 10px; width: min(1100px, 100vw); max-width: 100vw; }
.chart-room-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.chart-room-title { display: grid; flex: 1 1 180px; min-width: 0; }
.chart-room-title h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-room-members { display: flex; gap: 6px; }
.chart-room-member { position: relative; display: inline-flex; padding: 2px; border: 2px solid var(--member); border-radius: 50%; }
.chart-room-member .chart-online { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--bg, #fff); }
.chart-room-actions { display: flex; align-items: center; gap: 6px; }
.chart-room-actions .ghost { display: inline-flex; align-items: center; gap: 6px; }
.chart-room-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chart-room-tools .chip { display: inline-flex; align-items: center; gap: 6px; }
.chart-room-tools .chip .icon { width: 15px; height: 15px; }
.chart-room-swatch { width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; background: var(--member); }
.chart-room-hint { margin: 0; }
.chart-room-stage { position: relative; height: clamp(300px, 58vh, 560px); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.chart-room-canvas { display: block; touch-action: none; cursor: crosshair; }
.chart-room-canvas[data-tool="pan"] { cursor: grab; }
.chart-room-canvas[data-tool="erase"] { cursor: not-allowed; }
.chart-room-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; pointer-events: none; }
.chart-room-status:empty { display: none; }
.chart-room-note { position: absolute; display: flex; gap: 6px; width: 228px; padding: 6px; border-radius: 10px; background: var(--bg, #fff); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.chart-room-note input { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .chart-room-tools .chip { padding-inline: 10px; }
  .chart-room-stage { height: 58vh; }
}

/* Classroom (Learn): live classes and practice rooms on a shared chart. */
.classroom { display: grid; gap: 22px; }
.classroom-section { display: grid; gap: 8px; }
.classroom-section .section-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.classroom-section .section-row h2 { margin: 0; }
.classroom-section .section-row .ghost { display: inline-flex; align-items: center; gap: 6px; }
.classroom-section > p { margin: 0; }
.classroom-list { display: grid; gap: 8px; }
.classroom-card { display: grid; gap: 4px; width: 100%; padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--panel, transparent); color: inherit; font: inherit; cursor: pointer; }
.classroom-card:hover:not(:disabled) { border-color: var(--accent); }
.classroom-card:disabled { opacity: .6; cursor: default; }
.classroom-card.live { border-color: color-mix(in srgb, var(--danger, #e5484d) 55%, var(--border)); }
.classroom-when { font-size: .8rem; font-weight: 600; color: var(--muted); }
.classroom-action { display: inline-flex; align-items: center; gap: 4px; justify-self: start; margin-top: 4px; font-weight: 600; color: var(--accent); }
.classroom-action .icon { width: 14px; height: 14px; }
.classroom-live { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; background: var(--danger, #e5484d); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.classroom-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: classroom-pulse 1.6s ease-in-out infinite; }
@keyframes classroom-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .classroom-live::before { animation: none; } }
.classroom-start { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.classroom-start legend { padding: 0 4px; font-weight: 600; }
.homework-form .classroom-start label { display: flex; align-items: center; gap: 8px; }
.classroom-start input[type="radio"] { width: auto; margin: 0; }
.chart-room-more { align-self: center; color: var(--muted); }
.chart-room-main { display: grid; gap: 10px; }
.chart-room-main.with-questions { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .chart-room-main.with-questions { grid-template-columns: minmax(0, 1fr) 280px; } }
.class-questions { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; max-height: clamp(300px, 58vh, 560px); padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.class-questions h3 { margin: 0; font-size: 1rem; }
.class-question-list { display: grid; align-content: start; gap: 8px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.class-question-list li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--hover, rgba(127,127,127,.08)); }
.class-question-list li.answered { opacity: .65; }
.class-question-list li > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.class-question-list p { margin: 0; overflow-wrap: anywhere; }
.class-question-list .link { justify-self: start; }
.class-ask { display: flex; gap: 6px; }
.class-ask input { flex: 1; min-width: 0; }

/* Live class tools: who has the floor, the question shown to everyone, raised hands. */
.class-banners { display: grid; gap: 6px; }
.class-banners:empty { display: none; }
.class-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); }
.class-banner > span { flex: 1 1 200px; overflow-wrap: anywhere; }
.class-banner .icon { flex: none; width: 18px; height: 18px; color: var(--accent); }
.class-banner.floor { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.class-banner.spotlight { background: var(--hover, rgba(127,127,127,.08)); }
.class-hands { display: grid; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.class-hands p { display: flex; align-items: center; gap: 6px; margin: 0; }
.class-hands p .icon { width: 16px; height: 16px; color: var(--accent); }
.class-hands-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.class-hands-head h3 { margin: 0; font-size: 1rem; }
.class-hands-actions { display: flex; gap: 6px; }
.class-hand-list { display: grid; gap: 4px; max-height: 160px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.class-hand-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--hover, rgba(127,127,127,.08)); }
.class-hand-place { width: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.class-hand-who { display: grid; flex: 1; min-width: 0; }
.class-ask .ghost { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.class-question-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.class-questions { grid-template-rows: auto auto minmax(0, 1fr) auto; overflow-y: auto; }
.chart-room-note-line:empty { display: none; }
.chart-room-note-line { margin: 0; }
.chart-room-ltp { font-weight: 600; color: var(--text, inherit); font-variant-numeric: tabular-nums; }
