:root {
  --bg: #f7f8f5;
  --ink: #1f2933;
  --muted: #667085;
  --green: #111827;
  --green-dark: #000000;
  --green-soft: #F7F7F8;
  --line: #e4e9e6;
  --radius-md: 14px;
  --radius-lg: 20px;
}
* {
  box-sizing: border-box;
}
.hidden,
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
  padding-bottom: 118px;
}
.beian-footer {
  padding: 18px 16px 28px;
  text-align: center;
}
.beian-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: 13px;
  line-height: 20px;
  text-decoration: none;
}
.beian-footer a:hover {
  color: #374151;
  text-decoration: underline;
}
.beian-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-block;
}
button,
textarea {
  font-family: inherit;
}
.topbar {
  min-height: 58px;
  background: rgba(247, 248, 245, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 18px;
}
.brand {
  cursor: pointer;
}
.brand-main {
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.brand-sub {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.nav-link,
.lang-btn {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 0;
}
.page {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding-top: 64px;
}
.hero-card {
  max-width: 1180px;
  margin: 0 auto;
  background: rgba(255,255,255,0.84);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 38px 34px;
  box-shadow: 0 18px 50px rgba(31, 42, 55, 0.08);
}
.hero-card h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.05em;
  color: #111827;
}
.hero-desc {
  margin: 16px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
  max-width: 820px;
}
.starter-area.starter-two-column {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.starter-header-v800 {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}
.starter-title {
  font-weight: 850;
  font-size: 15px;
  color: var(--ink);
}
.starter-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}
.starter-categories {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.starter-categories button {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #475467;
  font-size: 13px;
  font-weight: 850;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.starter-categories button.active {
  background: var(--green-soft);
  border-color: #afd3c7;
  color: var(--green-dark);
}
.starter-preview,
.starter-scenarios-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  padding: 20px;
  min-height: 245px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.starter-scenarios {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
.starter-scenarios button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.starter-scenarios button.selected {
  background: var(--green-soft);
  border-color: #91c7b5;
  box-shadow: 0 8px 24px rgba(47, 125, 102, 0.12);
}
.starter-scenarios button strong {
  display: block;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 6px;
}
.starter-scenarios button span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}
.starter-clean-plus-v800,
[data-starter-more-v800],
[data-starter-scenario-more-v800] {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  font-weight: 850;
  display: grid;
  place-items: center;
  justify-self: start;
  margin-top: 2px;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  position: static;
  float: none;
}
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  padding: 14px 22px 18px;
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 14px;
}
textarea {
  width: 100%;
  height: 78px;
  resize: none;
  border: 1.5px solid #b8d3cc;
  border-radius: 18px;
  padding: 17px 20px;
  font-size: 16px;
  outline: none;
  background: #fff;
  color: var(--ink);
  line-height: 1.5;
}
textarea::placeholder {
  color: #a3a9b2;
  font-weight: 600;
}
textarea:focus {
  border-color: #7fb69c;
  box-shadow: 0 0 0 3px rgba(127, 182, 156, 0.16);
}
#sendBtn {
  border: 0;
  border-radius: 18px;
  background: var(--green);
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
  min-height: 66px;
  align-self: end;
}
#sendBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.messages {
  width: min(960px, calc(100vw - 40px));
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.message.user {
  max-width: 78%;
  margin-left: auto;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--green-dark);
  color: #fff;
  border: 0;
  line-height: 1.55;
  font-size: 15px;
  font-weight: 560;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.assistant {
  max-width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 28px 26px;
  color: var(--ink);
  box-shadow: 0 12px 34px rgba(31, 42, 55, 0.045);
}
.message.assistant::before {
  content: "Tavi:";
  display: block;
  margin-bottom: 10px;
  color: #5b9a84;
  font-size: 15px;
  font-weight: 850;
}
.message.assistant .message-content {
  white-space: pre-wrap;
  font-size: 16.5px;
  line-height: 1.78;
  font-weight: 520;
  color: #1f2937;
}
.actions-panel {
  width: min(960px, calc(100vw - 40px));
  margin: 10px auto 0;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 14px;
  box-shadow: 0 8px 24px rgba(31, 42, 55, 0.035);
}
.actions-panel.hidden {
  display: none;
}
.panel-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 850;
  margin-bottom: 8px;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 8px;
}
.action-btn {
  border: 1px solid #cfe0d8;
  background: #fff;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.action-btn:hover {
  background: var(--green-soft);
}
.answer-copy-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}
.copy-answer-btn {
  font-size: 12px;
  padding: 6px 10px;
  color: #557267;
  border-color: #dbe7e1;
}
.support-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.support-toggle-icon {
  font-size: 12px;
  color: #7b8a82;
  font-weight: 500;
}
.support-actions.support-collapsed,
#supportActions.support-collapsed,
.support-collapsed {
  display: none !important;
}
.recent-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(18, 32, 28, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.recent-modal.hidden {
  display: none !important;
}
.recent-modal-card {
  width: min(760px, 100%);
  max-height: min(680px, 86vh);
  overflow: hidden;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid #dfeee6;
  box-shadow: 0 24px 80px rgba(25, 60, 48, 0.20);
  display: flex;
  flex-direction: column;
}
.recent-modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.recent-modal-head strong {
  display: block;
  color: #173b30;
  font-size: 18px;
}
.recent-modal-head span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}
#recentCloseBtn {
  border: 0;
  background: var(--green-soft);
  color: var(--green-dark);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.recent-list {
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.recent-item {
  width: 100%;
  text-align: left;
  border: 1px solid #e0eee5;
  background: #fbfefc;
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-item strong {
  color: #173b30;
  font-size: 15px;
}
.recent-item span {
  color: #7f9088;
  font-size: 12px;
}
.recent-item em {
  color: #4f665d;
  font-size: 13px;
  font-style: normal;
  line-height: 1.45;
}
body.chat-mode-v800 #heroPanel {
  display: none;
}
body.chat-mode-v800 #homeContentPanelV800 {
  display: none;
}
body.chat-mode-v800 .messages {
  margin-top: 28px;
}
@media (max-width: 760px) {
  body {
    padding-bottom: 146px;
  }
  .topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    min-height: 54px;
    align-items: flex-start;
  }
  .brand-main {
    font-size: 20px;
  }
  .brand-sub {
    font-size: 12px;
  }
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .nav-link,
  .lang-btn {
    min-height: 28px;
    padding: 0 7px;
    font-size: 11.5px;
  }
  .page {
    width: calc(100vw - 24px);
    padding-top: 52px;
  }
  .hero-card {
    padding: 20px 14px;
    border-radius: 22px;
  }
  .hero-card h1 {
    font-size: 28px;
    line-height: 1.18;
  }
  .hero-desc {
    font-size: 14px;
    line-height: 1.55;
    margin-top: 12px;
  }
  .starter-area,
  .starter-area.starter-two-column {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    width: 100%;
    margin-top: 22px;
  }
  .starter-header-v800 {
    grid-column: 1 / -1;
  }
  .starter-title {
    font-size: 14px;
  }
  .starter-sub {
    font-size: 12px;
    line-height: 1.45;
  }
  .starter-categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 0;
  }
  .starter-categories button {
    min-height: 34px;
    border-radius: 13px;
    padding: 8px 7px;
    font-size: 11.5px;
    line-height: 1.22;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  html[lang="en"] .starter-categories button {
    font-size: 10.8px;
    line-height: 1.18;
    padding: 7px 6px;
  }
  .starter-scenarios-panel {
    min-height: auto;
    padding: 10px;
    border-radius: 18px;
    width: 100%;
    min-width: 0;
  }
  .starter-scenarios {
    gap: 8px;
  }
  .starter-scenarios button {
    padding: 10px 9px;
    border-radius: 14px;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .starter-scenarios button strong {
    font-size: 12.2px;
    line-height: 1.22;
    margin-bottom: 5px;
  }
  .starter-scenarios button span {
    font-size: 11.2px;
    line-height: 1.35;
  }
  html[lang="en"] .starter-scenarios button strong {
    font-size: 11.2px;
    line-height: 1.2;
  }
  html[lang="en"] .starter-scenarios button span {
    font-size: 10.5px;
    line-height: 1.32;
  }
  .composer {
    grid-template-columns: 1fr;
    padding: 10px 12px 12px;
  }
  textarea {
    height: 72px;
    font-size: 15px;
    padding: 14px 16px;
  }
  #sendBtn {
    min-height: 48px;
  }
}
@media (max-width: 720px) {
  .messages {
    width: calc(100vw - 24px);
    margin-top: 16px;
    gap: 14px;
  }
  .message.user {
    max-width: 92%;
    font-size: 14.5px;
  }
  .message.assistant {
    padding: 18px 17px 20px;
    border-radius: 18px;
  }
  .message.assistant .message-content {
    font-size: 15.5px;
    line-height: 1.72;
  }
  .actions-panel {
    width: calc(100vw - 24px);
  }
  .recent-modal {
    padding: 12px;
    align-items: flex-end;
  }
  .recent-modal-card {
    max-height: 82vh;
    border-radius: 20px;
  }
}
@media (max-width: 390px) {
  .starter-area,
  .starter-area.starter-two-column {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 8px;
  }
}

