@import url("https://fonts.googleapis.com/css2?family=ZCOOL+XiaoWei&family=Noto+Serif+SC:wght@400;600&display=swap");

:root {
  --bg: #0b0e14;
  --bg-soft: #131a27;
  --panel: rgba(18, 24, 36, 0.72);
  --panel-strong: rgba(35, 44, 65, 0.78);
  --accent: #f3c57a;
  --accent-2: #79dfff;
  --accent-3: #9f90ff;
  --text: #f4efe4;
  --muted: rgba(244, 239, 228, 0.66);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Noto Serif SC", "ZCOOL XiaoWei", serif;
  background: radial-gradient(circle at top, rgba(121, 223, 255, 0.09), transparent 58%),
    radial-gradient(circle at 20% 20%, rgba(243, 197, 122, 0.14), transparent 58%),
    radial-gradient(circle at 80% 12%, rgba(159, 144, 255, 0.12), transparent 54%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

body.app-booting .mobile-app-shell {
  visibility: hidden;
}

.mobile-app-shell {
  position: relative;
  z-index: 1;
  width: min(100vw, calc((100vh - 20px) * 9 / 16));
  max-width: 540px;
  min-width: 320px;
  height: calc(100vh - 20px);
  margin: 10px auto;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(9, 12, 18, 0.9);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.app-topbar {
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.app-topbar-title {
  min-width: 0;
}

.app-topbar-title h1 {
  margin: 0;
  font-size: 18px;
  font-family: "ZCOOL XiaoWei", serif;
  line-height: 1.2;
}

.app-topbar-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-viewport {
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.app-view {
  height: 100%;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#view-home {
  display: grid;
  align-content: end;
  min-height: 100%;
}

#view-home.hidden {
  display: none !important;
}

.app-view.hidden {
  display: none !important;
}

#view-home:not(.hidden) {
  display: grid;
  align-content: end;
  min-height: 100%;
  padding-bottom: calc(clamp(40px, 6vh, 76px) + env(safe-area-inset-bottom));
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(180px, 228px);
  justify-content: center;
  gap: 10px;
}

.home-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 10px;
  text-align: center;
  min-height: 66px;
  display: grid;
  place-items: center;
  gap: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  color: var(--text);
  width: 100%;
}

.home-card[data-home-action="chat"] {
  border-color: rgba(150, 40, 28, 0.78);
  background: linear-gradient(180deg, rgba(185, 66, 48, 0.95), rgba(145, 42, 30, 0.95));
  color: #fff2de;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 190, 0.35),
    0 4px 12px rgba(120, 33, 23, 0.32);
}

.home-card[data-home-action="chat"] h3 {
  color: #fff3df;
}

.home-card h3,
.home-side-entry-title {
  margin: 0;
  font-size: 21px;
  font-family: "ZCOOL XiaoWei", serif;
  line-height: 1.04;
}

.home-card p {
  display: none;
}

.mobile-chat-panel {
  height: 100%;
  padding: 10px;
  border-radius: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 10px;
}

.chart-record-panel,
.chart-record-editor-panel,
.sessions-panel {
  border-radius: 16px;
  padding: 12px;
}

.chart-record-actions {
  margin-bottom: 8px;
  display: flex;
  justify-content: flex-end;
}

.chart-record-form {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chart-record-form-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chart-record-list,
.session-list {
  display: grid;
  gap: 8px;
}

.session-entry,
.chart-record-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 16px;
  min-height: 46px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  position: relative;
}

.session-entry {
  min-height: 58px;
}

#view-charts .chart-record-item::before,
#view-charts .chart-record-item::after {
  content: none;
}

.chart-record-swipe-hint,
.session-swipe-hint {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.92;
  transition: opacity 160ms ease;
  z-index: 1;
}

.chart-record-swipe-hint:hover,
.session-swipe-hint:hover {
  opacity: 1;
}

.chart-record-swipe-hint-arrow {
  width: 8px;
  height: 8px;
  display: block;
  border: solid rgba(58, 79, 120, 0.66);
  border-width: 0 3px 3px 0;
  transform: rotate(135deg);
}

.chart-record-swipe-hint-arrow:nth-child(1) {
  opacity: 0.42;
}

.chart-record-swipe-hint-arrow:nth-child(2) {
  opacity: 0.68;
}

.chart-record-swipe-hint-arrow:nth-child(3) {
  opacity: 0.92;
}

.chart-record-item.is-actions-visible .chart-record-swipe-hint,
.session-entry.is-actions-visible .session-swipe-hint,
.session-entry.is-title-editing .session-swipe-hint {
  opacity: 0;
  pointer-events: none;
}

.chart-record-item.is-active {
  border-color: rgba(121, 223, 255, 0.6);
}

.chart-record-item.is-swipe-armed {
  box-shadow: inset 0 0 0 1px rgba(121, 223, 255, 0.38);
}

.session-entry.is-swipe-armed {
  box-shadow: inset 0 0 0 1px rgba(121, 223, 255, 0.3);
}

.chart-record-main {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  display: block;
  flex: 2;
  min-width: 0;
}

#view-sessions .session-item {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 0;
  padding-right: 52px;
}

#view-sessions .session-item:hover,
#view-sessions .session-item:active {
  transform: none !important;
}

#view-sessions .session-item h4,
#view-sessions .session-item p,
#view-sessions .session-item small {
  margin: 0;
}

#view-sessions .session-item h4 {
  color: rgba(45, 33, 20, 0.98);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

#view-sessions .session-item p {
  color: rgba(88, 68, 44, 0.92);
  font-size: 13px;
  line-height: 1.5;
}

#view-sessions .session-item small {
  color: rgba(108, 82, 54, 0.78);
}

#view-charts .chart-record-main {
  padding-right: 52px;
}

.chart-record-inline {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.28;
  white-space: nowrap;
}

.chart-record-name,
.chart-record-gender,
.chart-record-time,
.chart-record-place {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 600;
}

.chart-record-index {
  flex: 0 0 auto;
  min-width: 1.35em;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: rgba(98, 76, 52, 0.94);
}

.chart-record-name {
  color: rgba(45, 33, 20, 0.98);
  flex: 0 0 3.5em;
  min-width: 3.5em;
  max-width: 3.5em;
}

.chart-record-gender {
  color: rgba(78, 60, 40, 0.92);
  flex: 0 0 auto;
  max-width: 3em;
}

.chart-record-time {
  color: rgba(58, 79, 120, 0.95);
  flex: 0 1 auto;
  max-width: none;
}

.chart-record-place {
  color: rgba(108, 74, 42, 0.95);
  flex: 0 1 auto;
  max-width: 3.5em;
}

.chart-record-sep {
  flex: 0 0 auto;
  color: rgba(126, 102, 74, 0.78);
}

.chart-record-tools,
.session-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%) translateX(120%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.2s ease,
    opacity 0.16s ease;
  z-index: 2;
}

.chart-record-item.is-actions-visible .chart-record-tools,
.session-entry.is-actions-visible .session-tools {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.chart-record-item.is-actions-visible .chart-record-main,
.session-entry.is-actions-visible .session-item {
  opacity: 0.94;
}

.chart-record-action-btn,
.session-action-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(59, 99, 176, 0.68);
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95));
  box-shadow:
    0 5px 10px rgba(38, 64, 118, 0.2),
    inset 0 1px 0 rgba(202, 224, 255, 0.36);
  color: #eef5ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.chart-record-action-btn:hover,
.session-action-btn:hover {
  filter: brightness(1.02);
}

.chart-record-action-btn:active,
.session-action-btn:active {
  filter: brightness(0.98);
}

.chart-record-action-btn.is-delete,
.session-action-btn.is-delete {
  border: 1px solid rgba(151, 56, 41, 0.76);
  background: linear-gradient(180deg, rgba(178, 74, 55, 0.92), rgba(145, 48, 35, 0.94));
  box-shadow:
    0 5px 10px rgba(94, 38, 28, 0.2),
    inset 0 1px 0 rgba(255, 206, 192, 0.36);
}

.chart-record-action-icon {
  display: block;
  position: relative;
  width: 56%;
  height: 56%;
}

.chart-record-action-icon--minus::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86%;
  height: 20%;
  border-radius: 999px;
  background: #eef5ff;
  transform: translate(-50%, -50%);
}

.chart-record-action-icon--edit {
  width: 70%;
  height: 70%;
  position: relative;
  left: auto;
  top: auto;
  transform: none;
}

.chart-record-action-icon--edit::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 82%;
  height: 82%;
  border: 2.5px solid #eef5ff;
  border-radius: 2px;
  box-sizing: border-box;
  background: transparent;
  clip-path: polygon(0 0, 60% 0, 60% 34%, 100% 34%, 100% 100%, 0 100%);
  transform: translate(-50%, -50%);
}

.chart-record-action-icon--edit::after {
  content: "";
  position: absolute;
  left: 60%;
  top: 40%;
  width: 66%;
  height: 24%;
  border-radius: 3px;
  background: #eef5ff;
  clip-path: polygon(0 24%, 68% 24%, 82% 0, 100% 50%, 82% 100%, 68% 76%, 0 76%);
  transform: translate(-50%, -50%) rotate(132deg);
  transform-origin: center;
}

.session-title-edit {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.session-title-input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(165, 130, 85, 0.44);
  background: rgba(255, 249, 240, 0.82);
  color: rgba(50, 36, 21, 0.98);
  font-size: 14px;
  line-height: 1;
}

.session-title-input:focus {
  outline: none;
  border-color: rgba(148, 95, 44, 0.72);
  box-shadow:
    0 0 0 3px rgba(219, 183, 127, 0.22),
    inset 0 1px 0 rgba(255, 252, 246, 0.82);
}

.session-title-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-title-btn {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(121, 89, 53, 0.42);
  background: linear-gradient(180deg, rgba(241, 220, 187, 0.95), rgba(228, 198, 151, 0.95));
  color: rgba(63, 43, 22, 0.96);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.session-title-btn.is-cancel {
  border-color: rgba(169, 145, 114, 0.4);
  background: rgba(255, 249, 240, 0.72);
  color: rgba(112, 82, 50, 0.92);
}

#view-sessions .session-entry.is-title-editing {
  background: rgba(255, 251, 244, 0.48);
}

#view-sessions .session-entry.is-title-editing .session-tools {
  opacity: 0;
  pointer-events: none;
}


@media (max-width: 640px) {
  .chart-record-action-btn,
  .session-action-btn {
    width: 26px;
    height: 26px;
  }
}

@media (min-aspect-ratio: 1/1) {
  .chart-record-swipe-hint,
  .session-swipe-hint {
    display: inline-flex;
  }
}

body.modal-open {
  overflow: hidden;
}

.chart-method-picker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.chart-method-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 18, 12, 0.52);
  backdrop-filter: blur(6px);
}

.chart-method-modal-card {
  position: relative;
  width: min(360px, 92vw);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.chart-method-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chart-method-modal-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
}

.chart-method-modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.chart-method-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.chart-method-buttons button,
.chart-record-form-actions button,
.chat-input button,
.session-item,
.nav-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 10px;
}

.chart-record-result {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

#view-chart-result .chart-record-result {
  margin-top: 0;
}

.chart-record-result-head h4 {
  margin: 2px 0 0;
  font-size: 16px;
}

.session-item {
  text-align: left;
  display: grid;
  gap: 4px;
}

.bottom-nav {
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.nav-btn.is-active {
  border-color: rgba(121, 223, 255, 0.6);
  background: rgba(121, 223, 255, 0.14);
}

@media (max-height: 760px) {
  .mobile-app-shell {
    height: 100vh;
    margin: 0 auto;
    border-radius: 0;
    border: 0;
  }
}

@media (max-width: 460px) {
  .mobile-app-shell {
    width: 100vw;
    max-width: 100vw;
    min-width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: 0;
  }

  .home-grid {
    grid-template-columns: minmax(0, 66vw);
    justify-content: center;
  }

  .compact-grid {
    grid-template-columns: 1fr;
  }
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.2;
  background-image: radial-gradient(rgba(255, 255, 255, 0.4) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  mix-blend-mode: soft-light;
}

.aurora {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 60vh;
  background: conic-gradient(
    from 180deg at 50% 50%,
    rgba(126, 229, 255, 0.16),
    rgba(246, 192, 103, 0.14),
    rgba(141, 113, 255, 0.08),
    rgba(126, 229, 255, 0.12)
  );
  filter: blur(80px);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.hero {
  display: grid;
  gap: 24px;
  padding: 42px 8vw 16px;
  position: relative;
  z-index: 1;
}

.hero,
.flow,
.footer {
  display: none;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  font-size: 46px;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(243, 197, 122, 0.88), rgba(121, 223, 255, 0.56));
  color: #1a120b;
  box-shadow: var(--shadow);
}

.hero h1 {
  font-family: "ZCOOL XiaoWei", serif;
  font-size: clamp(32px, 4vw, 44px);
  margin: 0;
}

.hero-status {
  border: 1px solid rgba(121, 223, 255, 0.35);
  border-radius: 999px;
  background: rgba(121, 223, 255, 0.1);
  color: #d6f6ff;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.hero-intro {
  display: grid;
  gap: 16px;
}

.hero-intro h2 {
  margin: 0;
  font-size: clamp(24px, 3.1vw, 34px);
  line-height: 1.2;
}

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 4px;
}

.kpi-item span {
  font-size: 12px;
  color: var(--muted);
}

.kpi-item strong {
  font-size: 14px;
}

.method-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.method-chips span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.hero-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card h2 {
  margin-top: 0;
  font-size: 24px;
}

.hero-list {
  margin: 10px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 6px;
}

.input-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

label {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

textarea,
input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.7);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: rgba(121, 223, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(121, 223, 255, 0.16);
  background: rgba(9, 15, 26, 0.86);
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: #1f1f1f;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow: 0 10px 20px rgba(121, 223, 255, 0.22);
}

.flow {
  padding: 18px 8vw 72px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  align-items: start;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: fadeUp 0.6s ease forwards;
}

.panel-title span {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--accent-2);
  letter-spacing: 0.2em;
}

.panel-title h3 {
  margin: 6px 0 18px;
  font-size: 22px;
}

.panel-title.compact h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.option {
  background: var(--panel-strong);
  border: 1px solid transparent;
  padding: 16px;
  border-radius: 18px;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
}

