/* Symposia app styles. Patterns follow xiongcha (ap-topbar, ob-btn/ob-card, sdm-* direct messages). */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-link); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

/* ---------- App shell: top bar + one scroll area ---------- */
.sy-app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.sy-main { flex: 1; min-height: 0; overflow-y: auto; }

.sy-boot { height: 100dvh; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--text-muted); font-size: 14px; }

/* ---------- Top bar (from xiongcha .ap-topbar) ---------- */
.sy-topbar {
  position: relative;
  z-index: 140;
  flex-shrink: 0;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 28px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}
.sy-tb-logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; }
.sy-tb-mark {
  width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--text-on-brand);
  font-weight: 800; font-size: 15px; line-height: 1;
}
.sy-tb-wm { font-weight: 800; font-size: 16px; color: var(--brand-strong); letter-spacing: var(--tracking-tight); }

.sy-tb-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.sy-tb-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 650; color: var(--text-body);
  text-decoration: none; background: none; border: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sy-tb-link:hover { background: var(--surface-hover); color: var(--text-strong); }
.sy-tb-link.active, .sy-tb-link.open { color: var(--brand-strong); background: var(--brand-tint); }
.sy-chevron { transition: transform var(--dur-base) var(--ease-out); }
.sy-curr-trigger.open .sy-chevron { transform: rotate(180deg); }

.sy-tb-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.sy-site-switch { font-size: 13px; font-weight: 700; color: var(--brand-strong); text-decoration: none; white-space: nowrap; }
.sy-site-switch:hover { text-decoration: underline; }
.sy-tb-pill {
  font-size: 12px; font-weight: 700; color: var(--brand-strong);
  background: var(--brand-tint); border: 1px solid var(--brand-soft);
  padding: 5px 10px; border-radius: var(--radius-pill);
}


/* ---------- Language toggle (from xiongcha mobile .segmented / login .lang-toggle), moss palette ---------- */
.sy-lang {
  display: inline-flex;
  align-items: stretch;
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.sy-lang-btn {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  min-width: 36px;
  min-height: 28px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-hanzi), var(--font-sans);
  line-height: 1;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sy-lang-btn:hover:not(.selected) {
  color: var(--text-strong);
  background: var(--surface-hover);
}
.sy-lang-btn.selected {
  background: var(--brand);
  color: var(--text-on-brand);
}
.sy-lang-btn:focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: 1px;
}

/* ---------- Layered Curriculum dropdown ---------- */
.sy-curr { position: relative; }
.sy-curr-backdrop { position: fixed; inset: 0; z-index: 1; background: transparent; }
.sy-curr-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 2;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  width: min(720px, calc(100vw - 48px));
  max-height: min(70dvh, 560px);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: sy-pop var(--dur-base) var(--ease-out);
}
@keyframes sy-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Header stays put; only the course list scrolls, capped to the viewport. */
.sy-curr-col {
  min-width: 0; min-height: 0; max-height: min(70dvh, 560px);
  display: flex; flex-direction: column; overflow: hidden;
}
.sy-curr-grades { border-right: 1px solid var(--border-subtle); background: var(--bg-page); }
.sy-curr-head {
  flex: 0 0 auto;
  font-size: 11px; font-weight: 800; letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--text-muted); padding: 14px 16px 8px;
}
.sy-curr-head--row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-card); }
.sy-curr-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0 8px 10px;
  scrollbar-width: thin; scrollbar-color: var(--border-default) transparent;
}
.sy-curr-scroll::-webkit-scrollbar { width: 5px; }
.sy-curr-scroll::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
.sy-curr-all { font-size: 12px; font-weight: 700; color: var(--brand-strong); text-transform: none; letter-spacing: 0; text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.sy-curr-all:hover { background: var(--brand-tint); }

.sy-curr-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border: none; border-radius: var(--radius-sm);
  background: none; cursor: pointer; text-align: left;
  font-size: 14px; font-weight: 650; color: var(--text-body);
}
.sy-curr-item:hover { background: var(--surface-hover); }
.sy-curr-item.active { background: var(--brand-soft); color: var(--moss-900); }
.sy-curr-item-label { flex: 1; min-width: 0; }
.sy-curr-count { font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); padding: 1px 7px; }
.sy-curr-item.active .sy-curr-count { border-color: var(--moss-300); color: var(--moss-800); }
.sy-curr-arrow { color: var(--text-faint); flex-shrink: 0; }
.sy-curr-item.active .sy-curr-arrow { color: var(--moss-700); }