/* STEP047_ACTIVE_READING_RENDER */
.message.assistant .message-content {
  white-space: normal;
  line-height: 1.72;
}

.message.assistant .message-content p {
  margin: 0 0 13px;
  line-height: 1.72;
}

.message.assistant .message-content p:last-child,
.message.assistant .message-content ul:last-child,
.message.assistant .message-content ol:last-child,
.message.assistant .message-content blockquote:last-child {
  margin-bottom: 0;
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
  margin: 6px 0 13px 20px;
  padding: 0;
}

.message.assistant .message-content li {
  margin: 5px 0;
  line-height: 1.68;
}

.message.assistant .message-content strong {
  font-weight: 760;
  color: #173b30;
}

.message.assistant .message-content code {
  background: #f2f7f4;
  border: 1px solid #e2eee7;
  border-radius: 7px;
  padding: 1px 5px;
  font-size: 0.92em;
}

.message.assistant .message-content .xy-section-title {
  margin: 16px 0 8px;
  line-height: 1.48;
  font-size: 15.8px;
  font-weight: 820;
  color: #173b30;
}

.message.assistant .message-content .xy-section-title:first-child {
  margin-top: 0;
}

.message.assistant .message-content .xy-hr {
  height: 1px;
  background: #e7f0ea;
  margin: 14px 0;
}

.message.assistant .message-content blockquote {
  margin: 8px 0 14px;
  padding: 10px 13px;
  border-left: 3px solid #a8cdbb;
  background: #f6faf7;
  border-radius: 10px;
  color: #253041;
}

.message.assistant .message-content blockquote p {
  margin: 0 0 8px;
}

.message.assistant .message-content blockquote p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .message.assistant .message-content {
    line-height: 1.7;
  }

  .message.assistant .message-content .xy-section-title {
    font-size: 15.2px;
    margin: 14px 0 7px;
  }

  .message.assistant .message-content p {
    margin-bottom: 12px;
  }
}

/* STEP075A_THINKING_INDICATOR */
.thinking-message {
  opacity: 0.92;
}

.thinking-dot-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(20,30,50,0.08);
  font-size: 14px;
  line-height: 1.4;
}

.thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  animation: taviThinkingPulse 1.1s ease-in-out infinite;
}

.thinking-text {
  opacity: 0.72;
}

@keyframes taviThinkingPulse {
  0%, 100% { transform: scale(0.75); opacity: 0.35; }
  50% { transform: scale(1); opacity: 0.8; }
}

@media (max-width: 760px) {
  .thinking-dot-wrap {
    font-size: 13px;
    padding: 9px 12px;
  }
}

/* STEP075B_THINKING_INDICATOR_REUSE_CARD */
.thinking-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(25, 100, 75, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: #6f6f6f;
  font-size: 15px;
  line-height: 1.4;
}

.thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.72;
  animation: thinkingPulse 1.2s ease-in-out infinite;
}

@keyframes thinkingPulse {
  0%, 100% { opacity: 0.28; transform: scale(0.92); }
  50% { opacity: 0.9; transform: scale(1.08); }
}

@media (max-width: 760px) {
  .thinking-inline {
    font-size: 15px;
    padding: 9px 13px;
  }
}


/* STEP095_A_AI_DISCLAIMER */
.ai-disclaimer {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(120, 120, 120, 0.65);
  user-select: none;
}

/* STEP121_UI_COLOR_002_BLUE_VARS: changed CSS green variables to mist blue. */

/* STEP121_UI_COLOR_003_SOFT_GRAY_BLUE: softened bright blue into gray-blue for reading comfort. */


/* STEP121_UI_TITLE_001_HIDE_DIALOGUE_BASE: hide brand subtitle / dialogue base line in both zh and en. */
.brand-subtitle,
.logo-subtitle,
.app-subtitle,
.header-subtitle,
[data-i18n="title"],
[data-i18n="appSubtitle"] {
  display: none !important;
}


/* STEP121_UI_COLOR_004_CHATGPT_STYLE: ChatGPT-like neutral reading style with light green accent. */
.brand-sub {
  display: none !important;
}

.topbar {
  background: #ffffff;
}

.brand-main {
  color: #111827;
}

.nav-link {
  color: #374151;
}

.nav-link:hover {
  color: #000000;
  background: #F7F7F8;
}

.category-pill.active,
.scenario-card.active {
  background: #F7F7F8;
  border-color: #D9D9E3;
  color: #111827;
}

.scenario-title,
.category-pill.active {
  color: #111827;
}

.message.user .message-content,
.user-message,
.bubble-user {
  background: #F7F7F8 !important;
  color: #111827 !important;
  border: 1px solid #E5E7EB !important;
}

.send-btn,
.primary-btn {
  background: #111827 !important;
  color: #ffffff !important;
}

.send-btn:hover,
.primary-btn:hover {
  background: #000000 !important;
}

/* STEP121_UI_FIX_001_HIDE_BRAND_SUB_AND_CHATGPT_STYLE */
.brand-sub {
  display: none !important;
}

:root {
  --green: #111827;
  --green-dark: #000000;
  --green-soft: #F7F7F8;
}


/* STEP121_UI_COLOR_005_BLACK_WHITE: remove green accent, switch UI to black-white-gray. */
:root {
  --green: #111827;
  --green-dark: #000000;
  --green-soft: #F7F7F8;
}

.brand-main {
  color: #111827 !important;
}

.nav-link {
  color: #111827 !important;
}

.nav-link:hover {
  color: #000000 !important;
  background: #F7F7F8 !important;
}

.category-pill.active,
.scenario-card.active {
  background: #F7F7F8 !important;
  border-color: #D9D9E3 !important;
  color: #111827 !important;
}

.scenario-title,
.category-pill.active {
  color: #111827 !important;
}

.message.user .message-content,
.user-message,
.bubble-user {
  background: #111827 !important;
  color: #ffffff !important;
  border: 1px solid #111827 !important;
}

.send-btn,
.primary-btn {
  background: #111827 !important;
  color: #ffffff !important;
}

.send-btn:hover,
.primary-btn:hover {
  background: #000000 !important;
}

/* STEP_UI_COLOR_CLEANUP_001_FINAL_NEUTRAL:
   Final visual override. Unifies old green / gray-blue / black-white patches
   into one calm neutral teacher-tool palette.
   CSS only. No JS/backend change.
*/

:root {
  --bg: #F7F7F5;
  --ink: #1F2937;
  --muted: #6B7280;
  --green: #111827;
  --green-dark: #111827;
  --green-soft: #F3F4F6;
  --line: #E5E7EB;

  --xy-surface: #FFFFFF;
  --xy-surface-soft: #FAFAF9;
  --xy-hover: #F3F4F6;
  --xy-border: #E5E7EB;
  --xy-border-strong: #D1D5DB;
  --xy-accent: #111827;
  --xy-accent-hover: #000000;
  --xy-text: #1F2937;
  --xy-text-soft: #6B7280;
  --xy-quote-bg: #F8FAFC;
  --xy-quote-border: #CBD5E1;
}

/* global shell */
body {
  background: var(--bg) !important;
  color: var(--xy-text) !important;
}

.topbar {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid var(--xy-border) !important;
}

.brand-main,
.hero-card h1,
.starter-title,
.starter-scenarios button strong,
.recent-modal-head strong,
.recent-item strong,
.message.assistant .message-content strong,
.message.assistant .message-content .xy-section-title {
  color: var(--xy-text) !important;
}

.hero-desc,
.starter-sub,
.starter-scenarios button span,
.panel-title,
.support-toggle-icon,
.recent-modal-head span,
.recent-item span,
.recent-item em,
.ai-disclaimer {
  color: var(--xy-text-soft) !important;
}

/* main cards */
.hero-card,
.starter-preview,
.starter-scenarios-panel,
.message.assistant,
.actions-panel,
.recent-modal-card {
  background: var(--xy-surface) !important;
  border-color: var(--xy-border) !important;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.055) !important;
}

/* starter buttons */
.starter-categories button,
.starter-scenarios button,
.action-btn,
.recent-item,
.starter-clean-plus-v800,
[data-starter-more-v800],
[data-starter-scenario-more-v800] {
  background: var(--xy-surface) !important;
  color: var(--xy-text) !important;
  border-color: var(--xy-border) !important;
  box-shadow: none !important;
}

.starter-categories button:hover,
.starter-scenarios button:hover,
.action-btn:hover,
.recent-item:hover {
  background: var(--xy-hover) !important;
  border-color: var(--xy-border-strong) !important;
}

