/*
 * 题脉学习界面收敛层。
 * 只定义稳定的视觉规则；布局能力和业务状态仍由原组件样式维护。
 */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --text-strong: #1f2522;
  --text-secondary: #68716c;
  --surface-subtle: #f6f7f5;
  --focus-ring: 0 0 0 3px rgba(37, 99, 106, 0.14);
}

/* Branded sign-in and a focused modal for internal test credentials. */
.wechat-app-icon img {
  width: 24px;
  height: 24px;
  display: block;
}

.mobile-auth-wechat i img {
  width: 15px;
  height: 15px;
  display: block;
}

.login-brand {
  width: auto;
  min-width: 76px;
  padding: 0 14px;
}

.app {
  height: 100vh;
  height: 100dvh;
}

.test-login-dialog {
  width: min(400px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(35, 65, 69, 0.2);
}

.test-login-dialog::backdrop {
  background: rgba(31, 38, 36, 0.38);
  backdrop-filter: blur(4px);
}

.test-login-dialog > section {
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
}

.test-login-dialog header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: start;
  gap: 16px;
}

.test-login-dialog header span {
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.test-login-dialog header h2 {
  margin: 5px 0 0;
  font-size: 21px;
  line-height: 1.3;
}

.test-login-dialog header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.test-login-dialog header button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 22px;
  font-weight: 350;
  line-height: 1;
}

.test-login-dialog .login-form {
  margin-top: 22px;
  padding-top: 0;
  border-top: 0;
}

/* Turn grading prose into a result card that can be scanned before reading. */
.bubble.assistant.grade-result {
  box-sizing: border-box;
  flex: 0 0 auto;
  animation: none;
  opacity: 1;
  transform: none;
  width: min(760px, 100%);
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d5e1dc;
  border-left-width: 1px;
  border-radius: 18px;
  background: #fff;
  white-space: normal;
  box-shadow: 0 10px 30px rgba(28, 72, 57, 0.08);
}