.sy-curr-std-list { display: flex; flex-direction: column; gap: 2px; }
.sy-curr-std {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-body);
}
.sy-curr-std:hover, .sy-curr-std:focus-visible { background: var(--brand-tint); }
.sy-curr-std-name { font-size: 13.5px; line-height: 1.4; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sy-curr-placeholder, .sy-curr-msg { padding: 24px 16px; color: var(--text-muted); font-size: 14px; display: flex; align-items: center; gap: 10px; }
.sy-curr-msg { grid-column: 1 / -1; }

@media (max-width: 760px) {
  .sy-topbar { padding: 8px 10px; gap: 8px; }
  .sy-site-switch { font-size: 12px; }
  .sy-tb-nav { gap: 0; }
  .sy-tb-link { padding: 8px 6px; font-size: 12.5px; }
  .sy-tb-pill { display: none; }
  .sy-curr-panel {
    position: fixed; top: calc(var(--topbar-h) + 6px); left: 10px; right: 10px; width: auto;
    display: flex; flex-direction: column;
    max-height: calc(100dvh - var(--topbar-h) - 20px - env(safe-area-inset-bottom, 0px));
  }
  .sy-curr-col { max-height: none; }
  .sy-curr-grades { flex: 0 1 auto; border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: 38dvh; }
  .sy-curr-standards { flex: 1 1 auto; min-height: 0; }
}
@media (max-width: 420px) {
  .sy-tb-wm { display: none; }
  .sy-tb-link { padding: 8px 5px; font-size: 12px; }
  .sy-lang-btn { padding: 5px 8px; }
}

/* ---------- Primitives (from xiongcha .ob-btn / .ob-card) ---------- */
.sy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 14px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.sy-btn:disabled { opacity: .5; cursor: default; }
.sy-btn--primary { background: var(--brand); color: var(--text-on-brand); }
.sy-btn--primary:hover:not(:disabled) { background: var(--brand-hover); color: #fff; box-shadow: var(--shadow-brand); }
.sy-btn--ghost { background: var(--surface-card); color: var(--text-body); border-color: var(--border-default); }
.sy-btn--ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-tint); }
.sy-btn--sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.sy-link-btn { background: none; border: none; padding: 4px 6px; color: var(--brand-strong); font-weight: 700; font-size: 13.5px; cursor: pointer; border-radius: 6px; }
.sy-link-btn:hover { background: var(--brand-tint); }

.sy-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }

.sy-code {
  display: inline-flex; align-items: center; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--moss-800); background: var(--brand-tint); border: 1px solid var(--brand-soft);
  padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap;
}
.sy-code--lg { font-size: 13px; padding: 4px 10px; }

.sy-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-soft); border-top-color: var(--brand-strong); animation: sy-spin .8s linear infinite; display: inline-block; }
.sy-spinner--lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes sy-spin { to { transform: rotate(360deg); } }