.starter-categories button.active,
.starter-scenarios button.selected,
.category-pill.active,
.scenario-card.active {
  background: var(--xy-hover) !important;
  border-color: var(--xy-border-strong) !important;
  color: var(--xy-text) !important;
  box-shadow: none !important;
}

/* composer */
.composer {
  background: rgba(255, 255, 255, 0.94) !important;
  border-top: 1px solid var(--xy-border) !important;
}

textarea {
  background: var(--xy-surface) !important;
  border-color: var(--xy-border-strong) !important;
  color: var(--xy-text) !important;
}

textarea::placeholder {
  color: #9CA3AF !important;
}

textarea:focus {
  border-color: #9CA3AF !important;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08) !important;
}

/* primary send button */
#sendBtn,
.send-btn,
.primary-btn {
  background: var(--xy-accent) !important;
  color: #FFFFFF !important;
  border: 0 !important;
}

#sendBtn:hover,
.send-btn:hover,
.primary-btn:hover {
  background: var(--xy-accent-hover) !important;
}

#sendBtn:disabled {
  opacity: 0.55 !important;
}

/* messages */
.message.user,
.message.user .message-content,
.user-message,
.bubble-user {
  background: var(--xy-accent) !important;
  color: #FFFFFF !important;
  border: 1px solid var(--xy-accent) !important;
}

.message.assistant::before {
  color: var(--xy-text-soft) !important;
}

.message.assistant .message-content {
  color: var(--xy-text) !important;
}

/* rendered assistant content */
.message.assistant .message-content code {
  background: #F3F4F6 !important;
  border-color: var(--xy-border) !important;
  color: var(--xy-text) !important;
}

.message.assistant .message-content .xy-hr {
  background: var(--xy-border) !important;
}

.message.assistant .message-content blockquote {
  background: var(--xy-quote-bg) !important;
  border-left-color: var(--xy-quote-border) !important;
  color: var(--xy-text) !important;
}

/* modal */
.recent-modal {
  background: rgba(17, 24, 39, 0.28) !important;
}

#recentCloseBtn {
  background: var(--xy-hover) !important;
  color: var(--xy-text) !important;
}

/* thinking indicator */
.thinking-dot-wrap,
.thinking-inline {
  background: rgba(255, 255, 255, 0.78) !important;
  border-color: var(--xy-border) !important;
  color: var(--xy-text-soft) !important;
}


/* STEP_UI_MOBILE_CLEANUP_001:
   Mobile-only refinement.
   Fixes cramped top nav, oversized composer, hard black bubble, and weak spacing.
   CSS only. No JS/backend change.
*/

@media (max-width: 760px) {
  body {
    background: #F7F7F5 !important;
    padding-bottom: 124px !important;
  }

  .topbar {
    min-height: auto !important;
    padding: 8px 10px 9px !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom: 1px solid #E5E7EB !important;
  }

  .brand {
    display: none !important;
  }

  .nav {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    align-items: center !important;
  }

  .nav-link,
  .lang-btn {
    min-height: 30px !important;
    padding: 0 2px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    line-height: 30px !important;
    font-weight: 760 !important;
    text-align: center !important;
    color: #374151 !important;
    background: transparent !important;
    white-space: nowrap !important;
  }

  .nav-link:hover,
  .lang-btn:hover {
    background: #F3F4F6 !important;
    color: #111827 !important;
  }

  .page {
    width: 100% !important;
    padding: 22px 0 0 !important;
  }

  body.chat-mode-v800 .messages,
  .messages {
    width: 100% !important;
    padding: 0 14px !important;
    margin-top: 18px !important;
    gap: 14px !important;
  }

  .message.user {
    max-width: calc(100% - 18px) !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    padding: 13px 16px !important;
    border-radius: 22px !important;
    background: #111827 !important;
    color: #FFFFFF !important;
    font-size: 16px !important;
    line-height: 1.55 !important;
    font-weight: 650 !important;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.12) !important;
  }

  .message.assistant {
    width: 100% !important;
    max-width: 100% !important;
    padding: 18px 18px 20px !important;
    border-radius: 20px !important;
    background: #FFFFFF !important;
    border: 1px solid #E5E7EB !important;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.055) !important;
  }

  .message.assistant::before {
    margin-bottom: 10px !important;
    color: #6B7280 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
  }

  .message.assistant .message-content {
    font-size: 16px !important;
    line-height: 1.68 !important;
    color: #1F2937 !important;
  }

  .ai-disclaimer {
    margin-top: 10px !important;
    font-size: 12px !important;
    color: rgba(107, 114, 128, 0.72) !important;
  }

  .composer {
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    padding: 10px 12px 12px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid #E5E7EB !important;
    box-shadow: 0 -8px 26px rgba(17, 24, 39, 0.045) !important;
  }

  textarea {
    height: 58px !important;
    min-height: 58px !important;
    border-radius: 18px !important;
    border: 1.2px solid #D1D5DB !important;
    padding: 14px 16px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    background: #FFFFFF !important;
    color: #111827 !important;
  }

  textarea::placeholder {
    color: #A1A1AA !important;
    font-weight: 650 !important;
  }

  textarea:focus {
    border-color: #9CA3AF !important;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.075) !important;
  }

  #sendBtn {
    min-height: 48px !important;
    height: 48px !important;
    border-radius: 18px !important;
    background: #1F2937 !important;
    color: #FFFFFF !important;
    font-size: 17px !important;
    font-weight: 850 !important;
    letter-spacing: 0.01em !important;
  }

  #sendBtn:disabled {
    background: #8B8B8B !important;
    color: #FFFFFF !important;
    opacity: 1 !important;
  }

  .actions-panel {
    width: calc(100% - 28px) !important;
    margin: 10px auto 0 !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.05) !important;
  }
}