.option.active {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.option h4 {
  margin: 0 0 6px;
}

.chat-panel {
  display: grid;
  gap: 16px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-prompt {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.quick-prompt:hover {
  transform: translateY(-1px);
  background: rgba(121, 223, 255, 0.12);
  border-color: rgba(121, 223, 255, 0.42);
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
}

.ghost {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ghost:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field.wide {
  grid-column: 1 / -1;
}

.recommendation {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.small {
  font-size: 12px;
}

.hidden {
  display: none;
}

.chart-wrap {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.chart-card {
  background: rgba(10, 10, 12, 0.55);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 16px;
}

.settings {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(10, 10, 12, 0.55);
}

.settings {
  display: none;
}

.settings summary,
.chart-card summary {
  cursor: pointer;
  font-weight: 600;
}

.settings[open] summary,
.chart-card[open] summary {
  margin-bottom: 12px;
}

.settings h4 {
  margin: 0 0 12px;
}

.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.chart-output {
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

pre {
  background: rgba(6, 6, 8, 0.6);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 13px;
}

.chat {
  margin-top: 20px;
}

.chat-log {
  min-height: 280px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(7, 11, 18, 0.78), rgba(9, 13, 22, 0.88));
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  scrollbar-width: thin;
}

.chat-msg {
  padding: 9px 11px;
  border-radius: 14px;
  max-width: min(92%, 100%);
  line-height: 1.56;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-msg.user {
  background: linear-gradient(135deg, rgba(121, 223, 255, 0.24), rgba(121, 223, 255, 0.14));
  margin-left: auto;
}

.chat-msg.assistant {
  background: linear-gradient(135deg, rgba(243, 197, 122, 0.18), rgba(243, 197, 122, 0.1));
}

.chat-msg.chat-widget {
  max-width: min(100%, 760px);
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.chat-embed-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(9, 13, 22, 0.82);
}

.method-form-card {
  border-color: rgba(126, 229, 255, 0.28);
}

.chart-result-card {
  border-color: rgba(246, 192, 103, 0.28);
}

.chart-embed-head {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.chart-embed-head h4 {
  margin: 0;
  font-size: 16px;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.guide-panel {
  position: sticky;
  top: 18px;
}

.guide-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
}

.guide-list li {
  display: grid;
  gap: 4px;
}

.guide-list span {
  color: var(--muted);
  font-size: 13px;
}

.chart-viz {
  display: grid;
  gap: 12px;
}

.viz-grid {
  display: grid;
  gap: 10px;
}

.four-pillars {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tri-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.viz-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.viz-cell p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.viz-cell h5 {
  margin: 6px 0 0;
  font-size: 18px;
}

.viz-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viz-tags span {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(121, 223, 255, 0.08);
}

.viz-bars {
  display: grid;
  gap: 8px;
}

.viz-solar-time {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: rgba(121, 223, 255, 0.06);
}

.viz-solar-time p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.bazi-solar-tags span {
  background: rgba(126, 229, 255, 0.14);
}

.wx {
  font-style: normal;
  font-weight: 700;
}

.wx-wood {
  color: #2eb67d;
}

.wx-fire {
  color: #ff5d4f;
}

.wx-earth {
  color: #c9a56a;
}

.wx-metal {
  color: #f5b400;
}

.wx-water {
  color: #3f8cff;
}

.wx-neutral {
  color: #d2d2d2;
}

.professional-bazi-viz {
  gap: 14px;
}

.professional-bazi-viz.is-like-sample {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(18, 24, 34, 0.9);
}

.professional-pillars .pillar-cell h5 {
  font-size: 26px;
  letter-spacing: 0.04em;
}

.professional-pillars .pillar-cell small {
  color: var(--muted);
  font-size: 12px;
}

.ganzhi-colored {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.ganzhi-colored em {
  font-style: normal;
}

.bazi-pro-table-wrap {
  overflow-x: auto;
}

.bazi-pro-table {
  min-width: 880px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.bazi-pro-row {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bazi-pro-row:last-child {
  border-bottom: none;
}

.bazi-pro-row.bazi-pro-head {
  background: rgba(255, 255, 255, 0.04);
}

.bazi-pro-row.is-emphasized .bazi-pro-cell {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
}

.bazi-pro-row.is-shensha .bazi-pro-cell {
  font-size: 12px;
  color: var(--muted);
}

.pillar-shensha {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.pillar-shensha span {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(243, 197, 122, 0.34);
  background: rgba(243, 197, 122, 0.12);
  color: #f5dfb3;
  font-size: 11px;
  line-height: 1.2;
}

.bazi-pro-label,
.bazi-pro-cell {
  padding: 8px 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  text-align: center;
  display: grid;
  align-content: center;
  gap: 2px;
}

.bazi-pro-label {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.bazi-pro-row .bazi-pro-cell:last-child {
  border-right: none;
}

.bazi-detail-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.bazi-detail-row {
  display: grid;
  grid-template-columns: 90px repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bazi-detail-row:last-child {
  border-bottom: none;
}

.bazi-detail-row.bazi-detail-head {
  background: rgba(255, 255, 255, 0.04);
}

.bazi-detail-label,
.bazi-detail-cell {
  padding: 8px 10px;
  font-size: 13px;
}

.bazi-detail-label {
  color: var(--muted);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.bazi-detail-cell {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.bazi-detail-row .bazi-detail-cell:last-child {
  border-right: none;
}

.hidden-stem-list {
  display: grid;
  gap: 4px;
}

.hidden-stem-item {
  display: flex;
  justify-content: center;
  gap: 4px;
  align-items: center;
}

.hidden-stem-item i {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.shensha-tags span {
  background: rgba(243, 197, 122, 0.1);
}

.wx-bar i {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.wx-bar-wood i {
  background: linear-gradient(135deg, #2eb67d, #1d8b5f);
}

.wx-bar-fire i {
  background: linear-gradient(135deg, #ff5d4f, #ff8a5b);
}

.wx-bar-earth i {
  background: linear-gradient(135deg, #c9a56a, #aa8350);
}

.wx-bar-metal i {
  background: linear-gradient(135deg, #f5b400, #e1d26f);
}

.wx-bar-water i {
  background: linear-gradient(135deg, #3f8cff, #2ec9ff);
}

.fortune-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 10px;
}

.fortune-belt-wrap {
  display: grid;
  gap: 8px;
}

.fortune-belt-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.fortune-belt-title {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 13px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.fortune-belt-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  overflow-x: auto;
}

.fortune-belt-cell {
  appearance: none;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 6px;
  display: grid;
  gap: 3px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
}

.fortune-belt-cell:last-child {
  border-right: none;
}

.fortune-belt-cell.is-current {
  background: rgba(46, 168, 255, 0.18);
}

.fortune-belt-cell.is-selected,
.fortune-belt-cell:hover {
  background: rgba(243, 197, 122, 0.2);
}

.fortune-belt-cell p,
.fortune-belt-cell h6,
.fortune-belt-cell small {
  margin: 0;
}

.fortune-belt-cell h6 {
  font-size: 14px;
}

.fortune-belt-cell p,
.fortune-belt-cell small {
  color: var(--muted);
  font-size: 12px;
}

.fortune-gz-stack {
  display: grid;
  gap: 3px;
}

.fortune-gz-line {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.fortune-gz-line span {
  font-size: 15px;
  line-height: 1;
}

.fortune-gz-line em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}

.fortune-belt-cell.is-out-range {
  opacity: 0.45;
}

.wx-strip-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-radius: 10px;
  overflow: hidden;
}

.fortune-meta {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.fortune-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.wx-strip {
  text-align: center;
  padding: 8px 4px;
  font-weight: 700;
  color: #fff;
}

.wx-strip-wood {
  background: #129a67;
}

.wx-strip-fire {
  background: #e92331;
}

.wx-strip-water {
  background: #2f6bf2;
}

.wx-strip-metal {
  background: #f39a00;
}

.wx-strip-earth {
  background: #8a6440;
}

.fortune-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fortune-head h6 {
  margin: 0;
  font-size: 14px;
}

.fortune-head span {
  color: var(--muted);
  font-size: 12px;
}

.fortune-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.liunian-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.fortune-cell {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 4px;
}

.fortune-cell.is-current {
  border-color: rgba(121, 223, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(121, 223, 255, 0.2) inset;
}

.fortune-cell p,
.fortune-cell h6,
.fortune-cell small {
  margin: 0;
}

.fortune-cell p {
  color: var(--muted);
  font-size: 12px;
}

.fortune-cell h6 {
  font-size: 15px;
  font-weight: 700;
}

.fortune-cell small {
  color: var(--muted);
  font-size: 11px;
}

.viz-row {
  display: grid;
  grid-template-columns: 38px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.viz-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.viz-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.ziwei-grid,
.qimen-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ziwei-palace,
.qimen-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.ziwei-palace h6,
.qimen-cell h6 {
  margin: 0 0 4px;
  font-size: 13px;
}

.ziwei-palace p,
.qimen-cell p,
.qimen-cell small {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.ziwei-board,
.qimen-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ziwei-board.enhanced {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "a1 a2 a3 a4"
    "b1 cc cc b4"
    "c1 cc cc c4"
    "d1 d2 d3 d4";
  gap: 10px;
}

.ziwei-slot,
.qimen-slot {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 72px;
}

.ziwei-slot,
.qimen-slot,
.qimen-slot {
  opacity: 0;
  transform: translateY(6px);
  animation: fadeSlotIn 0.35s ease forwards;
  animation-delay: calc(var(--slot-index, 0) * 28ms);
}

.ziwei-slot h6,
.qimen-slot h6 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  border: 1px solid rgba(243, 197, 122, 0.5);
  background: rgba(243, 197, 122, 0.16);
  color: #ffe5b8;
}

.slot-mark.alt {
  border-color: rgba(121, 223, 255, 0.5);
  background: rgba(121, 223, 255, 0.14);
  color: #dff8ff;
}

.ziwei-slot h6,
.qimen-slot h6 {
  margin: 0 0 4px;
  font-size: 13px;
}

.ziwei-slot p,
.qimen-slot p,
.qimen-slot small {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.ziwei-slot.is-life {
  border-color: rgba(246, 192, 103, 0.7);
  background: rgba(246, 192, 103, 0.12);
  box-shadow: 0 0 0 1px rgba(246, 192, 103, 0.22) inset;
}

.ziwei-slot.is-body {
  border-color: rgba(126, 229, 255, 0.7);
  background: rgba(126, 229, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(126, 229, 255, 0.2) inset;
}

.ziwei-center {
  grid-area: cc;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(121, 223, 255, 0.05));
  display: grid;
  align-content: center;
  gap: 6px;
}

.ziwei-center h6 {
  margin: 0;
  font-size: 13px;
}

.ziwei-center p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.transform-tags span {
  background: rgba(246, 192, 103, 0.1);
}

.qimen-slot.is-duty {
  border-color: rgba(246, 192, 103, 0.7);
  background: linear-gradient(135deg, rgba(246, 192, 103, 0.14), rgba(246, 192, 103, 0.08));
  box-shadow: 0 0 0 1px rgba(246, 192, 103, 0.2) inset;
}

.qimen-slot.is-center {
  border-style: dashed;
  border-color: rgba(126, 229, 255, 0.5);
}

.qimen-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.qimen-line span {
  color: var(--muted);
}

.qimen-line strong {
  font-weight: 600;
}

.meihua-hexagrams {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meihua-hex-col {
  display: grid;
  gap: 8px;
}

.meihua-hex-col h6,
.meihua-text-item h6 {
  margin: 0;
  font-size: 13px;
  color: #5f4528;
  font-weight: 600;
  text-align: center;
}

.meihua-hex-lines {
  min-height: 170px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  display: grid;
  align-content: center;
  gap: 7px;
}

.meihua-hex-row {
  display: flex;
  justify-content: center;
}

.meihua-stroke {
  width: 72px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: center;
  justify-items: stretch;
}

.meihua-stroke i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(164, 116, 53, 0.98), rgba(214, 167, 103, 0.95));
}

.meihua-stroke.is-yang {
  grid-template-columns: 1fr;
}

.meihua-stroke.is-yang i:last-child {
  display: none;
}

.meihua-hex-row.is-moving .meihua-stroke i {
  background: linear-gradient(135deg, rgba(183, 65, 49, 1), rgba(220, 122, 80, 0.95));
  box-shadow: 0 0 0 1px rgba(183, 65, 49, 0.25), 0 0 8px rgba(183, 65, 49, 0.3);
}

.meihua-hex-empty {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.meihua-text-grid {
  display: grid;
  gap: 8px;
}

.meihua-text-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.meihua-text-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.meihua-six-text ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.meihua-six-text li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
}

.meihua-six-text li span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.meihua-six-text li em {
  font-style: normal;
  font-size: 12px;
  line-height: 1.5;
}

.meihua-six-fold summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.meihua-six-fold[open] summary {
  margin-bottom: 6px;
}

.chart-debug {
  margin-top: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(6, 6, 8, 0.55);
  padding: 8px 10px;
}

.chart-debug summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.chart-viz-empty,
.chart-viz-error {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--muted);
}

.chart-viz-error {
  color: #ffb9b9;
}

.chart-preview-note {
  margin-bottom: 12px;
  border: 1px solid rgba(255, 215, 140, 0.28);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(255, 215, 140, 0.08);
}

.chart-preview-note .label {
  margin: 0 0 6px;
  color: #ffd78c;
}

.chart-preview-note ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.chat-msg h2,
.chat-msg h3,
.chat-msg h4 {
  margin: 6px 0;
  line-height: 1.3;
}

.chat-msg h2 {
  font-size: 18px;
}

.chat-msg h3 {
  font-size: 16px;
}

.chat-msg h4 {
  font-size: 15px;
}

.chat-msg ul {
  margin: 8px 0;
  padding-left: 18px;
}

.chat-msg p {
  margin: 8px 0;
}

.chat-msg code {
  font-family: Consolas, Menlo, Monaco, monospace;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.9em;
}

.chat-msg pre {
  margin: 8px 0;
  background: rgba(6, 6, 8, 0.75);
  max-width: 100%;
  overflow-x: auto;
}

.chat-msg a {
  color: var(--accent-2);
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.chat-input input {
  min-width: 0;
}

.chart-viz,
.bazi-pro-table-wrap,
.fortune-belt-track,
.session-list,
.chart-record-result,
.chat-embed-card {
  min-width: 0;
}

.chat-input button {
  min-width: 88px;
}

.input-form-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(8, 8, 12, 0.65);
}

.input-form-head {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.input-form-title {
  margin: 0;
  font-size: 18px;
}

.smart-form {
  display: grid;
  gap: 14px;
}

.method-record-picker {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.method-record-picker label {
  font-size: 13px;
}

.method-record-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.method-record-picker-row select {
  min-width: 0;
}

.smart-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.smart-field {
  display: grid;
  gap: 7px;
}

.picker-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.picker-input-row input {
  min-width: 0;
}

.picker-trigger {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
}

.picker-trigger:hover {
  border-color: rgba(132, 93, 50, 0.66);
  background: rgba(255, 255, 255, 0.08);
}

.smart-field.wide {
  grid-column: 1 / -1;
}

.smart-field label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.required-mark {
  color: #ffb5b5;
  margin-left: 4px;
}

.smart-hint {
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.footer {
  padding: 0 8vw 40px;
  color: var(--muted);
  font-size: 13px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

::selection {
  background: rgba(121, 223, 255, 0.35);
  color: #fff;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlotIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .hero-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-status {
    white-space: normal;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-kpis {
    grid-template-columns: 1fr;
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    position: static;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-card {
    padding: 20px;
  }

  .chat-log {
    min-height: 340px;
    max-height: 64vh;
  }

  .chat-msg {
    max-width: 100%;
  }

  .four-pillars,
  .tri-grid,
  .ziwei-grid,
  .qimen-grid,
  .qimen-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ziwei-board.enhanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "a1 a2"
      "a3 a4"
      "b1 b4"
      "cc cc"
      "c1 c4"
      "d1 d2"
      "d3 d4";
  }

  .ziwei-center {
    grid-area: cc;
  }

  .bazi-detail-row {
    grid-template-columns: 70px repeat(4, minmax(0, 1fr));
  }

  .bazi-pro-row {
    grid-template-columns: 64px repeat(6, minmax(70px, 1fr));
  }

  .bazi-pro-row.is-emphasized .bazi-pro-cell {
    font-size: 24px;
  }

  .bazi-detail-label,
  .bazi-detail-cell {
    padding: 6px 6px;
    font-size: 12px;
  }

  .fortune-grid,
  .liunian-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wx-strip-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* ===== 基础主题变量 ===== */
:root {
  --bg: #1f1811;
  --bg-soft: #2b2217;
  --scene-bg-image: url("assets/background.svg");
  --scene-bg-focus: 50% 33.75%;
  --panel: rgba(248, 238, 216, 0.92);
  --panel-strong: rgba(241, 224, 193, 0.94);
  --accent: #a33e2b;
  --accent-2: #2f5a4b;
  --accent-3: #6a4c34;
  --text: #2d2418;
  --muted: rgba(61, 46, 29, 0.74);
  --border: rgba(90, 66, 40, 0.35);
  --shadow: 0 14px 30px rgba(31, 21, 12, 0.32);
}

body {
  font-family: "Noto Serif SC", "ZCOOL XiaoWei", serif;
  background:
    linear-gradient(rgba(36, 27, 18, 0.58), rgba(36, 27, 18, 0.58)),
    var(--scene-bg-image) center center / cover no-repeat fixed,
    radial-gradient(circle at 12% 10%, rgba(165, 132, 84, 0.22), transparent 30%),
    radial-gradient(circle at 86% 8%, rgba(120, 150, 112, 0.18), transparent 30%),
    radial-gradient(circle at 50% 115%, rgba(83, 60, 38, 0.28), transparent 48%),
    linear-gradient(180deg, #2e2419 0%, #1f1811 100%);
  color: var(--text);
}

.noise {
  opacity: 0.14;
  background-image:
    radial-gradient(rgba(70, 49, 27, 0.5) 0.6px, transparent 0.6px),
    radial-gradient(rgba(255, 255, 255, 0.22) 0.5px, transparent 0.5px);
  background-size: 3px 3px, 5px 5px;
  mix-blend-mode: multiply;
}

.aurora {
  inset: -45% -12% auto -12%;
  height: 72vh;
  opacity: 0.35;
  filter: blur(76px);
  background: conic-gradient(
    from 180deg at 50% 50%,
    rgba(122, 95, 61, 0.22),
    rgba(82, 120, 92, 0.14),
    rgba(173, 88, 61, 0.16),
    rgba(122, 95, 61, 0.22)
  );
}

.mobile-app-shell {
  border: 2px solid rgba(122, 88, 53, 0.75);
  background:
    linear-gradient(180deg, rgba(252, 243, 225, 0.84) 0%, rgba(241, 225, 196, 0.84) 100%);
  box-shadow:
    0 26px 40px rgba(15, 10, 6, 0.42),
    inset 0 0 0 1px rgba(255, 248, 231, 0.64),
    inset 0 0 44px rgba(121, 89, 51, 0.2);
}

.mobile-app-shell::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(121, 84, 46, 0.28);
  border-radius: 22px;
  pointer-events: none;
}

.mobile-app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 247, 232, 0.08), rgba(109, 74, 39, 0.08)),
    radial-gradient(circle at 20% 0%, rgba(255, 223, 168, 0.1), transparent 44%);
  mix-blend-mode: soft-light;
}

.panel,
.app-topbar,
.bottom-nav,
.mobile-chat-panel,
.chart-record-panel,
.chart-record-editor-panel,
.sessions-panel {
  background:
    linear-gradient(180deg, rgba(251, 242, 224, 0.94), rgba(240, 223, 191, 0.94));
  border-color: rgba(118, 84, 49, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 236, 0.72),
    0 8px 18px rgba(58, 41, 24, 0.16);
}

.app-topbar-title h1,
.home-card h3,
.panel-title h3,
.chart-embed-head h4,
.chart-record-result-head h4 {
  font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  color: #2a1f13;
}

.app-topbar {
  border-bottom: 1px solid rgba(117, 84, 49, 0.35);
}

.app-topbar-title p,
.muted,
.small,
.chart-record-main small,
.session-item small {
  color: #5c4a33;
}

.icon-btn,
.ghost,
.chart-method-buttons button,
.chart-record-form-actions button,
.chat-input button,
.session-item,
.nav-btn,
.quick-prompt,
.home-card {
  border: 1px solid rgba(112, 81, 46, 0.48);
  background:
    linear-gradient(180deg, rgba(239, 216, 177, 0.92), rgba(223, 191, 147, 0.92));
  color: #342515;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 227, 0.7),
    0 2px 5px rgba(92, 64, 34, 0.16);
}

.icon-btn:hover,
.ghost:hover,
.chart-method-buttons button:hover,
.chart-record-form-actions button:hover,
.chat-input button:hover,
.session-item:hover,
.nav-btn:hover,
.quick-prompt:hover,
.home-card:hover {
  transform: translateY(-1px);
  border-color: rgba(132, 93, 50, 0.66);
  background:
    linear-gradient(180deg, rgba(245, 223, 184, 0.96), rgba(227, 197, 153, 0.96));
}

.nav-btn.is-active {
  border-color: rgba(151, 56, 41, 0.76);
  background:
    linear-gradient(180deg, rgba(178, 74, 55, 0.92), rgba(145, 48, 35, 0.94));
  color: #fff1dd;
}

.home-card {
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}

.home-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(151, 56, 41, 0.2), transparent 68%);
  pointer-events: none;
}

.home-card p {
  color: #5a4731;
}

.chat-log {
  border: 1px solid rgba(110, 78, 44, 0.36);
  background:
    linear-gradient(180deg, rgba(253, 246, 232, 0.96), rgba(244, 228, 197, 0.96));
}

.chat-msg {
  border-color: rgba(110, 80, 47, 0.26);
}

.chat-msg.user {
  background:
    linear-gradient(135deg, rgba(177, 212, 194, 0.72), rgba(132, 168, 149, 0.72));
  color: #1f302a;
}

.chat-msg.assistant {
  background:
    linear-gradient(135deg, rgba(246, 229, 197, 0.92), rgba(234, 211, 174, 0.92));
  color: #332518;
}

.chat-embed-card {
  border-color: rgba(112, 82, 48, 0.34);
  background:
    linear-gradient(180deg, rgba(249, 239, 217, 0.96), rgba(237, 220, 188, 0.96));
}

.chat-input input,
.chat-input select,
.chat-input textarea,
.chart-record-form input,
.chart-record-form select,
.chart-record-form textarea,
.smart-form input,
.smart-form select,
.smart-form textarea {
  border: 1px solid rgba(114, 82, 46, 0.4);
  background: rgba(255, 250, 239, 0.86);
  color: #2e2216;
}

.chat-input input:focus,
.chat-input select:focus,
.chat-input textarea:focus,
.chart-record-form input:focus,
.chart-record-form select:focus,
.chart-record-form textarea:focus,
.smart-form input:focus,
.smart-form select:focus,
.smart-form textarea:focus {
  border-color: rgba(161, 62, 44, 0.7);
  box-shadow: 0 0 0 2px rgba(161, 62, 44, 0.14);
  background: rgba(255, 252, 244, 0.92);
}

.chart-record-item,
.session-item,
.fortune-meta,
.fortune-section,
.bazi-pro-table,
.bazi-detail-table {
  border-color: rgba(112, 81, 46, 0.35);
  background: rgba(250, 242, 223, 0.86);
}

.label,
.panel-title span {
  color: #8d3f2f;
}

.wx-strip-wood {
  background: #3c8054;
}

.wx-strip-fire {
  background: #b64536;
}

.wx-strip-water {
  background: #3f5f94;
}

.wx-strip-metal {
  background: #a27b2e;
}

.wx-strip-earth {
  background: #8f5f3a;
}

.bottom-nav {
  border-top: 1px solid rgba(116, 84, 48, 0.36);
}

@media (max-width: 460px) {
  .app-topbar-title h1 {
    font-size: 17px;
  }

  .app-topbar-title p {
    font-size: 11px;
  }
}

/* ===== 应用外壳与背景 ===== */
.mobile-app-shell {
  background: rgba(242, 228, 201, 0.22);
}

.mobile-app-shell::before {
  border-color: rgba(105, 70, 37, 0.46);
}

.mobile-app-shell::after {
  background: linear-gradient(180deg, rgba(255, 245, 222, 0.04), rgba(69, 45, 25, 0.14));
}

.app-viewport {
  position: relative;
  background-image: var(--scene-bg-image);
  background-position: var(--scene-bg-focus);
  background-repeat: no-repeat;
  background-size: cover;
}

.app-viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 232, 198, 0.12), transparent 45%),
    linear-gradient(180deg, rgba(28, 18, 10, 0.16), rgba(28, 18, 10, 0.34));
  pointer-events: none;
}

@media (max-aspect-ratio: 9/16) {
  .app-viewport {
    background-position: var(--scene-bg-focus);
    background-size: cover;
  }
}

@media (min-aspect-ratio: 9/16) {
  .app-viewport {
    background-position: var(--scene-bg-focus);
    background-size: cover;
  }
}

.app-view {
  position: relative;
  z-index: 1;
  background: transparent;
}

.subview-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

/* ===== Auth / account ===== */

#view-auth.subview-page {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 18px);
}

#view-auth.scroll-docked-view {
  overflow: hidden !important;
}

#view-auth .auth-panel {
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.auth-shell {
  display: grid;
  gap: 16px;
}

.auth-shell.hidden,
.auth-form.hidden,
.auth-status.hidden {
  display: none !important;
}

.auth-status {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(120, 92, 64, 0.18);
  background: rgba(255, 251, 244, 0.76);
  color: rgba(64, 45, 24, 0.92);
  line-height: 1.6;
}

.auth-status.is-error {
  border-color: rgba(167, 65, 47, 0.26);
  background: rgba(255, 240, 236, 0.88);
  color: rgba(128, 37, 24, 0.96);
}

.auth-status.is-success {
  border-color: rgba(57, 112, 81, 0.24);
  background: rgba(240, 251, 244, 0.88);
  color: rgba(32, 88, 58, 0.94);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-tab {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(121, 96, 69, 0.16);
  background: rgba(250, 244, 234, 0.88);
  color: rgba(87, 62, 38, 0.9);
  font-weight: 700;
}

.auth-tab.is-active {
  border-color: rgba(59, 99, 176, 0.28);
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95));
  color: #eef5ff;
  box-shadow:
    0 8px 16px rgba(38, 64, 118, 0.18),
    inset 0 1px 0 rgba(202, 224, 255, 0.3);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form-grid {
  gap: 14px;
}

.auth-secondary-button {
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid rgba(124, 100, 74, 0.18);
  background: linear-gradient(180deg, rgba(251, 247, 241, 0.98), rgba(238, 230, 220, 0.98));
  color: rgba(66, 49, 29, 0.94);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 16px rgba(56, 41, 26, 0.06);
}

.auth-secondary-button:hover {
  border-color: rgba(112, 93, 70, 0.28);
  background: linear-gradient(180deg, rgba(253, 249, 244, 1), rgba(241, 233, 223, 1));
  color: rgba(53, 39, 22, 0.98);
  transform: translateY(-1px);
}

.auth-code-field {
  width: 100%;
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auth-send-code {
  min-width: 128px;
  min-height: 42px;
  white-space: nowrap;
}

.auth-form-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.auth-form-actions--paired {
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.auth-form-actions--paired > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 112px;
  width: 112px;
  min-width: 112px;
  min-height: 42px;
  padding: 0 18px;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.auth-inline-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: -2px;
}

.auth-inline-actions-start {
  justify-content: flex-start;
}

.auth-link-button {
  padding: 0;
  border: none;
  background: none;
  color: rgba(60, 97, 171, 0.92);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-link-button:hover {
  color: rgba(44, 78, 148, 0.98);
  text-decoration: underline;
}

#view-auth .auth-account-card-compact {
  gap: 14px;
}

.auth-form-note {
  color: rgba(112, 87, 61, 0.88);
  font-size: 13px;
  line-height: 1.6;
}

@media (min-aspect-ratio: 1/1) {
  #view-auth.app-view {
    background: linear-gradient(
      180deg,
      rgba(246, 241, 233, 0.18) 0%,
      rgba(236, 228, 216, 0.28) 48%,
      rgba(224, 213, 198, 0.42) 100%
    ) !important;
  }

  #view-auth .auth-panel {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .auth-tabs {
    grid-template-columns: 1fr;
  }

  .auth-code-row,
  .auth-account-grid {
    grid-template-columns: 1fr;
  }

  .auth-send-code {
    width: 100%;
  }
}

.subview-titlebar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

.subview-titlebar-action {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 40px;
  min-height: 40px;
  pointer-events: none;
}

.subview-titlebar-action > * {
  pointer-events: auto;
}

.subview-page > .subview-panel {
  width: 100%;
}

.subview-main-title {
  margin: 0;
  text-align: center;
  font-size: clamp(30px, 5.6vw, 40px);
  line-height: 1.08;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: rgba(66, 44, 18, 0.96);
  font-family: "ZCOOL XiaoWei", serif;
}

.subview-panel {
  border-radius: 16px;
  padding: 12px;
}

.app-topbar,
.bottom-nav {
  background: linear-gradient(180deg, rgba(248, 236, 212, 0.82), rgba(233, 213, 180, 0.8));
}

.panel,
.mobile-chat-panel,
.chart-record-panel,
.chart-record-editor-panel,
.sessions-panel {
  background: linear-gradient(180deg, rgba(250, 239, 217, 0.82), rgba(235, 215, 182, 0.8));
}

.chat-log {
  background: linear-gradient(180deg, rgba(251, 241, 220, 0.78), rgba(238, 220, 188, 0.76));
}

/* ===== 单列布局与响应式 ===== */
.mobile-app-shell {
  grid-template-rows: 1fr;
}

.app-topbar,
.bottom-nav {
  display: none !important;
}

.app-viewport {
  overflow: auto;
}

.view-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.back-home-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 26px;
  color: rgba(58, 41, 22, 0.86);
  border-color: rgba(114, 82, 46, 0.32);
  background: linear-gradient(180deg, rgba(248, 235, 209, 0.62), rgba(236, 216, 182, 0.58));
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 233, 0.72),
    0 1px 3px rgba(65, 45, 24, 0.12);
}

.back-home-btn:hover {
  color: rgba(52, 36, 19, 0.95);
  border-color: rgba(124, 88, 47, 0.46);
  background: linear-gradient(180deg, rgba(249, 236, 210, 0.74), rgba(238, 218, 184, 0.68));
  transform: translateY(0);
}

.back-home-btn:active {
  transform: translateY(1px) scale(0.99);
}

.back-home-btn.is-danger {
  color: rgba(122, 36, 26, 0.9);
  border-color: rgba(152, 64, 47, 0.36);
  background: linear-gradient(180deg, rgba(248, 223, 214, 0.58), rgba(239, 205, 194, 0.54));
}

.back-home-btn.is-danger:hover {
  color: rgba(136, 36, 24, 0.96);
  border-color: rgba(164, 62, 44, 0.5);
  background: linear-gradient(180deg, rgba(250, 229, 220, 0.68), rgba(243, 209, 198, 0.64));
}

.icon-btn,
.ghost,
.chart-method-buttons button,
.chart-record-form-actions button,
.chat-input button,
.session-item,
.quick-prompt,
.home-card {
  transition:
    transform 180ms ease,
    box-shadow 220ms ease,
    filter 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
}

.home-card:active,
.icon-btn:active,
.ghost:active,
.chat-input button:active,
.session-item:active,
.quick-prompt:active {
  transform: translateY(1px) scale(0.985);
}

.home-card[data-home-action="chat"] {
  border-color: rgba(150, 40, 28, 0.82) !important;
  background: linear-gradient(180deg, rgba(185, 66, 48, 0.95), rgba(145, 42, 30, 0.95)) !important;
  color: #fff2de !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 190, 0.35),
    0 4px 12px rgba(120, 33, 23, 0.32),
    0 0 0 0 rgba(176, 58, 40, 0.5);
  animation: askCardBreath 2600ms ease-in-out infinite;
}

.home-card[data-home-action="chat"] h3 {
  color: #fff3df !important;
}

.home-card[data-home-action="chat"]:hover {
  filter: brightness(1.05);
}

.chat-msg {
  animation: chatBubbleIn 220ms ease both;
}

@keyframes askCardBreath {
  0%,
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 220, 190, 0.35),
      0 4px 12px rgba(120, 33, 23, 0.32),
      0 0 0 0 rgba(176, 58, 40, 0.5);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 220, 190, 0.35),
      0 6px 16px rgba(120, 33, 23, 0.4),
      0 0 0 8px rgba(176, 58, 40, 0.08);
  }
}

@keyframes chatBubbleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-card[data-home-action="chat"],
  .chat-msg {
    animation: none !important;
  }

  .icon-btn,
  .ghost,
  .chart-method-buttons button,
  .chart-record-form-actions button,
  .chat-input button,
  .session-item,
  .quick-prompt,
  .home-card {
    transition: none !important;
  }
}

/* ===== 会话区域与滚动容器 ===== */
.chat-log {
  min-height: 260px;
  max-height: 54vh;
  overscroll-behavior: contain;
}

.chat-msg {
  padding: 8px 10px;
  max-width: min(82%, 100%);
  line-height: 1.5;
  font-size: 13px;
}

.chat-msg.user {
  max-width: min(78%, 100%);
}

.chat-msg.assistant {
  max-width: min(82%, 100%);
}

.chat-msg.chat-widget {
  width: 100%;
  max-width: 100%;
}

.chat-embed-card {
  padding: 10px;
  overflow-x: auto;
}

.chart-embed-head h4 {
  font-size: 15px;
}

.chat-msg h2 {
  font-size: 16px;
}

.chat-msg h3 {
  font-size: 15px;
}

.chat-msg h4 {
  font-size: 14px;
}

.chat-msg p {
  font-size: 13px;
}

.chat-msg pre {
  max-width: 100%;
  overflow-x: auto;
  font-size: 12px;
}

.chat-msg table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.chat-input {
  gap: 8px;
}

.chat-input input {
  min-width: 0;
  font-size: 14px;
}

.chat-input button {
  min-width: 72px;
  font-size: 13px;
}

@media (max-width: 700px) {
  .chat-log {
    min-height: 240px;
    max-height: 52vh;
  }

  .chat-msg {
    max-width: 92%;
    font-size: 12px;
    line-height: 1.45;
    padding: 7px 9px;
  }

  .chat-msg h2 {
    font-size: 15px;
  }

  .chat-msg h3 {
    font-size: 14px;
  }

  .chat-msg h4 {
    font-size: 13px;
  }

  .chat-msg pre {
    font-size: 11px;
  }

  .chat-embed-card {
    padding: 8px;
  }

  .bazi-pro-row {
    grid-template-columns: 60px repeat(6, minmax(62px, 1fr));
  }

  .bazi-pro-row.is-emphasized .bazi-pro-cell {
    font-size: 18px;
  }

  .professional-pillars .pillar-cell h5 {
    font-size: 20px;
  }

  .fortune-belt-track {
    grid-auto-columns: minmax(76px, 1fr);
  }

  .fortune-belt-cell h6 {
    font-size: 12px;
  }

  .fortune-gz-line span {
    font-size: 13px;
  }

  .home-card h3 {
    font-size: 19px;
  }

  .home-card {
    min-height: 60px;
    padding: 9px 9px;
  }
}

/* ===== 横屏聊天面板修正 ===== */
#view-chat .mobile-chat-panel {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 6px 2px;
  border-radius: 0;
  gap: 8px;
}

#view-chat .chat-msg {
  align-self: flex-start;
  width: fit-content;
  max-width: 82%;
  margin: 0;
  padding: 9px 11px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(58, 39, 21, 0.1);
}

#view-chat .chat-msg:not(.chat-widget) {
  font-size: 14px;
  line-height: 1.55;
}

#view-chat .chat-msg:not(.chat-widget) p {
  font-size: inherit;
}

#view-chat .chat-msg.user {
  align-self: flex-end;
  max-width: 74%;
}

#view-chat .chat-msg.assistant {
  max-width: 82%;
}

#view-chat .chat-msg p {
  margin: 0;
}

#view-chat .chat-msg p + p {
  margin-top: 6px;
}

#view-chat .chat-embed-card,
#view-chat .method-form-card,
#view-chat .chart-result-card {
  border: none !important;
  box-shadow: none !important;
  background: rgba(249, 238, 214, 0.58) !important;
  border-radius: 10px;
  padding: 8px 10px;
}

#view-chat .method-record-picker,
#view-chat .input-form-panel {
  border: none;
  box-shadow: none;
  background: rgba(249, 238, 214, 0.5);
}

#view-chat .chart-debug {
  border: none;
  background: rgba(0, 0, 0, 0.08);
}

/* ===== Final Layout Stabilizer (chat readability + bg adapt) ===== */
.mobile-app-shell {
  width: min(calc(100vw - 16px), calc((100dvh - 16px) * 9 / 16));
  max-width: min(540px, calc(100vw - 16px));
  min-width: 0;
  height: min(calc(100dvh - 16px), calc((100vw - 16px) * 16 / 9));
  max-height: calc(100dvh - 16px);
  margin: 8px auto;
  aspect-ratio: 9 / 16;
}

.app-viewport {
  background-image:
    radial-gradient(circle at 50% 100%, rgba(32, 20, 10, 0.44), rgba(32, 20, 10, 0.16) 45%, transparent 72%),
    var(--scene-bg-image);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover, cover;
}

.app-viewport::before {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 232, 198, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(26, 16, 9, 0.2), rgba(26, 16, 9, 0.3));
}

@media (max-aspect-ratio: 9/16) {
  .app-viewport {
    background-size: cover, cover;
    background-position: center center;
  }
}

@media (min-aspect-ratio: 9/16) {
  .app-viewport {
    background-size: cover, cover;
    background-position: center center;
  }
}

#view-chat .chat-embed-card,
#view-chat .method-form-card,
#view-chat .chart-result-card {
  background: rgba(248, 237, 213, 0.46) !important;
  padding: 8px 9px;
}

#view-chat .professional-pillars .pillar-cell h5 {
  font-size: 18px;
}

#view-chat .bazi-pro-table {
  min-width: 640px;
}

#view-chat .bazi-pro-row.is-emphasized .bazi-pro-cell {
  font-size: 16px;
  line-height: 1.1;
}

#view-chat .bazi-pro-label,
#view-chat .bazi-pro-cell,
#view-chat .bazi-detail-label,
#view-chat .bazi-detail-cell {
  font-size: 12px;
  padding: 6px;
}

#view-chat .meihua-hex-lines {
  min-height: 132px;
}

#view-chat .meihua-stroke {
  width: 60px;
}

/* ===== Chat Fullscreen Fix (latest) ===== */
.mobile-app-shell {
  width: 100vw;
  max-width: none;
  min-width: 0;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
  background: transparent;
}

.mobile-app-shell::before,
.mobile-app-shell::after {
  content: none;
  display: none;
}

.app-viewport {
  width: 100%;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  background-image: var(--scene-bg-image) !important;
  background-repeat: no-repeat !important;
  background-position: var(--scene-bg-focus) !important;
  background-size: cover !important;
}

#view-home.app-view,
#view-chat.app-view,
#view-charts.app-view,
#view-chart-editor.app-view,
#view-sessions.app-view {
  height: 100%;
  padding:
    calc(clamp(10px, 2.6vw, 14px) + env(safe-area-inset-top))
    calc(10px + env(safe-area-inset-right))
    calc(clamp(10px, 2.6vw, 14px) + env(safe-area-inset-bottom))
    calc(10px + env(safe-area-inset-left));
}

#view-chat.app-view {
  overflow: hidden;
}

#view-charts.app-view,
#view-sessions.app-view {
  overflow: hidden;
}

#view-chat.subview-page {
  grid-template-rows: auto minmax(0, 1fr);
}

#view-chat .subview-main-title {
  margin-bottom: 2px;
}

#view-chat .mobile-chat-panel {
  height: 100%;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#view-chat .view-actions {
  display: none;
}

#view-chat .view-actions .back-home-btn {
  display: none;
}

#view-sessions .view-actions {
  display: none;
}

#view-chat .chat-log {
  min-height: 0;
  max-height: none;
  height: 100%;
  margin: 0;
}

#view-chat .chat-input {
  margin: 0;
  padding: 0;
}

#view-chat .input-form-panel {
  margin: 0;
}

#view-chat #result-panel {
  margin: 0;
  max-height: min(30vh, 220px);
  overflow: auto;
}

#chat-reset.chat-reset-icon-btn {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: var(--corner-left-gap, calc(16px + env(safe-area-inset-left)));
  z-index: 60;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(59, 99, 176, 0.68) !important;
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95)) !important;
  box-shadow:
    0 8px 16px rgba(38, 64, 118, 0.24),
    inset 0 1px 0 rgba(202, 224, 255, 0.36) !important;
  color: #eef5ff !important;
  line-height: 1;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#chat-reset.hidden {
  display: none !important;
  pointer-events: none;
}

#chat-reset .chat-reset-icon {
  display: block;
  position: relative;
  width: 58%;
  height: 58%;
  min-width: 18px;
  min-height: 18px;
  color: transparent;
  font-size: 0;
  line-height: 0;
  transform: none;
}

#chat-reset .chat-reset-icon::before,
#chat-reset .chat-reset-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78%;
  height: 12%;
  border-radius: 999px;
  background: #eef5ff;
  transform: translate(-50%, -50%);
}

#chat-reset .chat-reset-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

#chat-reset.chat-reset-icon-btn:hover {
  filter: brightness(1.02);
}

#chat-reset.chat-reset-icon-btn:active {
  transform: none;
  filter: brightness(0.98);
}

@media (max-width: 640px) {
  #view-chat #result-panel {
    max-height: min(26vh, 192px);
  }

  #chat-reset.chat-reset-icon-btn {
    top: calc(12px + env(safe-area-inset-top));
    left: var(--corner-left-gap, calc(12px + env(safe-area-inset-left)));
    width: 34px;
    height: 34px;
  }

  #chat-reset .chat-reset-icon {
    min-width: 16px;
    min-height: 16px;
  }

  .chat-scroll-bottom {
    right: 10px;
    bottom: 10px;
    min-height: 32px;
    padding-inline: 10px;
  }
}