/* ---------- Page typography & layout ---------- */
.sy-page { max-width: var(--container-lg); margin: 0 auto; padding: 32px 28px 64px; }
.sy-page--narrow { max-width: var(--container-md); }
.sy-h1 { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 800; color: var(--text-strong); letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); margin: 6px 0 8px; }
.sy-h2 { font-size: var(--text-lg); font-weight: 800; color: var(--text-strong); letter-spacing: var(--tracking-tight); margin: 0 0 12px; }
.sy-h3 { font-size: var(--text-md); font-weight: 800; color: var(--text-strong); margin: 26px 0 8px; }
.sy-h4 { font-size: var(--text-base); font-weight: 750; color: var(--text-strong); margin: 18px 0 6px; }
.sy-eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--brand-strong); }
.sy-muted { color: var(--text-muted); font-size: 14px; }
.sy-lead { font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--text-body); margin: 0; }
.sy-prose { font-size: 15.5px; line-height: var(--leading-relaxed); color: var(--text-body); margin: 0 0 12px; }
.sy-page-head { margin-bottom: 24px; }
.sy-section { margin-top: 36px; }
.sy-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sy-section-head .sy-h2 { margin: 0; }
.sy-crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.sy-crumbs a { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.sy-crumbs a:hover { color: var(--brand-strong); }
.sy-loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); padding: 40px 0; font-size: 14px; }
.sy-alert { padding: 14px 16px; border-radius: var(--radius-md); background: var(--brand-tint); border: 1px solid var(--brand-soft); color: var(--moss-900); font-size: 14px; }
.sy-empty { text-align: center; padding: 56px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Home */
.sy-hero {
  padding: 40px 36px; border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--moss-100), var(--moss-50) 60%, var(--stone-0));
  border: 1px solid var(--brand-soft);
}
.sy-hero-title { font-size: clamp(1.75rem, 3.5vw, 2.5rem); max-width: 720px; }
.sy-hero-sub { font-size: var(--text-md); line-height: var(--leading-relaxed); max-width: 680px; margin: 0 0 10px; }
.sy-hero-hint { font-size: 14px; color: var(--text-muted); margin: 0; }
.sy-grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.sy-grade-card { display: flex; align-items: center; gap: 14px; padding: 16px; text-decoration: none; transition: transform var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast); }
.sy-grade-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-soft); }
.sy-grade-badge {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: var(--moss-900);
  background: linear-gradient(135deg, var(--moss-300), var(--moss-200), var(--moss-100));
}
.sy-grade-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sy-grade-name { font-size: 15px; font-weight: 800; color: var(--text-strong); }
.sy-grade-meta { font-size: 12.5px; color: var(--text-muted); }
.sy-skeleton { height: 80px; background: linear-gradient(90deg, var(--stone-100), var(--stone-50), var(--stone-100)); background-size: 200% 100%; animation: sy-shimmer 1.4s infinite linear; }
@keyframes sy-shimmer { to { background-position: -200% 0; } }

/* Grade standards list */
.sy-std-list { display: flex; flex-direction: column; gap: 10px; }
.sy-std-card { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; text-decoration: none; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.sy-std-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.sy-std-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.sy-std-card-name { font-size: 15px; font-weight: 750; color: var(--text-strong); }
.sy-std-card-desc { font-size: 13.5px; line-height: 1.55; color: var(--text-body); }
.sy-std-card-go { color: var(--brand-strong); font-weight: 800; }

/* Standard page */
.sy-chapter { padding: 26px 30px; }
.sy-chapter .sy-h2 { margin-top: 6px; }
.sy-start {
  display: flex; align-items: center; gap: 18px;
  margin-top: 28px; padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--moss-300), var(--moss-500) 55%, var(--moss-600));
  color: var(--moss-900);
  box-shadow: var(--shadow-md);
}
.sy-start-icon {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--stone-0); color: var(--moss-800);
}
.sy-start-copy { flex: 1; min-width: 0; }
.sy-start-copy .sy-h2 { margin: 0 0 4px; color: var(--moss-900); }
.sy-start-copy p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--moss-900); }
.sy-start-btn { background: var(--stone-0); color: var(--moss-900); border-color: transparent; font-weight: 800; flex-shrink: 0; }
.sy-start-btn:hover:not(:disabled) { background: var(--moss-50); color: var(--moss-900); }
.sy-problems-head { margin: 0 0 12px; }
.sy-collapse-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  text-align: left; cursor: pointer; color: inherit;
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: 14px 16px; font: inherit; font-weight: 800;
}
.sy-collapse-btn:hover { border-color: var(--brand); }
.sy-count {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--text-on-brand); font-size: 13px; font-weight: 800;
}
.sy-collapse-label { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--brand-strong); }
#sy-problems-panel[hidden] { display: none; }
.sy-problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sy-problem {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  text-decoration: none; color: var(--text-body);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
a.sy-problem:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.sy-problem-num {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800; background: var(--brand-soft); color: var(--moss-900);
}
.sy-problem-title { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.55; }
.sy-problem-title img, .sy-bubble-text img, .sy-prose img, .sy-lead img { display: block; max-width: min(100%, 420px); height: auto; margin: 8px 0; }
.sy-problem-cta { font-size: 13px; font-weight: 800; color: var(--brand-strong); white-space: nowrap; }
.sy-problem.is-disabled { background: var(--bg-sunken); border-style: dashed; color: var(--text-muted); cursor: not-allowed; }
.sy-problem.is-disabled .sy-problem-num { background: var(--stone-200); color: var(--text-muted); }
.sy-problem-tag { font-size: 11.5px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border-default); border-radius: var(--radius-pill); padding: 2px 8px; white-space: nowrap; }

