.recommend-questions-panel {
  display: none;
  margin: 6px 0 0;
  margin-top: auto;
  padding: 4px 12px 8px 34px;
  border: none;
  border-radius: 0;
  background: transparent;
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
}

.recommend-questions-panel.is-visible {
  display: block;
}

.recommend-questions-list {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0;
  margin: 0;
}

.recommend-questions-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.recommend-questions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-items: stretch;
  gap: 8px;
  padding: 0;
}

.recommend-questions-label {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
  font-weight: 600;
  position: absolute;
  left: 0;
  top: 0;
  height: 36px;
  display: flex;
  align-items: center;
  transform: translateX(calc(-100% - 8px));
}

.recommend-questions-muted {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
  grid-column: 1 / -1;
  text-align: center;
}

.recommend-questions-btn {
  border: none;
  border-radius: 0;
  padding: 0 6px;
  background: transparent;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #4b5563;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  width: 100%;
}

.recommend-questions-btn:hover {
  color: #ff8a00;
  text-decoration: underline;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 720px) {
  .recommend-questions-panel {
    padding-left: 10px;
    padding-right: 10px;
  }

  .recommend-questions-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .recommend-questions-label {
    position: static;
    transform: none;
    height: auto;
    justify-content: center;
    margin-bottom: 6px;
  }

  .recommend-questions-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* Keep the canonical chat greeting in its original node for history restoration. */
#chatArea :not(.has-daily-guide) > .learning-daily-guide,
#chatArea .has-daily-guide > :not(.learning-daily-guide) { display: none !important; }
#chatArea {
  --learning-home-width: 752px;
  --learning-home-space: clamp(18px, 3vh, 32px);
  --home-title-size: 32px;
  --home-instruction-size: 18px;
  --home-resource-size: 17px;
  --home-meta-size: 14px;
  --home-row-gap: 18px;
  --learning-home-accent: #255d99;
}
html.layout-desktop #chatArea {
  --learning-home-space: clamp(24px, calc(18vh - 56px), 184px);
  --learning-home-width: clamp(752px, 52vw, 880px);
  --home-instruction-size: clamp(20px, 1.1vw, 22px);
  --home-resource-size: clamp(18px, 1.05vw, 20px);
  --home-meta-size: 15px;
}
html.device-tablet #chatArea {
  --home-title-size: clamp(32px, 4.5vmin, 38px);
}
html:is(.layout-desktop, .device-tablet) #chatArea {
  --home-preview-lines: 3;
  --home-card-inset: clamp(16px, 1.6vw, 24px);
  --home-card-padding-block: 7px;
}
@media (max-height: 760px) {
  html.device-tablet.mobile-tablet-landscape #chatArea { --home-preview-lines: 2; }
}
html.layout-mobile.device-tablet.mobile-tablet-landscape.has-visible-learning-home .chat-panel.is-mobile-empty #chatArea {
  --learning-home-space: 6px;
  --home-row-gap: 10px;
  --home-card-padding-block: 3px;
  --home-title-size: clamp(30px, 4vmin, 34px);
  --home-instruction-size: 17px;
  /* Keep the scroll viewport above the measured dock, even with a tall input or short screen. */
  margin-block-end: calc(var(--mobile-input-height-runtime) + env(safe-area-inset-bottom) + 28px) !important;
  padding-block-end: 4px !important;
  row-gap: 4px !important;
}
html.layout-industrial #chatArea {
  --learning-home-width: 880px;
  --home-title-size: 38px;
  --home-instruction-size: 23px;
  --home-resource-size: 21px;
  --home-meta-size: 17px;
  --home-row-gap: 20px;
}

/* The header and composer already size the chat viewport. Flexible margins
   share only the space left there and collapse when the content must scroll. */
html.layout-desktop #chatArea.is-initial-welcome:has(> .learning-home-panel.is-visible) {
  /* The desktop toolbar floats over the bottom edge of the chat area. */
  padding-block-end: calc(3.25rem + var(--industrial-tool-label, 0px) * 2) !important;
}
html.layout-desktop #chatArea.is-initial-welcome:has(> .learning-home-panel.is-visible) > .assistant-welcome-message {
  margin-block-start: auto !important;
}
html.layout-desktop #chatArea.is-initial-welcome > #recommendQuestionsPanel.learning-home-panel {
  margin-block-end: auto !important;
}
html.layout-mobile.has-visible-learning-home:not(.device-tablet) .main-container {
  /* The mobile shell already reserves the fixed header and dock. */
  max-height: none !important;
}
html.layout-mobile.has-visible-learning-home:not(.device-tablet) .is-mobile-empty #chatArea {
  padding-block-start: 12px !important;
  justify-content: flex-start;
}
html.layout-mobile.has-visible-learning-home:not(.device-tablet):not(.mobile-keyboard-open) .is-mobile-empty #chatArea > #mobileWelcomePanel {
  margin-block-start: auto;
}
html.layout-mobile.has-visible-learning-home:not(.device-tablet):not(.mobile-keyboard-open) .is-mobile-empty #chatArea > #recommendQuestionsPanel.learning-home-panel {
  margin-block-end: auto !important;
}
html.layout-mobile.has-visible-learning-home.mobile-keyboard-open .is-mobile-empty #chatArea {
  justify-content: flex-start !important;
}
html.layout-mobile.device-tablet.has-visible-learning-home.mobile-keyboard-open .is-mobile-empty #chatArea::before,
html.layout-mobile.device-tablet.has-visible-learning-home.mobile-keyboard-open .is-mobile-empty #chatArea::after {
  content: none;
}