@media (max-width: 640px) {
  .mobile-app-shell {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ===== 奇门盘样式 ===== */
#view-chat .qimen-enhanced-viz,
#view-charts .qimen-enhanced-viz,
.qimen-enhanced-viz {
  gap: 8px !important;
}

#view-chat .qimen-enhanced-viz .qimen-main-tags span,
#view-charts .qimen-enhanced-viz .qimen-main-tags span,
.qimen-enhanced-viz .qimen-main-tags span {
  background: rgba(229, 210, 173, 0.64) !important;
  border-color: rgba(141, 101, 57, 0.42) !important;
  color: #5f4528 !important;
}

#view-chat .qimen-enhanced-viz .qimen-solar-tags span,
#view-charts .qimen-enhanced-viz .qimen-solar-tags span,
.qimen-enhanced-viz .qimen-solar-tags span {
  background: rgba(236, 223, 195, 0.78) !important;
  border-color: rgba(155, 130, 90, 0.35) !important;
  color: #5f4528 !important;
}

#view-chat .qimen-enhanced-viz .qimen-board.enhanced,
#view-charts .qimen-enhanced-viz .qimen-board.enhanced,
.qimen-enhanced-viz .qimen-board.enhanced {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 !important;
  border: 1px solid rgba(124, 147, 114, 0.45);
  border-radius: 10px;
  overflow: hidden;
  background: #dce5d7 !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot,
#view-charts .qimen-enhanced-viz .qimen-slot,
.qimen-enhanced-viz .qimen-slot {
  border: 0 !important;
  border-right: 1px solid rgba(124, 147, 114, 0.45) !important;
  border-bottom: 1px solid rgba(124, 147, 114, 0.45) !important;
  border-radius: 0 !important;
  min-height: 178px;
  padding: 6px 7px;
  background: #dbe5d6 !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.qimen-tone-2,
#view-charts .qimen-enhanced-viz .qimen-slot.qimen-tone-2,
.qimen-enhanced-viz .qimen-slot.qimen-tone-2 {
  background: #d9e2d3 !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.qimen-tone-3,
#view-charts .qimen-enhanced-viz .qimen-slot.qimen-tone-3,
.qimen-enhanced-viz .qimen-slot.qimen-tone-3 {
  background: #dce4d9 !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.qimen-tone-4,
#view-charts .qimen-enhanced-viz .qimen-slot.qimen-tone-4,
.qimen-enhanced-viz .qimen-slot.qimen-tone-4 {
  background: #d8e0d2 !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.is-duty,
#view-charts .qimen-enhanced-viz .qimen-slot.is-duty,
.qimen-enhanced-viz .qimen-slot.is-duty {
  box-shadow: 0 0 0 1px rgba(83, 109, 72, 0.5) inset !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.is-duty-gate,
#view-charts .qimen-enhanced-viz .qimen-slot.is-duty-gate,
.qimen-enhanced-viz .qimen-slot.is-duty-gate {
  box-shadow: 0 0 0 1px rgba(110, 85, 56, 0.48) inset !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.is-center,
#view-charts .qimen-enhanced-viz .qimen-slot.is-center,
.qimen-enhanced-viz .qimen-slot.is-center {
  background: #e1e8df !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot.is-void,
#view-charts .qimen-enhanced-viz .qimen-slot.is-void,
.qimen-enhanced-viz .qimen-slot.is-void {
  background: #ece6d8 !important;
}

#view-chat .qimen-enhanced-viz .qimen-slot-head,
#view-charts .qimen-enhanced-viz .qimen-slot-head,
.qimen-enhanced-viz .qimen-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

#view-chat .qimen-enhanced-viz .qimen-slot h6,
#view-charts .qimen-enhanced-viz .qimen-slot h6,
.qimen-enhanced-viz .qimen-slot h6 {
  margin: 0;
  font-size: 17px;
  line-height: 1.08;
  color: #2e4631;
  font-weight: 700;
}

#view-chat .qimen-enhanced-viz .qimen-slot-marks,
#view-charts .qimen-enhanced-viz .qimen-slot-marks,
.qimen-enhanced-viz .qimen-slot-marks {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

#view-chat .qimen-enhanced-viz .slot-mark,
#view-charts .qimen-enhanced-viz .slot-mark,
.qimen-enhanced-viz .slot-mark {
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  background: rgba(243, 197, 122, 0.25);
  color: #5e4124;
  border-color: rgba(164, 118, 66, 0.45);
}

#view-chat .qimen-enhanced-viz .slot-mark.alt,
#view-charts .qimen-enhanced-viz .slot-mark.alt,
.qimen-enhanced-viz .slot-mark.alt {
  background: rgba(121, 223, 255, 0.26);
  color: #27556a;
  border-color: rgba(69, 122, 147, 0.48);
}

#view-chat .qimen-enhanced-viz .slot-mark.horse,
#view-charts .qimen-enhanced-viz .slot-mark.horse,
.qimen-enhanced-viz .slot-mark.horse {
  background: rgba(173, 214, 147, 0.28);
  color: #2f5b29;
  border-color: rgba(91, 138, 76, 0.42);
}

#view-chat .qimen-enhanced-viz .slot-mark.void,
#view-charts .qimen-enhanced-viz .slot-mark.void,
.qimen-enhanced-viz .slot-mark.void {
  background: rgba(222, 201, 166, 0.28);
  color: #6a5336;
  border-color: rgba(145, 118, 82, 0.45);
}

#view-chat .qimen-enhanced-viz .qimen-line,
#view-charts .qimen-enhanced-viz .qimen-line,
.qimen-enhanced-viz .qimen-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: baseline;
  margin: 0;
}

#view-chat .qimen-enhanced-viz .qimen-line span,
#view-charts .qimen-enhanced-viz .qimen-line span,
.qimen-enhanced-viz .qimen-line span {
  color: #6b5c47;
  font-size: 11px;
  line-height: 1.25;
}

#view-chat .qimen-enhanced-viz .qimen-line strong,
#view-charts .qimen-enhanced-viz .qimen-line strong,
.qimen-enhanced-viz .qimen-line strong {
  color: #28492d;
  font-size: 13px;
  line-height: 1.22;
  font-weight: 700;
}

#view-chat .qimen-enhanced-viz .qimen-mini-tags,
#view-charts .qimen-enhanced-viz .qimen-mini-tags,
.qimen-enhanced-viz .qimen-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

#view-chat .qimen-enhanced-viz .qimen-mini-tags span,
#view-charts .qimen-enhanced-viz .qimen-mini-tags span,
.qimen-enhanced-viz .qimen-mini-tags span {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid rgba(120, 98, 70, 0.26);
  background: rgba(255, 255, 255, 0.45);
  color: #5f4528;
  font-size: 10px;
  line-height: 1.2;
}

#view-chat .qimen-enhanced-viz .qimen-slot-foot,
#view-charts .qimen-enhanced-viz .qimen-slot-foot,
.qimen-enhanced-viz .qimen-slot-foot {
  display: block;
  margin-top: 3px;
  color: #73664e;
  font-size: 10px;
  line-height: 1.25;
}

#view-chat .qimen-enhanced-viz .qimen-center-panels,
#view-charts .qimen-enhanced-viz .qimen-center-panels,
.qimen-enhanced-viz .qimen-center-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#view-chat .qimen-enhanced-viz .qimen-center-block,
#view-charts .qimen-enhanced-viz .qimen-center-block,
.qimen-enhanced-viz .qimen-center-block {
  border: 1px solid rgba(141, 101, 57, 0.25);
  border-radius: 8px;
  padding: 6px 8px;
  background: #e7efe8;
  display: grid;
  gap: 5px;
}

#view-chat .qimen-enhanced-viz .qimen-center-block h6,
#view-charts .qimen-enhanced-viz .qimen-center-block h6,
.qimen-enhanced-viz .qimen-center-block h6 {
  margin: 0;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 700;
  color: #2e4631;
}

#view-chat .qimen-enhanced-viz .qimen-center-grid,
#view-charts .qimen-enhanced-viz .qimen-center-grid,
.qimen-enhanced-viz .qimen-center-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
}

#view-chat .qimen-enhanced-viz .qimen-center-item,
#view-charts .qimen-enhanced-viz .qimen-center-item,
.qimen-enhanced-viz .qimen-center-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

#view-chat .qimen-enhanced-viz .qimen-center-item span,
#view-charts .qimen-enhanced-viz .qimen-center-item span,
.qimen-enhanced-viz .qimen-center-item span {
  color: #6a5134;
  font-size: 12px;
}

#view-chat .qimen-enhanced-viz .qimen-center-item strong,
#view-charts .qimen-enhanced-viz .qimen-center-item strong,
.qimen-enhanced-viz .qimen-center-item strong {
  color: #2f6f1e;
  font-size: 13px;
  font-weight: 700;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-board,
#view-charts .qimen-enhanced-viz .qimen-pattern-board,
.qimen-enhanced-viz .qimen-pattern-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-col,
#view-charts .qimen-enhanced-viz .qimen-pattern-col,
.qimen-enhanced-viz .qimen-pattern-col {
  border: 1px solid rgba(141, 101, 57, 0.25);
  border-radius: 8px;
  padding: 6px;
  background: #eff4eb;
  display: grid;
  gap: 5px;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-col h6,
#view-charts .qimen-enhanced-viz .qimen-pattern-col h6,
.qimen-enhanced-viz .qimen-pattern-col h6 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #2e4631;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-list,
#view-charts .qimen-enhanced-viz .qimen-pattern-list,
.qimen-enhanced-viz .qimen-pattern-list {
  display: grid;
  gap: 4px;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-item,
#view-charts .qimen-enhanced-viz .qimen-pattern-item,
.qimen-enhanced-viz .qimen-pattern-item {
  border: 1px solid rgba(140, 154, 136, 0.35);
  border-radius: 6px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.5);
  display: grid;
  gap: 1px;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-item strong,
#view-charts .qimen-enhanced-viz .qimen-pattern-item strong,
.qimen-enhanced-viz .qimen-pattern-item strong {
  color: #2f6f1e;
  font-size: 11px;
  line-height: 1.2;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-item span,
#view-charts .qimen-enhanced-viz .qimen-pattern-item span,
.qimen-enhanced-viz .qimen-pattern-item span {
  color: #6a5134;
  font-size: 10px;
  line-height: 1.25;
}

#view-chat .qimen-enhanced-viz .qimen-pattern-item.is-empty,
#view-charts .qimen-enhanced-viz .qimen-pattern-item.is-empty,
.qimen-enhanced-viz .qimen-pattern-item.is-empty {
  text-align: center;
  color: #85765f;
}

@media (max-width: 900px) {
  #view-chat .qimen-enhanced-viz .qimen-slot,
  #view-charts .qimen-enhanced-viz .qimen-slot,
  .qimen-enhanced-viz .qimen-slot {
    min-height: 160px;
  }

  #view-chat .qimen-enhanced-viz .qimen-center-grid,
  #view-charts .qimen-enhanced-viz .qimen-center-grid,
  .qimen-enhanced-viz .qimen-center-grid {
    grid-template-columns: 1fr;
  }

  #view-chat .qimen-enhanced-viz .qimen-pattern-board,
  #view-charts .qimen-enhanced-viz .qimen-pattern-board,
  .qimen-enhanced-viz .qimen-pattern-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #view-chat .qimen-enhanced-viz .qimen-board.enhanced,
  #view-charts .qimen-enhanced-viz .qimen-board.enhanced,
  .qimen-enhanced-viz .qimen-board.enhanced {
    border-radius: 8px;
  }

  #view-chat .qimen-enhanced-viz .qimen-slot,
  #view-charts .qimen-enhanced-viz .qimen-slot,
  .qimen-enhanced-viz .qimen-slot {
    min-height: 140px;
    padding: 4px;
  }

  #view-chat .qimen-enhanced-viz .qimen-line strong,
  #view-charts .qimen-enhanced-viz .qimen-line strong,
  .qimen-enhanced-viz .qimen-line strong {
    font-size: 11px;
  }

  #view-chat .qimen-enhanced-viz .qimen-mini-tags span,
  #view-charts .qimen-enhanced-viz .qimen-mini-tags span,
  .qimen-enhanced-viz .qimen-mini-tags span {
    font-size: 9px;
    padding: 1px 4px;
  }

  #view-chat .qimen-enhanced-viz .qimen-center-panels,
  #view-charts .qimen-enhanced-viz .qimen-center-panels,
  .qimen-enhanced-viz .qimen-center-panels {
    grid-template-columns: 1fr;
  }
}

/* ===== 八字盘通用样式 ===== */
.chart-viz,
.professional-bazi-viz,
.professional-bazi-viz.is-like-sample,
.bazi-pro-table,
.bazi-detail-table,
.fortune-section,
.fortune-meta,
.fortune-belt-row,
.fortune-belt-cell,
.ziwei-slot,
.ziwei-center,
.qimen-slot,
.viz-cell,
.meihua-hex-lines,
.meihua-text-item,
.chart-debug,
#view-chat .chart-embed-card,
#view-chat .chart-result-card,
#view-charts .chart-record-result,
#view-chart-result .chart-record-result {
  background: rgba(255, 251, 242, 0.96) !important;
  border-color: rgba(121, 87, 50, 0.32) !important;
  color: #2f2316 !important;
}

.bazi-pro-row,
.bazi-detail-row,
.fortune-belt-cell,
.ziwei-slot,
.qimen-slot,
.meihua-text-item,
.meihua-hex-lines {
  border-color: rgba(121, 87, 50, 0.24) !important;
}

.bazi-pro-label,
.bazi-pro-cell,
.bazi-detail-label,
.bazi-detail-cell,
.fortune-belt-title,
.fortune-belt-cell p,
.fortune-belt-cell small,
.fortune-gz-line em,
.ziwei-slot p,
.qimen-slot p,
.qimen-slot small,
.qimen-line span,
.meihua-text-item h6,
.meihua-six-fold summary,
.meihua-six-text li span,
.viz-cell p,
.viz-solar-time p,
.chart-debug summary {
  color: #6a5134 !important;
}

.viz-tags span,
.slot-mark,
.slot-mark.alt,
.pillar-shensha span {
  background: rgba(244, 230, 199, 0.92) !important;
  border-color: rgba(141, 101, 57, 0.46) !important;
  color: #5f4528 !important;
}

.chart-debug {
  background: rgba(246, 235, 212, 0.9) !important;
}

.chart-debug pre,
.chart-viz pre,
.chart-record-result pre {
  background: rgba(248, 240, 223, 0.96) !important;
  color: #2f2316 !important;
  border-color: rgba(121, 87, 50, 0.28) !important;
}

.wx-neutral {
  color: #7a6b58 !important;
}

/* ===== 八字盘主卡配色 ===== */
#view-chat .professional-bazi-viz,
#view-charts .professional-bazi-viz,
.professional-bazi-viz {
  background: #f7efdf !important;
  color: #2f2316 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-row,
#view-charts .professional-bazi-viz .fortune-belt-row,
.professional-bazi-viz .fortune-belt-row {
  background: #f3e7cb !important;
  border-color: rgba(118, 84, 48, 0.34) !important;
}

#view-chat .professional-bazi-viz .fortune-belt-title,
#view-charts .professional-bazi-viz .fortune-belt-title,
.professional-bazi-viz .fortune-belt-title {
  background: #ead8b5 !important;
  color: #5f4528 !important;
  border-right-color: rgba(118, 84, 48, 0.28) !important;
}

#view-chat .professional-bazi-viz .fortune-belt-track,
#view-charts .professional-bazi-viz .fortune-belt-track,
.professional-bazi-viz .fortune-belt-track {
  background: #f6edd7 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell,
#view-charts .professional-bazi-viz .fortune-belt-cell,
.professional-bazi-viz .fortune-belt-cell {
  background: #f8f1df !important;
  color: #2f2316 !important;
  border-right-color: rgba(118, 84, 48, 0.24) !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell p,
#view-chat .professional-bazi-viz .fortune-belt-cell small,
#view-chat .professional-bazi-viz .fortune-gz-line em,
#view-charts .professional-bazi-viz .fortune-belt-cell p,
#view-charts .professional-bazi-viz .fortune-belt-cell small,
#view-charts .professional-bazi-viz .fortune-gz-line em,
.professional-bazi-viz .fortune-belt-cell p,
.professional-bazi-viz .fortune-belt-cell small,
.professional-bazi-viz .fortune-gz-line em {
  color: #654b2f !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line .wx-wood,
#view-charts .professional-bazi-viz .fortune-gz-line .wx-wood,
.professional-bazi-viz .fortune-gz-line .wx-wood {
  color: #2eb67d !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line .wx-fire,
#view-charts .professional-bazi-viz .fortune-gz-line .wx-fire,
.professional-bazi-viz .fortune-gz-line .wx-fire {
  color: #ff5d4f !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line .wx-earth,
#view-charts .professional-bazi-viz .fortune-gz-line .wx-earth,
.professional-bazi-viz .fortune-gz-line .wx-earth {
  color: #c9a56a !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line .wx-metal,
#view-charts .professional-bazi-viz .fortune-gz-line .wx-metal,
.professional-bazi-viz .fortune-gz-line .wx-metal {
  color: #f5b400 !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line .wx-water,
#view-charts .professional-bazi-viz .fortune-gz-line .wx-water,
.professional-bazi-viz .fortune-gz-line .wx-water {
  color: #3f8cff !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line .wx-neutral,
#view-charts .professional-bazi-viz .fortune-gz-line .wx-neutral,
.professional-bazi-viz .fortune-gz-line .wx-neutral {
  color: #7a6b58 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell.is-current,
#view-charts .professional-bazi-viz .fortune-belt-cell.is-current,
.professional-bazi-viz .fortune-belt-cell.is-current {
  background: #e9dcc0 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell.is-selected,
#view-chat .professional-bazi-viz .fortune-belt-cell:hover,
#view-charts .professional-bazi-viz .fortune-belt-cell.is-selected,
#view-charts .professional-bazi-viz .fortune-belt-cell:hover,
.professional-bazi-viz .fortune-belt-cell.is-selected,
.professional-bazi-viz .fortune-belt-cell:hover {
  background: #e5d2ad !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell.is-out-range,
#view-charts .professional-bazi-viz .fortune-belt-cell.is-out-range,
.professional-bazi-viz .fortune-belt-cell.is-out-range {
  opacity: 0.84 !important;
}

/* ===== 八字盘神煞行样式 ===== */
#view-chat .professional-bazi-viz .bazi-pro-row.is-shensha .bazi-pro-label,
#view-charts .professional-bazi-viz .bazi-pro-row.is-shensha .bazi-pro-label,
.professional-bazi-viz .bazi-pro-row.is-shensha .bazi-pro-label {
  color: #5a4226 !important;
}

#view-chat .professional-bazi-viz .bazi-pro-row.is-shensha .bazi-pro-cell,
#view-charts .professional-bazi-viz .bazi-pro-row.is-shensha .bazi-pro-cell,
.professional-bazi-viz .bazi-pro-row.is-shensha .bazi-pro-cell {
  color: #4a341c !important;
}

#view-chat .professional-bazi-viz .pillar-shensha span,
#view-charts .professional-bazi-viz .pillar-shensha span,
.professional-bazi-viz .pillar-shensha span {
  border: 1px solid #b1884f !important;
  background: #e9d2a7 !important;
  color: #4a3318 !important;
  font-weight: 700 !important;
}

/* ===== Bazi container and card layout ===== */
#view-chat .professional-bazi-viz,
#view-charts .professional-bazi-viz,
.professional-bazi-viz {
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

#view-chat .professional-bazi-viz .bazi-pro-table-wrap,
#view-charts .professional-bazi-viz .bazi-pro-table-wrap,
.professional-bazi-viz .bazi-pro-table-wrap {
  width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

#view-chat .professional-bazi-viz .bazi-pro-table,
#view-charts .professional-bazi-viz .bazi-pro-table,
.professional-bazi-viz .bazi-pro-table {
  width: 100% !important;
  min-width: 0 !important;
}

#view-chat .professional-bazi-viz .bazi-pro-row,
#view-charts .professional-bazi-viz .bazi-pro-row,
.professional-bazi-viz .bazi-pro-row {
  grid-template-columns: 52px repeat(6, minmax(0, 1fr)) !important;
}

#view-chat .professional-bazi-viz .bazi-pro-label,
#view-chat .professional-bazi-viz .bazi-pro-cell,
#view-charts .professional-bazi-viz .bazi-pro-label,
#view-charts .professional-bazi-viz .bazi-pro-cell,
.professional-bazi-viz .bazi-pro-label,
.professional-bazi-viz .bazi-pro-cell {
  padding: 5px 3px !important;
  font-size: 11px !important;
  line-height: 1.22 !important;
}

#view-chat .professional-bazi-viz .bazi-pro-row.is-emphasized .bazi-pro-cell,
#view-charts .professional-bazi-viz .bazi-pro-row.is-emphasized .bazi-pro-cell,
.professional-bazi-viz .bazi-pro-row.is-emphasized .bazi-pro-cell {
  font-size: 13px !important;
}

#view-chat .professional-bazi-viz .hidden-stem-list,
#view-charts .professional-bazi-viz .hidden-stem-list,
.professional-bazi-viz .hidden-stem-list {
  gap: 2px !important;
}

#view-chat .professional-bazi-viz .hidden-stem-item i,
#view-charts .professional-bazi-viz .hidden-stem-item i,
.professional-bazi-viz .hidden-stem-item i {
  font-size: 10px !important;
}

#view-chat .professional-bazi-viz .pillar-shensha,
#view-charts .professional-bazi-viz .pillar-shensha,
.professional-bazi-viz .pillar-shensha {
  gap: 2px !important;
}

#view-chat .professional-bazi-viz .pillar-shensha span,
#view-charts .professional-bazi-viz .pillar-shensha span,
.professional-bazi-viz .pillar-shensha span {
  font-size: 10px !important;
  padding: 1px 4px !important;
}

#view-chat .professional-bazi-viz .fortune-belt-row,
#view-charts .professional-bazi-viz .fortune-belt-row,
.professional-bazi-viz .fortune-belt-row {
  grid-template-columns: 34px 1fr !important;
}

#view-chat .professional-bazi-viz .fortune-belt-title,
#view-charts .professional-bazi-viz .fortune-belt-title,
.professional-bazi-viz .fortune-belt-title {
  font-size: 10px !important;
  line-height: 1 !important;
  writing-mode: vertical-rl !important;
  text-orientation: upright !important;
  letter-spacing: 0 !important;
  justify-self: stretch !important;
  align-self: stretch !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#view-chat .professional-bazi-viz .fortune-belt-track,
#view-charts .professional-bazi-viz .fortune-belt-track,
.professional-bazi-viz .fortune-belt-track {
  grid-auto-columns: minmax(66px, 1fr) !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell,
#view-charts .professional-bazi-viz .fortune-belt-cell,
.professional-bazi-viz .fortune-belt-cell {
  padding: 4px 3px !important;
  gap: 2px !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell h6,
#view-charts .professional-bazi-viz .fortune-belt-cell h6,
.professional-bazi-viz .fortune-belt-cell h6 {
  font-size: 12px !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell p,
#view-chat .professional-bazi-viz .fortune-belt-cell small,
#view-charts .professional-bazi-viz .fortune-belt-cell p,
#view-charts .professional-bazi-viz .fortune-belt-cell small,
.professional-bazi-viz .fortune-belt-cell p,
.professional-bazi-viz .fortune-belt-cell small {
  font-size: 10px !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line,
#view-charts .professional-bazi-viz .fortune-gz-line,
.professional-bazi-viz .fortune-gz-line {
  gap: 2px !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line span,
#view-charts .professional-bazi-viz .fortune-gz-line span,
.professional-bazi-viz .fortune-gz-line span {
  font-size: 12px !important;
}

#view-chat .professional-bazi-viz .fortune-gz-line em,
#view-charts .professional-bazi-viz .fortune-gz-line em,
.professional-bazi-viz .fortune-gz-line em {
  font-size: 10px !important;
}

#view-chat .professional-bazi-viz .pillar-shensha-text,
#view-charts .professional-bazi-viz .pillar-shensha-text,
.professional-bazi-viz .pillar-shensha-text {
  display: none !important;
}

#view-chat .professional-bazi-viz .pillar-shensha-list,
#view-charts .professional-bazi-viz .pillar-shensha-list,
.professional-bazi-viz .pillar-shensha-list {
  display: grid !important;
  gap: 1px !important;
  justify-items: center !important;
}

#view-chat .professional-bazi-viz .pillar-shensha-line,
#view-charts .professional-bazi-viz .pillar-shensha-line,
.professional-bazi-viz .pillar-shensha-line {
  font-size: 9px !important;
  line-height: 1.22 !important;
  color: #4a341c !important;
  white-space: nowrap !important;
  letter-spacing: 0 !important;
}

/* ===== Fortune belt track ===== */
#view-chat .professional-bazi-viz .fortune-belt-track,
#view-charts .professional-bazi-viz .fortune-belt-track,
.professional-bazi-viz .fortune-belt-track {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-columns: unset !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  gap: 0 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-track::-webkit-scrollbar,
#view-charts .professional-bazi-viz .fortune-belt-track::-webkit-scrollbar,
.professional-bazi-viz .fortune-belt-track::-webkit-scrollbar {
  display: none !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell,
#view-charts .professional-bazi-viz .fortune-belt-cell,
.professional-bazi-viz .fortune-belt-cell {
  min-width: 0 !important;
  width: 100% !important;
  border-right-width: 1px !important;
}

@media (max-width: 520px) {
  #view-chat .professional-bazi-viz .fortune-belt-track,
  #view-charts .professional-bazi-viz .fortune-belt-track,
  .professional-bazi-viz .fortune-belt-track {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .meihua-hexagrams {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .meihua-hex-col {
    gap: 6px;
  }

  .meihua-hex-col h6 {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .meihua-hex-lines {
    min-height: 120px;
    padding: 7px;
    gap: 6px;
  }

  .meihua-stroke {
    width: 54px;
    gap: 4px;
  }

  .meihua-stroke i {
    height: 5px;
  }
}

/* ===== Fortune belt fixed five columns ===== */
#view-chat .professional-bazi-viz .fortune-belt-track.fixed-five,
#view-charts .professional-bazi-viz .fortune-belt-track.fixed-five,
.professional-bazi-viz .fortune-belt-track.fixed-five {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-columns: unset !important;
  overflow: visible !important;
}

#view-chat .professional-bazi-viz .fortune-belt-wrap,
#view-charts .professional-bazi-viz .fortune-belt-wrap,
.professional-bazi-viz .fortune-belt-wrap {
  gap: 8px !important;
}

#view-chat .professional-bazi-viz .fortune-belt-group,
#view-charts .professional-bazi-viz .fortune-belt-group,
.professional-bazi-viz .fortune-belt-group {
  display: grid !important;
  gap: 0 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-group .fortune-belt-row,
#view-charts .professional-bazi-viz .fortune-belt-group .fortune-belt-row,
.professional-bazi-viz .fortune-belt-group .fortune-belt-row {
  margin: 0 !important;
  border-radius: 0 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-group .fortune-belt-row + .fortune-belt-row,
#view-charts .professional-bazi-viz .fortune-belt-group .fortune-belt-row + .fortune-belt-row,
.professional-bazi-viz .fortune-belt-group .fortune-belt-row + .fortune-belt-row {
  border-top: 0 !important;
}

#view-chat .professional-bazi-viz .fortune-belt-group .fortune-belt-row:first-child,
#view-charts .professional-bazi-viz .fortune-belt-group .fortune-belt-row:first-child,
.professional-bazi-viz .fortune-belt-group .fortune-belt-row:first-child {
  border-top-left-radius: 14px !important;
  border-top-right-radius: 14px !important;
}

#view-chat .professional-bazi-viz .fortune-belt-group .fortune-belt-row:last-child,
#view-charts .professional-bazi-viz .fortune-belt-group .fortune-belt-row:last-child,
.professional-bazi-viz .fortune-belt-group .fortune-belt-row:last-child {
  border-bottom-left-radius: 14px !important;
  border-bottom-right-radius: 14px !important;
}

#view-chat .professional-bazi-viz .fortune-belt-cell.fortune-belt-cell-empty,
#view-charts .professional-bazi-viz .fortune-belt-cell.fortune-belt-cell-empty,
.professional-bazi-viz .fortune-belt-cell.fortune-belt-cell-empty {
  background: rgba(236, 223, 195, 0.5) !important;
  border-right-color: rgba(118, 84, 48, 0.18) !important;
  cursor: default !important;
}

#view-chat .professional-bazi-viz .fortune-belt-row + .fortune-belt-row .fortune-belt-title,
#view-charts .professional-bazi-viz .fortune-belt-row + .fortune-belt-row .fortune-belt-title,
.professional-bazi-viz .fortune-belt-row + .fortune-belt-row .fortune-belt-title {
  color: #5f4528 !important;
  font-weight: 700 !important;
  opacity: 1 !important;
}

/* ===== Bazi header cells ===== */
#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-row.bazi-pro-head .bazi-pro-label,
#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-row.bazi-pro-head .bazi-pro-cell,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-row.bazi-pro-head .bazi-pro-label,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-row.bazi-pro-head .bazi-pro-cell,
.professional-bazi-viz .bazi-pro-table .bazi-pro-row.bazi-pro-head .bazi-pro-label,
.professional-bazi-viz .bazi-pro-table .bazi-pro-row.bazi-pro-head .bazi-pro-cell {
  font-weight: 700 !important;
}

#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-row .bazi-pro-label,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-row .bazi-pro-label,
.professional-bazi-viz .bazi-pro-table .bazi-pro-row .bazi-pro-label {
  font-weight: 700 !important;
}

/* ===== Flow year and fortune columns ===== */
#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-cell.bazi-col-flow,
#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-cell.bazi-col-fortune,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-cell.bazi-col-flow,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-cell.bazi-col-fortune,
.professional-bazi-viz .bazi-pro-table .bazi-pro-cell.bazi-col-flow,
.professional-bazi-viz .bazi-pro-table .bazi-pro-cell.bazi-col-fortune {
  background: rgba(229, 210, 173, 0.52) !important;
}

/* ===== Bazi table cells ===== */
#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-label,
#view-chat .professional-bazi-viz .bazi-pro-table .bazi-pro-cell,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-label,
#view-charts .professional-bazi-viz .bazi-pro-table .bazi-pro-cell,
.professional-bazi-viz .bazi-pro-table .bazi-pro-label,
.professional-bazi-viz .bazi-pro-table .bazi-pro-cell {
  border-right-color: rgba(118, 84, 48, 0.32) !important;
}

/* ===== Fortune belt title ===== */
#view-chat .professional-bazi-viz .fortune-belt-title,
#view-charts .professional-bazi-viz .fortune-belt-title,
.professional-bazi-viz .fortune-belt-title {
  font-size: 11px !important;
  font-weight: 700 !important;
  background: transparent !important;
}

/* ===== Fortune belt rows ===== */
#view-chat .professional-bazi-viz .fortune-belt-row,
#view-charts .professional-bazi-viz .fortune-belt-row,
.professional-bazi-viz .fortune-belt-row {
  background: transparent !important;
}

#view-chat .professional-bazi-viz .fortune-belt-title,
#view-charts .professional-bazi-viz .fortune-belt-title,
.professional-bazi-viz .fortune-belt-title {
  background-image: none !important;
  box-shadow: none !important;
}

/* ===== Fortune metadata ===== */
#view-chat .professional-bazi-viz .fortune-meta,
#view-charts .professional-bazi-viz .fortune-meta,
.professional-bazi-viz .fortune-meta {
  padding: 6px 8px !important;
  gap: 3px !important;
}

#view-chat .professional-bazi-viz .fortune-meta p,
#view-charts .professional-bazi-viz .fortune-meta p,
.professional-bazi-viz .fortune-meta p {
  font-size: 11px !important;
  line-height: 1.35 !important;
}

#view-chat .professional-bazi-viz .wx-strip,
#view-charts .professional-bazi-viz .wx-strip,
.professional-bazi-viz .wx-strip {
  padding: 6px 2px !important;
  font-size: 11px !important;
  line-height: 1.15 !important;
}

/* ===== Ziwei base layout ===== */
#view-chat .ziwei-viz,
#view-charts .ziwei-viz,
.ziwei-viz {
  width: 100% !important;
  min-width: 0 !important;
  gap: 10px !important;
}

#view-chat .ziwei-viz .ziwei-meta-grid,
#view-charts .ziwei-viz .ziwei-meta-grid,
.ziwei-viz .ziwei-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

#view-chat .ziwei-viz .ziwei-meta-item,
#view-charts .ziwei-viz .ziwei-meta-item,
.ziwei-viz .ziwei-meta-item {
  display: grid;
  gap: 1px;
  border: 1px solid rgba(118, 84, 48, 0.24);
  border-radius: 8px;
  padding: 5px 7px;
  background: #f8f0de;
}

#view-chat .ziwei-viz .ziwei-meta-item strong,
#view-charts .ziwei-viz .ziwei-meta-item strong,
.ziwei-viz .ziwei-meta-item strong {
  font-size: 11px;
  line-height: 1.2;
  color: #5f4528;
  font-weight: 700;
}

#view-chat .ziwei-viz .ziwei-meta-item span,
#view-charts .ziwei-viz .ziwei-meta-item span,
.ziwei-viz .ziwei-meta-item span {
  font-size: 11px;
  line-height: 1.25;
  color: #3f2d19;
}

#view-chat .ziwei-viz .ziwei-board.enhanced,
#view-charts .ziwei-viz .ziwei-board.enhanced,
.ziwei-viz .ziwei-board.enhanced {
  gap: 6px !important;
}

#view-chat .ziwei-viz .ziwei-slot,
#view-charts .ziwei-viz .ziwei-slot,
.ziwei-viz .ziwei-slot {
  min-height: 84px !important;
  padding: 6px 6px 5px !important;
  border-color: rgba(118, 84, 48, 0.28) !important;
  background: #f8f1df !important;
  box-shadow: none !important;
}

#view-chat .ziwei-viz .ziwei-slot.is-life,
#view-charts .ziwei-viz .ziwei-slot.is-life,
.ziwei-viz .ziwei-slot.is-life {
  background: #f3e6ca !important;
  border-color: rgba(176, 130, 72, 0.58) !important;
  box-shadow: 0 0 0 1px rgba(176, 130, 72, 0.18) inset !important;
}

#view-chat .ziwei-viz .ziwei-slot.is-body,
#view-charts .ziwei-viz .ziwei-slot.is-body,
.ziwei-viz .ziwei-slot.is-body {
  background: #efe5cf !important;
  border-color: rgba(130, 108, 74, 0.52) !important;
  box-shadow: 0 0 0 1px rgba(130, 108, 74, 0.16) inset !important;
}

#view-chat .ziwei-viz .ziwei-slot h6,
#view-charts .ziwei-viz .ziwei-slot h6,
.ziwei-viz .ziwei-slot h6 {
  margin: 0 0 4px !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  color: #4a341c !important;
  font-weight: 700 !important;
}

#view-chat .ziwei-viz .slot-mark,
#view-charts .ziwei-viz .slot-mark,
.ziwei-viz .slot-mark,
#view-chat .ziwei-viz .slot-mark.alt,
#view-charts .ziwei-viz .slot-mark.alt,
.ziwei-viz .slot-mark.alt {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 1;
  border-radius: 8px;
  border-color: rgba(141, 101, 57, 0.42) !important;
  background: rgba(244, 230, 199, 0.92) !important;
  color: #5f4528 !important;
}

#view-chat .ziwei-viz .ziwei-stars,
#view-charts .ziwei-viz .ziwei-stars,
.ziwei-viz .ziwei-stars {
  display: grid;
  gap: 1px;
}

#view-chat .ziwei-viz .ziwei-star-line,
#view-charts .ziwei-viz .ziwei-star-line,
.ziwei-viz .ziwei-star-line {
  display: block;
  font-size: 11px;
  line-height: 1.2;
  color: #4b351d;
}

#view-chat .ziwei-viz .ziwei-star-line.is-transform,
#view-charts .ziwei-viz .ziwei-star-line.is-transform,
.ziwei-viz .ziwei-star-line.is-transform {
  color: #7d5524;
  font-weight: 700;
}

#view-chat .ziwei-viz .ziwei-star-line.is-empty,
#view-charts .ziwei-viz .ziwei-star-line.is-empty,
.ziwei-viz .ziwei-star-line.is-empty {
  color: #8a7051;
}

#view-chat .ziwei-viz .ziwei-slot-meta,
#view-charts .ziwei-viz .ziwei-slot-meta,
.ziwei-viz .ziwei-slot-meta {
  margin: 3px 0 0;
  font-size: 10px !important;
  line-height: 1.15;
  color: #856849 !important;
}

#view-chat .ziwei-viz .ziwei-center,
#view-charts .ziwei-viz .ziwei-center,
.ziwei-viz .ziwei-center {
  padding: 8px 9px !important;
  border: 1px dashed rgba(118, 84, 48, 0.34) !important;
  background: #f5ebd3 !important;
}

#view-chat .ziwei-viz .ziwei-center h6,
#view-charts .ziwei-viz .ziwei-center h6,
.ziwei-viz .ziwei-center h6 {
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  color: #4a341c;
  font-weight: 700;
}

#view-chat .ziwei-viz .ziwei-center p,
#view-charts .ziwei-viz .ziwei-center p,
.ziwei-viz .ziwei-center p {
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  color: #6a5134;
}

#view-chat .ziwei-viz .ziwei-solar-tags span,
#view-charts .ziwei-viz .ziwei-solar-tags span,
.ziwei-viz .ziwei-solar-tags span {
  background: rgba(236, 223, 195, 0.78) !important;
}

#view-chat .ziwei-viz .ziwei-transform-tags span,
#view-charts .ziwei-viz .ziwei-transform-tags span,
.ziwei-viz .ziwei-transform-tags span {
  background: rgba(229, 210, 173, 0.64) !important;
  border-color: rgba(141, 101, 57, 0.42) !important;
  color: #5f4528 !important;
}

@media (max-width: 640px) {
  #view-chat .ziwei-viz .ziwei-meta-grid,
  #view-charts .ziwei-viz .ziwei-meta-grid,
  .ziwei-viz .ziwei-meta-grid {
    grid-template-columns: 1fr;
  }

  #view-chat .ziwei-viz .ziwei-slot,
  #view-charts .ziwei-viz .ziwei-slot,
  .ziwei-viz .ziwei-slot {
    min-height: 76px !important;
  }
}

/* ===== Ziwei astrolabe layout ===== */
#view-chat .ziwei-astrolabe-viz,
#view-charts .ziwei-astrolabe-viz,
.ziwei-astrolabe-viz {
  gap: 8px !important;
}

#view-chat .ziwei-astrolabe-viz,
#view-charts .ziwei-astrolabe-viz,
.ziwei-astrolabe-viz {
  --zw-slot-min-height: clamp(76px, 10.5vw, 110px);
  --zw-star-font: clamp(10px, 1.2vw, 13px);
  --zw-star-line-min-height: clamp(10px, 1.3vw, 13px);
  --zw-title-font: clamp(13px, 1.9vw, 18px);
  --zw-meta-font: clamp(9px, 1.2vw, 11px);
  --zw-center-title-font: clamp(13px, 1.8vw, 16px);
  --zw-center-label-font: clamp(10px, 1.25vw, 12px);
  --zw-center-value-font: clamp(11px, 1.35vw, 13px);
}

#view-chat .ziwei-astrolabe-viz .astrolabe-board,
#view-charts .ziwei-astrolabe-viz .astrolabe-board,
.ziwei-astrolabe-viz .astrolabe-board {
  gap: 0 !important;
  border: 1px solid rgba(124, 147, 114, 0.45);
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(233, 241, 226, 0.98), rgba(219, 229, 210, 0.98)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 253, 245, 0.52),
    0 6px 14px rgba(69, 56, 37, 0.1);
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot,
#view-charts .ziwei-astrolabe-viz .ziwei-slot,
.ziwei-astrolabe-viz .ziwei-slot {
  min-height: var(--zw-slot-min-height) !important;
  padding: clamp(3px, 0.7vw, 6px) clamp(4px, 0.85vw, 7px) clamp(3px, 0.7vw, 5px) !important;
  position: relative;
  border: 0 !important;
  border-right: 1px solid rgba(124, 147, 114, 0.45) !important;
  border-bottom: 1px solid rgba(124, 147, 114, 0.45) !important;
  border-radius: 0 !important;
  background:
    linear-gradient(180deg, rgba(228, 237, 220, 0.98), rgba(220, 231, 211, 0.98)) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-1,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-1,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-1 {
  background: linear-gradient(180deg, rgba(223, 234, 215, 0.98), rgba(215, 227, 206, 0.98)) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-2,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-2,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-2 {
  background: linear-gradient(180deg, rgba(225, 236, 218, 0.98), rgba(217, 229, 209, 0.98)) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-3,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-3,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-3 {
  background: linear-gradient(180deg, rgba(224, 235, 217, 0.98), rgba(216, 228, 208, 0.98)) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-4,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-4,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-4 {
  background: linear-gradient(180deg, rgba(220, 232, 213, 0.98), rgba(212, 224, 205, 0.98)) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.is-life,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.is-life,
.ziwei-astrolabe-viz .ziwei-slot.is-life {
  box-shadow:
    0 0 0 1px rgba(83, 109, 72, 0.56) inset,
    inset 0 0 0 9999px rgba(86, 130, 77, 0.035) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.is-body,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.is-body,
.ziwei-astrolabe-viz .ziwei-slot.is-body {
  box-shadow:
    0 0 0 1px rgba(110, 85, 56, 0.5) inset,
    inset 0 0 0 9999px rgba(124, 91, 64, 0.035) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-body,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-body,
.ziwei-astrolabe-viz .ziwei-slot-body {
  display: grid;
  gap: 3px;
  align-content: start;
  padding-right: clamp(24px, 3.6vw, 38px);
  padding-bottom: clamp(18px, 3vw, 26px);
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-group,
#view-charts .ziwei-astrolabe-viz .ziwei-star-group,
.ziwei-astrolabe-viz .ziwei-star-group {
  display: grid;
  grid-template-columns: clamp(9px, 1.4vw, 12px) 1fr;
  align-items: start;
  column-gap: clamp(1px, 0.35vw, 3px);
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-group i,
#view-charts .ziwei-astrolabe-viz .ziwei-star-group i,
.ziwei-astrolabe-viz .ziwei-star-group i {
  font-style: normal;
  font-size: clamp(8px, 1.05vw, 10px);
  line-height: 1.1;
  color: #7e7469;
  font-weight: 700;
  padding-top: 1px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-group.group-major i,
#view-charts .ziwei-astrolabe-viz .ziwei-star-group.group-major i,
.ziwei-astrolabe-viz .ziwei-star-group.group-major i {
  color: #5d3a1e;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-group.group-minor i,
#view-charts .ziwei-astrolabe-viz .ziwei-star-group.group-minor i,
.ziwei-astrolabe-viz .ziwei-star-group.group-minor i {
  color: #4a6240;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-group.group-adjective i,
#view-charts .ziwei-astrolabe-viz .ziwei-star-group.group-adjective i,
.ziwei-astrolabe-viz .ziwei-star-group.group-adjective i {
  color: #6c6a5b;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-group-body,
#view-charts .ziwei-astrolabe-viz .ziwei-star-group-body,
.ziwei-astrolabe-viz .ziwei-star-group-body {
  display: grid;
  gap: 1px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line,
.ziwei-astrolabe-viz .ziwei-star-line {
  display: inline-flex;
  align-items: center;
  gap: clamp(1px, 0.2vw, 2px);
  min-height: var(--zw-star-line-min-height);
  font-size: var(--zw-star-font);
  line-height: 1;
  font-weight: 700;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.row-major,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.row-major,
.ziwei-astrolabe-viz .ziwei-star-line.row-major {
  font-weight: 800;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.row-minor,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.row-minor,
.ziwei-astrolabe-viz .ziwei-star-line.row-minor {
  font-weight: 700;
  opacity: 0.92;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.row-adjective,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.row-adjective,
.ziwei-astrolabe-viz .ziwei-star-line.row-adjective {
  font-weight: 600;
  opacity: 0.84;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-name,
#view-charts .ziwei-astrolabe-viz .ziwei-star-name,
.ziwei-astrolabe-viz .ziwei-star-name {
  letter-spacing: 0.01em;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-major,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-major,
.ziwei-astrolabe-viz .ziwei-star-line.tone-major {
  color: #5b2fa4;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-wood,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-wood,
.ziwei-astrolabe-viz .ziwei-star-line.tone-wood {
  color: #1570d2;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-fire,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-fire,
.ziwei-astrolabe-viz .ziwei-star-line.tone-fire {
  color: #d64258;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-metal,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-metal,
.ziwei-astrolabe-viz .ziwei-star-line.tone-metal {
  color: #2c45cf;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-earth,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-earth,
.ziwei-astrolabe-viz .ziwei-star-line.tone-earth {
  color: #2f6f1e;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-neutral,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-neutral,
.ziwei-astrolabe-viz .ziwei-star-line.tone-neutral {
  color: #66584a;
}

#view-chat .ziwei-astrolabe-viz .ziwei-star-line.tone-empty,
#view-charts .ziwei-astrolabe-viz .ziwei-star-line.tone-empty,
.ziwei-astrolabe-viz .ziwei-star-line.tone-empty {
  color: #9a938c;
  font-weight: 500;
}

#view-chat .ziwei-astrolabe-viz .ziwei-hua-badge,
#view-charts .ziwei-astrolabe-viz .ziwei-hua-badge,
.ziwei-astrolabe-viz .ziwei-hua-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(10px, 1.35vw, 14px);
  height: clamp(10px, 1.35vw, 14px);
  border-radius: 3px;
  font-style: normal;
  font-weight: 700;
  font-size: clamp(8px, 0.95vw, 10px);
  line-height: 1;
  border: 1px solid rgba(54, 44, 30, 0.35);
  background: rgba(255, 255, 255, 0.72);
  color: #3f2d19;
}

#view-chat .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\7984,
#view-charts .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\7984,
.ziwei-astrolabe-viz .ziwei-hua-badge.hua-\7984 {
  background: #f1c75d;
  color: #473208;
}

#view-chat .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\6743,
#view-charts .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\6743,
.ziwei-astrolabe-viz .ziwei-hua-badge.hua-\6743 {
  background: #87b4f8;
  color: #163c77;
}

#view-chat .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\79d1,
#view-charts .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\79d1,
.ziwei-astrolabe-viz .ziwei-hua-badge.hua-\79d1 {
  background: #9ed38d;
  color: #24561a;
}

#view-chat .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\5fcc,
#view-charts .ziwei-astrolabe-viz .ziwei-hua-badge.hua-\5fcc,
.ziwei-astrolabe-viz .ziwei-hua-badge.hua-\5fcc {
  background: #e59f9f;
  color: #6b2323;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-foot,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-foot,
.ziwei-astrolabe-viz .ziwei-slot-foot {
  position: absolute;
  left: clamp(4px, 0.85vw, 7px);
  right: clamp(4px, 0.85vw, 7px);
  bottom: clamp(3px, 0.7vw, 6px);
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px;
  z-index: 2;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-foot strong,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-foot strong,
.ziwei-astrolabe-viz .ziwei-slot-foot strong {
  font-size: var(--zw-title-font);
  line-height: 1;
  color: #2d3b63;
  font-weight: 700;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-foot span,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-foot span,
.ziwei-astrolabe-viz .ziwei-slot-foot span {
  font-size: var(--zw-meta-font);
  line-height: 1;
  color: #6d3b83;
  font-weight: 700;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-meta-line,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-meta-line,
.ziwei-astrolabe-viz .ziwei-slot-meta-line {
  position: absolute;
  top: clamp(3px, 0.7vw, 6px);
  right: clamp(4px, 0.85vw, 7px);
  margin: 0;
  display: grid;
  justify-items: end;
  gap: 1px;
  text-align: right;
  z-index: 2;
  padding: 1px 3px;
  border-radius: 6px;
  background: rgba(248, 241, 223, 0.72);
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-meta-line em,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-meta-line em,
.ziwei-astrolabe-viz .ziwei-slot-meta-line em {
  font-style: normal;
  font-size: var(--zw-meta-font);
  line-height: 1;
  color: #6e6459;
  font-weight: 700;
}

#view-chat .ziwei-astrolabe-viz .astrolabe-center,
#view-charts .ziwei-astrolabe-viz .astrolabe-center,
.ziwei-astrolabe-viz .astrolabe-center {
  padding: 9px 10px !important;
  border: 0 !important;
  border-right: 1px solid rgba(124, 147, 114, 0.45) !important;
  border-bottom: 1px solid rgba(124, 147, 114, 0.45) !important;
  background: #e7efe8 !important;
  display: grid;
  gap: 8px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-more,
#view-charts .ziwei-astrolabe-viz .ziwei-center-more,
.ziwei-astrolabe-viz .ziwei-center-more {
  margin: 0;
  border: 1px dashed rgba(124, 147, 114, 0.42);
  border-radius: 6px;
  padding: 4px 6px;
  background: rgba(242, 248, 238, 0.72);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-more summary,
#view-charts .ziwei-astrolabe-viz .ziwei-center-more summary,
.ziwei-astrolabe-viz .ziwei-center-more summary {
  cursor: pointer;
  user-select: none;
  color: #5e6444;
  font-weight: 700;
  font-size: clamp(10px, 1.2vw, 12px);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-more[open] summary,
#view-charts .ziwei-astrolabe-viz .ziwei-center-more[open] summary,
.ziwei-astrolabe-viz .ziwei-center-more[open] summary {
  margin-bottom: 4px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-block,
#view-charts .ziwei-astrolabe-viz .ziwei-center-block,
.ziwei-astrolabe-viz .ziwei-center-block {
  display: grid;
  gap: 4px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-block h6,
#view-charts .ziwei-astrolabe-viz .ziwei-center-block h6,
.ziwei-astrolabe-viz .ziwei-center-block h6 {
  margin: 0;
  text-align: center;
  font-size: var(--zw-center-title-font);
  line-height: 1.05;
  font-weight: 700;
  color: #111;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-grid,
#view-charts .ziwei-astrolabe-viz .ziwei-center-grid,
.ziwei-astrolabe-viz .ziwei-center-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 8px;
  row-gap: 2px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-item,
#view-charts .ziwei-astrolabe-viz .ziwei-center-item,
.ziwei-astrolabe-viz .ziwei-center-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-item span,
#view-charts .ziwei-astrolabe-viz .ziwei-center-item span,
.ziwei-astrolabe-viz .ziwei-center-item span {
  color: #6a5134;
  font-size: var(--zw-center-label-font);
  line-height: 1.2;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-item strong,
#view-charts .ziwei-astrolabe-viz .ziwei-center-item strong,
.ziwei-astrolabe-viz .ziwei-center-item strong {
  color: #2f6f1e;
  font-size: var(--zw-center-value-font);
  line-height: 1.2;
  font-weight: 700;
}

#view-chat .ziwei-astrolabe-viz .ziwei-transform-tags span,
#view-charts .ziwei-astrolabe-viz .ziwei-transform-tags span,
.ziwei-astrolabe-viz .ziwei-transform-tags span {
  font-size: 11px;
  padding: 3px 8px;
}

@media (max-width: 900px) {
  #view-chat .ziwei-astrolabe-viz .ziwei-slot,
  #view-charts .ziwei-astrolabe-viz .ziwei-slot,
  .ziwei-astrolabe-viz .ziwei-slot {
    min-height: 114px !important;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-star-line,
  #view-charts .ziwei-astrolabe-viz .ziwei-star-line,
  .ziwei-astrolabe-viz .ziwei-star-line {
    font-size: 13px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-slot-foot strong,
  #view-charts .ziwei-astrolabe-viz .ziwei-slot-foot strong,
  .ziwei-astrolabe-viz .ziwei-slot-foot strong {
    font-size: 18px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-center-block h6,
  #view-charts .ziwei-astrolabe-viz .ziwei-center-block h6,
  .ziwei-astrolabe-viz .ziwei-center-block h6 {
    font-size: 19px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-center-item span,
  #view-charts .ziwei-astrolabe-viz .ziwei-center-item span,
  .ziwei-astrolabe-viz .ziwei-center-item span {
    font-size: 12px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-center-item strong,
  #view-charts .ziwei-astrolabe-viz .ziwei-center-item strong,
  .ziwei-astrolabe-viz .ziwei-center-item strong {
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  #view-chat .ziwei-astrolabe-viz .astrolabe-board,
  #view-charts .ziwei-astrolabe-viz .astrolabe-board,
  .ziwei-astrolabe-viz .astrolabe-board {
    border-radius: 8px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-slot,
  #view-charts .ziwei-astrolabe-viz .ziwei-slot,
  .ziwei-astrolabe-viz .ziwei-slot {
    min-height: 92px !important;
    padding: 4px 4px 4px !important;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-star-line,
  #view-charts .ziwei-astrolabe-viz .ziwei-star-line,
  .ziwei-astrolabe-viz .ziwei-star-line {
    font-size: 11px;
    min-height: 12px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-slot-foot strong,
  #view-charts .ziwei-astrolabe-viz .ziwei-slot-foot strong,
  .ziwei-astrolabe-viz .ziwei-slot-foot strong {
    font-size: 14px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-slot-foot span,
  #view-charts .ziwei-astrolabe-viz .ziwei-slot-foot span,
  .ziwei-astrolabe-viz .ziwei-slot-foot span {
    font-size: 9px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-star-group,
  #view-charts .ziwei-astrolabe-viz .ziwei-star-group,
  .ziwei-astrolabe-viz .ziwei-star-group {
    grid-template-columns: 10px 1fr;
    column-gap: 2px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-star-group i,
  #view-charts .ziwei-astrolabe-viz .ziwei-star-group i,
  .ziwei-astrolabe-viz .ziwei-star-group i {
    font-size: 9px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-slot-meta-line em,
  #view-charts .ziwei-astrolabe-viz .ziwei-slot-meta-line em,
  .ziwei-astrolabe-viz .ziwei-slot-meta-line em {
    font-size: 9px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-center-grid,
  #view-charts .ziwei-astrolabe-viz .ziwei-center-grid,
  .ziwei-astrolabe-viz .ziwei-center-grid {
    grid-template-columns: 1fr;
    row-gap: 1px;
  }

  #view-chat .ziwei-astrolabe-viz .ziwei-center-block h6,
  #view-charts .ziwei-astrolabe-viz .ziwei-center-block h6,
  .ziwei-astrolabe-viz .ziwei-center-block h6 {
    font-size: 15px;
  }
}

/* ===== Global home button ===== */
.global-home-btn {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: var(--corner-right-gap, calc(16px + env(safe-area-inset-right)));
  z-index: 60;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(151, 56, 41, 0.68);
  background: linear-gradient(180deg, rgba(182, 71, 50, 0.94), rgba(149, 49, 34, 0.95));
  color: #fff2de;
  font-size: 0;
  box-shadow:
    0 8px 16px rgba(80, 27, 19, 0.24),
    inset 0 1px 0 rgba(255, 221, 189, 0.34);
  cursor: pointer;
}

.global-home-btn.hidden {
  display: none !important;
  pointer-events: none;
}

.global-home-btn .home-icon {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: #fff2de;
  transform: translateX(-1px);
}

.global-home-btn .home-icon.is-back {
  position: relative;
  width: 56%;
  height: 56%;
  min-width: 18px;
  min-height: 18px;
  display: block;
  margin: 0 auto;
  font-size: 0;
  color: transparent;
  transform: none;
}

.global-home-btn .home-icon.is-back::before,
.global-home-btn .home-icon.is-back::after {
  content: "";
  position: absolute;
  background: #fff2de;
  border-radius: 999px;
}

/* ===== Back icon arrow ===== */
.global-home-btn .home-icon.is-back::before {
  left: 45%;
  top: 50%;
  width: 46%;
  height: 16%;
  transform: translate(-50%, -118%) rotate(-50deg);
}

.global-home-btn .home-icon.is-back::after {
  left: 45%;
  top: 50%;
  width: 46%;
  height: 16%;
  transform: translate(-50%, 18%) rotate(50deg);
}

.global-home-btn.is-user-entry {
  border-color: rgba(151, 56, 41, 0.76);
  background: linear-gradient(180deg, rgba(186, 69, 49, 0.95), rgba(149, 49, 34, 0.96));
  box-shadow:
    0 8px 16px rgba(80, 27, 19, 0.24),
    inset 0 1px 0 rgba(255, 221, 189, 0.34);
}

.global-home-btn.is-user-entry .home-icon {
  position: relative;
  width: 58%;
  height: 58%;
  min-width: 18px;
  min-height: 18px;
  border-radius: 0;
  background: transparent;
  color: transparent;
  transform: none;
  overflow: visible;
  display: block;
  margin: 0 auto;
}

.global-home-btn.is-user-entry .home-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3%;
  width: 36%;
  height: 36%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  transform: translateX(-50%);
}

.global-home-btn.is-user-entry .home-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: 74%;
  height: 46%;
  border-radius: 999px 999px 58% 58%;
  background: rgba(255, 255, 255, 0.98);
  transform: translateX(-50%);
}

.global-home-btn:hover {
  filter: brightness(1.02);
}

.global-home-btn:active {
  filter: brightness(0.98);
}

@media (max-width: 640px) {
  .global-home-btn {
    top: calc(12px + env(safe-area-inset-top));
    width: 34px;
    height: 34px;
  }

  .global-home-btn .home-icon {
    font-size: 16px;
  }

  .global-home-btn .home-icon.is-back {
    min-width: 16px;
    min-height: 16px;
  }

  .global-home-btn.is-user-entry .home-icon {
    min-width: 16px;
    min-height: 16px;
  }
}

/* ===== Home grid responsive layout ===== */
#view-home .home-grid {
  /* Home grid column width */
  grid-template-columns: minmax(0, clamp(118px, 30vw, 136px));
  gap: clamp(10px, 2.2vw, 14px);
}

#view-home .home-card h3,
#view-home .home-secondary-actions .home-side-entry-title {
  font-size: clamp(26px, 5.1vw, 34px);
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  line-height: 1.08;
}

@media (max-width: 460px) {
  #view-home .home-grid {
    gap: 14px;
  }

  #view-home .home-card h3,
  #view-home .home-secondary-actions .home-side-entry-title {
    font-size: clamp(24px, 8.4vw, 32px);
    letter-spacing: 0.18em;
    text-indent: 0.18em;
  }
}

/* ===== Shared subview page layout ===== */
#view-chat.subview-page,
#view-charts.subview-page,
#view-chart-result.subview-page,
#view-sessions.subview-page {
  gap: 8px;
}

#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-sessions .sessions-panel {
  padding-top: 8px;
}

#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-chart-editor .chart-record-editor-panel,
#view-sessions .sessions-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#view-chart-result .chart-record-result {
  background: transparent !important;
  border-color: transparent !important;
}

#chat-export.chart-add-icon-btn,
#chat-reset.chart-add-icon-btn,
#chart-record-add.chart-add-icon-btn {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: var(--corner-left-gap, calc(16px + env(safe-area-inset-left)));
  z-index: 60;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(59, 99, 176, 0.68);
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95));
  box-shadow:
    0 8px 16px rgba(38, 64, 118, 0.24),
    inset 0 1px 0 rgba(202, 224, 255, 0.36);
  color: #eef5ff;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#chat-export.chart-add-icon-btn.hidden,
#chat-reset.chart-add-icon-btn.hidden,
#chart-record-add.chart-add-icon-btn.hidden {
  display: none !important;
  pointer-events: none;
}

#sessions-clear-icon.chart-add-icon-btn {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: var(--corner-left-gap, calc(16px + env(safe-area-inset-left)));
  z-index: 60;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(59, 99, 176, 0.68);
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95));
  box-shadow:
    0 8px 16px rgba(38, 64, 118, 0.24),
    inset 0 1px 0 rgba(202, 224, 255, 0.36);
  color: #eef5ff;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

#sessions-clear-icon.chart-add-icon-btn.hidden {
  display: none !important;
  pointer-events: none;
}

#sessions-clear-icon.chart-add-icon-btn .chart-record-action-icon {
  width: 58%;
  height: 58%;
}

#sessions-clear-icon.chart-add-icon-btn .chart-record-action-icon--minus::before {
  width: 78%;
  height: 14%;
}

#sessions-clear-icon.chart-add-icon-btn:hover {
  filter: brightness(1.02);
}

#sessions-clear-icon.chart-add-icon-btn:active {
  filter: brightness(0.98);
}

#chat-export.chart-add-icon-btn .chat-export-icon,
#chat-reset.chart-add-icon-btn .chat-reset-icon,
#chart-record-add.chart-add-icon-btn .chat-reset-icon {
  display: block;
  position: relative;
  width: 58%;
  height: 58%;
  min-width: 18px;
  min-height: 18px;
  color: transparent;
  font-size: 0;
  line-height: 0;
  transform: none;
}

#chat-reset.chart-add-icon-btn .chat-reset-icon::before,
#chat-reset.chart-add-icon-btn .chat-reset-icon::after,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::before,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78%;
  height: 12%;
  border-radius: 999px;
  background: #eef5ff;
  transform: translate(-50%, -50%);
}

#chat-reset.chart-add-icon-btn .chat-reset-icon::after,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

#chat-export.chart-add-icon-btn .chat-export-icon {
  background:
    center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v10M8 10l4 4 4-4M5 18h14' fill='none' stroke='%23eef5ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#chat-reset.chart-add-icon-btn:hover,
#chat-export.chart-add-icon-btn:hover,
#chart-record-add.chart-add-icon-btn:hover {
  filter: brightness(1.02);
}

#chat-reset.chart-add-icon-btn:active,
#chat-export.chart-add-icon-btn:active,
#chart-record-add.chart-add-icon-btn:active {
  filter: brightness(0.98);
}

@media (max-width: 640px) {
  #chat-export.chart-add-icon-btn,
  #chat-reset.chart-add-icon-btn,
  #chart-record-add.chart-add-icon-btn {
    top: calc(12px + env(safe-area-inset-top));
    left: var(--corner-left-gap, calc(12px + env(safe-area-inset-left)));
    width: 34px;
    height: 34px;
  }

  #sessions-clear-icon.chart-add-icon-btn {
    top: calc(12px + env(safe-area-inset-top));
    left: var(--corner-left-gap, calc(12px + env(safe-area-inset-left)));
    width: 34px;
    height: 34px;
  }

  #chat-export.chart-add-icon-btn .chat-export-icon,
  #chat-reset.chart-add-icon-btn .chat-reset-icon,
  #chart-record-add.chart-add-icon-btn .chat-reset-icon {
    min-width: 16px;
    min-height: 16px;
  }
}

#chat-export.chart-add-icon-btn.is-export-feedback::after {
  content: attr(data-export-feedback);
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  z-index: 2;
  min-width: max-content;
  max-width: 180px;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(96, 73, 50, 0.18);
  background: rgba(255, 252, 245, 0.96);
  color: rgba(79, 54, 31, 0.94);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 10px 20px rgba(52, 38, 25, 0.16);
  pointer-events: none;
  white-space: nowrap;
}

.subview-titlebar--action .subview-titlebar-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.subview-titlebar-action > #chat-reset.chart-add-icon-btn {
  order: 1;
}

.subview-titlebar-action > #chat-export.chart-add-icon-btn {
  order: 2;
}

@media (min-aspect-ratio: 1/1) {
  .subview-titlebar-action > #chat-export.chart-add-icon-btn {
    order: 0;
  }

  #chat-export.chart-add-icon-btn.is-export-feedback::after {
    right: calc(100% + 8px);
    left: auto;
  }
}

@media (max-aspect-ratio: 1/1) {
  #view-chat .subview-titlebar--action .subview-titlebar-action {
    right: auto !important;
    left: 0 !important;
    width: 88px;
    min-width: 88px;
    justify-content: flex-start;
  }

  #view-chat .subview-titlebar-action > #chat-reset.chart-add-icon-btn {
    position: fixed !important;
    top: calc(12px + env(safe-area-inset-top)) !important;
    right: auto !important;
    bottom: auto !important;
    left: var(--corner-left-gap, calc(12px + env(safe-area-inset-left))) !important;
    z-index: 80 !important;
    margin: 0 !important;
  }

  #view-chat .subview-titlebar-action > #chat-export.chart-add-icon-btn {
    position: fixed !important;
    top: calc(12px + env(safe-area-inset-top)) !important;
    right: auto !important;
    bottom: auto !important;
    left: calc(var(--corner-left-gap, calc(12px + env(safe-area-inset-left))) + 46px) !important;
    z-index: 80 !important;
    margin: 0 !important;
  }
}

/* ===== Corner spacing and safe area ===== */
:root {
  --corner-gap: clamp(12px, 3vw, 16px);
  --corner-safe-inset: max(env(safe-area-inset-left), env(safe-area-inset-right));
  --corner-left-gap: calc(var(--corner-gap) + var(--corner-safe-inset));
  --corner-right-gap: calc(var(--corner-gap) + var(--corner-safe-inset));
}

#view-chat.app-view,
#view-charts.app-view,
#view-chart-result.app-view,
#view-chart-editor.app-view,
#view-sessions.app-view {
  padding-left: var(--corner-left-gap);
  padding-right: var(--corner-right-gap);
}

#view-chat.subview-page,
#view-charts.subview-page,
#view-chart-result.subview-page,
#view-chart-editor.subview-page,
#view-sessions.subview-page {
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
}

#view-chat .mobile-chat-panel,
#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-chart-editor .chart-record-editor-panel,
#view-sessions .sessions-panel {
  inline-size: 100%;
  max-inline-size: 100%;
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  justify-self: stretch;
}

/* ===== Shared panel horizontal padding ===== */
#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-chart-editor .chart-record-editor-panel,
#view-sessions .sessions-panel {
  padding-left: clamp(12px, 3vw, 16px);
  padding-right: clamp(12px, 3vw, 16px);
}

/* ===== Shared panel edge alignment ===== */
#view-chat .mobile-chat-panel,
#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-chart-editor .chart-record-editor-panel,
#view-sessions .sessions-panel {
  margin-inline: 0;
}

/* ===== Shared panel grid ===== */
#view-chart-editor .chart-record-editor-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-content: start;
}

#view-chart-editor .chart-record-form {
  margin: 0;
}

/* ===== Chart editor enter animation ===== */
#view-chart-editor:not(.hidden) {
  animation: chart-editor-enter 180ms ease-out;
}

/* ===== Final scene cleanup: unify portrait and landscape ===== */
body {
  background: linear-gradient(180deg, #ead8b5 0%, #debf88 100%);
}

.aurora,
.noise {
  display: none;
}

.mobile-app-shell {
  width: 100vw !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  aspect-ratio: auto !important;
  background: transparent !important;
}

.mobile-app-shell::before,
.mobile-app-shell::after,
.app-viewport::before {
  content: none !important;
  display: none !important;
}

.app-viewport {
  background-image: var(--scene-bg-image) !important;
  background-repeat: no-repeat !important;
  background-position: var(--scene-bg-focus) !important;
  background-size: cover !important;
}

#view-chat .mobile-chat-panel {
  border-radius: 18px !important;
  padding: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

#view-chat .chat-input,
#view-chat .input-form-panel,
#view-chat #result-panel {
  width: 100% !important;
  margin: 0 !important;
}

#view-chat .chat-input {
  padding: 6px !important;
  align-items: center;
  gap: 10px !important;
  border: 1px solid rgba(118, 84, 49, 0.34) !important;
  border-radius: 14px !important;
}

#view-chat .chat-input input {
  min-height: 40px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#view-chat .chat-input button {
  min-height: 40px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 192, 0.36),
    0 5px 12px rgba(110, 39, 27, 0.12) !important;
}

/* ===== Home view bottom safe area ===== */
#view-home.app-view {
  padding-bottom: calc(clamp(10px, 2.6vw, 14px) + env(safe-area-inset-bottom) + 35px);
}

/* ===== 紫微盘版心宽度 ===== */
#view-chat .ziwei-astrolabe-viz .astrolabe-board,
#view-charts .ziwei-astrolabe-viz .astrolabe-board,
.ziwei-astrolabe-viz .astrolabe-board {
  width: min(100%, 560px);
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 700px) {
  #view-chat .ziwei-board.enhanced,
  #view-charts .ziwei-board.enhanced,
  .ziwei-board.enhanced {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-areas:
      "a1 a2 a3 a4"
      "b1 cc cc b4"
      "c1 cc cc c4"
      "d1 d2 d3 d4" !important;
  }
}

/* ===== 紫微盘样式 ===== */
#view-chat .ziwei-astrolabe-viz,
#view-charts .ziwei-astrolabe-viz,
.ziwei-astrolabe-viz {
  --zw-board-border: rgba(118, 84, 48, 0.34);
  --zw-cell-border: rgba(118, 84, 48, 0.24);
  --zw-board-bg: #f3e7cb;
  --zw-cell-bg: #f8f1df;
  --zw-cell-bg-2: #f6edd7;
  --zw-text: #2f2316;
  --zw-muted: #654b2f;
  --zw-accent: #8d3f2f;
  --zw-gugong-blue: #2d3b63;
}

#view-chat .ziwei-astrolabe-viz .astrolabe-board,
#view-charts .ziwei-astrolabe-viz .astrolabe-board,
.ziwei-astrolabe-viz .astrolabe-board {
  border-color: var(--zw-board-border) !important;
  background: linear-gradient(180deg, rgba(250, 239, 217, 0.82), rgba(235, 215, 182, 0.8)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 231, 0.58),
    0 6px 14px rgba(69, 56, 37, 0.1) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot,
#view-charts .ziwei-astrolabe-viz .ziwei-slot,
.ziwei-astrolabe-viz .ziwei-slot {
  border-right-color: var(--zw-cell-border) !important;
  border-bottom-color: var(--zw-cell-border) !important;
  background: var(--zw-cell-bg) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-1,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-1,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-1 {
  background: #f8f1df !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-2,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-2,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-2 {
  background: #f7eedb !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-3,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-3,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-3 {
  background: #f6ecd6 !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.palace-tone-4,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.palace-tone-4,
.ziwei-astrolabe-viz .ziwei-slot.palace-tone-4 {
  background: #f5ead2 !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.is-life,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.is-life,
.ziwei-astrolabe-viz .ziwei-slot.is-life {
  box-shadow: none !important;
  border-right-color: var(--zw-cell-border) !important;
  border-bottom-color: var(--zw-cell-border) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.is-body,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.is-body,
.ziwei-astrolabe-viz .ziwei-slot.is-body {
  box-shadow: none !important;
  border-right-color: var(--zw-cell-border) !important;
  border-bottom-color: var(--zw-cell-border) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.is-focus,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.is-focus,
.ziwei-astrolabe-viz .ziwei-slot.is-focus {
  box-shadow: inset 0 0 0 9999px rgba(45, 59, 99, 0.075) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot.is-focus-rel,
#view-charts .ziwei-astrolabe-viz .ziwei-slot.is-focus-rel,
.ziwei-astrolabe-viz .ziwei-slot.is-focus-rel {
  box-shadow: inset 0 0 0 9999px rgba(45, 59, 99, 0.04) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-foot strong,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-foot strong,
.ziwei-astrolabe-viz .ziwei-slot-foot strong {
  color: var(--zw-accent) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-foot span,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-foot span,
.ziwei-astrolabe-viz .ziwei-slot-foot span {
  color: var(--zw-gugong-blue) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-marker,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-marker,
.ziwei-astrolabe-viz .ziwei-slot-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 0 5px;
  height: 1.1em;
  border-radius: 999px;
  font-style: normal;
  font-weight: 700;
  font-size: 0.62em;
  line-height: 1;
  color: rgba(45, 59, 99, 0.78);
  background: rgba(255, 248, 231, 0.72);
  border: 1px solid rgba(118, 84, 48, 0.28);
}

#view-chat .ziwei-astrolabe-viz .ziwei-slot-meta-line em,
#view-charts .ziwei-astrolabe-viz .ziwei-slot-meta-line em,
.ziwei-astrolabe-viz .ziwei-slot-meta-line em {
  color: var(--zw-muted) !important;
}

#view-chat .ziwei-astrolabe-viz .astrolabe-center,
#view-charts .ziwei-astrolabe-viz .astrolabe-center,
.ziwei-astrolabe-viz .astrolabe-center {
  border-right-color: var(--zw-cell-border) !important;
  border-bottom-color: var(--zw-cell-border) !important;
  background: var(--zw-cell-bg-2) !important;
  align-content: start !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-brief,
#view-charts .ziwei-astrolabe-viz .ziwei-center-brief,
.ziwei-astrolabe-viz .ziwei-center-brief {
  display: grid;
  gap: 4px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-brief-item,
#view-charts .ziwei-astrolabe-viz .ziwei-brief-item,
.ziwei-astrolabe-viz .ziwei-brief-item {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: baseline;
}

#view-chat .ziwei-astrolabe-viz .ziwei-brief-item span,
#view-charts .ziwei-astrolabe-viz .ziwei-brief-item span,
.ziwei-astrolabe-viz .ziwei-brief-item span {
  font-size: var(--zw-meta-font);
  color: var(--zw-muted);
  font-weight: 700;
  white-space: nowrap;
}

#view-chat .ziwei-astrolabe-viz .ziwei-brief-item strong,
#view-charts .ziwei-astrolabe-viz .ziwei-brief-item strong,
.ziwei-astrolabe-viz .ziwei-brief-item strong {
  font-size: var(--zw-meta-font);
  color: var(--zw-text);
  font-weight: 700;
  text-align: right;
}

#view-chat .ziwei-astrolabe-viz .ziwei-brief-item.is-bazi,
#view-charts .ziwei-astrolabe-viz .ziwei-brief-item.is-bazi,
.ziwei-astrolabe-viz .ziwei-brief-item.is-bazi {
  grid-template-columns: 1fr;
  row-gap: 1px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-brief-item.is-bazi strong,
#view-charts .ziwei-astrolabe-viz .ziwei-brief-item.is-bazi strong,
.ziwei-astrolabe-viz .ziwei-brief-item.is-bazi strong {
  text-align: left;
  letter-spacing: 0.04em;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt,
.ziwei-astrolabe-viz .ziwei-center-belt {
  display: grid;
  gap: 6px;
  width: min(100%, 560px);
  margin-left: auto;
  margin-right: auto;
  margin-top: 10px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-row,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-row,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-row {
  grid-template-columns: 44px 1fr;
  border-color: var(--zw-cell-border);
  border-radius: 10px;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-title,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-title,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-title {
  background: rgba(248, 241, 223, 0.84);
  border-right-color: var(--zw-cell-border);
  color: var(--zw-muted);
  font-size: var(--zw-meta-font);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-track,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-track,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-track {
  grid-auto-columns: minmax(74px, 1fr);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-track.fixed-five,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-track.fixed-five,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-track.fixed-five {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-columns: unset !important;
  overflow: visible !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell {
  background: rgba(255, 248, 231, 0.52);
  border-right-color: var(--zw-cell-border);
  padding: 4px 4px;
  gap: 2px;
  color: var(--zw-text);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell h6,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell h6,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell h6 {
  font-size: clamp(11px, 1.5vw, 13px);
  color: var(--zw-text);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell p,
#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell small,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell p,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell small,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell p,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell small {
  font-size: var(--zw-meta-font);
  color: var(--zw-muted);
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell.is-current,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell.is-current,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell.is-current {
  background: rgba(45, 59, 99, 0.11) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell.is-selected,
#view-chat .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell:hover,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell.is-selected,
#view-charts .ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell:hover,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell.is-selected,
.ziwei-astrolabe-viz .ziwei-center-belt .fortune-belt-cell:hover {
  background: rgba(141, 63, 47, 0.13) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-more,
#view-charts .ziwei-astrolabe-viz .ziwei-center-more,
.ziwei-astrolabe-viz .ziwei-center-more {
  border-color: rgba(118, 84, 48, 0.34) !important;
  background: rgba(248, 241, 223, 0.72) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-more summary,
#view-charts .ziwei-astrolabe-viz .ziwei-center-more summary,
.ziwei-astrolabe-viz .ziwei-center-more summary {
  color: #5f4528 !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-block h6,
#view-charts .ziwei-astrolabe-viz .ziwei-center-block h6,
.ziwei-astrolabe-viz .ziwei-center-block h6 {
  color: var(--zw-text) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-item span,
#view-charts .ziwei-astrolabe-viz .ziwei-center-item span,
.ziwei-astrolabe-viz .ziwei-center-item span {
  color: var(--zw-muted) !important;
}

#view-chat .ziwei-astrolabe-viz .ziwei-center-item strong,
#view-charts .ziwei-astrolabe-viz .ziwei-center-item strong,
.ziwei-astrolabe-viz .ziwei-center-item strong {
  color: var(--zw-text) !important;
}

@keyframes chart-editor-enter {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== UX refinement: hierarchy, consistency ===== */

#view-chat .mobile-chat-panel,
#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-chart-editor .chart-record-editor-panel,
#view-sessions .sessions-panel {
  background: linear-gradient(180deg, rgba(251, 242, 224, 0.95), rgba(240, 223, 191, 0.95));
  border: 1px solid rgba(118, 84, 49, 0.42);
}

#view-home .home-card h3,
#view-home .home-secondary-actions .home-side-entry-title {
  letter-spacing: 0.09em;
  text-indent: 0.09em;
}

@media (max-width: 460px) {
  #view-home .home-card h3,
  #view-home .home-secondary-actions .home-side-entry-title {
    letter-spacing: 0.08em;
    text-indent: 0.08em;
  }
}

.global-home-btn,
#chat-export.chart-add-icon-btn,
#chat-reset.chart-add-icon-btn,
#chat-reset.chat-reset-icon-btn,
#chart-record-add.chart-add-icon-btn,
#sessions-clear-icon.chart-add-icon-btn {
  width: 40px;
  height: 40px;
  box-shadow:
    0 6px 12px rgba(58, 41, 24, 0.24),
    inset 0 1px 0 rgba(255, 238, 210, 0.34);
}

@media (max-width: 640px) {
  .global-home-btn,
  #chat-export.chart-add-icon-btn,
  #chat-reset.chart-add-icon-btn,
  #chat-reset.chat-reset-icon-btn,
  #chart-record-add.chart-add-icon-btn,
  #sessions-clear-icon.chart-add-icon-btn {
    width: 38px;
    height: 38px;
  }
}

.empty-state-block {
  margin: 14vh auto 0;
  max-width: min(100%, 340px);
  text-align: center;
  line-height: 1.6;
  border: 1px dashed rgba(120, 84, 46, 0.45);
  border-radius: 14px;
  padding: 14px 12px;
  background: rgba(250, 241, 221, 0.9);
}

.empty-state-block:not(.hidden) {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.empty-state-action {
  min-width: 110px;
  min-height: 38px;
  padding: 8px 16px;
  font-size: 15px;
  line-height: 1;
  border-radius: 10px;
}

/* Desktop rail is hidden on mobile by default. */
.desktop-shell-nav {
  display: none;
}

@media (max-aspect-ratio: 1/1) {
  #view-home .home-card[data-home-action="auth"] {
    display: none !important;
  }
}

/* ===== Desktop UI logic (independent from mobile shell) ===== */
@media (min-aspect-ratio: 1/1) {
  .mobile-app-shell {
    width: 100vw;
    max-width: none;
    min-width: 0;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    grid-template-columns: clamp(182px, 20vw, 246px) minmax(0, 1fr);
    grid-template-rows: 1fr;
    overflow: hidden;
  }

  .desktop-shell-nav {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 20px;
    padding: 26px 18px 24px 14px;
    background: linear-gradient(180deg, rgba(246, 233, 208, 0.84), rgba(234, 215, 183, 0.7) 54%, rgba(231, 214, 185, 0.48));
    border-right: none;
    box-shadow: none;
    backdrop-filter: blur(8px) saturate(1.08);
    z-index: 3;
    min-height: 0;
    overflow: hidden;
  }

  .desktop-shell-nav::after {
    content: "";
    position: absolute;
    top: 0;
    right: -62px;
    width: 86px;
    height: 100%;
    background: linear-gradient(90deg, rgba(236, 219, 189, 0.92), rgba(236, 219, 189, 0.54) 38%, rgba(236, 219, 189, 0.14) 72%, transparent);
    pointer-events: none;
  }

  .desktop-brand {
    display: grid;
    gap: 4px;
    padding-left: 10px;
  }

  .desktop-brand h1 {
    margin: 0;
    font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
    font-size: 32px;
    letter-spacing: 0.08em;
    color: #2f2416;
  }

  .desktop-brand p {
    margin: 0;
    font-size: 12px;
    color: rgba(95, 74, 47, 0.88);
    line-height: 1.35;
  }

  .desktop-nav-list {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 0;
    padding-right: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .desktop-nav-btn {
    border: 1px solid rgba(112, 81, 46, 0.3);
    border-radius: 16px;
    padding: 14px 12px;
    background: linear-gradient(180deg, rgba(242, 222, 188, 0.74), rgba(225, 194, 152, 0.66));
    color: #342515;
    font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
    font-size: 26px;
    line-height: 1.08;
    letter-spacing: 0.08em;
    text-indent: 0.08em;
    text-align: center;
    position: relative;
    cursor: pointer;
    box-shadow:
      inset 0 1px 0 rgba(255, 247, 229, 0.64),
      0 8px 18px rgba(92, 64, 34, 0.08);
    transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  }

  .desktop-nav-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow:
      inset 0 1px 0 rgba(255, 248, 232, 0.72),
      0 10px 20px rgba(92, 64, 34, 0.1);
  }

  #chat-export {
    display: inline-flex !important;
    top: calc(20px + env(safe-area-inset-top));
    right: calc(20px + env(safe-area-inset-right));
    left: auto;
    z-index: 80;
  }

  .subview-titlebar--action {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding-right: 68px;
  }

  .subview-titlebar--action .subview-main-title {
    width: 100%;
  }

  .subview-titlebar--action .subview-titlebar-action {
    position: static;
    transform: none;
    min-width: 0;
    min-height: 0;
    pointer-events: auto;
    align-self: start;
  }

  .subview-titlebar-action > #chat-export.chart-add-icon-btn,
  .subview-titlebar-action > #chat-reset.chart-add-icon-btn,
  .subview-titlebar-action > #chart-record-add.chart-add-icon-btn,
  .subview-titlebar-action > #sessions-clear-icon.chart-add-icon-btn {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: auto;
  }

  #global-home-btn {
    display: none !important;
  }

  .app-viewport {
    min-width: 0;
    height: 100%;
    padding: 0;
    background-position: var(--scene-bg-focus) !important;
  }

  .app-view {
    padding:
      20px
      max(20px, env(safe-area-inset-right))
      20px
      max(20px, env(safe-area-inset-left));
  }

  #view-home,
  #view-home:not(.hidden),
  #view-home.app-view {
    display: grid;
    align-content: center;
    min-height: 100%;
    padding:
      26px
      max(26px, env(safe-area-inset-right))
      26px
      max(26px, env(safe-area-inset-left));
  }

  #view-home .home-grid {
    display: none;
  }

  #view-home .home-secondary-actions {
    display: none;
  }

  #view-home .home-card {
    min-height: 132px;
    border-radius: 18px;
  }

  #view-home .home-card h3 {
    font-size: clamp(34px, 3vw, 44px);
    letter-spacing: 0.08em;
    text-indent: 0.08em;
  }

  #view-chat.app-view,
  #view-charts.app-view,
  #view-chart-result.app-view,
  #view-chart-editor.app-view,
  #view-sessions.app-view {
    padding:
      20px
      max(20px, env(safe-area-inset-right))
      20px
      max(20px, env(safe-area-inset-left));
  }

  .subview-page {
    gap: 12px;
  }

  .subview-main-title {
    text-align: left;
    text-indent: 0;
    letter-spacing: 0.08em;
    font-size: clamp(34px, 2.6vw, 44px);
    padding-left: 6px;
  }

  #view-chat .mobile-chat-panel,
  #view-charts .chart-record-panel,
  #view-chart-result .chart-record-panel,
  #view-chart-editor .chart-record-editor-panel,
  #view-sessions .sessions-panel {
    height: 100%;
    min-height: 0;
    padding: 16px;
  }

  .empty-state-block {
    margin-top: 8vh;
  }
}

/* ===== Final tone sync ===== */
#view-chat .subview-main-title {
  color: rgba(61, 40, 17, 0.96) !important;
  text-shadow: 0 1px 0 rgba(255, 240, 214, 0.24) !important;
}

.global-home-btn,
#chat-export.chart-add-icon-btn,
#chat-reset.chart-add-icon-btn,
#chat-reset.chat-reset-icon-btn,
#chart-record-add.chart-add-icon-btn,
#sessions-clear-icon.chart-add-icon-btn {
  border-radius: 999px !important;
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.24),
    inset 0 1px 0 rgba(255, 244, 225, 0.26) !important;
  backdrop-filter: blur(10px) saturate(1.05);
}

.global-home-btn,
.global-home-btn.is-user-entry {
  border-color: rgba(128, 47, 34, 0.74) !important;
  background: linear-gradient(180deg, rgba(175, 67, 49, 0.94), rgba(129, 41, 30, 0.95)) !important;
}

#chat-export.chart-add-icon-btn,
#chat-reset.chat-reset-icon-btn,
#chart-record-add.chart-add-icon-btn,
#sessions-clear-icon.chart-add-icon-btn {
  border: 1px solid rgba(133, 97, 57, 0.58) !important;
  background: linear-gradient(180deg, rgba(238, 217, 181, 0.94), rgba(213, 176, 122, 0.95)) !important;
  color: rgba(59, 38, 20, 0.96) !important;
}

#chat-reset.chat-reset-icon-btn {
  font-size: 24px !important;
  font-weight: 400 !important;
}

#chat-export.chart-add-icon-btn,
#chart-record-add.chart-add-icon-btn,
#sessions-clear-icon.chart-add-icon-btn {
  border: 1px solid rgba(59, 99, 176, 0.68) !important;
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95)) !important;
  color: #eef5ff !important;
  box-shadow:
    0 8px 16px rgba(38, 64, 118, 0.24),
    inset 0 1px 0 rgba(202, 224, 255, 0.36) !important;
}

#chart-record-add.chart-add-icon-btn .chat-reset-icon::before,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::after,
#sessions-clear-icon.chart-add-icon-btn .chart-record-action-icon--minus::before {
  background: #eef5ff !important;
}

/* ===== Final chat background cleanup ===== */
/* ===== Final chat scroll fix ===== */
/* ===== Final chat send icon buttons ===== */
#view-chat #chat-send {
  flex: 0 0 auto !important;
  position: relative !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid rgba(133, 97, 57, 0.58) !important;
  background: linear-gradient(180deg, rgba(238, 217, 181, 0.94), rgba(213, 176, 122, 0.95)) !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: 0 !important;
  overflow: hidden !important;
  cursor: pointer !important;
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.2),
    inset 0 1px 0 rgba(255, 244, 225, 0.26) !important;
  backdrop-filter: blur(10px) saturate(1.05) !important;
  transition:
    transform 180ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease,
    filter 220ms ease !important;
}

#view-chat #chat-send::before,
#view-chat #chat-send::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
}

#view-chat #chat-send.is-send::before {
  width: 34%;
  height: 14%;
  border-radius: 999px;
  background: rgba(59, 38, 20, 0.96);
  transform: translate(-42%, -14%) rotate(-40deg);
}

#view-chat #chat-send.is-send::after {
  width: 22%;
  height: 22%;
  border-top: 3px solid rgba(59, 38, 20, 0.96);
  border-right: 3px solid rgba(59, 38, 20, 0.96);
  transform: translate(-2%, -62%) rotate(6deg);
}

#view-chat #chat-send.is-stop {
  border-color: rgba(128, 47, 34, 0.74) !important;
  background: linear-gradient(180deg, rgba(175, 67, 49, 0.94), rgba(129, 41, 30, 0.95)) !important;
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.24),
    inset 0 1px 0 rgba(255, 244, 225, 0.22) !important;
}

#view-chat #chat-send.is-stop::before {
  width: 34%;
  height: 34%;
  border-radius: 5px;
  background: rgba(255, 242, 222, 0.98);
  transform: translate(-50%, -50%);
}

#view-chat #chat-send.is-stop::after {
  width: 0;
  height: 0;
  border: 0;
  background: none;
  transform: translate(-50%, -50%);
}

#view-chat #chat-send:not(:disabled):hover {
  transform: translateY(-1px) !important;
  filter: brightness(1.02) !important;
}

#view-chat #chat-send:not(:disabled):active {
  transform: translateY(1px) scale(0.985) !important;
  filter: brightness(0.98) !important;
}

#view-chat #chat-send:focus-visible {
  outline: none !important;
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.24),
    inset 0 1px 0 rgba(255, 244, 225, 0.26),
    0 0 0 3px rgba(211, 168, 108, 0.24) !important;
}

#view-chat #chat-send.is-stop:focus-visible {
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.24),
    inset 0 1px 0 rgba(255, 244, 225, 0.22),
    0 0 0 3px rgba(182, 78, 60, 0.24) !important;
}

#view-chat #chat-send:disabled {
  cursor: default !important;
  filter: saturate(0.72) opacity(0.64) !important;
  box-shadow:
    0 6px 14px rgba(18, 10, 4, 0.08),
    inset 0 1px 0 rgba(255, 249, 239, 0.46) !important;
}

#view-chat #chat-send:disabled.is-send::before {
  background: rgba(115, 89, 60, 0.76);
}

#view-chat #chat-send:disabled.is-send::after {
  border-top-color: rgba(115, 89, 60, 0.76);
  border-right-color: rgba(115, 89, 60, 0.76);
}

@media (max-width: 480px) {
  #view-chat #chat-send {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }
}

/* ===== Final chat underlay alignment ===== */
@media (min-aspect-ratio: 1/1) {
  #view-chat.app-view {
    padding-top: 20px !important;
  }

  #view-chat.subview-page {
    gap: 8px !important;
  }

  #view-chat .subview-main-title {
    margin-bottom: 0 !important;
  }

  #view-chat .mobile-chat-panel {
    padding-top: 0 !important;
  }

}



/* ===== Final send arrow tone + weight ===== */
#view-chat #chat-send.is-send {
  border-color: rgba(133, 97, 57, 0.58) !important;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 248, 232, 0.24) 0, rgba(255, 248, 232, 0) 34%),
    linear-gradient(180deg, rgba(238, 217, 181, 0.94), rgba(213, 176, 122, 0.95)) !important;
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.2),
    inset 0 1px 0 rgba(255, 244, 225, 0.26),
    inset 0 -1px 0 rgba(122, 87, 50, 0.12) !important;
}

#view-chat #chat-send.is-send::before {
  width: 22px;
  height: 22px;
  background:
    center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20V5M7.2 9.8 12 5l4.8 4.8' fill='none' stroke='%238f2e24' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  transform: translate(-50%, calc(-50% - 1px));
}

#view-chat #chat-send.is-send::after {
  width: 0;
  height: 0;
  border: 0;
  background: none;
  transform: translate(-50%, -50%);
}

#view-chat #chat-send.is-send:not(:disabled):hover {
  border-color: rgba(148, 109, 66, 0.68) !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 250, 239, 0.28) 0, rgba(255, 250, 239, 0) 36%),
    linear-gradient(180deg, rgba(244, 224, 189, 0.98), rgba(221, 184, 128, 0.98)) !important;
}

#view-chat #chat-send.is-send:focus-visible {
  box-shadow:
    0 10px 22px rgba(18, 10, 4, 0.24),
    inset 0 1px 0 rgba(255, 244, 225, 0.26),
    inset 0 -1px 0 rgba(122, 87, 50, 0.12),
    0 0 0 3px rgba(211, 168, 108, 0.24) !important;
}

/* ===== Final chat structure ===== */
#view-chat,
.scroll-docked-view {
  --app-scrollbar-dock: 14px;
  --scroll-docked-dock: var(--app-scrollbar-dock);
  --scroll-rail-size: 10px;
  --scroll-rail-color: rgba(137, 99, 57, 0.68);
  --scroll-rail-track-color: rgba(246, 239, 226, 0.34);
  --scroll-rail-track: rgba(246, 239, 226, 0.3);
  --scroll-rail-track-border: 1px solid rgba(138, 102, 62, 0.14);
  --scroll-rail-track-margin: 10px 0 14px;
  --scroll-rail-thumb: linear-gradient(180deg, rgba(172, 127, 79, 0.92), rgba(132, 94, 53, 0.96));
  --scroll-rail-thumb-border: 2px solid rgba(246, 239, 226, 0.52);
  --scroll-rail-thumb-shadow: inset 0 1px 0 rgba(255, 248, 236, 0.24);
  --scroll-rail-thumb-hover: linear-gradient(180deg, rgba(183, 136, 86, 0.96), rgba(143, 101, 57, 0.98));
}

.scroll-docked-view {
  --scroll-docked-surface-radius: 16px;
  --scroll-docked-surface-background:
    linear-gradient(180deg, rgba(251, 242, 224, 0.95), rgba(240, 223, 191, 0.95));
  --scroll-docked-surface-border: rgba(118, 84, 49, 0.42);
  --scroll-docked-surface-shadow:
    inset 0 1px 0 rgba(255, 249, 236, 0.72),
    0 8px 18px rgba(58, 41, 24, 0.16);
  --scroll-docked-flow-padding-inline: 12px;
  --scroll-docked-flow-padding-top: 12px;
  --scroll-docked-flow-padding-bottom: 12px;
}

#view-charts,
#view-chart-result,
#view-sessions {
  --scroll-docked-flow-padding-top: 8px;
}

#view-chat {
  --chat-scrollbar-dock: var(--app-scrollbar-dock);
  --scroll-docked-dock: var(--chat-scrollbar-dock);
  --chat-underlay-bottom-gap: 0px;
  --chat-underlay-color: rgba(18, 14, 10, 0.18);
}

#view-chat .chat-log-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
}

.chat-scroll-bottom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(128, 47, 34, 0.36);
  background: linear-gradient(180deg, rgba(249, 241, 227, 0.96), rgba(233, 211, 176, 0.94));
  color: rgba(64, 43, 21, 0.96);
  font-size: 12px;
  line-height: 1;
  box-shadow:
    0 10px 24px rgba(50, 35, 20, 0.16),
    inset 0 1px 0 rgba(255, 250, 242, 0.74);
  cursor: pointer;
}

.chat-scroll-bottom:hover {
  filter: brightness(1.02);
}

.chat-scroll-bottom:active {
  filter: brightness(0.98);
}

#view-chat .chat-log-stage::before {
  content: "";
  position: absolute;
  inset: 0 0 var(--chat-underlay-bottom-gap) 0;
  border-radius: 20px;
  pointer-events: none;
}

#view-chat .chat-log,
.scroll-docked-host {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-rail-color) var(--scroll-rail-track-color);
}

#view-chat .chat-log {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#view-chat .chat-log::before {
  content: none !important;
  display: none !important;
}

#view-chat .chat-log-flow,
.scroll-docked-flow {
  position: relative;
  min-height: 100%;
  width: 100%;
  box-sizing: border-box;
}

#view-chat .chat-log-flow {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 10px;
  padding: 10px 0 8px;
}

#view-chat .chat-log-flow > * {
  position: relative;
  z-index: 1;
}

#view-chat .chat-msg.chat-widget {
  max-width: 100% !important;
}

:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions) .scroll-docked-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.scroll-docked-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: var(--scroll-docked-surface-radius);
}