@media (max-width: 390px) {
  .nav-link,
  .lang-btn {
    font-size: 12.2px !important;
    font-weight: 760 !important;
  }

  .messages {
    padding: 0 12px !important;
  }

  .message.user {
    max-width: calc(100% - 10px) !important;
    font-size: 15.5px !important;
  }

  .composer {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}


/* STEP_UI_MOBILE_SOFT_BUBBLE_001:
   Soften mobile user bubble and primary button.
   User message should be context, not the strongest visual block.
   CSS only. No JS/backend change.
*/

@media (max-width: 760px) {
  .message.user,
  .message.user .message-content,
  .user-message,
  .bubble-user {
    background: #F3F4F6 !important;
    color: #111827 !important;
    border: 1px solid #E5E7EB !important;
    box-shadow: none !important;
  }

  #sendBtn {
    background: #4B5563 !important;
    color: #FFFFFF !important;
    box-shadow: none !important;
  }

  #sendBtn:hover {
    background: #374151 !important;
  }

  #sendBtn:disabled {
    background: #A1A1AA !important;
    color: #FFFFFF !important;
    opacity: 1 !important;
  }
}

/* R1A_CHATGPT_LIKE_UI_REFRESH_MINIMAL_FIX
   Frontend-only layout refresh: sidebar + centered chat + bottom composer.
   Keeps existing ids/data flow intact. No backend or semantic-chain dependency. */
:root {
  --xy-chat-bg: #ffffff;
  --xy-sidebar-bg: #f7f7f8;
  --xy-chat-border: #e5e7eb;
  --xy-chat-text: #111827;
  --xy-chat-muted: #6b7280;
  --xy-chat-soft: #f3f4f6;
  --xy-chat-hover: #ececf1;
  --xy-chat-accent: #111827;
  --xy-chat-width: 840px;
  --xy-sidebar-expanded-width: 280px;
  --xy-sidebar-collapsed-width: 76px;
  --xy-sidebar-width: var(--xy-sidebar-expanded-width);
}

body.sidebar-collapsed {
  --xy-sidebar-width: var(--xy-sidebar-collapsed-width);
}

html,
body {
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

body {
  min-height: 100vh !important;
  padding-bottom: 0 !important;
  background: var(--xy-chat-bg) !important;
  color: var(--xy-chat-text) !important;
}

.xy-app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--xy-sidebar-width) minmax(0, 1fr);
  background: var(--xy-chat-bg);
}