@media (max-width: 640px) {
  .sy-page { padding: 22px 16px 48px; }
  .sy-hero { padding: 26px 20px; }
  .sy-chapter { padding: 20px 18px; }
  .sy-start { flex-wrap: wrap; padding: 18px; }
  .sy-start-btn { width: 100%; }
  .sy-problem { align-items: flex-start; }
}

/* ---------- Instruction page (from xiongcha .sdm-* direct messages: fixed height, inner scroll) ---------- */
.sy-chat-page { position: relative; height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface-card); max-width: 920px; margin: 0 auto; border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); }
/* Slim header (original 62px). The 120px tutor avatar is absolutely positioned on the page so
   its top half sits on this bar and its bottom half floats over the lesson thread; the bar itself does not grow. */
.sy-chat-head { flex-shrink: 0; height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 22px 0 158px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-card); position: relative; z-index: 2; overflow: visible; }
.sy-tutor-av {
  position: absolute;
  top: 2px;
  left: 22px;
  width: 120px;
  height: 120px;
  z-index: 5;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--stone-0);
  border: 2px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.sy-tutor-av-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
}
.sy-tutor-av-layer.is-on { opacity: 1; }
.sy-icon-btn {
  width: 36px; height: 36px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm);
  background: var(--surface-card); color: var(--text-body); cursor: pointer;
}
.sy-icon-btn svg { width: 18px; height: 18px; }
.sy-icon-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-tint); }
.sy-icon-btn:disabled { opacity: .5; cursor: default; }
.sy-chat-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sy-review-btn {
  width: auto; padding: 0 12px; gap: 6px;
  font-size: 13px; font-weight: 700; text-decoration: none; color: inherit; white-space: nowrap;
}
.sy-chat-av, .sy-msg-av {
  border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--moss-900);
  background: linear-gradient(135deg, var(--moss-300), var(--moss-200));
  border: 1.5px solid var(--moss-200);
}
.sy-chat-av { width: 36px; height: 36px; font-size: 14px; }
.sy-chat-info { flex: 1; min-width: 0; }
.sy-chat-name { font-size: 14.5px; font-weight: 800; color: var(--text-strong); }
.sy-chat-status { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.sy-thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 24px 16px 158px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--border-default) transparent; position: relative; z-index: 1; background: var(--bg-page); }
.sy-thread::-webkit-scrollbar { width: 5px; }
.sy-thread::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.sy-msg-line { display: flex; align-items: flex-end; gap: 10px; max-width: 78%; animation: sy-msg-in var(--dur-base) var(--ease-out); }
.sy-msg-line.theirs { align-self: flex-start; }
.sy-msg-line.mine { align-self: flex-end; flex-direction: row-reverse; }
@keyframes sy-msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.sy-msg-av { width: 30px; height: 30px; font-size: 12px; }
.sy-msg-av--spacer { visibility: hidden; }