.scroll-docked-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--scroll-docked-surface-radius);
  border: 1px solid var(--scroll-docked-surface-border);
  background: var(--scroll-docked-surface-background) !important;
  box-shadow: var(--scroll-docked-surface-shadow);
  pointer-events: none;
}

.scroll-docked-host {
  --scroll-docked-dock: var(--app-scrollbar-dock);
  touch-action: pan-y;
}

.scroll-docked-flow {
  padding:
    var(--scroll-docked-flow-padding-top)
    var(--scroll-docked-flow-padding-inline)
    var(--scroll-docked-flow-padding-bottom);
}

.scroll-docked-flow > * {
  position: relative;
  z-index: 1;
}

#view-chat .chat-embed-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#view-chat .chat-log::-webkit-scrollbar,
.scroll-docked-host::-webkit-scrollbar {
  width: var(--scroll-rail-size);
  height: var(--scroll-rail-size);
}

#view-chat .chat-log::-webkit-scrollbar-track,
.scroll-docked-host::-webkit-scrollbar-track {
  background: var(--scroll-rail-track);
  border-radius: 999px;
  border: var(--scroll-rail-track-border);
  margin: var(--scroll-rail-track-margin);
}

#view-chat .chat-log::-webkit-scrollbar-thumb,
.scroll-docked-host::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: var(--scroll-rail-thumb-border);
  background: var(--scroll-rail-thumb);
  box-shadow: var(--scroll-rail-thumb-shadow);
}