.xy-sidebar {
  height: 100vh;
  background: var(--xy-sidebar-bg);
  border-right: 1px solid var(--xy-chat-border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 12px;
  min-width: 0;
  transition: width 0.18s ease;
}

.sidebar-collapse-btn {
  width: 42px;
  height: 38px;
  border: 1px solid var(--xy-chat-border);
  border-radius: 12px;
  background: #fff;
  color: var(--xy-chat-text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
}

body:not(.sidebar-collapsed) .sidebar-collapse-btn {
  margin-left: auto;
}

.sidebar-brand {
  padding: 8px 10px 4px;
  cursor: pointer;
}

.brand-main {
  font-size: 16px !important;
  letter-spacing: -0.02em !important;
  color: var(--xy-chat-text) !important;
}

.brand-sub {
  margin-top: 4px !important;
  font-size: 12px !important;
  color: var(--xy-chat-muted) !important;
}

.sidebar-new-chat {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--xy-chat-border);
  border-radius: 12px;
  background: #fff;
  color: var(--xy-chat-text);
  font-size: 14px;
  font-weight: 760;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.sidebar-collapsed .xy-sidebar {
  align-items: center;
  padding-left: 10px;
  padding-right: 10px;
}

body.sidebar-collapsed .sidebar-brand {
  width: 100%;
  padding: 8px 0 2px;
  text-align: center;
}

body.sidebar-collapsed .brand-main {
  font-size: 0 !important;
}

body.sidebar-collapsed .brand-main::before {
  content: "小";
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--xy-chat-border);
  color: var(--xy-chat-text);
  font-size: 16px;
  font-weight: 850;
}

html[lang="en"] body.sidebar-collapsed .brand-main::before {
  content: "X";
}

body.sidebar-collapsed .brand-sub,
body.sidebar-collapsed .sidebar-section-head span,
body.sidebar-collapsed .sidebar-footer .nav-link,
body.sidebar-collapsed .sidebar-footer .lang-btn {
  display: none !important;
}

body.sidebar-collapsed .sidebar-new-chat {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0 !important;
  text-align: center;
  font-size: 0;
  display: grid;
  place-items: center;
}

body.sidebar-collapsed .sidebar-new-chat::before {
  content: "+";
  font-size: 24px;
  line-height: 1;
}

.sidebar-new-chat:hover,
.sidebar-footer .nav-link:hover,
.sidebar-footer .lang-btn:hover,
.recent-item:hover {
  background: var(--xy-chat-hover) !important;
}

.sidebar-recent {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-section-head {
  padding: 4px 10px 0;
}

body.sidebar-collapsed .sidebar-section-head {
  padding: 4px 0 0;
  text-align: center;
}

.sidebar-section-head strong {
  display: block;
  font-size: 13px;
  color: var(--xy-chat-text);
}

body.sidebar-collapsed .sidebar-section-head strong {
  font-size: 0;
}

body.sidebar-collapsed .sidebar-section-head strong::before {
  content: "Recent";
  font-size: 11px;
  color: var(--xy-chat-muted);
  letter-spacing: -0.01em;
}

html[lang="zh-CN"] body.sidebar-collapsed .sidebar-section-head strong::before {
  content: "最近";
}

.sidebar-section-head span {
  display: block;
  margin-top: 3px;
  color: var(--xy-chat-muted);
  font-size: 11px;
  line-height: 1.35;
}

.sidebar-recent-list,
.recent-list.sidebar-recent-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 2px 4px !important;
  gap: 6px !important;
}

.recent-item {
  border: 0 !important;
  background: transparent !important;
  border-radius: 10px !important;
  padding: 10px 10px !important;
  gap: 4px !important;
  min-height: 48px;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-recent-list,
body.sidebar-collapsed .recent-list.sidebar-recent-list {
  display: none !important;
}

.recent-item.active {
  background: #e9e9ef !important;
}

.recent-item strong {
  color: var(--xy-chat-text) !important;
  font-size: 13px !important;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-item span,
.recent-item em {
  color: var(--xy-chat-muted) !important;
  font-size: 11px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-turns-preview {
  margin-top: 4px;
  display: grid;
  gap: 3px;
}

.recent-turn-preview {
  padding-left: 6px;
  border-left: 2px solid #dddde4;
}

.recent-turn-preview small,
.recent-turn-preview em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer.nav {
  display: grid !important;
  gap: 4px !important;
  padding-top: 8px;
  border-top: 1px solid var(--xy-chat-border);
}

body.sidebar-collapsed .sidebar-footer.nav {
  display: none !important;
}

.sidebar-footer .nav-link,
.sidebar-footer .lang-btn {
  width: 100%;
  min-height: 34px;
  border-radius: 10px;
  padding: 0 10px !important;
  text-align: left;
  color: #4b5563 !important;
  font-size: 13px !important;
  line-height: 34px;
}

.xy-main-panel {
  position: relative;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  padding-bottom: calc(118px + env(safe-area-inset-bottom));
}

.topbar {
  display: none !important;
}

.page {
  width: 100% !important;
  max-width: var(--xy-chat-width) !important;
  margin: 0 auto !important;
  padding: 48px 24px 24px !important;
}

.hero-card {
  max-width: 760px !important;
  margin: min(12vh, 96px) auto 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.hero-card h1 {
  font-size: clamp(30px, 4vw, 44px) !important;
  line-height: 1.15 !important;
  letter-spacing: -0.03em !important;
  color: var(--xy-chat-text) !important;
}

.hero-desc {
  max-width: 620px !important;
  margin-top: 12px !important;
  color: var(--xy-chat-muted) !important;
  font-size: 15px !important;
  font-weight: 500 !important;
}

.starter-area.starter-two-column {
  display: block !important;
  margin-top: 28px !important;
}

.starter-header-v800 {
  text-align: center;
}

.starter-title {
  color: var(--xy-chat-text) !important;
  font-size: 14px !important;
}

.starter-sub {
  color: var(--xy-chat-muted) !important;
  font-size: 12px !important;
}

.starter-categories {
  display: none !important;
}

.starter-preview,
.starter-scenarios-panel {
  min-height: 0 !important;
  margin-top: 16px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.starter-scenarios {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.starter-scenarios button {
  min-height: 88px;
  padding: 14px 15px !important;
  border-radius: 16px !important;
  border: 1px solid var(--xy-chat-border) !important;
  background: #fff !important;
  box-shadow: none !important;
}

.starter-scenarios button:hover {
  background: #fafafa !important;
  border-color: #d1d5db !important;
}

.starter-scenarios button strong {
  color: var(--xy-chat-text) !important;
  font-size: 13px !important;
}

.starter-scenarios button span {
  color: var(--xy-chat-muted) !important;
  font-size: 12px !important;
}

body.chat-mode-v800 #heroPanel,
body.chat-mode-v800 #homeContentPanelV800 {
  display: none !important;
}

.messages {
  width: 100% !important;
  max-width: var(--xy-chat-width) !important;
  margin: 0 auto !important;
  padding: 0 0 8px !important;
  gap: 0 !important;
}

body.chat-mode-v800 .page {
  padding-top: 24px !important;
}

body.chat-mode-v800 .messages {
  margin-top: 0 !important;
}

.message {
  margin-bottom: 22px;
}

.message.user {
  max-width: 72% !important;
  width: fit-content;
  margin-left: auto !important;
  margin-right: 0 !important;
  padding: 10px 14px !important;
  border-radius: 18px !important;
  background: var(--xy-chat-soft) !important;
  color: var(--xy-chat-text) !important;
  border: 1px solid var(--xy-chat-border) !important;
  box-shadow: none !important;
  font-size: 15px !important;
  font-weight: 500 !important;
}

.message.assistant {
  max-width: 100% !important;
  padding: 0 0 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.message.assistant::before {
  content: "Tavi Quokka" !important;
  display: block;
  margin-bottom: 7px !important;
  color: var(--xy-chat-muted) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
}

html[lang="en"] .message.assistant::before {
  content: "Tavi Quokka" !important;
}

.message.assistant .message-content {
  color: var(--xy-chat-text) !important;
  font-size: 16px !important;
  line-height: 1.78 !important;
}

.ai-disclaimer {
  margin-top: 10px !important;
  color: rgba(107, 114, 128, 0.62) !important;
  font-size: 11.5px !important;
}

.answer-copy-row {
  margin-top: 8px !important;
}

.actions-panel {
  width: 100% !important;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.panel-title {
  font-size: 12px !important;
  color: var(--xy-chat-muted) !important;
  margin: 0 0 8px !important;
}

.action-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-bottom: 10px !important;
}

.action-btn {
  min-height: 34px;
  border: 1px solid var(--xy-chat-border) !important;
  background: #fff !important;
  color: var(--xy-chat-text) !important;
  border-radius: 999px !important;
  padding: 7px 12px !important;
  font-size: 13px !important;
  font-weight: 620 !important;
  box-shadow: none !important;
}

.action-btn:hover {
  background: var(--xy-chat-soft) !important;
}

.support-toggle {
  margin-top: 2px !important;
  justify-content: flex-start !important;
  gap: 10px;
}

.composer {
  position: fixed !important;
  left: calc(var(--xy-sidebar-width) + max(24px, (100vw - var(--xy-sidebar-width) - var(--xy-chat-width)) / 2 + 24px)) !important;
  right: max(24px, (100vw - var(--xy-sidebar-width) - var(--xy-chat-width)) / 2 + 24px) !important;
  bottom: env(safe-area-inset-bottom) !important;
  z-index: 40 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 42px !important;
  align-items: end;
  gap: 8px !important;
  padding: 12px 0 18px !important;
  border-top: 0 !important;
  background: linear-gradient(to top, #fff 78%, rgba(255,255,255,0)) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

textarea {
  height: auto !important;
  min-height: 52px !important;
  max-height: 180px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 24px !important;
  padding: 14px 18px !important;
  font-size: 15px !important;
  line-height: 1.45 !important;
  background: #fff !important;
  color: var(--xy-chat-text) !important;
  box-shadow: 0 4px 20px rgba(17, 24, 39, 0.08) !important;
}

textarea:focus {
  border-color: #9ca3af !important;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08), 0 4px 20px rgba(17, 24, 39, 0.08) !important;
}

#sendBtn {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 999px !important;
  align-self: center !important;
  overflow: hidden;
  white-space: nowrap;
  text-indent: -999px;
  position: relative;
  background: var(--xy-chat-accent) !important;
}

#sendBtn::after {
  content: "↑";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-indent: 0;
  font-size: 22px;
  font-weight: 800;
}

.recent-modal {
  display: none !important;
}

.xy-sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .xy-app-shell {
    grid-template-columns: 1fr;
  }

  .xy-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 90;
    box-shadow: 18px 0 44px rgba(17, 24, 39, 0.18);
  }

  body.sidebar-collapsed .xy-sidebar {
    width: min(86vw, 300px);
    align-items: stretch;
    padding: 14px 12px;
  }

  body.sidebar-collapsed .brand-main {
    font-size: 16px !important;
  }

  body.sidebar-collapsed .brand-main::before,
  body.sidebar-collapsed .sidebar-section-head strong::before,
  body.sidebar-collapsed .sidebar-new-chat::before {
    content: none;
    display: none;
  }

  body.sidebar-collapsed .brand-sub,
  body.sidebar-collapsed .sidebar-section-head span,
  body.sidebar-collapsed .recent-item span,
  body.sidebar-collapsed .recent-item em,
  body.sidebar-collapsed .sidebar-footer .nav-link,
  body.sidebar-collapsed .sidebar-footer .lang-btn {
    display: block !important;
  }

  body.sidebar-collapsed .sidebar-recent-list,
  body.sidebar-collapsed .recent-list.sidebar-recent-list {
    display: flex !important;
  }

  body.sidebar-collapsed .sidebar-footer.nav {
    display: grid !important;
  }

  body.sidebar-collapsed .sidebar-new-chat {
    width: 100%;
    height: auto;
    min-height: 42px;
    padding: 0 12px !important;
    text-align: left;
    font-size: 14px;
    display: block;
  }

  body.sidebar-collapsed .sidebar-section-head {
    text-align: left;
    padding: 4px 10px 0;
  }

  body.sidebar-collapsed .sidebar-section-head strong {
    font-size: 13px;
  }

  body.sidebar-collapsed .recent-item {
    width: 100% !important;
    height: auto !important;
    min-height: 48px !important;
    padding: 10px 10px !important;
    display: flex !important;
    place-items: initial;
  }

  body.sidebar-collapsed .recent-item strong {
    display: -webkit-box !important;
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    border: 0;
    font-size: 13px !important;
  }

  body.sidebar-open .xy-sidebar {
    transform: translateX(0);
  }

  .xy-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    border: 0;
    padding: 0;
    background: rgba(17, 24, 39, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .xy-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    min-height: 52px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 8px 14px !important;
    background: rgba(255,255,255,0.92) !important;
    border-bottom: 1px solid var(--xy-chat-border) !important;
    backdrop-filter: blur(14px) !important;
  }

  .sidebar-toggle {
    width: auto !important;
    min-height: 34px !important;
    padding: 0 10px !important;
    border: 1px solid var(--xy-chat-border) !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: var(--xy-chat-text) !important;
    line-height: 32px !important;
    font-size: 13px !important;
  }

  .mobile-brand {
    display: grid;
    gap: 1px;
  }

  .mobile-brand strong {
    font-size: 14px;
    color: var(--xy-chat-text);
  }

  .mobile-brand span {
    font-size: 11px;
    color: var(--xy-chat-muted);
  }

  .xy-main-panel {
    padding-bottom: calc(126px + env(safe-area-inset-bottom));
  }

  .page {
    padding: 24px 14px 24px !important;
  }

  .hero-card {
    margin-top: min(8vh, 58px) !important;
  }

  .starter-scenarios {
    grid-template-columns: 1fr !important;
  }

  .message.user {
    max-width: 86% !important;
  }

  .composer {
    left: 12px !important;
    right: 12px !important;
    bottom: env(safe-area-inset-bottom) !important;
    padding-bottom: 12px !important;
  }

  .action-row {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .action-btn {
    flex: 0 0 auto;
    max-width: 82vw;
  }
}

@media (min-width: 901px) {
  .mobile-brand {
    display: none;
  }
}

.sidebar-collapse-btn {
  display: none !important;
}

/* R1A_UI_SIDEBAR_SIMPLE_STABLE_LAYOUT_FIX
   Desktop sidebar is fixed and always expanded. Mobile keeps drawer behavior.
   This intentionally disables the previous desktop collapsed/narrow rail experiment. */
@media (min-width: 901px) {
  :root {
    --xy-sidebar-width: 280px;
  }

  body.sidebar-collapsed {
    --xy-sidebar-width: 280px;
  }

  .xy-app-shell {
    grid-template-columns: 280px minmax(0, 1fr) !important;
  }

  .xy-sidebar {
    width: 280px !important;
    min-width: 280px !important;
    align-items: stretch !important;
    padding: 14px 12px !important;
  }

  .sidebar-collapse-btn {
    display: none !important;
  }

  body.sidebar-collapsed .xy-sidebar,
  body.sidebar-collapsed .sidebar-brand,
  body.sidebar-collapsed .sidebar-section-head {
    align-items: stretch !important;
    text-align: left !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body.sidebar-collapsed .brand-main {
    font-size: 16px !important;
  }

  body.sidebar-collapsed .brand-main::before,
  body.sidebar-collapsed .sidebar-section-head strong::before,
  body.sidebar-collapsed .sidebar-new-chat::before {
    content: none !important;
    display: none !important;
  }

  body.sidebar-collapsed .brand-sub,
  body.sidebar-collapsed .sidebar-section-head span,
  body.sidebar-collapsed .sidebar-footer .nav-link,
  body.sidebar-collapsed .sidebar-footer .lang-btn {
    display: block !important;
  }

  body.sidebar-collapsed .sidebar-footer.nav {
    display: grid !important;
  }

  body.sidebar-collapsed .sidebar-new-chat {
    width: 100% !important;
    height: auto !important;
    min-height: 42px !important;
    padding: 0 12px !important;
    text-align: left !important;
    font-size: 14px !important;
    display: block !important;
  }

  body.sidebar-collapsed .sidebar-recent-list,
  body.sidebar-collapsed .recent-list.sidebar-recent-list {
    display: flex !important;
  }

  .recent-item {
    min-height: auto !important;
    max-height: 68px !important;
    padding: 9px 10px !important;
    gap: 3px !important;
  }

  .recent-item strong {
    -webkit-line-clamp: 2 !important;
    line-height: 1.32 !important;
  }

  .recent-item em,
  .recent-turns-preview {
    display: none !important;
  }

  .xy-main-panel {
    width: 100% !important;
  }

  .page {
    max-width: 840px !important;
  }

  .composer {
    left: calc(280px + max(24px, (100vw - 280px - var(--xy-chat-width)) / 2 + 24px)) !important;
    right: max(24px, (100vw - 280px - var(--xy-chat-width)) / 2 + 24px) !important;
  }
}


/* STEP_UI_MOBILE_NAV_LEFT_001:
   Mobile nav only.
   Change forced 5-column grid into left-aligned content-width row.
   CSS only. No JS/backend change.
*/

/* R1A_UI_RECENT_ITEM_TEXT_VISIBLE_FIX
   Keep desktop sidebar simple/stable and force Recent text to render visibly.
   Recent records are intentionally lightweight: title + time only. */
.recent-list.sidebar-recent-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
}

.recent-list.sidebar-recent-list .recent-item {
  width: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0 !important;
  padding: 10px 12px !important;
  text-align: left !important;
  overflow: hidden !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: transparent !important;
  color: #111827 !important;
}

.recent-list.sidebar-recent-list .recent-item.active {
  background: #e9e9ef !important;
}

.recent-list.sidebar-recent-list .recent-title,
.recent-list.sidebar-recent-list .recent-meta {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  max-width: 100% !important;
  min-width: 0 !important;
  position: static !important;
  transform: none !important;
  text-indent: 0 !important;
}

.recent-list.sidebar-recent-list .recent-title {
  color: #111827 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}

.recent-list.sidebar-recent-list .recent-meta {
  color: #6b7280 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
  margin-top: 5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.recent-list.sidebar-recent-list .recent-item strong,
.recent-list.sidebar-recent-list .recent-item em,
.recent-list.sidebar-recent-list .recent-turns-preview {
  display: none !important;
}

@media (min-width: 901px) {
  body.sidebar-collapsed .recent-list.sidebar-recent-list {
    display: flex !important;
  }
}

@media (max-width: 760px) {
  .topbar {
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 8px 12px 9px !important;
    overflow: hidden !important;
  }

  .nav {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 18px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .nav::-webkit-scrollbar {
    display: none !important;
  }

  .nav-link,
  .lang-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: auto !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 13.5px !important;
    line-height: 30px !important;
    font-weight: 760 !important;
    text-align: left !important;
    white-space: nowrap !important;
    color: #111827 !important;
    background: transparent !important;
  }

  .nav-link:hover,
  .lang-btn:hover {
    background: transparent !important;
    color: #000000 !important;
  }
}

@media (max-width: 390px) {
  .nav {
    gap: 15px !important;
  }

  .nav-link,
  .lang-btn {
    font-size: 13px !important;
  }
}


/* STEP_UI_NAV_UNDERLINE_FIX_001:
   Remove default anchor underline from Home nav.
   Keep nav items visually consistent with button nav items.
   CSS only. No JS/backend change.
*/

.nav-link,
.nav-link:link,
.nav-link:visited,
.nav-link:hover,
.nav-link:active,
.lang-btn {
  text-decoration: none !important;
}

@media (max-width: 760px) {
  .nav-link,
  .nav-link:link,
  .nav-link:visited,
  .nav-link:hover,
  .nav-link:active,
  .lang-btn {
    text-decoration: none !important;
  }
}

/* R1A_UI_RECENT_ITEM_RENDER_TEXT_RESTORE_FIX
   Final override: recent records must show real text, not skeleton-like bars. */
.sidebar-recent .recent-list.sidebar-recent-list .recent-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  width: 100% !important;
  min-height: 54px !important;
  height: auto !important;
  max-height: none !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: transparent !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-item:hover,
.sidebar-recent .recent-list.sidebar-recent-list .recent-item.active {
  background: #f3f4f6 !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-title {
  display: -webkit-box !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #111827 !important;
  font-size: 14px !important;
  line-height: 1.28 !important;
  font-weight: 600 !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-meta {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-top: 5px !important;
  color: #6b7280 !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-item strong,
.sidebar-recent .recent-list.sidebar-recent-list .recent-item em,
.sidebar-recent .recent-list.sidebar-recent-list .recent-turns-preview {
  display: none !important;
}

/* R1A_UI_RECENT_FONT_SIZE_SPACING_FIX
   Softer ChatGPT-like recent item: title + time, no clipped meta. */
.sidebar-recent .recent-list.sidebar-recent-list {
  gap: 6px !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-item {
  min-height: auto !important;
  height: auto !important;
  max-height: none !important;
  padding: 9px 10px !important;
  border-radius: 12px !important;
  overflow: visible !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-title {
  font-size: 13px !important;
  line-height: 1.3 !important;
  font-weight: 500 !important;
  color: #111827 !important;
  overflow: hidden !important;
}

.sidebar-recent .recent-list.sidebar-recent-list .recent-meta {
  margin-top: 4px !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  font-weight: 400 !important;
  color: #6b7280 !important;
  overflow: hidden !important;
}