.sy-bubble { padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.6; min-width: 0; overflow-wrap: anywhere; }
.sy-bubble-text { white-space: pre-wrap; }
.sy-msg-line.theirs .sy-bubble { background: var(--surface-card); border: 1px solid var(--border-subtle); color: var(--text-strong); border-bottom-left-radius: 6px; }
.sy-msg-line.mine .sy-bubble { background: var(--brand); color: var(--text-on-brand); border-bottom-right-radius: 6px; font-weight: 600; }
.sy-bubble-label { font-size: 11px; font-weight: 800; letter-spacing: var(--tracking-caps); text-transform: uppercase; margin-bottom: 2px; color: var(--brand-strong); }
.sy-kind-prompt .sy-bubble { border-color: var(--brand) !important; }
.sy-kind-hint .sy-bubble { background: var(--brand-soft) !important; border: 1px solid var(--border-subtle) !important; }
.sy-kind-hint .sy-bubble-label { color: var(--moss-700); }
.sy-kind-success .sy-bubble { background: var(--brand-soft) !important; border-color: var(--border-subtle) !important; }
.sy-kind-success .sy-bubble-label { color: var(--moss-700); }
.sy-kind-correct .sy-bubble { border-color: var(--border-subtle) !important; }
.sy-kind-feedback .sy-bubble, .sy-kind-scaffold .sy-bubble { border-left: 3px solid var(--border-subtle) !important; }
.sy-bubble mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }

.sy-typing { padding: 12px 16px; }
.sy-typing-dots { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); }
.sy-typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .35; animation: sy-typing-bounce 1.2s infinite ease-in-out; }
.sy-typing-dots i:nth-child(2) { animation-delay: .15s; }
.sy-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sy-typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }

.sy-composer { flex-shrink: 0; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-subtle); background: var(--surface-card); display: flex; flex-direction: column; gap: 8px; }
.sy-composer-wait { min-height: 44px; display: flex; align-items: center; font-size: 13px; color: var(--text-muted); font-weight: 600; }
/* Multiple choice: a row of buttons that wraps to new lines (never scrolls sideways). */
.sy-choices { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.sy-choice {
  flex: 0 1 auto; max-width: 100%;
  padding: 10px 16px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-subtle); background: var(--surface-card); color: var(--text-strong);
  font-size: 14.5px; font-weight: 700; cursor: pointer; text-align: center;
  white-space: normal; overflow-wrap: anywhere;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.sy-choice:hover { background: var(--brand-soft); border-color: var(--brand); }
.sy-choice:active { transform: scale(.97); }
/* Hint stays at the end of the response row (same line as input/send or to the right of choices). */
.sy-composer-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.sy-composer-row:has(.sy-choices) { align-items: flex-end; }
.sy-composer-row .sy-choices { flex: 1; min-width: 0; }
.sy-composer-row .sy-btn,
.sy-composer-row .sy-link-btn,
.sy-hint-btn { flex-shrink: 0; white-space: nowrap; }
/* Same hint control as the mobile lesson: icon plus a short label, last on the answer row. */
.sy-hint-btn {
  align-self: center; display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: none; color: var(--brand-strong); font-size: 13px; font-weight: 700; cursor: pointer;
}
.sy-hint-btn:hover { background: var(--brand-tint); }
.sy-hint-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.sy-composer-input { flex: 1; min-width: 0; border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-page); padding: 11px 14px; font: inherit; font-size: 15px; color: var(--text-strong); outline: none; }
.sy-composer-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.sy-done { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sy-done-text { font-weight: 800; color: var(--moss-800); }
.sy-done-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-left: auto; }

@media (max-width: 640px) {
  .sy-chat-page { border: none; }
  .sy-tutor-av { left: 14px; }
  .sy-chat-head { padding: 0 14px 0 146px; }
  .sy-thread { padding: 16px 14px 12px 146px; }
  .sy-msg-line { max-width: 92%; }
  .sy-composer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
}

/* ---------- Homepage continue banner and learning progress ---------- */
.sy-learning { margin-top: 8px; }
.sy-learning .sy-h1 { margin-bottom: 18px; }

.sy-continue {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--moss-300);
  background: linear-gradient(120deg, var(--moss-100), var(--stone-0) 40%, var(--moss-50), var(--moss-200));
  background-size: 220% 220%;
  box-shadow: var(--shadow-sm);
  animation: sy-continue-in 0.45s var(--ease-out), sy-continue-shift 9s ease-in-out infinite;
}
.sy-continue-copy { min-width: 0; }
.sy-continue-body { margin: 6px 0 0; color: var(--text-body); }
.sy-continue-meta { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-muted); font-size: 13px; font-weight: 650; }
.sy-continue-btn { animation: sy-continue-pulse 2.8s ease-in-out infinite; flex-shrink: 0; }
.sy-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--moss-900);
  background: var(--brand-soft);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}