#view-chat .chat-log::-webkit-scrollbar-thumb:hover,
.scroll-docked-host::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-rail-thumb-hover);
}
/* ===== Final chat widget system ===== */
#view-chat {
  --chat-underlay-color: rgba(20, 15, 11, 0.4);
  --chat-widget-max-width: min(100%, 35rem);
  --chat-widget-surface:
    linear-gradient(180deg, rgba(252, 249, 243, 0.985), rgba(243, 235, 223, 0.98));
  --chat-widget-border: rgba(122, 94, 61, 0.22);
  --chat-widget-shadow: 0 10px 24px rgba(24, 17, 10, 0.12);
}

#view-chat .chat-msg.chat-widget {
  align-self: stretch !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#view-chat .chat-msg.chat-widget .chat-embed-card {
  width: var(--chat-widget-max-width) !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 16px 16px 18px !important;
  border: 1px solid var(--chat-widget-border) !important;
  border-radius: 20px !important;
  background: var(--chat-widget-surface) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    var(--chat-widget-shadow) !important;
  backdrop-filter: blur(8px) saturate(1.01) !important;
  overflow: hidden;
}

#view-chat .chat-msg.chat-widget .input-form-head,
#view-chat .chat-msg.chat-widget .chart-embed-head {
  display: grid;
  gap: 6px;
  margin-bottom: 14px !important;
}

#view-chat .chat-msg.chat-widget .label {
  color: rgba(151, 77, 61, 0.82) !important;
  letter-spacing: 0.08em;
  font-size: 11px !important;
  font-weight: 700 !important;
}

#view-chat .chat-msg.chat-widget .input-form-title,
#view-chat .chat-msg.chat-widget .chart-embed-head h4 {
  margin: 0;
  color: rgba(52, 37, 22, 0.96) !important;
  font-size: 18px !important;
  line-height: 1.25;
  font-weight: 700 !important;
}