/* Give the initial greeting and daily guide the same reading column. */
html.layout-desktop #chatArea.is-initial-welcome > .assistant-welcome-message,
html.layout-mobile .is-mobile-empty #chatArea > #mobileWelcomePanel {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--learning-home-width) !important;
  align-self: center;
  flex: none;
  min-block-size: calc(var(--home-title-size) * 1.2 + var(--home-instruction-size) * 3.1 + 60px);
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}
html.layout-mobile .is-mobile-empty #chatArea > #mobileWelcomePanel:not(.has-daily-guide) {
  min-block-size: 0;
}
html.layout-mobile .is-mobile-empty #mobileWelcomePanel > .mobile-welcome-subtitle {
  margin-block-end: 0;
}
html.layout-desktop #chatArea.is-initial-welcome > #recommendQuestionsPanel.learning-home-panel,
html.layout-mobile .is-mobile-empty #chatArea > #recommendQuestionsPanel.learning-home-panel {
  box-sizing: border-box;
  flex: none;
  width: 100%;
  max-width: var(--learning-home-width);
  align-self: center;
  margin-inline: auto !important;
  margin-block-start: var(--learning-home-space) !important;
  padding: 0;
  transform: none !important;
}
#recommendQuestionsPanel.learning-home-panel .recommend-questions-wrap {
  display: block;
  width: 100%;
  max-width: none;
}
.learning-daily-guide {
  display: grid;
  width: 100%;
  justify-items: center;
  text-align: center;
}
html:is(.layout-desktop, .device-tablet) .learning-daily-guide {
  font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}