/* Difficulty timeline on the learning progress page, after xiongcha's collection timeline (.ctl-*). */
.sy-timeline { position: relative; margin: 4px 0 12px; }
.sy-timeline-cap {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-strong);
  font-family: var(--font-sans);
}
.sy-timeline-cap--top { margin-bottom: 10px; }
.sy-timeline-cap--bottom { margin-top: 12px; }
.sy-timeline-track { position: relative; padding: 4px 0 8px; }
.sy-timeline-spine {
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(to bottom, transparent, var(--brand) 10%, var(--brand) 90%, transparent);
}
.sy-timeline-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}
.sy-timeline-item.sy-timeline-gap-sm { margin-top: 12px; }
.sy-timeline-item.sy-timeline-gap-md { margin-top: 28px; }
.sy-timeline-item.sy-timeline-gap-lg { margin-top: 48px; }
.sy-timeline-node { grid-column: 2; grid-row: 1; display: flex; justify-content: center; padding-top: 18px; z-index: 1; }
.sy-timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);
}
.sy-timeline-item.sy-mastery-band--low .sy-timeline-dot { border-color: #E07A2F; box-shadow: 0 0 0 4px color-mix(in srgb, #E07A2F 18%, transparent); }
.sy-timeline-item.sy-mastery-band--mid .sy-timeline-dot { border-color: #EAB308; box-shadow: 0 0 0 4px color-mix(in srgb, #EAB308 20%, transparent); }
.sy-timeline-item.sy-mastery-band--high .sy-timeline-dot { border-color: #3F8F4E; box-shadow: 0 0 0 4px color-mix(in srgb, #3F8F4E 20%, transparent); }
.sy-timeline-item.is-left .sy-timeline-bubble { grid-column: 1; grid-row: 1; justify-self: end; }
.sy-timeline-item.is-right .sy-timeline-bubble { grid-column: 3; grid-row: 1; justify-self: start; }
.sy-timeline-bubble {
  position: relative;
  width: min(100%, 340px);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(34, 43, 29, 0.07);
}
.sy-timeline-bubble::after {
  content: "";
  position: absolute;
  top: 22px;
  width: 12px;
  height: 12px;
  background: var(--surface-card);
  transform: rotate(45deg);
}
.sy-timeline-item.is-left .sy-timeline-bubble::after {
  right: -7px;
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}
.sy-timeline-item.is-right .sy-timeline-bubble::after {
  left: -7px;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
}

.sy-progress-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.sy-progress-actions { display: flex; justify-content: flex-end; width: 100%; }
.sy-progress-top, .sy-progress-mastery { display: flex; align-items: center; gap: 10px; width: 100%; }
.sy-progress-status {
  font-size: 12.5px; font-weight: 750; margin-left: auto;
  padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.sy-progress-name { margin: 0; font-size: 17px; font-weight: 800; color: var(--text-strong); }
.sy-progress-desc {
  margin: 0;
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sy-progress-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; }
.sy-progress-facts div { display: flex; gap: 6px; align-items: baseline; }
.sy-progress-facts dt { font-size: 12px; font-weight: 750; color: var(--text-muted); }
.sy-progress-facts dd { margin: 0; font-size: 13.5px; color: var(--text-strong); }
.sy-mastery-label { font-size: 12.5px; font-weight: 750; color: var(--text-muted); }
.sy-progress-mastery strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.sy-meter { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--stone-200); overflow: hidden; }
.sy-meter span { display: block; height: 100%; border-radius: inherit; }
/* Mastery page only. Orange, yellow, green — no red. Text stays dark so yellow remains readable. */
.sy-mastery-band--low .sy-progress-status { color: #9A3412; background: #FFF4E8; border-color: #F0C08A; }
.sy-mastery-band--low .sy-progress-mastery strong { color: #9A3412; }
.sy-mastery-band--low .sy-meter span { background: #E07A2F; }
.sy-mastery-band--mid .sy-progress-status { color: #713F12; background: #FEF9C3; border-color: #E4CC5C; }
.sy-mastery-band--mid .sy-progress-mastery strong { color: #854D0E; }
.sy-mastery-band--mid .sy-meter span { background: #EAB308; }
.sy-mastery-band--high .sy-progress-status { color: #14532D; background: #E7F6EA; border-color: #8FCB9B; }
.sy-mastery-band--high .sy-progress-mastery strong { color: #166534; }
.sy-mastery-band--high .sy-meter span { background: #3F8F4E; }

.sy-mastery { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; min-width: 0; flex-shrink: 0; }
.sy-mastery-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 750; color: var(--text-strong); }
.sy-mastery-pct { font-size: 18px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sy-mastery--pulse { animation: sy-mastery-blink 0.9s ease-in-out, sy-mastery-bounce 0.9s cubic-bezier(.22, 1.35, .36, 1); }

.sy-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 300;
  max-width: min(640px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  font-weight: 750;
  font-size: 14.5px;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: sy-toast-in 0.28s var(--ease-out);
}
.sy-toast--ok { background: #E7F6EA; color: #0E6B32; border-color: #0E6B32; }
.sy-toast--miss { background: #FDECEF; color: #DC143C; border-color: #DC143C; }

@keyframes sy-continue-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes sy-continue-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes sy-continue-pulse { 0%, 100% { box-shadow: var(--shadow-brand); } 50% { box-shadow: 0 0 0 0 rgba(118, 144, 79, 0); } }
@keyframes sy-mastery-blink {
  0%, 100% { opacity: 1; }
  38% { opacity: 0.12; }
}
@keyframes sy-mastery-bounce {
  0% { transform: translateY(0) scale(1); }
  32% { transform: translateY(-8px) scale(1.16); }
  58% { transform: translateY(1px) scale(0.94); }
  78% { transform: translateY(-3px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes sy-toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%); } }

@media (max-width: 640px) {
  .sy-timeline-spine { left: 13px; transform: none; }
  .sy-timeline-item { grid-template-columns: 28px minmax(0, 1fr); }
  .sy-timeline-item.is-left .sy-timeline-bubble,
  .sy-timeline-item.is-right .sy-timeline-bubble { grid-column: 2; justify-self: stretch; width: 100%; }
  .sy-timeline-item.is-left .sy-timeline-node,
  .sy-timeline-item.is-right .sy-timeline-node { grid-column: 1; }
  .sy-timeline-item.is-left .sy-timeline-bubble::after,
  .sy-timeline-item.is-right .sy-timeline-bubble::after {
    left: -7px;
    right: auto;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    border-left: 1px solid var(--border-subtle);
  }
  .sy-continue { flex-direction: column; align-items: stretch; }
  .sy-mastery-name { max-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  /* The mastery badge is intentionally left out. Mobile always blinks and pops it when the
     percent changes, and that is the lesson feedback. The other motion still yields. */
  .sy-typing-dots i, .sy-msg-line, .sy-curr-panel, .sy-skeleton,
  .sy-continue, .sy-continue-btn, .sy-toast { animation: none; }
  .sy-tutor-av-layer { transition: none; }
}

/* ---------- Blazor error UI ---------- */
#blazor-error-ui { background: var(--moss-100); color: var(--moss-900); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* All About Learning: single-column dropdown reusing the curriculum menu styles */
.sy-learn-panel {
  grid-template-columns: minmax(0, 1fr);
  width: min(320px, calc(100vw - 48px));
}
.sy-learn-menu .sy-curr-item {
  text-decoration: none;
}

/* All About Learning pages */
.sy-article-list { display: flex; flex-direction: column; gap: 12px; }
.sy-article-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 22px; text-decoration: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.sy-article-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.sy-article-card-title { font-size: 18px; font-weight: 800; color: var(--text-strong); letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); }
.sy-article-card-dek { font-size: 14.5px; line-height: 1.55; color: var(--text-body); margin: 0; }
.sy-article-card-meta { font-size: 12.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sy-article-card-meta span + span::before { content: "·"; margin-right: 8px; color: var(--text-faint); }

.sy-article { }

/* Homepage Recommended Readings: article cards in a responsive grid */
.sy-recommended-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.sy-article-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; text-decoration: none; font-weight: 700; font-size: 13.5px; color: var(--brand-strong); }
.sy-article-back:hover { text-decoration: underline; }
.sy-article-title { font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.15rem); font-weight: 800; color: var(--text-strong); letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); margin: 8px 0 12px; }
.sy-article-dek { font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--text-body); margin: 0 0 14px; }
.sy-article-meta { font-size: 13.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.sy-article-meta span + span::before { content: "·"; margin-right: 8px; color: var(--text-faint); }
.sy-article-body { margin-top: 8px; }
.sy-article-body .sy-h3 { margin-top: 28px; }
.sy-article-body .sy-prose { font-size: 16.5px; line-height: 1.7; margin: 0 0 16px; }
.sy-article-refs { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.sy-article-refs .sy-h3 { margin-top: 0; }
.sy-article-refs ol { margin: 0; padding-left: 1.25em; color: var(--text-body); font-size: 14px; line-height: 1.55; }
.sy-article-refs li { margin: 0 0 8px; }
.sy-article-refs li:last-child { margin-bottom: 0; }

.sy-category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.sy-category-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 20px; text-decoration: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
}
.sy-category-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.sy-category-card-title { font-size: 16px; font-weight: 800; color: var(--text-strong); }
.sy-category-card-dek { font-size: 13.5px; line-height: 1.5; color: var(--text-body); margin: 0; }
.sy-category-card-meta { font-size: 12.5px; color: var(--text-muted); }

/* ---------- Splash login (/login, preview; a simpler xiongcha .lsd-page: hero left, form right) ---------- */
.sy-splash-app { min-height: 100vh; background: var(--surface-card); }
.sy-splash { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
.sy-splash-hero { display: flex; flex-direction: column; padding: 52px 64px; background: var(--bg-page); border-right: 1px solid var(--border-subtle); }
.sy-splash-logo { display: flex; align-items: center; gap: 10px; }
.sy-splash-wm { font-weight: 800; font-size: 18px; color: var(--brand-strong); letter-spacing: var(--tracking-tight); }
.sy-splash-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 560px; padding: 48px 0; }
.sy-splash-h1 { margin: 0 0 18px; font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; color: var(--text-strong); }
.sy-splash-h2 { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.75; color: var(--text-body); max-width: 46ch; }
.sy-splash-foot { font-size: 12px; color: var(--text-muted); }
.sy-splash-panel { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 52px 64px; background: var(--surface-card); }
.sy-splash-lang { position: absolute; top: 44px; right: 64px; }
.sy-splash-form { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; }
.sy-splash-heading { margin: 0 0 8px; font-size: 26px; font-weight: 800; color: var(--text-strong); }
.sy-splash-sub { margin: 0 0 30px; font-size: 14.5px; line-height: 1.6; color: var(--text-muted); }
.sy-splash-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 26px; }
.sy-splash-field span { font-size: 12.5px; font-weight: 700; color: var(--text-body); }
.sy-splash-field input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-page); font: inherit; font-size: 15px; color: var(--text-strong); outline: none; }
.sy-splash-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.sy-splash-submit { width: 100%; min-height: 48px; justify-content: center; font-size: 15.5px; }

@media (max-width: 860px) {
  .sy-splash { grid-template-columns: 1fr; }
  .sy-splash-hero { padding: 36px 24px; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .sy-splash-mid { padding: 32px 0 24px; }
  .sy-splash-h1 { font-size: 30px; }
  .sy-splash-panel { padding: 72px 24px 40px; }
  .sy-splash-lang { top: 20px; right: 24px; }
}
/* FocusOnNavigate focuses the tagline h1 on arrival; it is not interactive, so no focus ring (mobile does the same for h1). */
.sy-splash-h1:focus, .sy-splash-h1:focus-visible { outline: none; }