#view-chat .chat-msg.chat-widget .chart-embed-head p,
#view-chat .chat-msg.chat-widget .muted.small,
#view-chat .chat-msg.chat-widget .smart-hint,
#view-chat .chat-msg.chat-widget .field-help,
#view-chat .chat-msg.chat-widget .field-hint {
  color: rgba(91, 72, 49, 0.84) !important;
}

#view-chat .chat-msg.chat-widget .smart-form-grid {
  gap: 14px !important;
}

#view-chat .chat-msg.chat-widget .smart-field {
  gap: 8px !important;
}

#view-chat .chat-msg.chat-widget .smart-field label {
  color: rgba(61, 46, 29, 0.9) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
}

#view-chat .chat-msg.chat-widget .required-mark {
  color: rgba(176, 90, 75, 0.92) !important;
}

#view-chat .chat-msg.chat-widget .smart-form input,
#view-chat .chat-msg.chat-widget .smart-form select,
#view-chat .chat-msg.chat-widget .smart-form textarea {
  min-height: 46px;
  border: 1px solid rgba(122, 94, 61, 0.24) !important;
  border-radius: 14px !important;
  background: rgba(255, 252, 246, 0.98) !important;
  color: #2e2216 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

#view-chat .chat-msg.chat-widget .smart-form input:focus,
#view-chat .chat-msg.chat-widget .smart-form select:focus,
#view-chat .chat-msg.chat-widget .smart-form textarea:focus {
  border-color: rgba(161, 62, 44, 0.58) !important;
  box-shadow: 0 0 0 3px rgba(161, 62, 44, 0.12) !important;
  background: rgba(255, 254, 249, 1) !important;
}

#view-chat .chat-msg.chat-widget .picker-trigger,
#view-chat .chat-msg.chat-widget #method-apply-record {
  height: 44px;
  border: 1px solid rgba(118, 84, 49, 0.34) !important;
  border-radius: 13px !important;
  background: linear-gradient(180deg, rgba(245, 236, 219, 0.96), rgba(234, 221, 200, 0.96)) !important;
  color: rgba(66, 49, 30, 0.92) !important;
  font-weight: 600 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

#view-chat .chat-msg.chat-widget .picker-trigger:hover,
#view-chat .chat-msg.chat-widget #method-apply-record:hover {
  border-color: rgba(132, 93, 50, 0.52) !important;
  background: linear-gradient(180deg, rgba(248, 240, 225, 0.98), rgba(238, 226, 206, 0.98)) !important;
}

#view-chat .chat-msg.chat-widget .form-actions {
  margin-top: 4px;
  justify-content: flex-start;
  gap: 10px;
}

#view-chat .chat-msg.chat-widget .form-actions .ghost,
#view-chat .chat-msg.chat-widget .form-actions .primary {
  min-width: 118px;
  min-height: 42px;
  border-radius: 14px !important;
  font-weight: 700 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 227, 0.56),
    0 6px 14px rgba(56, 39, 20, 0.1) !important;
}

#view-chat .chat-msg.chat-widget .form-actions .ghost {
  border: 1px solid rgba(118, 84, 49, 0.38) !important;
  background: linear-gradient(180deg, rgba(239, 216, 177, 0.92), rgba(223, 191, 147, 0.92)) !important;
  color: rgba(52, 37, 21, 0.96) !important;
}

#view-chat .chat-msg.chat-widget .form-actions .primary {
  border: 1px solid rgba(150, 40, 28, 0.72) !important;
  background: linear-gradient(180deg, rgba(185, 66, 48, 0.96), rgba(145, 42, 30, 0.97)) !important;
  color: rgba(255, 242, 222, 0.98) !important;
}

#view-chat .chat-msg.chat-widget .form-actions .ghost:hover {
  border-color: rgba(132, 93, 50, 0.56) !important;
}

#view-chat .chat-msg.chat-widget .form-actions .primary:hover {
  border-color: rgba(168, 52, 37, 0.82) !important;
  background: linear-gradient(180deg, rgba(198, 77, 58, 0.98), rgba(154, 45, 31, 0.99)) !important;
}

#view-chat .chat-msg.chat-widget .chart-debug {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(122, 94, 61, 0.18) !important;
  border-radius: 14px;
  background: rgba(255, 248, 236, 0.72) !important;
}

#view-chat .chat-msg.chat-widget .agent-progress-card {
  display: inline-flex !important;
  align-items: flex-start;
  width: auto !important;
  max-width: min(100%, 32rem) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  overflow: visible !important;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease;
  transform-origin: left center;
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-dismissing {
  opacity: 0;
  transform: translateY(-3px) scale(0.985);
  filter: blur(0.3px);
  pointer-events: none;
}

#view-chat .agent-progress-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(142, 108, 66, 0.1);
  background: rgba(249, 243, 233, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-complete .agent-progress-line {
  border-color: rgba(102, 125, 88, 0.1);
  background: rgba(238, 243, 235, 0.66);
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-error .agent-progress-line {
  border-color: rgba(165, 83, 64, 0.1);
  background: rgba(249, 234, 228, 0.68);
}

#view-chat .agent-progress-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(170, 111, 56, 0.72);
  box-shadow: 0 0 0 3px rgba(182, 120, 63, 0.08);
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-complete .agent-progress-dot {
  background: rgba(97, 125, 84, 0.68);
  box-shadow: 0 0 0 3px rgba(101, 130, 89, 0.08);
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-error .agent-progress-dot {
  background: rgba(168, 87, 70, 0.72);
  box-shadow: 0 0 0 3px rgba(178, 96, 76, 0.08);
}

#view-chat .agent-progress-state {
  flex: 0 0 auto;
  color: rgba(133, 98, 62, 0.64);
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.04em;
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-complete .agent-progress-state {
  color: rgba(96, 116, 82, 0.66);
}

#view-chat .chat-msg.chat-widget .agent-progress-card.is-error .agent-progress-state {
  color: rgba(140, 76, 60, 0.68);
}

#view-chat .agent-progress-current {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: rgba(58, 42, 25, 0.76);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}

@media (max-aspect-ratio: 1/1) {
  .mobile-app-shell:has(#view-chat:not(.hidden)) .app-viewport::before {
    content: none !important;
    display: none !important;
  }

  #view-chat {
    --chat-widget-max-width: 100%;
  }

  #view-chat .subview-main-title {
    margin-bottom: 0 !important;
  }

  #view-chat .mobile-chat-panel {
    padding: 0 !important;
  }

  #view-chat .chat-log {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  #view-chat .chat-log::before {
    content: none !important;
    display: none !important;
  }

  #view-chat .chat-msg.chat-widget .form-actions {
    justify-content: stretch;
  }

  #view-chat .chat-msg.chat-widget .form-actions > * {
    flex: 1 1 0;
  }
}

/* ===== App logo placements ===== */
.shell-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  user-select: none;
  pointer-events: none;
}

.shell-logo-link {
  pointer-events: auto;
  cursor: pointer;
  text-decoration: none;
}

.shell-logo-link:hover {
  transform: translateY(-1px);
}

.shell-logo-link:active {
  transform: translateY(0);
}

.shell-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shell-logo-mobile {
  position: fixed;
  top: auto;
  left: auto;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: clamp(44px, 12vw, 58px);
  height: clamp(44px, 12vw, 58px);
  z-index: 45;
  display: none;
  filter: drop-shadow(0 10px 18px rgba(88, 52, 21, 0.18));
}

.shell-logo-desktop {
  width: clamp(58px, 6vw, 76px);
  height: clamp(58px, 6vw, 76px);
  margin: 0 0 10px 0;
  filter: drop-shadow(0 8px 14px rgba(88, 52, 21, 0.12));
}

.seal-home-hint {
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  color: rgba(100, 74, 49, 0.56);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  border: none;
  background: none;
  box-shadow: none;
  text-shadow: 0 1px 2px rgba(255, 251, 244, 0.5);
}

.seal-home-hint-mobile {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 44;
  width: clamp(44px, 12vw, 58px);
  min-height: 14px;
  padding: 0;
  border-radius: 0;
  opacity: 0.84;
}

.seal-home-hint-desktop {
  min-height: 18px;
  padding: 0;
  border-radius: 0;
  opacity: 0.72;
}

@media (max-aspect-ratio: 1/1) {
  .mobile-app-shell:has(#view-home:not(.hidden)) .shell-logo-mobile {
    display: inline-flex;
  }

  .mobile-app-shell:has(#view-home:not(.hidden)) .seal-home-hint-mobile {
    display: inline-flex;
  }

  .shell-logo-desktop {
    display: none !important;
  }

  .seal-home-hint-desktop {
    display: none !important;
  }
}

@media (min-aspect-ratio: 1/1) {
  .shell-logo-mobile {
    display: none !important;
  }

  .seal-home-hint-mobile {
    display: none !important;
  }

  .seal-home-hint-desktop {
    display: inline-flex;
  }
}

@media (min-aspect-ratio: 1/1) {
  .mobile-app-shell:has(#view-chat:not(.hidden)) .app-viewport::before {
    content: none !important;
    display: none !important;
  }

  .app-viewport {
    --desktop-subview-surface-width: 100%;
    background-position: var(--scene-bg-focus) !important;
  }

  .mobile-app-shell {
    grid-template-columns: clamp(216px, 18.5vw, 236px) minmax(0, 1fr);
  }

  .desktop-shell-nav {
    grid-template-rows: auto 1fr;
    gap: 22px;
    padding: 24px 18px 26px;
    background: linear-gradient(180deg, rgba(244, 237, 225, 0.96), rgba(238, 230, 217, 0.94));
    border-right: 1px solid rgba(192, 169, 135, 0.32);
    backdrop-filter: blur(6px) saturate(1.02);
    min-height: 0;
    overflow: hidden;
  }

  .desktop-shell-nav::after {
    content: none !important;
    display: none !important;
  }

  .desktop-brand {
    justify-items: center;
    gap: 0;
    padding: 12px 0 0;
  }

  .desktop-brand h1 {
    display: none;
  }

  .shell-logo-desktop {
    width: clamp(92px, 8vw, 122px);
    height: clamp(92px, 8vw, 122px);
    margin: 0;
    filter: drop-shadow(0 8px 14px rgba(88, 52, 21, 0.1));
  }

  .desktop-nav-list {
    position: relative;
    align-content: start;
    gap: 18px;
    min-height: 0;
    padding: 28px 6px 0 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .desktop-nav-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(138, 102, 61, 0.9) transparent;
  }

  .desktop-nav-list::-webkit-scrollbar {
    width: 6px;
  }

  .desktop-nav-list::-webkit-scrollbar-track {
    background: transparent;
    margin: 14px 0 16px;
  }

  .desktop-nav-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(164, 122, 76, 0.92), rgba(125, 89, 54, 0.96));
    box-shadow: 0 0 0 1px rgba(255, 247, 235, 0.08);
  }

  .desktop-nav-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(175, 131, 82, 0.96), rgba(136, 97, 59, 0.98));
  }

  .desktop-nav-list::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: rgba(190, 168, 136, 0.68);
  }

  .desktop-nav-list::after {
    content: "";
    position: absolute;
    top: -5px;
    left: 50%;
    width: 11px;
    height: 11px;
    border: 1px solid rgba(176, 93, 73, 0.76);
    background: rgba(250, 246, 239, 0.94);
    box-shadow: 0 0 0 2px rgba(244, 237, 225, 0.96);
    transform: translateX(-50%) rotate(45deg);
  }

  .subview-page > .subview-panel {
    width: var(--desktop-subview-surface-width);
    margin-inline: auto;
  }

  .scroll-docked-view {
    --scroll-docked-flow-padding-inline: 16px;
    --scroll-docked-flow-padding-top: 16px;
    --scroll-docked-flow-padding-bottom: 16px;
  }

  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions) .scroll-docked-panel {
    --scroll-docked-surface-radius: 28px;
    --scroll-docked-surface-background:
      linear-gradient(180deg, rgba(252, 247, 239, 0.92), rgba(244, 235, 221, 0.9));
    --scroll-docked-surface-border: rgba(177, 154, 122, 0.34);
    --scroll-docked-surface-shadow:
      inset 0 1px 0 rgba(255, 252, 247, 0.82),
      0 10px 28px rgba(71, 51, 29, 0.08);
    border-radius: var(--scroll-docked-surface-radius);
  }

  #view-sessions .session-list,
  #view-charts .chart-record-list {
    gap: 10px;
  }

  #view-sessions .session-entry:hover,
  #view-sessions .session-entry.is-actions-visible,
  #view-sessions .session-entry.is-title-editing {
    border-color: rgba(156, 133, 102, 0.28) !important;
    background: rgba(255, 251, 244, 0.58) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.92),
      0 10px 22px rgba(54, 42, 28, 0.08) !important;
  }

  #view-charts .chart-record-item {
    padding: 14px 16px 14px 18px;
    border: 1px solid rgba(173, 151, 120, 0.22) !important;
    border-radius: 18px !important;
    background:
      linear-gradient(180deg, rgba(249, 245, 238, 0.94), rgba(239, 231, 220, 0.95)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.9),
      0 8px 18px rgba(54, 42, 28, 0.06) !important;
  }

  #view-charts .chart-record-item:hover,
  #view-charts .chart-record-item.is-active {
    border-color: rgba(149, 127, 98, 0.28) !important;
    background:
      linear-gradient(180deg, rgba(252, 249, 243, 0.97), rgba(242, 235, 225, 0.97)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.92),
      0 10px 22px rgba(54, 42, 28, 0.08) !important;
  }

  #view-chat .mobile-chat-panel {
    width: var(--desktop-subview-surface-width);
    margin-inline: auto;
    padding: 0 !important;
    gap: 14px !important;
  }

  #view-chat .chat-log-stage {
    width: 100%;
  }

  #view-chat .chat-log-stage::before {
    border-radius: 28px !important;
  }

  #view-chat,
  .scroll-docked-view {
    --scroll-rail-size: 6px;
    --scroll-rail-color: rgba(138, 102, 61, 0.9);
    --scroll-rail-track-color: transparent;
    --scroll-rail-track: rgba(235, 225, 209, 0.18);
    --scroll-rail-track-border: 0;
    --scroll-rail-track-margin: 14px 3px 16px 0;
    --scroll-rail-thumb: linear-gradient(180deg, rgba(164, 122, 76, 0.92), rgba(125, 89, 54, 0.96));
    --scroll-rail-thumb-border: 0;
    --scroll-rail-thumb-shadow: 0 0 0 1px rgba(255, 247, 235, 0.08);
    --scroll-rail-thumb-hover: linear-gradient(180deg, rgba(175, 131, 82, 0.96), rgba(136, 97, 59, 0.98));
  }

  #view-chat .chat-msg.chat-widget {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  #view-chat .chat-msg.chat-widget .chat-embed-card,
  #view-chat .input-form-panel,
  #view-chat #result-panel {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10px 18px 2px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  #view-chat .chat-msg.chat-widget .agent-progress-card {
    width: auto !important;
    max-width: calc(100% - 18px) !important;
    padding: 0 !important;
  }

  #view-chat .chat-msg.chat-widget .chart-launch-card {
    max-width: calc(100% - 20px) !important;
  }

  #view-chat .chat-chart-launcher {
    max-width: 100%;
  }

  #view-chat .agent-progress-line {
    width: auto;
    max-width: 100%;
  }

  #view-chat .chat-msg.chat-widget .chart-debug {
    background: rgba(255, 248, 236, 0.54) !important;
    box-shadow: none !important;
  }

  #view-chat .chat-input {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 8px 8px 8px 18px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(193, 171, 138, 0.44) !important;
    background: rgba(252, 247, 239, 0.82) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 252, 247, 0.78),
      0 6px 16px rgba(73, 53, 31, 0.08) !important;
    backdrop-filter: blur(8px) saturate(1.01) !important;
  }

  #view-chat .chat-input input {
    color: rgba(69, 50, 27, 0.96) !important;
  }

  #view-chat .chat-input input::placeholder {
    color: rgba(146, 126, 96, 0.82) !important;
  }
}

/* ===== Final work-surface cleanup ===== */
.app-view {
  overflow-x: hidden;
}

.subview-panel {
  overflow: hidden;
}

.mobile-app-shell:has(:is(#view-chat, #view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-auth).app-view:not(.hidden)) .app-viewport::before {
  content: "" !important;
  display: block !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 239, 214, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 248, 237, 0.06), rgba(46, 33, 19, 0.14)) !important;
}

#view-chat {
  --chat-underlay-color: rgba(24, 18, 13, 0.12);
}

#view-chat .chat-msg.assistant,
#view-chat .chat-msg.user,
#view-chat .chat-msg.chat-widget .chat-embed-card {
  backdrop-filter: none !important;
}

#view-chat .chat-msg.assistant {
  box-shadow:
    0 10px 22px rgba(55, 39, 22, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

#view-chat .chat-msg.user {
  box-shadow:
    0 10px 22px rgba(88, 52, 34, 0.12),
    inset 0 1px 0 rgba(255, 239, 220, 0.28) !important;
}

@media (max-width: 700px) {
  #view-chat,
  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-auth) {
    --scroll-rail-size: 4px;
    --scroll-rail-color: rgba(132, 96, 58, 0.72);
    --scroll-rail-track-color: transparent;
    --scroll-rail-track: transparent;
    --scroll-rail-track-border: 0;
    --scroll-rail-track-margin: 10px 1px 12px 0;
    --scroll-rail-thumb: linear-gradient(180deg, rgba(156, 114, 72, 0.82), rgba(121, 86, 54, 0.9));
    --scroll-rail-thumb-border: 0;
    --scroll-rail-thumb-shadow: none;
    --scroll-rail-thumb-hover: linear-gradient(180deg, rgba(166, 122, 77, 0.86), rgba(129, 92, 58, 0.92));
  }

  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-auth) .scroll-docked-flow {
    padding-inline: 12px !important;
  }

  #view-chart-editor .chart-record-form {
    overflow-x: hidden;
  }
}

#view-sessions .sessions-panel {
  height: 100% !important;
  min-height: 0 !important;
}

#view-sessions .scroll-docked-stage {
  flex: 1 1 auto;
  min-height: 0;
}

#view-sessions .scroll-docked-host {
  height: 100%;
}

#view-sessions .scroll-docked-flow {
  min-height: 100%;
}

@media (max-width: 700px) {
  #view-chat .chat-msg.assistant,
  #view-chat .chat-msg.chat-widget .chat-embed-card {
    background: rgba(255, 249, 241, 0.96) !important;
  }

  #view-chat .chat-msg.assistant,
  #view-chat .chat-msg.chat-widget {
    color: #3f2d18 !important;
  }
}

.field-wide {
  grid-column: 1 / -1;
}

.field-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.field-helper-link {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(60, 97, 171, 0.92);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.field-helper-link:hover {
  color: rgba(44, 78, 148, 0.98);
  text-decoration: underline;
}

.field-note,
.field-error {
  display: block;
  font-size: 12px;
  line-height: 1.55;
}

.field-note.hidden,
.field-error.hidden,
.form-error-summary.hidden {
  display: none !important;
}

.field-note {
  color: #6d573b;
}

.field-error {
  color: #a13f2c;
}

#view-chart-editor .chart-date-picker,
#view-chart-editor .chart-time-picker {
  display: grid;
  align-items: center;
  gap: 7px;
}

#view-chart-editor .chart-date-picker {
  grid-template-columns: minmax(92px, 1.25fr) minmax(68px, 0.9fr) minmax(68px, 0.9fr);
}

#view-chart-editor .chart-time-picker {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

#view-chart-editor .chart-date-picker select,
#view-chart-editor .chart-time-picker select {
  min-width: 0;
}

#view-chart-editor .chart-picker-cell {
  display: block;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(178, 154, 122, 0.28);
  border-radius: 14px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
  overflow: hidden;
}

#view-chart-editor .chart-picker-cell select {
  width: 100%;
  height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  color: rgba(52, 38, 24, 0.96);
  font-size: 15px;
  line-height: 1;
  text-align: center;
  text-align-last: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  box-shadow: none;
}

#view-chart-editor .chart-picker-cell select::-ms-expand {
  display: none;
}

#view-chart-editor .chart-picker-cell select:focus {
  box-shadow: inset 0 0 0 2px rgba(121, 95, 58, 0.24);
  background: rgba(255, 253, 248, 0.96);
}

#view-chart-editor .chart-time-separator {
  color: rgba(115, 88, 58, 0.82);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

#view-chart-editor .chart-time-mode {
  display: grid;
  gap: 12px;
}

#view-chart-editor .chart-time-switch {
  display: grid;
  grid-template-columns: auto auto auto auto;
  gap: 10px;
  align-items: center;
  justify-content: start;
  padding: 8px 10px 6px;
  border: 1px solid rgba(178, 154, 122, 0.22);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.72);
  color: rgba(114, 86, 53, 0.92);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: none;
  cursor: pointer;
  user-select: none;
}

#view-chart-editor .chart-time-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#view-chart-editor .chart-time-switch i {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(173, 145, 108, 0.34);
  background: linear-gradient(180deg, rgba(214, 200, 176, 0.88), rgba(237, 228, 212, 0.94));
  box-shadow: inset 0 1px 3px rgba(93, 68, 39, 0.12);
}

#view-chart-editor .chart-time-switch i::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 234, 220, 0.98));
  box-shadow: 0 2px 8px rgba(109, 84, 56, 0.16);
  transition: transform 0.18s ease;
}

#view-chart-editor .chart-time-mode.is-fuzzy-mode .chart-time-switch i {
  background: linear-gradient(180deg, rgba(151, 120, 84, 0.88), rgba(123, 95, 66, 0.92));
}

#view-chart-editor .chart-time-mode.is-fuzzy-mode .chart-time-switch i::before {
  transform: translate(20px, -50%);
}

#view-chart-editor .chart-time-panel {
  display: none;
  gap: 8px;
  padding: 12px 12px 11px;
  border: 1px solid rgba(178, 154, 122, 0.24);
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.6);
}

#view-chart-editor .chart-time-mode.is-precise-mode .chart-time-panel-precise,
#view-chart-editor .chart-time-mode.is-fuzzy-mode .chart-time-panel-fuzzy {
  display: grid;
}

#view-chart-editor .chart-time-panel textarea {
  min-height: 84px;
  resize: vertical;
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.96);
  color: rgba(60, 42, 25, 0.98);
}

#view-chart-editor .chart-time-panel textarea::placeholder {
  color: rgba(144, 123, 94, 0.72);
}

@media (max-width: 700px) {
  #view-chart-editor .chart-date-picker {
    grid-template-columns: minmax(88px, 1.18fr) minmax(62px, 0.91fr) minmax(62px, 0.91fr);
  }

  #view-chart-editor .chart-time-picker {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  #view-chart-editor .chart-picker-cell select {
    padding-inline: 8px;
    font-size: 14px;
  }
}

.form-error-summary {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(151, 56, 41, 0.24);
  background: rgba(255, 240, 236, 0.78);
  color: #8f3727;
}

.form-error-summary ul {
  margin: 0;
  padding-left: 18px;
}

.chart-record-calibration {
  display: inline-flex;
  margin-top: 5px;
  color: #6b5537;
  font-size: 12px;
  line-height: 1.4;
}

.chart-record-calibration.is-stable {
  color: #4f7a50;
}

.chart-record-calibration.is-pending {
  color: #9a6a2e;
}

@media (max-width: 560px) {
  .field-meta-row {
    align-items: flex-start;
  }
}

/* ===== Focused work-surface refinements ===== */
#view-charts .scroll-docked-flow,
#view-sessions .scroll-docked-flow,
#view-notices .scroll-docked-flow {
  max-width: 980px;
  margin-inline: auto;
}

#view-auth .scroll-docked-flow {
  max-width: 880px;
  margin-inline: auto;
  min-height: 100%;
}

#view-auth .scroll-docked-stage {
  flex: 1 1 auto;
  min-height: 0;
}

#view-auth .scroll-docked-host {
  min-height: 0;
  scrollbar-gutter: stable both-edges;
  width: 100% !important;
  margin-right: 0 !important;
}

#view-auth .scroll-docked-stage::before {
  inset: 0;
}

#view-chart-editor .scroll-docked-flow {
  max-width: 920px;
  margin-inline: auto;
}

#view-charts .scroll-docked-stage::before,
#view-sessions .scroll-docked-stage::before,
#view-auth .scroll-docked-stage::before,
#view-chart-editor .scroll-docked-stage::before {
  border-color: rgba(176, 150, 116, 0.36) !important;
  background:
    linear-gradient(180deg, rgba(252, 248, 241, 0.96), rgba(244, 235, 220, 0.94)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 247, 0.9),
    0 14px 32px rgba(67, 47, 25, 0.08) !important;
}

#view-charts #chart-record-empty,
#view-sessions #session-empty {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 8px 6px;
  color: rgba(103, 78, 48, 0.86);
}

#view-sessions .view-actions {
  max-width: 980px;
  margin: 0 auto 6px;
  justify-content: flex-end;
}

#view-charts .chart-record-list,
#view-sessions .session-list {
  width: 100%;
}

#view-charts .chart-record-main {
  display: grid;
  gap: 7px;
  padding-right: 56px;
}

.chart-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.chart-record-head .chart-record-name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  line-height: 1.3;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.chart-record-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.chart-record-status.is-icon-only {
  justify-content: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  border-color: rgba(88, 126, 92, 0.18);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0) 52%),
    linear-gradient(180deg, rgba(240, 247, 239, 0.98), rgba(228, 239, 228, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 4px 10px rgba(57, 90, 59, 0.08);
}

.chart-record-status-mark {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(82, 120, 84, 0.82);
  box-shadow:
    0 0 0 3px rgba(92, 133, 95, 0.12),
    inset 0 1px 0 rgba(236, 248, 236, 0.42);
}

.chart-record-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: rgba(98, 73, 45, 0.92);
  font-size: 13px;
  line-height: 1.5;
}

.chart-record-meta-dot {
  color: rgba(149, 121, 84, 0.76);
}

.chart-record-meta .chart-record-time,
.chart-record-meta .chart-record-place {
  min-width: 0;
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: inherit;
  font-weight: 500;
  color: inherit;
}

#view-sessions .session-item {
  gap: 6px;
}

.session-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.session-item-head h4 {
  flex: 1 1 auto;
  min-width: 0;
}

.session-method-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(145, 115, 78, 0.18);
  background: rgba(250, 243, 232, 0.94);
  color: rgba(112, 78, 42, 0.9);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.session-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.session-shujian-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(151, 56, 41, 0.18);
  background: rgba(248, 231, 220, 0.88);
  color: rgba(126, 54, 38, 0.94);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

#view-sessions .session-item p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#view-auth .auth-shell {
  gap: 18px;
}

#view-auth .auth-secondary-button {
  min-width: 92px;
  border-color: rgba(125, 103, 78, 0.16);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(251, 247, 241, 0.98), rgba(237, 229, 218, 0.98));
  color: var(--auth-ink-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    inset 0 -1px 0 rgba(158, 136, 105, 0.1),
    0 10px 18px rgba(53, 39, 25, 0.08);
}

#view-auth .auth-secondary-button:hover {
  border-color: rgba(95, 113, 86, 0.28);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, rgba(251, 248, 244, 1), rgba(236, 230, 220, 0.98));
  color: rgba(49, 38, 24, 0.98);
}

.auth-link-button,
.field-helper-link {
  color: rgba(150, 67, 48, 0.94);
}

.auth-link-button:hover,
.field-helper-link:hover {
  color: rgba(126, 54, 38, 0.98);
}

#view-chart-editor .chart-record-form {
  margin: 0;
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(169, 144, 110, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.84), rgba(249, 242, 230, 0.8));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 8px 18px rgba(74, 53, 30, 0.04);
}

#view-chart-editor .chart-record-form-grid {
  gap: 16px 16px;
}

#view-chart-editor .field {
  gap: 6px;
}

#view-chart-editor .field > span {
  color: rgba(114, 86, 53, 0.9);
  font-size: 12px;
  letter-spacing: 0.08em;
}

#view-chart-editor .chart-record-form-actions {
  margin-top: 16px;
  padding-top: 14px;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid rgba(188, 164, 131, 0.3);
}

#view-chart-editor .chart-record-form-actions button {
  min-height: 40px;
  padding-inline: 18px;
}

@media (min-aspect-ratio: 1/1) {
  #view-charts .chart-record-item:hover,
  #view-charts .chart-record-item.is-active {
    background: rgba(255, 251, 244, 0.58) !important;
  }
}

@media (max-width: 700px) {
  #view-chart-editor .chart-record-form {
    padding: 14px 14px 14px;
    border-radius: 20px;
    background:
      linear-gradient(180deg, rgba(255, 250, 243, 0.82), rgba(248, 239, 224, 0.78));
  }

  #view-chart-editor .chart-record-form-actions {
    margin-top: 14px;
    padding-top: 12px;
  }

  .chart-record-head {
    align-items: center;
  }

  .chart-record-head .chart-record-name {
    font-size: 15px;
  }

  .chart-record-status {
    min-height: 24px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .chart-record-status.is-icon-only {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
  }

  .chart-record-status-mark {
    width: 6px;
    height: 6px;
  }

  #view-chat .chat-input input {
    color: rgba(73, 52, 27, 0.96) !important;
  }

  #view-chat .chat-input input::placeholder {
    color: rgba(144, 121, 90, 0.78) !important;
  }

}

/* ===== Final restrained desktop pass ===== */
#chat-export.chart-add-icon-btn,
#chat-reset.chart-add-icon-btn,
#chart-record-add.chart-add-icon-btn,
#sessions-clear-icon.chart-add-icon-btn {
  border-color: rgba(151, 76, 55, 0.62) !important;
  background: linear-gradient(180deg, rgba(191, 95, 70, 0.96), rgba(155, 59, 40, 0.97)) !important;
  box-shadow:
    0 10px 20px rgba(102, 40, 28, 0.2),
    inset 0 1px 0 rgba(255, 224, 193, 0.28) !important;
  color: rgba(255, 242, 223, 0.98) !important;
}

#chat-reset.chart-add-icon-btn .chat-reset-icon::before,
#chat-reset.chart-add-icon-btn .chat-reset-icon::after,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::before,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::after,
#sessions-clear-icon.chart-add-icon-btn .chart-record-action-icon--minus::before {
  background: rgba(255, 243, 224, 0.98) !important;
}

#view-chat .chat-log-stage::before {
  border: 1px solid rgba(175, 146, 107, 0.34);
}

#view-charts #chart-record-empty,
#view-sessions #session-empty {
  padding-top: 26px;
}

#view-charts .chart-record-list,
#view-sessions .session-list {
  padding-top: 2px;
}

#view-charts .chart-record-item {
  padding: 14px 14px 14px 16px;
}

#view-charts .chart-record-item:hover,
#view-charts .chart-record-item.is-active {
  background: rgba(255, 251, 244, 0.52) !important;
}

#view-charts .chart-record-head .chart-record-name {
  font-size: 17px;
}

.chart-record-meta {
  gap: 7px;
  line-height: 1.55;
}