#chatArea.is-initial-welcome .assistant-welcome-message p:first-child,
#chatArea #mobileWelcomePanel .mobile-welcome-title,
#chatArea .learning-guide-title {
  margin: 0 !important;
  color: #182b40 !important;
  font-size: var(--home-title-size) !important;
  font-weight: 750 !important;
  line-height: 1.2 !important;
}
.learning-daily-guide > span {
  margin-block-start: 8px;
  max-inline-size: 30em;
  color: #465b70;
  font-size: var(--home-instruction-size);
  line-height: 1.55;
  text-wrap: balance;
}
#chatArea .learning-daily-guide button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin: 3px 0 0;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--learning-home-accent);
  font: inherit;
  font-size: var(--home-meta-size);
  font-weight: 600;
  cursor: pointer;
}
.learning-daily-guide button:enabled::after {
  content: '';
  width: 6px;
  height: 6px;
  border-block-start: 2px solid currentColor;
  border-inline-end: 2px solid currentColor;
  transform: rotate(45deg);
}
#chatArea .learning-daily-guide button:disabled { color: #506379; cursor: default; }
.learning-daily-guide button:is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: 3px; }
.learning-daily-guide button:focus-visible, .learning-home-panel button:focus-visible {
  outline: 2px solid var(--learning-home-accent);
  outline-offset: 2px;
}
.learning-home-controls button, .learning-home-panel [data-home-action="retry"] {
  color: #395674; font: inherit; font-size: 14px; cursor: pointer;
  background: transparent; border: 0; padding: 5px 8px;
}
.learning-home-controls { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vw, 12px); margin-block-start: 6px; }
.learning-home-controls button { display: grid; place-items: center; min-width: 48px; min-height: 48px; }
.learning-home-controls button::before {
  content: ''; width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 50%;
}
.learning-home-controls [aria-current="true"]::before {
  background: currentColor; color: var(--learning-home-accent);
}
.learning-home-controls button:active::before {
  color: var(--learning-home-accent);
  box-shadow: 0 0 0 4px rgb(37 93 153 / 12%);
}
@media (prefers-reduced-motion: no-preference) {
  .learning-home-controls button::before {
    transition: transform 140ms ease-out, background-color 140ms ease-out;
  }
  .learning-home-controls [aria-current="true"]::before { transform: scale(1.12); }
  .learning-home-controls button:active::before { transform: scale(.85); }
}
#chatArea #recommendQuestionsPanel.learning-home-panel .recommend-questions-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: var(--home-row-gap) clamp(20px, 3.2vw, 40px) !important;
  font-size: var(--home-resource-size);
}
/* Reserve the whole group, including a short final page, so the heading and controls stay still. */
.learning-home-panel .recommend-questions-grid.is-paged {
  grid-template-rows: repeat(2, 1fr);
  min-block-size: calc(2 * (var(--home-preview-lines, 2) * 1.45em + 1.4 * var(--home-meta-size) + 4px + 2 * var(--home-card-padding-block, 0px)) + var(--home-row-gap));
}
#recommendQuestionsPanel.learning-home-panel .learning-home-item {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #223c58;
  font: inherit;
  font-size: var(--home-resource-size);
  font-weight: 600;
  line-height: 1.45;
  text-align: start;
  cursor: pointer;
}
html:is(.layout-desktop, .device-tablet) #recommendQuestionsPanel.learning-home-panel .learning-home-item {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(44px, 1fr);
  align-content: stretch;
}
/* Draw the surface in the question's grid cell. The label and question share one button. */
html:is(.layout-desktop, .device-tablet) .learning-home-item::before {
  content: '';
  grid-area: 2 / 1;
  place-self: stretch;
  pointer-events: none;
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 6%), 0 3px 11px rgb(15 23 42 / 4%);
}
html:is(.layout-desktop, .device-tablet) .learning-home-item > small {
  grid-area: 1 / 1;
  margin-inline: var(--home-card-inset);
}
html:is(.layout-desktop, .device-tablet) .learning-home-item > span {
  grid-area: 2 / 1;
  place-self: center start;
  margin: var(--home-card-padding-block) var(--home-card-inset);
}
.learning-home-item small { font-size: var(--home-meta-size); font-weight: 400; line-height: 1.4; color: #5c7082; }
html.layout-desktop .learning-home-item small { color: #28569a; font-weight: 600; }
html.layout-desktop .learning-home-item small[data-group="practice"] { color: #096861; }
html.layout-desktop .learning-home-item small[data-group="multimodal"] { color: #6648a3; }
.learning-home-item > span {
  display: -webkit-box;
  -webkit-line-clamp: var(--home-preview-lines, 2);
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.learning-home-blank { white-space: nowrap; }
@media (hover: hover) {
  .learning-home-item:hover > span { color: var(--learning-home-accent); text-decoration: underline; text-underline-offset: 3px; }
}
.learning-home-panel .learning-home-item:active > span { color: var(--learning-home-accent); }
.learning-home-panel [hidden] { display: none !important; }

@media (max-height: 850px) {
  html.layout-desktop:not(.layout-industrial) #chatArea.is-initial-welcome:has(> .learning-home-panel.is-visible) {
    --learning-home-space: 14px;
    --home-title-size: 28px;
    --home-instruction-size: 17px;
    --home-resource-size: 16px;
    --home-meta-size: 13px;
    --home-preview-lines: 2;
    --home-row-gap: 10px;
    --home-card-padding-block: 5px;
    padding-block: 12px 32px !important;
  }

  html.layout-desktop:not(.layout-industrial) #chatArea.is-initial-welcome:has(> .learning-home-panel.is-visible) > .assistant-welcome-message {
    min-block-size: 0;
  }

  html.layout-desktop:not(.layout-industrial) #chatArea.is-initial-welcome .learning-daily-guide button,
  html.layout-desktop:not(.layout-industrial) #chatArea.is-initial-welcome .learning-home-controls button {
    min-height: 32px;
  }
}

@media (max-width: 600px) {
  html.layout-mobile:not(.device-tablet) #chatArea {
    --learning-home-space: 12px;
    --home-title-size: 29px;
    --home-instruction-size: 16px;
    --home-resource-size: 16px;
    --home-row-gap: 8px;
  }
  html.layout-mobile:not(.device-tablet) #chatArea #recommendQuestionsPanel.learning-home-panel .recommend-questions-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html.layout-mobile:not(.device-tablet) .learning-home-panel .recommend-questions-grid.is-paged {
    grid-template-rows: none;
    align-content: start;
    min-block-size: calc(4 * max(44px, 2.9em) + 3 * var(--home-row-gap));
  }
  html.layout-mobile:not(.device-tablet) #recommendQuestionsPanel .learning-home-item {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    align-content: center;
    align-items: baseline;
  }
  html.layout-mobile:not(.device-tablet) .learning-home-item small { font-size: 13px; }
}
#quizRecommendedCatalog:not([hidden]) { display: grid; gap: 6px; margin-block-start: 12px; }
#quizRecommendedCatalog > button { justify-content: start; text-align: start; white-space: normal; }
#quizRecommendedCatalog [aria-current="true"] { outline: 2px solid #306cb5; }