.grade-result-head {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid #e1ebe6;
  background: linear-gradient(135deg, #edf7f2 0%, #f8fbf9 100%);
}

.grade-result-state {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.grade-result-state > div {
  display: grid;
  gap: 2px;
}

.grade-result-symbol {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #d9ede4;
  color: #216147;
  font-size: 23px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.grade-result-head span {
  color: #658073;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.grade-result-head strong {
  color: #1e3129;
  font-size: 17px;
  font-weight: 800;
}

.grade-result-head small {
  color: #738078;
  font-size: 10.5px;
  font-weight: 500;
}

.grade-result-head b {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: #dcefe5;
  color: #276349;
  font-size: 11.5px;
  font-weight: 800;
}

.grade-result.is-wrong .grade-result-head {
  border-bottom-color: #efddd8;
  background: linear-gradient(135deg, #fcf0ed 0%, #fff9f7 100%);
}

.grade-result.is-wrong .grade-result-symbol {
  background: #f2d9d4;
  color: #9a352d;
}

.grade-result.is-wrong .grade-result-head b {
  background: #f1d8d4;
  color: #9a352d;
}

.grade-answer-grid {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 16px 18px 4px;
}

.grade-answer-grid.single-answer {
  grid-template-columns: minmax(0, 1fr);
}

.grade-answer-item {
  box-sizing: border-box;
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px 9px 13px;
  border: 1px solid #e0e7e3;
  border-radius: 14px;
  background: #f8faf9;
}

.grade-answer-item span {
  color: #68766f;
  font-size: 10.5px;
  font-weight: 650;
}

.grade-answer-item strong {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e7eeea;
  color: #31443c;
  font-size: 16px;
  font-weight: 850;
}

.grade-answer-arrow {
  display: grid;
  place-items: center;
  color: #9aa49f;
  font-size: 16px;
  font-style: normal;
}

.grade-result.is-wrong .your-answer {
  border-color: #efd8d3;
  background: #fdf8f7;
}

.grade-result.is-wrong .your-answer strong {
  background: #f1d8d4;
  color: #98372f;
}

.grade-answer-item.correct-answer {
  border-color: #cfe3d8;
  background: #f6faf8;
}

.grade-answer-item.correct-answer strong,
.grade-result.is-right .your-answer strong {
  background: #dcefe5;
  color: #276349;
}

.grade-result-summary {
  margin: 12px 18px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f9f8;
  color: #5b635f;
  font-size: 12px;
  line-height: 1.6;
}

.grade-explanation {
  display: grid;
  gap: 10px;
  padding: 14px 18px 17px;
}

.grade-explanation-section {
  padding: 13px 14px 14px;
  border: 1px solid #e3e9e6;
  border-radius: 14px;
  background: #fafcfb;
}

.grade-explanation-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  color: #26312d;
  font-size: 12px;
  font-weight: 800;
}

.grade-explanation-section h3 i {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7f0ed;
  color: var(--accent-dark);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 800;
}

.grade-explanation-section p {
  margin: 0;
  color: #35423c;
  font-size: 12.5px;
  line-height: 1.75;
}

.grade-explanation-section.grade-review {
  border-color: #e5e4dc;
  background: #fbfaf6;
}

.grade-explanation-section.grade-review h3 i {
  background: #eeece2;
  color: #75663d;
}

.grade-result .message-feedback {
  margin: 0 17px;
  padding: 8px 0 10px;
}

@media (max-width: 760px) {
  .login-screen {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .topbar,
  .mobile-settings-head,
  .mobile-auth-head {
    background: var(--panel);
    backdrop-filter: none;
  }

  .login-panel {
    width: min(100%, 420px);
    max-width: 100%;
    min-height: auto;
    box-sizing: border-box;
    padding: 24px 24px 22px;
  }

  .login-brand {
    margin-top: 0;
  }

  .mobile-settings-developer {
    display: none;
  }

  .login-heading > span {
    font-size: 10.5px;
  }

  .login-heading h1 {
    font-size: clamp(27px, 8vw, 33px);
  }

  .login-heading p {
    width: 100%;
    max-width: 310px;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .test-login-dialog {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin: auto;
  }

  .test-login-dialog > section {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  }

  .bubble.assistant.grade-result {
    padding: 0;
    border-radius: 14px;
  }

  .grade-result-head {
    min-height: 76px;
    padding: 13px 14px;
  }

  .grade-result-symbol {
    width: 35px;
    height: 35px;
    flex-basis: 35px;
    border-radius: 11px;
    font-size: 21px;
  }

  .grade-result-head strong {
    font-size: 15.5px;
  }

  .grade-result-head small {
    font-size: 9.5px;
  }

  .grade-answer-grid {
    grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
    gap: 4px;
    padding: 13px 14px 3px;
  }

  .grade-answer-item {
    min-height: 52px;
    padding: 8px 8px 8px 10px;
    border-radius: 12px;
  }

  .grade-answer-item span {
    font-size: 9.5px;
  }

  .grade-answer-item strong {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
    border-radius: 9px;
    font-size: 14px;
  }

  .grade-result-summary {
    margin: 10px 14px 0;
  }

  .grade-explanation {
    gap: 8px;
    padding: 12px 14px 14px;
  }

  .grade-explanation-section {
    padding: 11px 12px 12px;
    border-radius: 12px;
  }

  .grade-explanation-section p {
    font-size: 12px;
    line-height: 1.7;
  }
}

button,
textarea,
input,
select {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* 历史题目是一条可扫描的记录，不再表现成空白大卡片。 */
.question-round-archive {
  border-color: var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  box-shadow: none;
}

.question-round-archive > summary {
  min-height: 40px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  padding: 7px 10px;
}

.question-round-archive > summary > span {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.question-round-archive > summary small {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.question-round-archive > summary strong {
  min-width: 0;
  display: block;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-round-archive > summary b {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
}

.question-round-content {
  gap: var(--space-3);
  padding: var(--space-3);
}

/* 选项、引导和诊断使用同一套紧凑交互密度。 */
.choice-card,
.guide-option,
.learning-action-option,
.diagnosis-finding {
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.guide-card,
.learning-actions-card,
.diagnosis-card {
  border-radius: var(--radius-md);
  box-shadow: none;
}

.guide-card {
  padding: var(--space-3);
}

.guide-title {
  margin-bottom: var(--space-2);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
}

.guide-options {
  gap: 6px;
}

.guide-option {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.diagnosis-card h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.diagnosis-summary,
.diagnosis-finding > div {
  font-size: 13px;
  line-height: 1.55;
}

.diagnosis-finding {
  padding: var(--space-2) 10px;
}

/* 调试信息可以保留，但视觉上退到内容之后。 */
.tool-debug-card {
  border-color: #d7ded9;
  border-radius: var(--radius-sm);
  background: #fafbfa;
  color: var(--text-secondary);
  box-shadow: none;
}

.tool-debug-card > summary {
  min-height: 32px;
  padding: 6px 8px;
}

.tool-debug-name,
.tool-debug-brief,
.tool-debug-status {
  font-size: 10px;
}

@media (min-width: 761px) {
  .study-workspace.has-question {
    grid-template-columns: minmax(0, 1.62fr) minmax(340px, 0.92fr);
  }

  .question-card {
    padding: var(--space-5) clamp(28px, 3vw, 44px) 36px;
  }

  .question-head {
    padding-bottom: var(--space-3);
  }

  .question-head h2 {
    font-size: 16px;
    font-weight: 600;
  }

  .material,
  .stem {
    margin-top: var(--space-4);
    font-size: 15px;
    line-height: 1.72;
  }

  .choice-grid {
    gap: var(--space-2);
    margin-top: var(--space-4);
  }

  .choice-card {
    min-height: 44px;
    padding: 8px 11px;
    border-radius: 10px;
  }

  .choice-body {
    font-size: 13.5px;
    line-height: 1.55;
  }

  .dialogue-panel .chat {
    gap: var(--space-3);
    padding: 20px 18px 14px;
  }

  .bubble {
    font-size: 14px;
    line-height: 1.58;
  }

  .bubble.user {
    max-width: 88%;
    padding: 9px 12px;
    border-radius: var(--radius-lg) var(--radius-lg) 5px var(--radius-lg);
  }

  .study-workspace:not(.has-question) .study-start-copy h2 {
    font-size: clamp(28px, 2.6vw, 34px);
    letter-spacing: -0.025em;
  }

  .study-workspace:not(.has-question) .study-start-actions-grid button {
    min-height: 44px;
    border-radius: var(--radius-md);
  }
}

@media (max-width: 760px) {
  .mobile-chat-welcome {
    gap: var(--space-4);
  }

  .mobile-chat-welcome .study-start-copy h2,
  .study-start-copy h2 {
    font-size: clamp(24px, 7vw, 28px);
    line-height: 1.28;
    letter-spacing: -0.02em;
  }

  .study-start-copy p {
    font-size: 13px;
    line-height: 1.6;
  }

  .study-start-actions-grid {
    gap: var(--space-2);
  }

  .study-start-actions-grid button {
    min-height: 42px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
  }

  .study-workspace.has-question > .mobile-study-splitter {
    min-height: 14px;
    background: #f6f6f3;
  }

  .study-workspace.has-question > .mobile-study-splitter i {
    width: 32px;
    height: 3px;
    background: #aeb6b1;
  }

  .chat-question-card .material,
  .chat-question-card .stem {
    font-size: 14px;
    line-height: 1.68;
  }

  .chat-question-card .choice-body {
    font-size: 13px;
    line-height: 1.55;
  }

  .dialogue-panel .chat,
  .study-workspace.mobile-question-focus .chat {
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .bubble {
    font-size: 14px;
    line-height: 1.62;
  }

  .guide-card {
    padding: 10px;
  }

  .guide-title {
    font-size: 13.5px;
  }

  .guide-option {
    min-height: 36px;
    font-size: 12.5px;
  }

  .question-round-archive > summary small {
    display: none;
  }

  .question-round-archive > summary strong {
    font-size: 11.5px;
  }

  .composer textarea {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  textarea,
  input,
  select {
    transition: none;
  }
}

/* Product polish: make the learning hierarchy legible without adding chrome. */
.bubble.assistant:not(.thinking) {
  border-left: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 4%, transparent), transparent 84px);
}

/* Keep the conversation vertically draggable after a streamed result is
   replaced by a taller grade card, especially inside Android WebView. */
.dialogue-panel .chat {
  touch-action: pan-y;
}

.bubble.user {
  border-color: #eadbd4;
  background: #f7efeb;
}

/* Keep multiline input scrollable without exposing the native scrollbar as a
   stray vertical bar inside the rounded composer. */
.composer textarea {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.composer textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.composer textarea:focus,
.composer textarea:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Reading typography: favor calm Chinese text density over compact dashboard
   density. Keep system fonts so web and APK render crisply without downloads. */
@media (min-width: 761px) {
  .question-card .meta {
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.55;
  }

  .question-card .material,
  .question-card .stem {
    font-size: 16.5px;
    font-weight: 400;
    line-height: 1.82;
    letter-spacing: 0.005em;
    text-wrap: pretty;
  }

  .question-card .choice-body {
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.68;
  }

  .dialogue-panel .bubble {
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.68;
  }

  .dialogue-panel .guide-title {
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.68;
    text-wrap: pretty;
  }

  .dialogue-panel .guide-option {
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.58;
  }
}

@media (max-width: 760px) {
  .chat-question-card .material,
  .chat-question-card .stem {
    font-size: 15.5px;
    line-height: 1.78;
  }

  .chat-question-card .choice-body,
  .dialogue-panel .bubble {
    font-size: 14.5px;
    line-height: 1.68;
  }

  .dialogue-panel .guide-title {
    font-weight: 500;
    line-height: 1.62;
  }

  .dialogue-panel .guide-option {
    font-weight: 400;
    line-height: 1.55;
  }
}

.message-feedback-button {
  min-height: 32px;
  color: #707773;
  font-size: 11px;
}

.composer-area .quota-low-notice {
  min-height: 22px;
  justify-content: space-between;
  margin: 3px 20px 0;
  color: #686f6b;
  font-size: 10.5px;
  line-height: 1.35;
}

.composer-area .quota-low-notice #quotaLowNoticeButton {
  flex: 0 0 auto;
  color: #565d59;
  font-size: 10.5px;
}

@media (min-width: 761px) {
  .study-workspace.has-question {
    grid-template-columns: minmax(0, 1.66fr) minmax(360px, 0.94fr);
  }

  .question-stage {
    scrollbar-gutter: stable;
  }

  .question-stage .question-head {
    position: sticky;
    top: 0;
    z-index: 4;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
  }

  .question-head-actions button,
  .question-skip {
    min-height: 36px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .dialogue-panel .chat {
    background: linear-gradient(180deg, #fbfaf8 0, #fff 72px);
  }

  .bubble.assistant:not(.thinking) {
    padding: 8px 8px 8px 12px;
  }
}

@media (max-width: 760px) {
  .app {
    grid-template-rows: 64px minmax(0, 1fr);
  }

  .topbar {
    min-height: 64px;
  }

  .session-entry,
  .new-session-entry {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .session-entry {
    top: 10px;
    left: 8px;
    background:
      linear-gradient(#343936, #343936) 14px 14px / 16px 1.5px no-repeat,
      linear-gradient(#343936, #343936) 14px 21px / 16px 1.5px no-repeat,
      linear-gradient(#343936, #343936) 14px 28px / 12px 1.5px no-repeat,
      transparent;
  }

  .topbar-brand-actions {
    top: 10px;
    right: 6px;
  }

  .study-workspace.has-question,
  .study-workspace.has-question.mobile-question-focus {
    --mobile-question-height: 58%;
    grid-template-rows: var(--mobile-question-height) 16px minmax(0, 1fr);
  }

  .study-workspace.has-question > .question-stage {
    padding: 0 16px 16px;
    scrollbar-gutter: stable;
  }

  .study-workspace.has-question > .mobile-study-splitter {
    min-height: 16px;
    border-color: #e5ddd7;
    background: #f8f3ef;
  }

  .study-workspace.has-question > .mobile-study-splitter i {
    width: 40px;
    height: 4px;
    background: #a99d96;
  }

  .chat-question-card .mobile-question-layout-action,
  .chat-question-card .question-skip {
    min-height: 44px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 11px;
  }

  .chat-question-card .meta {
    color: #646b67;
    font-size: 10.5px;
  }

  .chat-question-card .choice-card {
    min-height: 48px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .dialogue-panel .chat,
  .study-workspace.mobile-question-focus .chat {
    padding: 14px 16px;
  }

  .bubble.assistant:not(.thinking) {
    max-width: 100%;
    padding: 7px 6px 7px 12px;
  }

  .bubble.user {
    max-width: 88%;
    padding: 10px 13px;
  }

  .message-feedback {
    margin-top: 9px;
  }

  .message-feedback-button {
    min-height: 44px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .guide-quick-starts button {
    min-height: 44px;
    padding: 7px 12px;
    font-size: 11.5px;
  }

  .composer-area .quota-low-notice {
    min-height: 26px;
    margin: 1px 16px 0;
    font-size: 10px;
  }

  .composer,
  .composer:nth-child(n),
  .study-workspace.mobile-question-focus .composer {
    min-height: 56px;
    margin-top: 5px;
  }

  .composer textarea {
    min-height: 44px;
    height: 44px;
    line-height: 22px;
  }

  .composer #sendButton {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .question-timeline-item button {
    min-height: 32px;
    padding: 5px 8px;
  }
}

/* Keep the structured result card intact after the generic bubble rules above. */
.dialogue-panel .bubble.assistant.grade-result {
  width: min(760px, 100%);
  max-width: 100%;
  padding: 0;
  border: 1px solid #d9e2dd;
  background: #fff;
  white-space: normal;
}

@media (max-width: 760px) {
  .dialogue-panel .bubble.assistant.grade-result {
    max-width: 100%;
    padding: 0;
  }
}

/* Mobile native shell: one full-screen surface instead of desktop cards in a viewport. */
@media (max-width: 760px) {
  :root {
    --bg: #f7f9f7;
    --panel: #ffffff;
    --panel-soft: #eff5f2;
    --accent: #256b58;
    --accent-dark: #174b3e;
    --guide: #edf6f2;
    --guide-line: #c8ded5;
  }

  html,
  body,
  .app {
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: var(--panel);
  }

  .app {
    height: 100vh;
    height: 100dvh;
  }

  .study-workspace,
  .study-workspace:not(.has-question),
  .study-workspace.mobile-question-collapsed,
  .study-workspace.mobile-question-focus {
    height: 100%;
    display: block;
    overflow: hidden;
    background: var(--panel);
  }

  .dialogue-panel,
  .study-workspace:not(.has-question) .dialogue-panel,
  .study-workspace.mobile-question-collapsed .dialogue-panel,
  .study-workspace.mobile-question-focus .dialogue-panel {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    overflow: hidden;
    background: var(--panel);
  }

  .login-screen {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    background: var(--bg);
  }

  .login-panel {
    width: 100%;
    max-width: none;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(28px, env(safe-area-inset-top)) 28px max(24px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }

  .login-brand {
    width: auto;
    height: auto;
    margin: 0 0 24px;
    border-radius: 0;
    background: transparent;
    color: var(--accent-dark);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 29px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .login-heading > span {
    color: var(--accent);
    font-size: 10.5px;
    letter-spacing: 0.09em;
  }

  .login-heading h1 {
    margin-top: 13px;
    font-size: clamp(29px, 8.4vw, 35px);
    line-height: 1.24;
  }

  .login-heading p {
    max-width: 330px;
    margin-top: 15px;
    font-size: 13px;
    line-height: 1.68;
  }

  .login-primary-actions {
    width: min(100%, 330px);
    margin-top: 28px;
  }

  .wechat-login-button {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 18px;
    border-radius: 15px;
    background: #07c160;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
  }

  .wechat-login-button:hover,
  .wechat-login-button:active {
    background: #06b458;
  }

  .wechat-app-icon {
    width: 29px;
    height: 29px;
    background: transparent;
    box-shadow: none;
  }

  .wechat-app-icon img {
    width: 23px;
    height: 23px;
  }

  .test-login-toggle {
    width: min(100%, 330px);
    min-height: 46px;
    margin-top: 12px;
    border: 1px solid #d8e2dd;
    border-radius: 14px;
    background: var(--panel);
    color: var(--accent-dark);
    font-size: 12px;
  }

  .login-footnote {
    max-width: 330px;
    margin-top: 20px;
    color: #858d88;
    line-height: 1.55;
  }

  .chat.has-mobile-welcome {
    justify-content: flex-start;
    padding-top: clamp(72px, 13vh, 112px);
    padding-bottom: 24px;
  }

  .mobile-chat-welcome {
    width: 100%;
    max-width: 420px;
    align-self: center;
    gap: 18px;
  }

  .mobile-chat-welcome .study-start-copy h2 {
    color: #1f2924;
    font-size: clamp(25px, 7.4vw, 31px);
  }

  .mobile-chat-welcome .study-start-actions-grid button {
    min-height: 50px;
    border-color: #dbe6e0;
    background: #f3f7f5;
    color: #27463b;
    box-shadow: none;
  }

  .composer #sendButton,
  .mobile-logout-actions button:last-child,
  .mobile-account-card > span {
    border-color: var(--accent);
    background: var(--accent);
  }

  .mobile-profile-dialog,
  .mobile-debug-dialog,
  .mobile-auth-dialog,
  .mobile-profile-dialog > .mobile-settings-page,
  .mobile-debug-dialog > .mobile-debug-page,
  .mobile-auth-dialog > section {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: none;
    max-height: none;
  }

  .mobile-profile-dialog,
  .mobile-debug-dialog,
  .mobile-auth-dialog {
    inset: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }

  .mobile-profile-dialog > .mobile-settings-page,
  .mobile-debug-dialog > .mobile-debug-page,
  .mobile-auth-dialog > section {
    background: var(--bg);
  }

  body.mobile-full-page-open .app {
    visibility: hidden;
    pointer-events: none;
  }

  .session-drawer {
    width: 50vw;
    min-width: 0;
    border-right: 1px solid #dfe5e1;
    border-radius: 0;
    background: #fff;
    box-shadow: 10px 0 28px rgba(28, 45, 38, 0.14);
  }

  .session-drawer-head,
  .session-drawer-actions,
  .session-list,
  .session-account-footer {
    background: #fff;
  }

  .session-overlay {
    background: rgba(18, 28, 24, 0.4);
    backdrop-filter: none;
  }
}

/* Final phone polish: compact coaching cards and a clearly native shell. */
@media (max-width: 760px) {
  .topbar {
    border-bottom-color: #1f6b57;
    background: #1f6b57;
    color: #fff;
    backdrop-filter: none;
  }

  .brand-copy h1 {
    color: #fff;
  }

  .session-entry {
    background:
      linear-gradient(#fff, #fff) 14px 14px / 16px 1.5px no-repeat,
      linear-gradient(#fff, #fff) 14px 21px / 16px 1.5px no-repeat,
      linear-gradient(#fff, #fff) 14px 28px / 12px 1.5px no-repeat,
      rgba(255, 255, 255, 0.1);
  }

  .new-session-entry {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .session-entry:hover,
  .session-entry:active,
  .new-session-entry:hover,
  .new-session-entry:active {
    background-color: rgba(255, 255, 255, 0.18);
  }

  .session-drawer {
    width: 61.8vw;
    max-width: 320px;
  }

  .session-card-main {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
  }

  .dialogue-panel .guide-card {
    width: 100%;
    align-self: stretch;
    padding: 11px;
    border: 1px solid #d9e7e0;
    border-radius: 14px;
    background: #fbfdfc;
    box-shadow: none;
  }

  .dialogue-panel .guide-title {
    margin-bottom: 8px;
    color: #25352e;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.5;
  }

  .dialogue-panel .guide-options {
    gap: 6px;
  }

  .dialogue-panel .guide-option {
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid #dce7e2;
    border-radius: 10px;
    background: #fff;
    color: #2d3b35;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.42;
  }

  .dialogue-panel .guide-option:active {
    border-color: #9fc6b7;
    background: #edf6f2;
  }

  .message-feedback,
  .guide-card .message-feedback {
    margin-top: 6px;
    padding-top: 4px;
  }

  .message-feedback-button,
  .guide-card .message-feedback-button {
    min-height: 24px;
    padding: 1px 4px;
    font-size: 10.5px;
  }

  .guide-quick-starts,
  .study-workspace.mobile-question-focus .guide-quick-starts {
    gap: 4px;
    padding: 4px 14px 2px;
  }

  .guide-quick-starts button,
  .study-workspace.mobile-question-focus .guide-quick-starts button {
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 11px;
    font-size: 10.5px;
    line-height: 1.2;
  }

  /* Match the desktop Web login: icon first, label below. */
  .login-primary-actions {
    width: auto;
  }

  .wechat-login-button {
    width: 92px;
    min-width: 92px;
    min-height: 74px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: 14px;
    background: transparent;
    color: #26342e;
    font-size: 12px;
  }

  .wechat-login-button:hover,
  .wechat-login-button:active {
    background: #eef4f1;
  }

  .wechat-app-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #07c160;
  }

  .wechat-app-icon img {
    width: 25px;
    height: 25px;
  }
}