#view-chart-editor .chart-record-form {
  max-width: 760px;
  margin-inline: auto;
  padding: 22px 22px 18px;
  border-color: rgba(170, 145, 110, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(247, 238, 225, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 22px rgba(74, 53, 30, 0.05);
}

#view-chart-editor .chart-record-form input,
#view-chart-editor .chart-record-form select {
  min-height: 44px;
  border-color: rgba(178, 154, 122, 0.34);
  background: rgba(255, 251, 245, 0.96);
}

#view-chart-editor .chart-record-form .chart-picker-cell select {
  min-height: 0;
  height: 42px;
  border: 0;
  background: transparent;
}

#view-chart-editor .chart-record-form input::placeholder {
  color: rgba(143, 120, 90, 0.72);
}

#view-chart-editor .field-meta-row {
  margin-top: 2px;
}

#view-chart-editor .chart-record-form-actions {
  max-width: 760px;
  margin-inline: auto;
}

@media (max-width: 700px) {
  #view-chart-editor .chart-record-form {
    max-width: none;
    padding: 16px 16px 15px;
  }

  #view-chart-editor .chart-record-form-actions {
    max-width: none;
  }

  #view-auth .auth-account-card {
    max-width: none;
    padding: 18px 18px;
  }
}

/* ===== Notice surface ===== */
.home-secondary-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.home-side-entry {
  width: min(228px, 100%);
  min-height: 44px;
  padding: 8px 16px 9px;
  border: 1px solid rgba(138, 103, 62, 0.34);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(247, 236, 215, 0.94), rgba(236, 217, 184, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 249, 239, 0.78),
    0 6px 14px rgba(88, 61, 31, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  color: rgba(60, 42, 22, 0.94);
}

.home-side-entry:hover {
  border-color: rgba(145, 104, 59, 0.46);
  background: linear-gradient(180deg, rgba(250, 239, 219, 0.98), rgba(239, 220, 188, 0.96));
}

.home-side-entry-title {
  font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  font-size: 18px;
  line-height: 1;
}

.mobile-app-shell:has(#view-notices.app-view:not(.hidden)) .app-viewport::before {
  content: "" !important;
  display: block !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 239, 214, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 248, 237, 0.06), rgba(46, 33, 19, 0.14)) !important;
}

#view-notices .scroll-docked-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#view-notices .scroll-docked-flow {
  max-width: 1040px;
  margin-inline: auto;
}

.notices-panel {
  border-radius: 16px;
}

.notice-layout {
  display: grid;
  gap: 12px;
  align-items: start;
}

.notice-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.notice-empty {
  padding: 22px 4px 6px;
  color: rgba(103, 78, 48, 0.86);
}

.notice-list {
  display: grid;
  gap: 12px;
}

.notice-list-item {
  width: 100%;
  min-height: 94px;
  padding: 14px 16px 14px 18px;
  border: 1px solid rgba(173, 151, 120, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(249, 245, 238, 0.94), rgba(239, 231, 220, 0.95));
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.9),
    0 8px 18px rgba(54, 42, 28, 0.06);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 12px;
  position: relative;
  overflow: hidden;
  color: rgba(56, 39, 19, 0.95);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.notice-list-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 13px 0 0 13px;
  background: transparent;
}

.notice-list-item.is-unread {
  border-color: rgba(157, 76, 44, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.96), rgba(248, 236, 218, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.9),
    0 10px 22px rgba(113, 57, 27, 0.08);
}

.notice-list-item.is-unread::before {
  background: linear-gradient(180deg, #b14a28, #d49a53);
}

.notice-list-item.is-read {
  background: rgba(255, 251, 244, 0.44);
  color: rgba(70, 51, 30, 0.78);
}

.notice-list-item.is-read .notice-list-item-head strong {
  font-weight: 650;
}

.notice-list-item.is-unread .notice-list-item-head strong {
  font-weight: 850;
  color: rgba(54, 34, 17, 0.98);
}

.notice-list-item:hover {
  border-color: rgba(156, 133, 102, 0.28);
  background: rgba(255, 251, 244, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.92),
    0 10px 22px rgba(54, 42, 28, 0.08);
}

.notice-list-item.is-expanded {
  align-items: start;
  border-color: rgba(156, 133, 102, 0.32);
  background:
    linear-gradient(180deg, rgba(252, 249, 243, 0.97), rgba(242, 235, 225, 0.97));
}

.notice-list-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.notice-list-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.notice-list-item-head strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: rgba(45, 33, 20, 0.98);
  font-size: 16px;
  line-height: 1.38;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-list-date,
.notice-list-summary {
  margin: 0;
}

.notice-list-date {
  flex: 0 0 auto;
  color: rgba(121, 95, 65, 0.76);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.notice-list-summary {
  color: rgba(87, 67, 48, 0.82);
  font-size: 13px;
  line-height: 1.56;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.notice-expand-btn {
  align-self: start;
  min-width: 58px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid rgba(118, 98, 75, 0.2);
  border-radius: 999px;
  background: rgba(248, 244, 238, 0.9);
  color: rgba(89, 71, 51, 0.92);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.86),
    0 4px 10px rgba(54, 42, 28, 0.04);
}

.notice-expand-btn:hover {
  border-color: rgba(149, 127, 98, 0.28);
  background: rgba(252, 249, 243, 0.96);
}

.notice-expanded-body {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid rgba(185, 160, 127, 0.28);
  color: rgba(65, 46, 25, 0.94);
}

.notice-reader {
  display: none !important;
}

.notice-reader--empty {
  display: none !important;
  place-items: center;
  min-height: 260px;
}

.notice-reader-placeholder {
  color: rgba(118, 92, 63, 0.82);
  font-size: 14px;
  line-height: 1.7;
}

.notice-date {
  color: rgba(121, 95, 65, 0.78);
  font-size: 12px;
  line-height: 1;
}

.notice-expanded-body h2,
.notice-expanded-body h3,
.notice-expanded-body h4 {
  margin: 22px 0 10px;
  color: rgba(56, 39, 19, 0.96);
  font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  line-height: 1.28;
}

.notice-expanded-body h2 {
  font-size: 24px;
}

.notice-expanded-body h3 {
  font-size: 20px;
}

.notice-expanded-body h4 {
  font-size: 17px;
}

.notice-expanded-body p,
.notice-expanded-body ul,
.notice-expanded-body pre {
  margin: 0 0 16px;
}

.notice-expanded-body p,
.notice-expanded-body li {
  font-size: 15px;
  line-height: 1.92;
}

.notice-expanded-body ul {
  padding-left: 22px;
}

.notice-expanded-body li + li {
  margin-top: 8px;
}

.notice-expanded-body a {
  color: rgba(150, 67, 48, 0.94);
  text-decoration: none;
  border-bottom: 1px solid rgba(150, 67, 48, 0.22);
}

.notice-expanded-body a:hover {
  color: rgba(126, 54, 38, 0.98);
  border-bottom-color: rgba(126, 54, 38, 0.34);
}

.notice-expanded-body code {
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(123, 92, 56, 0.1);
  font-size: 0.92em;
}

.notice-expanded-body pre {
  overflow: auto;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(113, 84, 50, 0.08);
}

@media (min-aspect-ratio: 1/1) {
  #view-notices.subview-page > .subview-panel {
    width: min(100%, 980px);
  }

  #view-notices .scroll-docked-flow {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  #view-notices .notice-rail {
    position: static;
  }
}

@media (max-width: 700px) {
  .home-secondary-actions {
    margin-top: 9px;
  }

  .home-side-entry {
    width: min(66vw, 228px);
    min-height: 42px;
    padding-inline: 14px;
  }

  .home-side-entry-title {
    font-size: 17px;
  }

  #view-notices .scroll-docked-flow {
    padding-inline: 12px !important;
  }

  #view-notices .notice-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .notice-list-item {
    min-height: 88px;
    padding: 13px 13px 13px 16px;
    border-radius: 17px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .notice-list-item-head {
    gap: 10px;
  }

  .notice-list-item-head strong {
    font-size: 15px;
  }

  .notice-list-date {
    font-size: 11px;
  }

  .notice-expand-btn {
    min-width: 52px;
    min-height: 30px;
    padding-inline: 11px;
  }

  .notice-expanded-body p,
  .notice-expanded-body li {
    font-size: 14px;
    line-height: 1.86;
  }
}

/* ===== Desktop subview alignment ===== */
#chat-export.chart-add-icon-btn,
#chat-reset.chart-add-icon-btn,
#chat-reset.chat-reset-icon-btn,
#chart-record-add.chart-add-icon-btn,
#sessions-clear-icon.chart-add-icon-btn {
  border: 1px solid rgba(59, 99, 176, 0.68) !important;
  background: linear-gradient(180deg, rgba(76, 126, 218, 0.94), rgba(52, 96, 188, 0.95)) !important;
  box-shadow:
    0 8px 16px rgba(38, 64, 118, 0.24),
    inset 0 1px 0 rgba(202, 224, 255, 0.36) !important;
  color: #eef5ff !important;
}

#chat-reset.chart-add-icon-btn .chat-reset-icon::before,
#chat-reset.chart-add-icon-btn .chat-reset-icon::after,
#chat-reset .chat-reset-icon::before,
#chat-reset .chat-reset-icon::after,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::before,
#chart-record-add.chart-add-icon-btn .chat-reset-icon::after,
#sessions-clear-icon.chart-add-icon-btn .chart-record-action-icon--minus::before {
  background: #eef5ff !important;
}

#view-sessions .view-actions {
  display: none !important;
}

@media (min-aspect-ratio: 1/1) {
  :is(#view-chat, #view-charts, #view-chart-result, #view-sessions, #view-notices, #view-auth).subview-page {
    --desktop-content-rail-width: min(100%, 1400px);
  }

  #view-chat.subview-page {
    --desktop-content-rail-width: min(100%, 1500px);
  }

  #view-charts.subview-page {
    --desktop-content-rail-width: min(100%, 1500px);
  }

  #view-chart-result.subview-page {
    --desktop-content-rail-width: min(100%, 1500px);
  }

  #view-sessions.subview-page {
    --desktop-content-rail-width: min(100%, 1500px);
  }

  #view-notices.subview-page {
    --desktop-content-rail-width: min(100%, 1660px);
  }

  #view-auth.subview-page {
    --desktop-content-rail-width: min(100%, 1320px);
  }

  #view-chart-editor.subview-page {
    --desktop-content-rail-width: min(100%, 920px);
  }

  #view-chat .chat-onboarding,
  #view-chat .chat-input,
  #view-chat #result-panel,
  #view-chat .chat-log-flow,
  #view-charts .scroll-docked-flow,
  #view-chart-result .scroll-docked-flow,
  #view-chart-editor .scroll-docked-flow,
  #view-sessions .scroll-docked-flow,
  #view-notices .scroll-docked-flow,
  #view-auth .scroll-docked-flow {
    width: var(--desktop-content-rail-width) !important;
    max-width: var(--desktop-content-rail-width) !important;
    margin-inline: auto !important;
  }

  #view-auth .auth-shell,
  #view-auth #auth-account-panel {
    max-width: var(--desktop-content-rail-width) !important;
    margin-inline: auto !important;
  }

  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth).subview-page {
    --desktop-subview-track-width: 100%;
    gap: 8px !important;
  }

  #view-chat.subview-page {
    --desktop-subview-track-width: 100%;
  }

  .subview-page > .subview-titlebar,
  .subview-page > .subview-panel {
    justify-self: center;
    margin-inline: auto;
  }

  #view-chat .mobile-chat-panel,
  #view-charts .chart-record-panel,
  #view-chart-result .chart-record-panel,
  #view-chart-editor .chart-record-editor-panel,
  #view-notices .notices-panel,
  #view-auth .auth-panel,
  #view-sessions .sessions-panel {
    justify-self: stretch !important;
    margin-inline: auto !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  .subview-page > .subview-titlebar {
    width: var(--desktop-subview-track-width, 100%);
    max-width: 100%;
    margin-bottom: 14px;
  }

  .subview-page > .subview-titlebar .subview-main-title,
  .subview-page > .subview-main-title {
    padding-left: 0;
    text-align: center;
    text-indent: 0.18em;
    letter-spacing: 0.18em;
  }

  .subview-titlebar--action {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-right: 0;
  }

  .subview-titlebar--action .subview-main-title {
    width: 100%;
  }

  .subview-titlebar--action .subview-titlebar-action {
    position: absolute;
    top: 50%;
    right: 0;
    min-width: 40px;
    min-height: 40px;
    transform: translateY(-50%);
    pointer-events: none;
  }

  .subview-titlebar--action .subview-titlebar-action > * {
    pointer-events: auto;
  }

  .subview-titlebar-action--placeholder {
    visibility: hidden;
  }

  .subview-titlebar-action > #chat-export.chart-add-icon-btn,
  .subview-titlebar-action > #chat-reset.chat-reset-icon-btn,
  .subview-titlebar-action > #chat-reset.chart-add-icon-btn,
  .subview-titlebar-action > #chart-record-add.chart-add-icon-btn,
  .subview-titlebar-action > #global-home-btn,
  .subview-titlebar-action > #sessions-clear-icon.chart-add-icon-btn {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    z-index: auto !important;
    margin: 0 !important;
  }

  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-stage,
  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-host,
  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-flow {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-stage {
    flex: 1 1 auto !important;
  }

}

/* ===== 2026-03 final theme system ===== */
:root {
  --theme-ink: #2c2319;
  --theme-ink-soft: rgba(82, 64, 45, 0.86);
  --theme-paper: rgba(243, 236, 225, 0.92);
  --theme-paper-strong: rgba(234, 224, 207, 0.96);
  --theme-paper-soft: rgba(250, 245, 237, 0.72);
  --theme-panel-edge: rgba(126, 102, 74, 0.24);
  --theme-panel-edge-strong: rgba(113, 89, 63, 0.38);
  --theme-shadow-soft: 0 18px 36px rgba(40, 28, 17, 0.14);
  --theme-shadow-mid: 0 28px 58px rgba(33, 24, 16, 0.18);
  --theme-control-top: rgba(248, 242, 233, 0.94);
  --theme-control-bottom: rgba(232, 223, 208, 0.97);
  --theme-control-edge: rgba(121, 98, 71, 0.34);
  --theme-action-top: rgba(110, 136, 170, 0.96);
  --theme-action-bottom: rgba(73, 97, 129, 0.99);
  --theme-action-edge: rgba(68, 92, 123, 0.88);
  --theme-danger-top: rgba(171, 80, 58, 0.96);
  --theme-danger-bottom: rgba(132, 49, 38, 0.99);
  --theme-danger-edge: rgba(131, 49, 39, 0.84);
  --bg: #21180f;
  --bg-soft: #2b1f14;
  --panel: rgba(243, 236, 224, 0.92);
  --panel-strong: rgba(233, 222, 204, 0.95);
  --accent: #a14c3a;
  --accent-2: #4f6787;
  --accent-3: #7d6144;
  --text: #2c2319;
  --muted: rgba(85, 67, 47, 0.78);
  --border: rgba(122, 98, 70, 0.28);
  --shadow: 0 18px 36px rgba(40, 28, 17, 0.16);
}

body {
  color: var(--theme-ink);
  background:
    linear-gradient(rgba(28, 21, 14, 0.28), rgba(28, 21, 14, 0.34)),
    var(--scene-bg-image) var(--scene-bg-focus) / cover no-repeat fixed,
    radial-gradient(circle at 18% 10%, rgba(166, 128, 77, 0.14), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(101, 125, 154, 0.12), transparent 30%),
    radial-gradient(circle at 50% 116%, rgba(76, 56, 37, 0.18), transparent 42%),
    linear-gradient(180deg, #2a1f13 0%, #1d150d 100%);
}

.noise {
  opacity: 0.09;
  background-image:
    radial-gradient(rgba(70, 49, 27, 0.36) 0.55px, transparent 0.55px),
    radial-gradient(rgba(255, 255, 255, 0.14) 0.46px, transparent 0.46px);
  mix-blend-mode: multiply;
}

.aurora {
  opacity: 0.12;
  filter: blur(100px);
  background: conic-gradient(
    from 180deg at 50% 50%,
    rgba(165, 128, 79, 0.14),
    rgba(104, 126, 153, 0.1),
    rgba(122, 93, 64, 0.08),
    rgba(165, 128, 79, 0.14)
  );
}

.mobile-app-shell {
  border-color: rgba(117, 95, 69, 0.48) !important;
  background:
    linear-gradient(180deg, rgba(239, 231, 219, 0.18) 0%, rgba(222, 210, 192, 0.24) 100%) !important;
  box-shadow:
    0 28px 56px rgba(25, 18, 12, 0.14),
    inset 0 0 0 1px rgba(255, 250, 242, 0.2),
    inset 0 0 28px rgba(112, 87, 58, 0.03) !important;
}

.app-viewport {
  background-image:
    linear-gradient(180deg, rgba(76, 58, 39, 0.12), rgba(43, 33, 23, 0.18)),
    var(--scene-bg-image) !important;
  background-repeat: no-repeat, no-repeat !important;
  background-position: center center, var(--scene-bg-focus) !important;
  background-size: cover, cover !important;
  background-blend-mode: multiply, normal;
  box-shadow:
    inset 0 0 0 1px rgba(124, 99, 70, 0.06),
    inset 0 26px 52px rgba(255, 250, 242, 0.04) !important;
}

.app-viewport::before {
  background:
    radial-gradient(circle at 50% 4%, rgba(255, 248, 236, 0.08), transparent 34%),
    radial-gradient(circle at 50% 108%, rgba(28, 21, 14, 0.1), transparent 46%),
    linear-gradient(180deg, rgba(24, 18, 12, 0.03), rgba(24, 18, 12, 0.08)) !important;
}

.app-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 244, 229, 0.03), rgba(255, 244, 229, 0) 40%),
    linear-gradient(180deg, rgba(32, 24, 16, 0.04), rgba(32, 24, 16, 0.1));
  mix-blend-mode: multiply;
  opacity: 0.72;
  pointer-events: none;
}

.subview-page > .subview-titlebar .subview-main-title,
.subview-page > .subview-main-title,
.panel-title h3,
.desktop-brand h1,
.home-card h3,
.home-side-entry-title,
.chart-record-head .chart-record-name,
.session-item-head h4 {
  color: var(--theme-ink) !important;
  letter-spacing: 0.085em !important;
  text-indent: 0.085em !important;
}

.subview-main-title,
.panel-title span,
.label {
  color: rgba(55, 43, 30, 0.96) !important;
}

.shell-logo-desktop,
.shell-logo-mobile {
  opacity: 0.6;
}

.shell-logo-desktop {
  filter: drop-shadow(0 8px 16px rgba(48, 36, 24, 0.08)) saturate(0.72) !important;
}

.shell-logo-mobile {
  filter: drop-shadow(0 10px 20px rgba(48, 36, 24, 0.12)) saturate(0.74) !important;
}

.subview-panel,
#view-charts .chart-record-panel,
#view-chart-result .chart-record-panel,
#view-chart-editor .chart-record-editor-panel,
#view-sessions .sessions-panel,
#view-auth .auth-panel {
  border-color: var(--theme-panel-edge) !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 252, 246, 0.06), rgba(255, 252, 246, 0) 40%),
    linear-gradient(180deg, rgba(239, 231, 219, 0.16), rgba(223, 212, 194, 0.24)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.18),
    inset 0 -18px 28px rgba(147, 119, 87, 0.02),
    0 12px 24px rgba(40, 28, 17, 0.05) !important;
}

#view-chat .mobile-chat-panel {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth)
  .scroll-docked-stage::before,
#view-chat .chat-log-stage::before {
  border-color: rgba(122, 99, 73, 0.18) !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 250, 241, 0.05), rgba(255, 250, 241, 0) 40%),
    linear-gradient(180deg, rgba(45, 34, 23, 0.03), rgba(45, 34, 23, 0.08)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 246, 0.1),
    inset 0 -18px 36px rgba(145, 118, 86, 0.015),
    0 10px 22px rgba(56, 40, 23, 0.04) !important;
}

#view-charts .chart-record-item,
#view-sessions .session-entry,
.fortune-meta,
.fortune-section,
.bazi-pro-table,
.bazi-detail-table {
  border-color: rgba(125, 103, 79, 0.2) !important;
  background:
    linear-gradient(180deg, rgba(249, 245, 238, 0.93), rgba(239, 231, 220, 0.95)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.9),
    0 10px 22px rgba(54, 42, 28, 0.07) !important;
}

.quick-prompt,
.ghost,
.icon-btn,
.chart-method-buttons button,
.chart-record-form-actions button,
.chart-record-action-btn,
.chat-input button,
.auth-send-code,
.home-card,
.home-side-entry,
.desktop-nav-btn,
.nav-btn,
.subview-titlebar-action > *,
.session-action-btn {
  border-color: var(--theme-control-edge) !important;
  background:
    linear-gradient(180deg, var(--theme-control-top), var(--theme-control-bottom)) !important;
  color: var(--theme-ink) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.88),
    0 8px 16px rgba(55, 41, 27, 0.08) !important;
}

.quick-prompt:hover,
.ghost:hover,
.icon-btn:hover,
.chart-method-buttons button:hover,
.chart-record-form-actions button:hover,
.chart-record-action-btn:hover,
.chat-input button:hover,
.auth-send-code:hover,
.home-card:hover,
.home-side-entry:hover,
.desktop-nav-btn:hover:not(.is-active),
.nav-btn:hover,
.subview-titlebar-action > *:hover,
.session-action-btn:hover {
  border-color: rgba(98, 122, 151, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(251, 247, 242, 0.99), rgba(238, 230, 219, 0.99)) !important;
}

.desktop-nav-btn:active:not(.is-active) {
  border-color: rgba(98, 122, 151, 0.4) !important;
  background:
    linear-gradient(180deg, rgba(243, 237, 228, 0.99), rgba(229, 221, 209, 0.99)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.74),
    0 5px 10px rgba(55, 41, 27, 0.08) !important;
  transform: translateY(0.5px);
}

.desktop-nav-btn.is-active,
.desktop-nav-btn.is-active:hover,
.desktop-nav-btn.is-active:active,
.desktop-nav-btn.is-active:focus-visible {
  border-color: rgba(151, 56, 41, 0.72) !important;
  background:
    linear-gradient(180deg, rgba(178, 74, 55, 0.92), rgba(145, 48, 35, 0.94)) !important;
  color: #f6f5f3 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 191, 0.32),
    0 6px 14px rgba(96, 34, 24, 0.12) !important;
}

.primary,
#chart-record-save,
#view-auth .auth-form button:not(.ghost):not(.auth-send-code):not(.auth-link-button):not(.auth-tab):not(.auth-secondary-button),
#chat-export.chart-add-icon-btn,
#chat-reset.chart-add-icon-btn,
#chat-reset.chat-reset-icon-btn,
#chart-record-add.chart-add-icon-btn,
#view-chat #chat-send.is-send {
  border-color: var(--theme-action-edge) !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.18) 0, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, var(--theme-action-top), var(--theme-action-bottom)) !important;
  color: #f6f5f3 !important;
  box-shadow:
    inset 0 1px 0 rgba(235, 243, 251, 0.22),
    inset 0 -1px 0 rgba(54, 72, 93, 0.28),
    0 10px 22px rgba(49, 66, 84, 0.18) !important;
}

.primary:hover,
#chart-record-save:hover,
#view-auth .auth-form button:not(.ghost):not(.auth-send-code):not(.auth-link-button):not(.auth-tab):not(.auth-secondary-button):hover,
#chat-export.chart-add-icon-btn:hover,
#chat-reset.chart-add-icon-btn:hover,
#chat-reset.chat-reset-icon-btn:hover,
#chart-record-add.chart-add-icon-btn:hover,
#view-chat #chat-send.is-send:not(:disabled):hover {
  border-color: rgba(84, 108, 138, 0.96) !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22) 0, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, rgba(127, 151, 180, 0.99), rgba(86, 109, 139, 1)) !important;
}

.ghost.is-danger,
#sessions-clear,
#global-home-btn,
#sessions-clear-icon.chart-add-icon-btn,
.session-action-btn.is-delete,
.chart-record-action-btn.is-delete,
#view-chat #chat-send.is-stop,
.home-card[data-home-action="chat"] {
  border-color: var(--theme-danger-edge) !important;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 238, 229, 0.22) 0, rgba(255, 238, 229, 0) 42%),
    linear-gradient(180deg, var(--theme-danger-top), var(--theme-danger-bottom)) !important;
  color: #fff3eb !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 223, 210, 0.24),
    inset 0 -1px 0 rgba(104, 46, 36, 0.22),
    0 10px 22px rgba(95, 46, 35, 0.18) !important;
}

.ghost.is-danger:hover,
#sessions-clear:hover,
#global-home-btn:hover,
#sessions-clear-icon.chart-add-icon-btn:hover,
.session-action-btn.is-delete:hover,
.chart-record-action-btn.is-delete:hover,
#view-chat #chat-send.is-stop:not(:disabled):hover,
.home-card[data-home-action="chat"]:hover {
  border-color: rgba(154, 61, 46, 0.92) !important;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 238, 229, 0.24) 0, rgba(255, 238, 229, 0) 42%),
    linear-gradient(180deg, rgba(193, 92, 70, 0.98), rgba(153, 59, 44, 0.99)) !important;
}

.auth-link-button,
.field-helper-link,
.notice-expanded-body a {
  color: rgba(79, 104, 137, 0.96) !important;
}

.auth-link-button:hover,
.field-helper-link:hover,
.notice-expanded-body a:hover {
  color: rgba(60, 84, 115, 0.98) !important;
}

#view-auth .auth-secondary-button {
  border-color: rgba(123, 101, 77, 0.18) !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(249, 245, 238, 0.96), rgba(237, 229, 218, 0.96)) !important;
  color: rgba(86, 68, 48, 0.92) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    inset 0 -1px 0 rgba(158, 136, 105, 0.08),
    0 8px 16px rgba(53, 68, 87, 0.08) !important;
}

#view-auth .auth-secondary-button:hover {
  border-color: rgba(95, 113, 86, 0.28) !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(252, 249, 244, 1), rgba(238, 231, 221, 1)) !important;
  color: rgba(70, 55, 37, 0.96) !important;
}

#view-auth .auth-status {
  border-color: rgba(126, 105, 80, 0.2) !important;
  background: rgba(255, 252, 247, 0.82) !important;
  color: var(--theme-ink-soft) !important;
}

#view-auth .auth-status.is-error {
  border-color: rgba(139, 74, 58, 0.22) !important;
  background: rgba(252, 244, 241, 0.88) !important;
  color: #7d4335 !important;
}

#view-auth .auth-status.is-success {
  border-color: rgba(100, 122, 149, 0.22) !important;
  background: rgba(241, 246, 251, 0.9) !important;
  color: rgba(67, 87, 112, 0.94) !important;
}

@media (min-aspect-ratio: 1/1) {
  .desktop-shell-nav {
    background:
      linear-gradient(180deg, rgba(242, 236, 227, 0.74), rgba(229, 220, 206, 0.64)) !important;
    border-right: 1px solid rgba(132, 111, 87, 0.12) !important;
    box-shadow: none !important;
    backdrop-filter: blur(10px) saturate(0.9) !important;
  }

  .desktop-nav-list::before {
    background: rgba(136, 113, 84, 0.22) !important;
  }

  .desktop-nav-list::after {
    border-color: rgba(122, 100, 75, 0.18) !important;
    background: rgba(248, 243, 236, 0.68) !important;
    box-shadow: 0 0 0 2px rgba(245, 239, 230, 0.58) !important;
    opacity: 0.4;
  }

  .desktop-nav-btn {
    min-height: clamp(56px, 8.5vh, 74px);
    padding: 10px 12px;
    border-radius: 20px;
    border-color: rgba(127, 108, 86, 0.22) !important;
    background:
      linear-gradient(180deg, rgba(247, 243, 236, 0.78), rgba(236, 230, 220, 0.82)) !important;
    color: rgba(56, 45, 31, 0.84) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.78),
      0 4px 10px rgba(59, 45, 31, 0.05) !important;
  }

}

#view-chat {
  --chat-underlay-color:
    linear-gradient(180deg, rgba(244, 237, 228, 0.18), rgba(228, 218, 203, 0.08));
}

#view-chat .chat-msg.assistant,
#view-chat .chat-msg.user,
#view-chat .chat-msg.chat-widget .chat-embed-card {
  border-radius: 20px !important;
}

#view-chat .chat-msg.assistant,
#view-chat .chat-msg.chat-widget .chat-embed-card {
  border-color: rgba(122, 100, 75, 0.2) !important;
  background:
    linear-gradient(180deg, rgba(248, 241, 231, 0.98), rgba(235, 225, 209, 0.98)) !important;
  color: var(--theme-ink) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.86),
    0 12px 26px rgba(48, 38, 27, 0.08) !important;
}

#view-chat .chat-msg.user {
  border-color: rgba(100, 121, 148, 0.24) !important;
  background:
    linear-gradient(180deg, rgba(223, 233, 245, 0.98), rgba(205, 219, 235, 0.99)) !important;
  color: rgba(48, 66, 89, 0.96) !important;
  box-shadow:
    inset 0 1px 0 rgba(245, 249, 255, 0.72),
    0 12px 24px rgba(52, 67, 80, 0.1) !important;
}

#view-chat .chat-onboarding-line,
#view-chat .chat-msg.assistant p,
#view-chat .chat-msg.assistant li,
#view-chat .chat-msg.chat-widget .chat-embed-card p {
  color: var(--theme-ink-soft) !important;
}

#view-chat .chat-starter-prompts .quick-prompt,
.quick-prompt,
.home-side-entry {
  min-height: 34px;
  padding-inline: 12px;
  border-color: rgba(116, 97, 74, 0.24) !important;
  background:
    linear-gradient(180deg, rgba(250, 246, 241, 0.97), rgba(239, 231, 220, 0.98)) !important;
  color: rgba(67, 54, 39, 0.94) !important;
  font-size: 12px;
}

#view-chat .chat-starter-prompts .quick-prompt:hover,
.quick-prompt:hover,
.home-side-entry:hover {
  color: rgba(59, 76, 98, 0.96) !important;
}

#view-chat .chat-input {
  border-color: rgba(121, 101, 76, 0.24) !important;
  background: rgba(245, 239, 230, 0.96) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.84),
    0 10px 20px rgba(47, 37, 26, 0.1) !important;
}

.chat-input input,
.chat-input select,
.chat-input textarea,
.chart-record-form input,
.chart-record-form select,
.smart-form input,
.smart-form select,
.smart-form textarea,
#view-auth input,
#view-auth select,
#view-auth textarea {
  border-color: rgba(128, 110, 87, 0.24) !important;
  background: rgba(255, 253, 249, 0.95) !important;
  color: var(--theme-ink) !important;
}

.chat-input input:focus,
.chat-input select:focus,
.chat-input textarea:focus,
.chart-record-form input:focus,
.chart-record-form select:focus,
.smart-form input:focus,
.smart-form select:focus,
.smart-form textarea:focus,
#view-auth input:focus,
#view-auth select:focus,
#view-auth textarea:focus {
  border-color: rgba(102, 127, 156, 0.42) !important;
  box-shadow: 0 0 0 2px rgba(102, 127, 156, 0.11) !important;
  background: rgba(255, 253, 249, 0.98) !important;
}

#view-chat .chat-scroll-bottom {
  border-color: rgba(89, 111, 139, 0.28) !important;
  background:
    linear-gradient(180deg, rgba(248, 245, 240, 0.96), rgba(235, 229, 219, 0.95)) !important;
  color: rgba(55, 72, 95, 0.94) !important;
  box-shadow:
    0 10px 24px rgba(44, 34, 22, 0.12),
    inset 0 1px 0 rgba(255, 252, 246, 0.84) !important;
}

#view-charts .chart-record-item {
  min-height: 84px;
  padding: 12px 18px;
  border-radius: 18px;
}

.chart-record-head {
  gap: 10px;
}

.chart-record-head .chart-record-name {
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
}

.chart-record-status,
.session-method-pill {
  border-color: rgba(118, 98, 75, 0.2) !important;
  background: rgba(248, 244, 238, 0.9) !important;
  color: rgba(89, 71, 51, 0.9) !important;
  box-shadow: inset 0 1px 0 rgba(255, 253, 248, 0.76) !important;
}

.chart-record-status {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
}

.chart-record-status.is-stable {
  border-color: rgba(98, 120, 148, 0.2) !important;
  background: rgba(233, 239, 247, 0.88) !important;
  color: rgba(65, 84, 108, 0.94) !important;
}

.chart-record-status.is-pending {
  border-color: rgba(149, 111, 77, 0.22) !important;
  background: rgba(246, 236, 223, 0.9) !important;
  color: rgba(104, 74, 46, 0.92) !important;
}

.chart-record-status.is-icon-only {
  width: 24px;
  min-width: 24px;
  padding: 0;
}

.chart-record-status-mark {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(114, 137, 164, 0.98), rgba(86, 108, 134, 0.99)) !important;
  box-shadow:
    0 0 0 4px rgba(114, 137, 164, 0.14),
    inset 0 1px 0 rgba(238, 246, 255, 0.46);
}

#view-sessions .session-list {
  gap: 12px;
}

#view-sessions .session-entry {
  min-height: 94px;
  padding: 14px 16px;
  border-radius: 18px;
}

#view-sessions .session-item {
  gap: 6px;
  padding: 2px 62px 2px 0;
}

#view-sessions .session-item h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.38;
  letter-spacing: 0.015em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

#view-sessions .session-item p {
  color: rgba(87, 67, 48, 0.82);
  font-size: 13px;
  line-height: 1.56;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.session-item-meta {
  gap: 8px;
  row-gap: 6px;
  padding-top: 2px;
}

.session-item-meta-dot {
  color: rgba(142, 117, 92, 0.68);
  line-height: 1;
}

.session-method-pill {
  min-height: 23px;
  padding-inline: 9px;
  border-color: rgba(98, 120, 148, 0.18) !important;
  background: rgba(233, 239, 247, 0.84) !important;
  color: rgba(64, 84, 109, 0.94) !important;
}

.session-shujian-pill {
  min-height: 23px;
  padding-inline: 9px;
  border-color: rgba(151, 92, 64, 0.18) !important;
  background: rgba(248, 232, 218, 0.82) !important;
  color: rgba(122, 65, 40, 0.95) !important;
}

.session-item-time {
  color: rgba(109, 86, 61, 0.76);
}

#view-notices .notice-layout {
  gap: 12px;
}

#view-notices .notice-list {
  gap: 12px;
}

#view-notices .notice-list-item {
  min-height: 94px;
  padding: 14px 16px 14px 18px;
  border-radius: 18px;
}

#view-notices .notice-list-item.is-expanded {
  border-color: rgba(156, 133, 102, 0.32) !important;
  background:
    linear-gradient(180deg, rgba(252, 249, 243, 0.97), rgba(242, 235, 225, 0.97)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.9),
    0 10px 22px rgba(54, 42, 28, 0.08) !important;
}

#view-notices .notice-list-item.is-expanded.is-unread {
  border-color: rgba(157, 76, 44, 0.28) !important;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.96), rgba(248, 236, 218, 0.92)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.9),
    0 10px 22px rgba(113, 57, 27, 0.08) !important;
}

.notice-rail-empty {
  display: grid;
  align-content: start;
  min-height: 74px;
  padding: 16px 14px;
  border: 1px dashed rgba(132, 108, 79, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(249, 245, 239, 0.9), rgba(239, 231, 220, 0.94));
  color: rgba(100, 79, 58, 0.76);
}

.notice-rail-empty strong {
  font-size: 13px;
  font-weight: 600;
}

.notice-empty-state {
  min-height: clamp(260px, 42vh, 420px);
  display: grid;
  place-content: start center;
  justify-items: center;
  gap: 10px;
  padding: clamp(84px, 13vh, 128px) 18px 24px;
  text-align: center;
  color: rgba(96, 75, 54, 0.76);
}

.notice-empty-state strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(83, 64, 46, 0.9);
}

.notice-empty-state p {
  margin: 0;
  font-size: 13px;
  line-height: 1.58;
  color: rgba(114, 90, 64, 0.7);
}

.notice-empty-state.is-secondary p,
.notice-empty-state.is-loading p {
  display: none;
}

#view-auth .auth-panel {
  padding: 0 !important;
}

#view-auth {
  --auth-content-width: min(100%, 720px);
  --auth-serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --auth-paper-top: rgba(253, 250, 244, 0.98);
  --auth-paper-bottom: rgba(243, 234, 221, 0.96);
  --auth-edge-soft: rgba(131, 108, 81, 0.2);
  --auth-ink-strong: rgba(57, 40, 23, 0.96);
  --auth-ink-soft: rgba(110, 85, 58, 0.74);
  --auth-moss-strong: rgba(83, 101, 74, 0.92);
  --auth-moss-soft: rgba(131, 148, 117, 0.12);
  --auth-mist-soft: rgba(166, 177, 168, 0.12);
  --auth-sand-soft: rgba(191, 164, 122, 0.16);
}

#view-auth .auth-shell {
  width: 100%;
}

#view-auth #auth-guest-panel,
#view-auth #auth-account-panel {
  width: 100%;
  max-width: var(--auth-content-width);
  margin-inline: auto;
  padding-top: 4px;
}

#view-auth #auth-guest-panel > .auth-form,
#view-auth #auth-account-panel > .auth-account-card,
#view-auth #auth-account-panel > .auth-inline-actions.auth-inline-actions-start,
#view-auth #auth-account-panel > #auth-change-phone-form {
  width: 100%;
  max-width: none;
}

#view-auth #auth-change-phone-form {
  width: min(100%, 1040px);
  margin-inline: auto;
}

#view-auth .auth-account-card {
  display: grid;
  width: min(100%, 1040px);
  margin-inline: auto;
  padding: 20px 22px 22px;
  gap: 14px;
  border-radius: 22px;
  border: 1px solid rgba(125, 103, 79, 0.2);
  background:
    linear-gradient(180deg, rgba(249, 245, 238, 0.93), rgba(239, 231, 220, 0.95)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.9),
    0 10px 22px rgba(54, 42, 28, 0.07) !important;
}

#view-auth #auth-account-panel > .auth-account-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 20px 22px 20px;
  gap: 14px;
  border-radius: 24px;
  border: 1px solid rgba(133, 110, 82, 0.14);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.78), transparent 34%),
    linear-gradient(180deg, rgba(252, 248, 241, 0.97), rgba(242, 234, 222, 0.96)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -12px 18px rgba(154, 129, 96, 0.03),
    0 10px 22px rgba(46, 33, 21, 0.05) !important;
}

#view-auth #auth-account-panel > .auth-account-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.4), transparent 22%),
    radial-gradient(circle at 18% 100%, rgba(180, 191, 179, 0.08), transparent 26%),
    radial-gradient(circle at 82% 100%, rgba(180, 191, 179, 0.08), transparent 26%);
  pointer-events: none;
}

#view-auth #auth-account-panel > .auth-account-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  border: 1px solid rgba(142, 118, 90, 0.08);
  pointer-events: none;
}

#view-auth #auth-account-panel > .auth-account-card > * {
  position: relative;
  z-index: 1;
}

#view-auth .auth-account-head {
  display: flex;
  position: relative;
  justify-content: flex-end;
  align-items: center;
  min-height: 32px;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(141, 116, 87, 0.12);
}

#view-auth .auth-account-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: 0;
  padding-top: 0;
}

#view-auth .auth-account-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(124, 142, 133, 0.18);
  background: linear-gradient(180deg, rgba(237, 241, 241, 0.94), rgba(228, 233, 233, 0.92));
  color: rgba(84, 98, 96, 0.86);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: none;
}

#view-auth .auth-account-logout {
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(126, 100, 70, 0.18);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(250, 246, 239, 0.98), rgba(239, 229, 214, 0.96));
  color: rgba(86, 60, 36, 0.94);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 4px 12px rgba(60, 41, 22, 0.06);
  transition:
    background 200ms ease,
    box-shadow 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}

#view-auth .auth-account-logout:hover {
  border-color: rgba(114, 92, 67, 0.3);
  background: linear-gradient(180deg, rgba(251, 248, 243, 1), rgba(242, 232, 219, 0.98));
  color: var(--auth-ink-strong);
}

#view-auth .auth-account-logout:active {
  color: rgba(72, 52, 32, 0.92);
}

#view-auth .auth-account-grid {
  display: grid;
  gap: 10px;
}

#view-auth .auth-account-grid--meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#view-auth .auth-account-item {
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
  min-height: 84px;
  padding: 12px 14px;
  align-content: start;
  border-radius: 16px;
  border: 1px solid rgba(132, 109, 81, 0.1);
  box-shadow: none;
}

#view-auth .auth-account-item--meta {
  min-height: 76px;
  gap: 5px;
  padding: 13px 16px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

#view-auth .auth-account-grid--meta .auth-account-item--meta:first-child {
  background: linear-gradient(180deg, rgba(250, 246, 240, 0.96), rgba(242, 235, 226, 0.92)) !important;
}

#view-auth .auth-account-grid--meta .auth-account-item--meta:last-child {
  background: linear-gradient(180deg, rgba(248, 245, 239, 0.96), rgba(236, 241, 236, 0.9)) !important;
}

#view-auth .auth-account-item span {
  letter-spacing: 0.04em;
}

#view-auth .auth-account-item--meta span {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(112, 87, 61, 0.62);
}

#view-auth .auth-account-item--meta strong {
  font-size: 15px;
  line-height: 1.35;
  color: rgba(71, 51, 30, 0.88);
}

#view-auth .auth-account-item--balance {
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  min-height: 136px;
  padding: 18px 20px;
  gap: 18px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.56), transparent 30%),
    linear-gradient(180deg, rgba(250, 246, 239, 0.98), rgba(242, 234, 223, 0.95)) !important;
}

#view-auth .auth-account-item--balance::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.44), transparent 22%),
    radial-gradient(circle at 24% 100%, rgba(181, 194, 181, 0.08), transparent 24%),
    radial-gradient(circle at 76% 100%, rgba(181, 194, 181, 0.08), transparent 24%);
  pointer-events: none;
}

#view-auth .auth-account-item--balance > * {
  position: relative;
  z-index: 1;
}

#view-auth .auth-account-balance-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  justify-self: center;
}

#view-auth .auth-account-balance-icon-slot {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(129, 107, 82, 0.14);
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.92), rgba(244, 236, 224, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 18px rgba(70, 49, 27, 0.04);
}

#view-auth .auth-account-balance-icon-slot::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 14px;
  bottom: 10px;
  left: 14px;
  border-left: 1px solid rgba(134, 110, 83, 0.12);
  border-right: 1px solid rgba(134, 110, 83, 0.12);
  border-radius: 12px;
}

#view-auth .auth-account-balance-icon-slot::after {
  content: "";
  position: absolute;
  inset: 14px 10px;
  border-radius: 12px;
  background: repeating-linear-gradient(
    180deg,
    rgba(132, 108, 78, 0) 0 9px,
    rgba(132, 108, 78, 0.07) 9px 10px
  );
}

#view-auth .auth-account-balance-icon-slot--art {
  display: grid;
  place-items: center;
  padding: 10px;
}

#view-auth .auth-account-balance-icon-slot--art::before,
#view-auth .auth-account-balance-icon-slot--art::after {
  display: none;
}

#view-auth .auth-account-balance-icon-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#view-auth .auth-account-balance-copy {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(120px, 1fr);
  grid-template-areas:
    "label note"
    "value note"
    "action note";
  align-items: center;
  column-gap: 18px;
  row-gap: 8px;
  min-width: 0;
}

#view-auth .auth-account-balance-copy span {
  grid-area: label;
  align-self: end;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--auth-ink-soft);
}

#view-auth .auth-account-balance-copy strong {
  grid-area: value;
  align-self: start;
  font-family: var(--auth-serif);
  font-size: clamp(40px, 4.2vw, 54px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: rgba(57, 40, 23, 0.98);
}

#view-auth .auth-account-balance-copy small {
  grid-area: note;
  align-self: center;
  font-size: 12px;
  line-height: 1.6;
  max-width: 20ch;
  color: rgba(112, 87, 61, 0.74);
}

#view-auth .auth-account-recharge {
  grid-area: action;
  justify-self: start;
  min-height: 30px;
  padding: 0 16px;
  border: 1px solid rgba(111, 84, 50, 0.2);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(99, 72, 41, 0.96), rgba(74, 53, 30, 0.96));
  color: rgba(255, 250, 241, 0.98);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 16px rgba(74, 53, 30, 0.12);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

#view-auth .auth-account-recharge:hover {
  background: linear-gradient(180deg, rgba(112, 81, 45, 0.98), rgba(82, 58, 31, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 18px rgba(74, 53, 30, 0.16);
}

#view-auth .auth-account-recharge:active {
  transform: translateY(1px);
}

#view-auth .auth-inline-actions.auth-inline-actions-start {
  width: min(100%, 1040px);
  margin-inline: auto;
  margin-top: 10px;
  padding-inline: 10px;
}

#view-auth .auth-inline-actions .auth-link-button {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: rgba(84, 102, 83, 0.92) !important;
}

#view-auth .auth-inline-actions-start .auth-link-button {
  gap: 10px;
}

#view-auth .auth-inline-actions-start .auth-link-button::before {
  content: "";
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, rgba(96, 113, 84, 0.44), rgba(96, 113, 84, 0));
}

#view-auth .auth-inline-actions-start .auth-link-button:hover {
  color: rgba(67, 82, 63, 0.98) !important;
  text-decoration: none;
}

#view-auth .auth-inline-actions:not(.auth-inline-actions-start) .auth-link-button:hover {
  color: rgba(67, 82, 63, 0.98) !important;
  text-decoration: none;
}

#view-auth #auth-change-phone-form > .auth-form-actions {
  width: min(100%, 1040px);
  margin-inline: auto;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#view-auth #auth-change-phone-form > .auth-form-actions > button {
  min-width: 96px;
  min-height: 42px;
}

@media (min-aspect-ratio: 1/1) {
  #view-notices .notice-layout {
    grid-template-columns: 1fr;
  }

  #view-auth {
    --auth-content-width: min(100%, 1108px);
  }

  #view-auth #auth-guest-panel,
  #view-auth #auth-account-panel {
    width: 100% !important;
    max-width: var(--auth-content-width) !important;
  }

  #view-auth #auth-guest-panel > .auth-form,
  #view-auth #auth-account-panel > .auth-account-card,
  #view-auth #auth-account-panel > .auth-inline-actions.auth-inline-actions-start,
  #view-auth #auth-account-panel > #auth-change-phone-form {
    width: 100%;
    max-width: none;
  }

  #view-auth #auth-change-phone-form > .auth-account-card {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 700px) {
  #view-auth #auth-account-panel > .auth-account-card {
    padding: 18px 18px 18px;
    gap: 12px;
    border-radius: 22px;
  }

  #view-auth #auth-account-panel > .auth-account-card::after {
    inset: 8px;
    border-radius: 16px;
  }

  #view-auth .auth-account-head-actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding-top: 0;
  }

  #view-auth .auth-account-grid--meta {
    grid-template-columns: 1fr;
  }

  #view-auth .auth-account-item--balance {
    grid-template-columns: 68px minmax(0, 1fr);
    min-height: 124px;
    gap: 12px;
    padding: 15px 14px;
  }

  #view-auth .auth-account-balance-icon {
    width: 58px;
    height: 58px;
  }

  #view-auth .auth-account-balance-copy {
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "value"
      "note"
      "action";
    row-gap: 4px;
  }

  #view-auth .auth-account-balance-copy strong {
    font-size: 32px;
  }

  #view-auth .auth-account-balance-copy small {
    max-width: none;
  }

  #view-auth .auth-inline-actions.auth-inline-actions-start {
    margin-top: 8px;
    padding-inline: 2px;
  }

  #view-sessions .session-entry {
    min-height: 88px;
    padding: 13px 12px;
  }

  #view-sessions .session-item {
    padding-right: 56px;
  }

  .notice-empty-state {
    padding: 18px 14px;
  }

}

/* ===== 2026-03 chat hotfix ===== */
#view-chat .chat-log-stage {
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
}

#view-chat .chat-log-flow {
  gap: 16px !important;
  padding: 22px 18px 20px 16px !important;
}

#view-chat .chat-onboarding,
#view-chat .chat-msg.assistant,
#view-chat .chat-msg.chat-widget .chat-embed-card {
  max-width: min(100%, 920px) !important;
  margin-left: 4px !important;
}

#view-chat .chat-msg.user {
  max-width: min(100%, 620px) !important;
  margin-right: 8px !important;
}

#view-chat .chat-input {
  margin-bottom: 0 !important;
}

#view-chat .chat-scroll-bottom {
  right: 18px !important;
  bottom: 20px !important;
  min-height: 36px !important;
  padding-inline: 13px !important;
}

#view-chat #chat-send.is-send::before {
  background:
    center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20V5M7.2 9.8 12 5l4.8 4.8' fill='none' stroke='%23f6f5f3' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

@media (min-aspect-ratio: 1/1) {
  #view-chat .chat-log-flow {
    gap: 18px !important;
    padding: 30px 24px 28px 18px !important;
  }

  #view-chat .chat-onboarding,
  #view-chat .chat-msg.assistant,
  #view-chat .chat-msg.chat-widget .chat-embed-card {
    margin-left: 8px !important;
  }

  #view-chat .chat-msg.user {
    margin-right: 14px !important;
  }
}

@media (max-width: 700px) {
  #view-chat .mobile-chat-panel {
    gap: 6px !important;
  }

  #view-chat .chat-log-flow {
    gap: 14px !important;
    padding: 16px 10px 14px 10px !important;
  }

  #view-chat .chat-msg.assistant,
  #view-chat .chat-msg.chat-widget .chat-embed-card {
    max-width: calc(100% - 12px) !important;
    margin-left: 0 !important;
  }

  #view-chat .chat-msg.user {
    max-width: calc(100% - 22px) !important;
    margin-right: 0 !important;
  }

  #view-chat .chat-input {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  #view-chat .chat-scroll-bottom {
    right: 14px !important;
    bottom: 16px !important;
  }
}

#view-chat .mobile-chat-panel,
:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-panel {
  overflow: visible !important;
}

#view-chat .chat-log-stage,
:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-stage {
  overflow: visible !important;
}

@media (min-aspect-ratio: 1/1) {
  #global-home-btn.is-desktop-back-visible {
    display: inline-flex !important;
  }
}

/* ===== Final chart launcher ===== */
.chart-record-head {
  justify-content: flex-start;
}

.chart-record-status.is-pending {
  margin-left: auto;
}

.chart-record-status.is-inline-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0 5px;
  border-radius: 7px;
  border: 1px solid rgba(132, 113, 89, 0.18) !important;
  background: rgba(249, 246, 241, 0.78) !important;
  color: rgba(110, 91, 68, 0.76) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.82),
    0 2px 5px rgba(55, 41, 27, 0.04) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
}

.chart-record-time {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.chart-record-time-text {
  min-width: 0;
}

.chart-record-time-calibration {
  transform: translateY(-0.5px);
}

@media (max-width: 700px) {
  .chart-record-time {
    gap: 6px;
  }

  .chart-record-status.is-inline-mark {
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 9px !important;
  }
}

#view-chat .chat-onboarding {
  display: grid !important;
  justify-items: start !important;
  gap: 10px !important;
  width: min(100%, 920px) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#view-chat .chat-onboarding.hidden {
  display: none !important;
}

#view-chat .chat-msg.assistant:not(.chat-onboarding) {
  margin-top: 0;
}

#view-chat .chat-onboarding-line {
  display: block;
  width: fit-content;
  max-width: min(100%, 920px);
  margin: 0 !important;
  padding: 9px 11px !important;
  border: 1px solid rgba(122, 100, 75, 0.2) !important;
  border-radius: 20px !important;
  background: linear-gradient(180deg, rgba(248, 241, 231, 0.98), rgba(235, 225, 209, 0.98)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.86),
    0 12px 26px rgba(48, 38, 27, 0.08) !important;
  color: var(--theme-ink-soft) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  letter-spacing: normal !important;
}

#view-chat .chat-starter-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px !important;
  margin: 0 !important;
  padding-left: 12px;
}

#view-chat .chat-onboarding.is-condensed .chat-starter-prompts {
  display: none !important;
}

#view-chat .chat-onboarding .quick-prompt {
  min-height: 34px;
  padding-inline: 14px;
  border-radius: 999px;
  border-color: rgba(116, 97, 74, 0.24) !important;
  background: linear-gradient(180deg, rgba(250, 246, 241, 0.97), rgba(239, 231, 220, 0.98)) !important;
  color: rgba(67, 54, 39, 0.94) !important;
  font-size: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.88),
    0 8px 16px rgba(55, 41, 27, 0.08) !important;
}

#view-chat .chat-onboarding .quick-prompt:hover {
  border-color: rgba(98, 122, 151, 0.34) !important;
  background: linear-gradient(180deg, rgba(251, 247, 242, 0.99), rgba(238, 230, 219, 0.99)) !important;
  color: rgba(59, 76, 98, 0.96) !important;
}

@media (max-width: 700px) {
  #view-chat .chat-onboarding {
    width: 100% !important;
    gap: 8px !important;
  }

  #view-chat .chat-onboarding-line {
    max-width: calc(100% - 12px);
    padding: 9px 11px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
  }

  #view-chat .chat-starter-prompts {
    gap: 8px !important;
    padding-left: 8px;
  }

  #view-chat .chat-onboarding .quick-prompt {
    min-height: 32px;
    padding-inline: 12px;
    font-size: 11px;
  }
}

#view-chat .chat-msg.assistant.chat-widget {
  width: auto !important;
  max-width: none !important;
  margin: 0 0 0 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#view-chat .chat-msg.chat-widget .chat-embed-card.chart-launch-card {
  display: inline-flex !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  overflow: hidden !important;
}

#view-chat .chat-chart-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 248, 237, 0.99);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

#view-chat .chat-chart-launcher:hover {
  background: rgba(133, 59, 43, 0.09);
  box-shadow: 0 8px 16px rgba(73, 35, 24, 0.08);
}

#view-chat .chat-chart-launcher:active {
  transform: translateY(1px);
}

#view-chat .chat-chart-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 230, 201, 0.26), rgba(255, 230, 201, 0) 40%),
    linear-gradient(180deg, rgba(181, 73, 55, 0.98), rgba(138, 44, 32, 1));
  color: rgba(255, 248, 237, 0.99);
  box-shadow:
    inset 0 1px 0 rgba(255, 229, 198, 0.32),
    0 7px 14px rgba(90, 34, 25, 0.16);
}

#view-chat .chat-chart-launcher-mark {
  display: block;
  width: 17px;
  height: 17px;
}

#view-chat .chat-chart-launcher-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(112, 26, 19, 0.96);
  color: #fff7ed;
  font-size: 9px;
  line-height: 1;
  box-shadow:
    0 3px 8px rgba(73, 20, 14, 0.18),
    0 0 0 2px rgba(250, 244, 236, 0.92);
}

@media (max-aspect-ratio: 1/1) {
  #view-chat .chat-msg.assistant.chat-widget {
    margin-left: 0 !important;
  }

  /* Mirror the portrait notice tile directly from the home cards above. */
  #view-home .home-secondary-actions {
    margin-top: 14px;
  }

  #view-home .home-secondary-actions .home-side-entry {
    width: clamp(118px, 30vw, 136px);
    min-height: 60px;
    padding: 9px 9px;
    border-radius: 14px;
    border: 1px solid var(--theme-control-edge) !important;
    background:
      linear-gradient(180deg, var(--theme-control-top), var(--theme-control-bottom)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.88),
      0 8px 16px rgba(55, 41, 27, 0.08) !important;
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    gap: 0;
    text-align: center;
    transition:
      transform 180ms ease,
      box-shadow 220ms ease,
      filter 220ms ease,
      border-color 220ms ease,
      background 220ms ease;
  }

  #view-home .home-secondary-actions .home-side-entry::after {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -18px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(151, 56, 41, 0.2), transparent 68%);
    pointer-events: none;
  }

  #view-home .home-secondary-actions .home-side-entry-title {
    margin: 0;
    font-weight: 700;
    color: var(--theme-ink) !important;
  }

  #view-home .home-secondary-actions .home-side-entry:hover {
    transform: translateY(-1px);
    border-color: rgba(98, 122, 151, 0.34) !important;
    background:
      linear-gradient(180deg, rgba(251, 247, 242, 0.99), rgba(238, 230, 219, 0.99)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.92),
      0 10px 22px rgba(52, 40, 28, 0.1) !important;
  }

  #view-home .home-secondary-actions .home-side-entry:active {
    transform: translateY(1px) scale(0.985);
  }
}

/* ===== Record/session action controls refinement ===== */
.chart-record-action-icon--close {
  width: 70%;
  height: 70%;
}

.chart-record-action-icon--close::before,
.chart-record-action-icon--close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84%;
  height: 16%;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.chart-record-action-icon--close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.chart-record-action-icon--close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.chart-record-action-btn.is-close,
.session-action-btn.is-close {
  border: 1px solid rgba(129, 112, 91, 0.3);
  background: linear-gradient(180deg, rgba(249, 245, 239, 0.96), rgba(238, 231, 221, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 248, 0.88),
    0 5px 10px rgba(55, 41, 27, 0.08);
  color: rgba(92, 72, 50, 0.94);
}

@media (max-aspect-ratio: 1/1) {
  .chart-record-swipe-hint,
  .session-swipe-hint {
    display: inline-flex;
    right: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 2px;
    opacity: 0.88;
  }

  .chart-record-swipe-hint-arrow {
    width: 8px;
    height: 8px;
    border-width: 0 2.5px 2.5px 0;
    border-color: rgba(88, 108, 133, 0.82);
  }

  .chart-record-item.is-actions-visible .chart-record-tools,
  .session-entry.is-actions-visible .session-tools {
    right: 8px;
  }
}

@media (min-aspect-ratio: 1/1) {
  .chart-record-swipe-hint,
  .session-swipe-hint {
    display: inline-flex;
    right: 12px;
    min-width: 42px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid rgba(132, 113, 89, 0.24);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(248, 243, 236, 0.94), rgba(236, 229, 219, 0.96));
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.86),
      0 7px 14px rgba(55, 41, 27, 0.08);
    gap: 3px;
    opacity: 0.96;
  }

  .chart-record-swipe-hint:hover,
  .session-swipe-hint:hover {
    border-color: rgba(115, 98, 77, 0.34);
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.9),
      0 9px 18px rgba(55, 41, 27, 0.1);
  }

  .chart-record-swipe-hint-arrow {
    border-color: rgba(86, 108, 134, 0.82);
  }

  .chart-record-tools,
  .session-tools {
    right: 8px;
    gap: 5px;
    padding: 5px;
    border: 1px solid rgba(132, 113, 89, 0.2);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(249, 245, 239, 0.98), rgba(239, 232, 222, 0.98));
    box-shadow:
      inset 0 1px 0 rgba(255, 253, 248, 0.88),
      0 10px 22px rgba(55, 41, 27, 0.1);
  }

  .chart-record-item.is-actions-visible .chart-record-main,
  .session-entry.is-actions-visible .session-item {
    padding-right: 126px;
  }
}

/* ===== Final docked scrollbar restore ===== */

#view-chat,
:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth).scroll-docked-view {
  --app-scrollbar-dock: 14px;
}

#view-chat .chat-log-stage,
:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-stage {
  overflow: visible !important;
}

#view-chat .chat-log,
:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-host {
  width: calc(100% + var(--scroll-docked-dock, var(--app-scrollbar-dock))) !important;
  max-width: none !important;
  margin-right: calc(var(--scroll-docked-dock, var(--app-scrollbar-dock)) * -1) !important;
  padding-right: 0 !important;
  scrollbar-gutter: stable !important;
}

#view-chat .chat-log-flow,
:is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth) .scroll-docked-flow {
  position: relative;
  z-index: 1;
}

@media (max-width: 700px) {
  #view-chat,
  :is(#view-charts, #view-chart-result, #view-chart-editor, #view-sessions, #view-notices, #view-auth).scroll-docked-view {
    --app-scrollbar-dock: 10px;
  }
}

/* ===== Final chat viewport clamp ===== */
#view-chat {
  --chat-underlay-bottom-gap: 0px;
  --chat-stage-clip-radius: 20px;
}

#view-chat .chat-log-stage {
  clip-path: inset(0 calc(var(--chat-scrollbar-dock, var(--app-scrollbar-dock)) * -1) 0 0 round var(--chat-stage-clip-radius));
}

#view-chat .chat-msg {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

#view-chat .chat-msg.is-copyable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#view-chat .chat-msg.is-copyable.is-copy-feedback {
  position: relative;
}

#view-chat .chat-msg.is-copyable.is-copy-feedback::after {
  content: attr(data-copy-feedback);
  position: absolute;
  z-index: 6;
  left: 10px;
  top: -8px;
  padding: 3px 8px 4px;
  border: 1px solid rgba(255, 248, 235, 0.22);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(76, 58, 36, 0.92), rgba(52, 39, 25, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 232, 0.16),
    0 6px 14px rgba(52, 38, 22, 0.18);
  color: rgba(255, 250, 239, 0.96);
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.02em;
  pointer-events: none;
  transform: translateY(-100%);
  white-space: nowrap;
}

.home-side-entry.has-unread-notice::before,
.desktop-nav-btn.has-unread-notice::before {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  display: block;
  border: 1px solid rgba(255, 245, 229, 0.92);
  background: #a53625;
  box-shadow:
    0 0 0 2px rgba(165, 54, 37, 0.1),
    0 2px 6px rgba(104, 46, 24, 0.18);
}

#view-chat .chat-msg.user.is-copyable.is-copy-feedback::after {
  left: auto;
  right: 10px;
  border-color: rgba(235, 246, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(54, 68, 84, 0.92), rgba(39, 51, 65, 0.94));
  color: rgba(244, 250, 255, 0.96);
}

#view-chat .chat-input {
  grid-template-columns: minmax(0, 1fr) auto !important;
  margin-bottom: 0 !important;
}

@media (min-aspect-ratio: 1/1) {
  #view-chat {
    --chat-stage-clip-radius: 28px;
  }

  #view-chat.app-view {
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }
}

@media (max-width: 700px) {
  #view-chat .chat-input {
    gap: 8px !important;
    padding: 8px !important;
  }

}
