:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-muted: #f6f7f9;
  --ink: #151823;
  --muted: #687083;
  --line: #e3e6ec;
  --accent: #d92d38;
  --accent-strong: #a92733;
  --coach: #2c6b59;
  --risk: #bd1f2b;
  --warm: #8a5b11;
  --shadow: 0 10px 26px rgba(21, 24, 35, 0.05);
  --soft-shadow: 0 8px 20px rgba(21, 24, 35, 0.06);
  --radius: 8px;
  --hair-start: #3a475c;
  --hair-end: #1f2937;
  --aura-opacity: 0.54;
  --aura-scale: 1;
  --brow-angle: 0deg;
  --mouth-shift: 0;
  --pressure-opacity: 0;
  --turn-top-offset: 18px;

  /* === 设计后台可编辑变量(默认值=当前外观) === */
  --brand-bg: #151823;        /* 顶部「AI老板」黑框底色 */
  --ui-radius: 12px;          /* 顶部黑框/白框圆角 */
  --card-radius: 12px;        /* 老板指数卡圆角 */
  --bubble-radius: 14px;      /* 聊天气泡圆角 */
  --input-radius: 18px;       /* 输入框圆角 */
  --topbar-label-size: 14px;  /* 顶部「AI老板」「菜单」字号 */
  --title-size: 22px;         /* 「把老板叫出来」标题字号 */
  --score-num-color: #bd1f2b; /* 老板指数大数字颜色 */
  --score-num-size: 30px;     /* 老板指数大数字字号 */
  --text-size: 15px;          /* 聊天+大宗师 正文字号 */
  --name-size: 12px;          /* 聊天+大宗师 名称字号 */
  --boss-bubble-bg: #ffffff;  /* AI老板气泡底色 */
  --user-bubble-bg: #ffe4e5;  /* 用户气泡底色 */
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #f8fafb 0%, #edf1f4 58%, #e8edf1 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

/* 整页锁定视口:任何尺寸下顶栏/老板图片/大宗师卡都固定在顶部,
   只有聊天窗口内部滚动(vh 是老浏览器/微信 webview 的回退,dvh 优先) */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 12px;
}

.setup-screen {
  align-items: center;
  background: rgba(238, 242, 246, 0.96);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 10;
}

.setup-screen.is-hidden {
  display: none;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 760px;
  padding: 24px;
  width: 100%;
}

.setup-card h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

.setup-step.is-hidden {
  display: none;
}

.setup-card > p:not(.eyebrow),
.setup-step > p:not(.eyebrow) {
  color: var(--muted);
  margin-bottom: 18px;
}

.setup-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.setup-option {
  align-items: flex-start;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  display: grid;
  gap: 7px;
  min-height: 150px;
  padding: 16px;
  text-align: left;
}

.setup-option.is-selected {
  background: #edf6ff;
  border-color: #83bdea;
  box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.12);
}

.setup-option small {
  color: var(--muted);
}

.avatar-token {
  background: linear-gradient(145deg, #e5edf7, #f8fafc);
  border: 1px solid #cfd9e6;
  border-radius: 999px;
  height: 54px;
  position: relative;
  width: 54px;
}

.avatar-token::before {
  background: #f3c9ab;
  border-radius: 50%;
  content: "";
  height: 28px;
  left: 12px;
  position: absolute;
  top: 12px;
  width: 30px;
}

.avatar-token::after {
  background: #2f3d52;
  border-radius: 16px 16px 8px 8px;
  content: "";
  height: 17px;
  left: 10px;
  position: absolute;
  top: 8px;
  width: 34px;
}

.female-token::after {
  background: #44344f;
}

.avatar-token-b::after {
  background: #3f5069;
}

.avatar-token-c::after {
  background: #4a5568;
}

.avatar-token-d::after {
  background: #4b3b57;
}

.avatar-token-e::after {
  background: #5a4b68;
}

.avatar-token-f::after {
  background: #3f4056;
}

.setup-start {
  width: 100%;
}

.settings-card {
  display: grid;
  gap: 12px;
  max-width: 360px;
}

.settings-card h2 {
  margin: 0;
}

.setting-action {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-weight: 900;
  min-height: 48px;
  padding: 0 16px;
  text-align: left;
}

.setup-close-button {
  width: 100%;
}

.name-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.name-option {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 800;
  min-height: 48px;
}

.name-option.is-selected {
  background: #edf6ff;
  border-color: #83bdea;
  box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.12);
  color: var(--accent-strong);
}

.topbar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 0 auto 6px;
  max-width: 920px;
  position: relative;
  width: 100%;
}

.brand-stack {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 0;
}

.brand-home {
  flex: 0 0 auto;
}

.brand-mark {
  align-items: center;
  background: var(--brand-bg);
  border-radius: var(--ui-radius);
  color: #fff;
  display: inline-flex;
  font-size: var(--topbar-label-size);
  font-weight: 800;
  min-height: 40px;
  justify-content: center;
  min-width: 70px;
  padding: 0 12px;
  white-space: nowrap;
}

.topbar-title {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  left: 50%;
  line-height: 1.05;
  margin: 0;
  max-width: calc(100% - 220px);
  overflow: hidden;
  position: absolute;
  text-align: center;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 22px;
  margin-bottom: 0;
}

h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.status-strip {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.topbar-menu {
  align-items: center;
  display: flex;
  margin-left: auto;
  position: relative;
  z-index: 5;
}

.menu-button {
  border-radius: var(--ui-radius);
  font-size: var(--topbar-label-size);
  min-height: 44px;
  min-width: 74px;
  padding: 0 14px;
}

.menu-popover {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--soft-shadow);
  display: grid;
  gap: 4px;
  min-width: 116px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
}

.menu-popover.is-hidden {
  display: none;
}

.menu-item {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 900;
  min-height: 38px;
  padding: 0 12px;
  text-align: left;
  white-space: nowrap;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-muted);
}

.status-strip span,
.section-heading span,
.example-chip,
.trait-cloud span {
  background: #e7eef7;
  border: 1px solid #d3deec;
  border-radius: 999px;
  color: #36536f;
  display: inline-flex;
  font-size: 12px;
  line-height: 1;
  padding: 8px 10px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  flex: 1;
  margin: 0 auto;
  max-width: 920px;
  min-height: 0;
  width: 100%;
}

.profile-panel,
.simulation-panel {
  min-width: 0;
}

.profile-panel {
  display: none;
}

.panel-block,
.simulation-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel-block {
  margin-bottom: 16px;
  padding: 16px;
}

.section-heading,
.action-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.action-row {
  justify-content: flex-end;
  margin-top: 12px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading p {
  font-weight: 800;
  margin-bottom: 0;
}

.avatar-block {
  overflow: hidden;
}

.avatar-stage {
  background: linear-gradient(145deg, #f7faff, #e8eef5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  min-height: 238px;
  overflow: hidden;
  place-items: center;
}

.boss-avatar {
  display: block;
  height: 220px;
  width: 220px;
}

.aura {
  fill: url("#auraGradient");
  opacity: var(--aura-opacity);
  transform: scale(var(--aura-scale));
  transform-origin: 110px 108px;
}

.face,
.neck {
  fill: #f3c9ab;
}

.hair-back,
.hair-front,
.bang {
  fill: url("#hairGradient");
}

.shoulders {
  fill: #2f3d52;
}

.collar-left,
.collar-right {
  fill: #f8fafc;
  stroke: #d5dde8;
  stroke-width: 2;
}

.eye {
  fill: #111827;
}

.brow {
  stroke: #111827;
  stroke-linecap: round;
  stroke-width: 5;
  transform-origin: center;
}

.brow-left {
  transform: rotate(var(--brow-angle));
}

.brow-right {
  transform: rotate(calc(var(--brow-angle) * -1));
}

.nose {
  fill: none;
  stroke: #cc9574;
  stroke-linecap: round;
  stroke-width: 3;
}

.mouth {
  fill: none;
  stroke: #8a4a45;
  stroke-linecap: round;
  stroke-width: 4;
  transform: translateY(var(--mouth-shift));
}

.pressure-dot {
  fill: #d24b4b;
  opacity: var(--pressure-opacity);
}

.avatar-stage[data-gender="female"] {
  --hair-start: #44344f;
  --hair-end: #241f33;
}

.avatar-stage[data-avatar="male-neutral"] {
  --hair-start: #3a475c;
  --hair-end: #1f2937;
}

.avatar-stage[data-avatar="male-calm"] {
  --hair-start: #3f5069;
  --hair-end: #253247;
}

.avatar-stage[data-avatar="male-soft"] {
  --hair-start: #4a5568;
  --hair-end: #2f3746;
}

.avatar-stage[data-avatar="female-neutral"] {
  --hair-start: #4b3b57;
  --hair-end: #2a2435;
}

.avatar-stage[data-avatar="female-calm"] {
  --hair-start: #5a4b68;
  --hair-end: #332b43;
}

.avatar-stage[data-avatar="female-soft"] {
  --hair-start: #3f4056;
  --hair-end: #292b3e;
}

.avatar-stage[data-level="1"] {
  --aura-opacity: 0.68;
  --aura-scale: 1.03;
  --brow-angle: -4deg;
  --mouth-shift: 2px;
  --pressure-opacity: 0.28;
}

.avatar-stage[data-level="2"] {
  --aura-opacity: 0.78;
  --aura-scale: 1.06;
  --brow-angle: -8deg;
  --mouth-shift: 4px;
  --pressure-opacity: 0.5;
}

.avatar-stage[data-level="3"] {
  --aura-opacity: 0.9;
  --aura-scale: 1.1;
  --brow-angle: -12deg;
  --mouth-shift: 6px;
  --pressure-opacity: 0.74;
}

.segmented {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
  margin: 12px 0 0;
  padding: 0;
}

.segmented legend {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
}

.segmented input:checked + span {
  background: #dceeff;
  border-color: #8ac0ed;
  color: var(--accent-strong);
}

.avatar-note,
.memory-list,
.profile-facts dd,
.coach-stack p,
.action-row p {
  color: var(--muted);
  font-size: 14px;
}

.avatar-note {
  margin-top: 12px;
}

.profile-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.boss-score-card {
  background: #f8fafc;
  border: 1px solid #e1e8f0;
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 12px;
}

.boss-score-topline,
.score-meta {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.boss-score-topline p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 2px;
}

.boss-score-topline strong {
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.boss-score-topline span {
  background: #fff;
  border: 1px solid #dbe3ed;
  border-radius: 999px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 9px;
  white-space: nowrap;
}

.score-track {
  background: linear-gradient(90deg, #f0b4ad, #f3f4f6 50%, #a9d6bc);
  border-radius: 999px;
  height: 10px;
  margin: 12px 0 10px;
  position: relative;
}

.score-zero {
  background: rgba(23, 32, 51, 0.32);
  height: 18px;
  left: 50%;
  position: absolute;
  top: -4px;
  width: 1px;
}

.score-marker {
  background: #172033;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.24);
  height: 18px;
  position: absolute;
  top: -4px;
  transform: translateX(-50%);
  width: 18px;
}

.score-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-reason {
  color: #475467;
  font-size: 13px;
  margin: 8px 0 0;
}

.score-evidence {
  margin-top: 10px;
  min-height: 0;
}

.profile-facts div {
  border-bottom: 1px solid #eef1f5;
  padding-bottom: 10px;
}

.profile-facts dt {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.profile-facts dd {
  margin: 4px 0 0;
}

.trait-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  min-height: 34px;
}

.simulation-panel {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.mobile-home-panel {
  background:
    linear-gradient(145deg, rgba(248, 250, 251, 0.98) 0%, rgba(255, 255, 255, 0.98) 58%, rgba(241, 248, 245, 0.98) 100%),
    #ffffff;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr;
  min-height: 214px;
  overflow: hidden;
  /* 水平内边距与 .chat-window 一致(12px),使老板图片/大宗师卡与聊天气泡左右对齐 */
  padding: 7px 12px 7px;
  position: relative;
}

.mobile-home-panel::before {
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.32) 60%, rgba(255, 255, 255, 0) 100%);
  content: "";
  inset: 0;
  position: absolute;
}

.summon-visual {
  align-self: stretch;
  background: linear-gradient(160deg, #e3eaf1 0%, #f1f4f2 58%, #e9e1dc 100%);
  border: 1px solid rgba(202, 213, 225, 0.92);
  border-radius: 16px;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.72), 0 6px 18px rgba(21, 24, 35, 0.06);
  min-height: 150px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.summon-visual img {
  filter: drop-shadow(0 18px 24px rgba(21, 24, 35, 0.22));
  height: 100%;
  left: 50%;
  object-fit: cover;
  object-position: 50% 24%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

.visual-score-grid {
  --visual-card-width: 108px;
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  left: 10px;
  position: absolute;
  right: 10px;
  top: 12px;
}

.visual-score-card {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(228, 234, 242, 0.72);
  border-radius: var(--card-radius);
  box-shadow: 0 6px 16px rgba(21, 24, 35, 0.06);
  min-width: 0;
  padding: 8px 9px;
  width: var(--visual-card-width);
}

.visual-score-index {
  display: grid;
  align-content: center;
}

.visual-score-profile {
  display: grid;
  align-content: center;
  justify-self: end;
  /* 只需容纳 5 个字(值 12px×5≈60 + 内边距);随内容收缩,整体贴右 */
  margin-left: auto;
  max-width: 84px;
  overflow: hidden;
  width: max-content;
}

.visual-score-card span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.score-line {
  align-items: center;
  column-gap: 6px;
  display: grid;
  grid-template-columns: minmax(0, 52px) minmax(0, 1fr);
}

.score-meta-left {
  display: grid;
  gap: 3px;
}

.visual-score-card strong {
  color: var(--score-num-color);
  display: block;
  font-size: var(--score-num-size);
  justify-self: center;
  line-height: 1;
}

.boss-score-topline .score-value-negative,
.visual-score-card .score-value-negative {
  color: #bd1f2b;
}

.boss-score-topline .score-value-positive,
.visual-score-card .score-value-positive {
  color: #16864a;
}

.visual-score-card em {
  color: #263041;
  display: block;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.visual-score-facts {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
}

.visual-score-facts b {
  color: #1d2433;
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  margin-top: 1px;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.mobile-score-strip {
  align-self: end;
  display: grid;
  gap: 4px;
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
  position: relative;
  z-index: 1;
}

.mobile-coach-card {
  background: #f4faf7;
  border: 1px solid rgba(196, 219, 211, 0.78);
  border-radius: 12px;
  box-shadow: none;
  min-width: 0;
  padding: 8px 10px;
}

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

.coach-history-button {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(196, 218, 210, 0.96);
  border-radius: 999px;
  color: var(--coach);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  min-height: 26px;
  padding: 0 10px;
}

.coach-card-head span {
  color: var(--coach);
  display: block;
  font-size: var(--name-size);
  font-weight: 800;
  line-height: 1.2;
}

.mobile-coach-card strong,
.mobile-coach-card em {
  color: var(--coach);
  display: block;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.45;
  margin-top: 5px;
}

/* 大宗师秘籍(历史记录)列表,在菜单浮层里展示 */
.codex-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding-left: 20px;
}

.codex-list li {
  color: var(--coach);
  font-size: 14px;
  line-height: 1.5;
}

.ghost-button,
.primary-button {
  border-radius: 12px;
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
}

.ghost-button {
  background: #fff;
  border: 1px solid var(--line);
  color: #344054;
}

.primary-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.chat-window {
  background: #f6f7f9;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  max-height: none;
  min-height: 120px;
  overflow-y: auto;
  /* 输入框已改为面板下方独立成行(不再悬浮盖住聊天),无需预留大底边 */
  padding: 12px 12px 20px;
  scroll-padding-top: var(--turn-top-offset);
}

.turn-group {
  align-content: start;
  display: grid;
  gap: 12px;
  scroll-margin-top: var(--turn-top-offset);
}

.message {
  border-radius: var(--bubble-radius);
  max-width: min(86%, 680px);
  padding: 11px 13px;
  width: fit-content;
}

.chat-body,
.coach-body {
  font-size: var(--text-size);
  line-height: 1.55;
  margin-bottom: 0;
}

.chat-meta {
  font-size: var(--name-size);
  font-weight: 800;
  line-height: 1.2;
}

.message-meta {
  margin-bottom: 6px;
}

.boss-message {
  align-self: flex-start;
  background: #fffefd;
  border: 1px solid #e6e9ef;
  justify-self: start;
  margin-right: auto;
}

.boss-message .message-meta {
  color: #9f2a34;
}

.user-message {
  align-self: flex-end;
  background: #fff3f4;
  border: 1px solid #f4d1d5;
  cursor: pointer; /* 可点:回放这一轮的大宗师分析/提示 */
  justify-self: end;
  margin-left: auto;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.coach-message {
  align-self: flex-start;
  background: #f4faf7;
  border: 1px solid #c9ddd5;
  justify-self: start;
  margin-right: auto;
}

.coach-message .message-meta,
.coach-kicker {
  color: var(--coach);
}

.coach-kicker {
  font-size: 12px;
  font-weight: 900;
  margin: 8px 0 4px;
  text-transform: uppercase;
}

.coach-kicker:first-of-type {
  margin-top: 0;
}

.input-zone {
  background: transparent;
  display: grid;
  gap: 6px;
  padding: 0;
}

.input-zone label {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

.composer-footer-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 30px;
  padding: 0 8px 0 10px;
}

.composer-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

/* 输入字数提醒:平时安静,接近 140 上限时转警示色 */
.char-counter {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.char-counter.is-warn {
  color: var(--accent);
}

.bottom-composer {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(221, 227, 235, 0.96);
  border-radius: 20px;
  box-shadow: 0 8px 22px rgba(21, 24, 35, 0.07);
  margin: 12px auto 0;
  max-width: min(920px, 100%);
  padding: 8px;
  position: sticky;
  bottom: 14px;
  width: 100%;
  z-index: 4;
}

.mobile-insight-drawer {
  background: #ffffff;
  border-top: 1px solid var(--line);
}

.mobile-insight-drawer summary {
  color: #344054;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
  padding: 12px 16px;
}

.mobile-insight-drawer summary::-webkit-details-marker {
  display: none;
}

.mobile-insight-drawer summary::after {
  content: "展开";
  color: var(--muted);
  float: right;
  font-size: 12px;
}

.mobile-insight-drawer[open] summary::after {
  content: "收起";
}

.mobile-insight-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 16px 14px;
}

.mobile-insight-grid div {
  background: var(--surface-muted);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  min-width: 0;
  padding: 10px;
}

.mobile-insight-grid strong {
  color: var(--ink);
  display: block;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.composer-box {
  align-items: flex-end;
  background: #fbfcfd;
  border: 1px solid #d5dce7;
  border-radius: var(--input-radius);
  display: block;
  padding: 4px;
  position: relative;
}

.composer-box:focus-within {
  border-color: #b9c7d8;
  box-shadow: 0 0 0 3px rgba(31, 111, 178, 0.12);
}

textarea {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  display: block;
  height: 70px;
  max-height: 112px;
  min-height: 70px;
  outline: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 8px;
  resize: none;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

textarea::placeholder {
  color: #7a8292;
  font-weight: 500;
}

.input-zone .primary-button {
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  min-height: 28px;
  min-width: 56px;
  padding: 0 12px;
  white-space: nowrap;
}

button:focus-visible,
.segmented input:focus-visible + span {
  outline: 3px solid rgba(31, 111, 178, 0.22);
  outline-offset: 2px;
}

textarea:focus {
  box-shadow: none;
  outline: 0;
}

.app-footer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 8px auto 0;
  max-width: 920px;
  text-align: center;
  width: 100%;
}

.example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.example-chip {
  background: #f3f6fa;
}

.action-row p {
  margin-bottom: 0;
}

.coach-message p:last-child {
  margin-bottom: 0;
}

.memory-list {
  margin: 0;
  padding-left: 20px;
}

.memory-list li {
  margin-bottom: 8px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .simulation-panel {
    min-height: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 6px 10px max(8px, env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 8px;
  }

  .topbar-title {
    font-size: var(--title-size);
    max-width: calc(100% - 158px);
  }

  .brand-mark,
  .menu-button {
    min-width: 62px;
    padding: 0 10px;
  }

  .topbar {
    margin-bottom: 3px;
  }

  h1 {
    font-size: 24px;
  }

  .brand-mark,
  .menu-button {
    min-height: 36px;
    min-width: 66px;
    padding: 0 12px;
  }

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

  .profile-panel {
    grid-template-columns: 1fr;
  }

  .setup-options {
    grid-template-columns: 1fr;
  }

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

  /* 弹性填充代替固定高度:配合 .app-shell 的视口锁定,
     顶部区块钉死,聊天窗自适应剩余空间 */
  .simulation-panel {
    flex: 1;
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .mobile-home-panel {
    gap: 4px;
    grid-template-columns: 1fr;
    min-height: 232px;
    padding: 6px 12px 6px;
  }

  .summon-visual {
    min-height: 136px;
  }

  .summon-visual img {
    height: 100%;
    object-position: 50% 25%;
    width: 100%;
  }

  .visual-score-grid {
    --visual-card-width: 108px;
    gap: 7px;
    left: 8px;
    right: 8px;
    top: 8px;
  }

  .mobile-score-strip {
    grid-template-columns: 1fr;
  }

  .mobile-coach-card {
    /* 正文向右铺满 */
    padding: 7px 12px 8px;
  }

  /* 手机端默认折叠:分析截 2 行、提示截 1 行,点“展开”看全文;省屏 */
  #mobileCoachCard:not(.is-expanded) #mobileCoachAnalysis {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: 3px;
  }

  #mobileCoachCard:not(.is-expanded) #mobileCoachStrategy {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
    margin-top: 2px;
  }

  .mobile-coach-card strong,
  .mobile-coach-card em {
    font-size: 13px;
    line-height: 1.4;
  }

  .chat-window {
    min-height: 0;
    padding: 12px 12px 16px;
  }

  .message {
    max-width: 92%;
    padding: 12px 13px;
  }

  .section-heading,
  .action-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .bottom-composer {
    align-self: stretch;
    bottom: max(8px, env(safe-area-inset-bottom));
    border-radius: 18px;
    left: 10px;
    margin: 6px 0 0;
    max-width: none;
    padding: 6px;
    right: 10px;
    width: auto;
  }

  .composer-box {
    display: block;
  }

  .ghost-button {
    width: 100%;
  }

  .input-zone .primary-button,
  .menu-button {
    width: auto;
  }

  .mobile-insight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 6px 10px max(8px, env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 22px;
  }

  .topbar-title {
    font-size: var(--title-size);
    max-width: calc(100% - 148px);
  }

  .eyebrow {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .status-strip span,
  .section-heading span,
  .example-chip,
  .trait-cloud span {
    font-size: 11px;
    padding: 7px 9px;
  }

  .simulation-panel {
    border-radius: 12px;
  }

  .mobile-home-panel {
    min-height: 214px;
    padding: 6px 12px 5px;
  }

  .mobile-score-strip {
    gap: 4px;
  }

  .summon-visual {
    min-height: 126px;
  }

  .visual-score-card {
    padding: 7px 8px;
  }


  .message {
    max-width: 96%;
  }

  .input-zone label {
    font-size: 13px;
  }

}

@media (max-width: 370px) {
  .mobile-score-strip {
    grid-template-columns: 1fr;
  }

  .mobile-home-panel {
    min-height: 208px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .boss-avatar,
  .aura,
  .pressure-dot,
  .message {
    transition: 220ms ease;
  }
}

/* ------------------------------------------------------------------ */
/* Desktop (>=1024px) mirrors the phone layout: one centered column    */
/* (hero + coach card + chat + floating composer). Only the height     */
/* budget changes so the chat scrolls inside the panel instead of the  */
/* whole page.                                                         */
/* ------------------------------------------------------------------ */
@media (min-width: 1024px) {
  /* 与移动端一致:整页锁死视口高度,只有聊天区内部滚动,
     老板图片和大宗师卡固定不随聊天上滚 */
  .app-shell {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  /* workspace 用弹性行填满 topbar/输入框/页脚之外的空间,
     simulation-panel 随之拉伸,内部的 chat-window 才是滚动容器 */
  .workspace {
    grid-template-rows: minmax(0, 1fr);
  }

  .simulation-panel {
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .chat-window {
    padding: 16px 16px 20px;
  }
}

/* ================================================================== */
/* 「职场兵法」墨色主题                                                  */
/* 整个主题层集中在这里,删除本段 + 还原 design-config.json               */
/* (备份: backups/design-config.light-2026-07-07.json) 即可回到浅色。    */
/* 调色板: 墨黑 #14161a / 面板 #1e2126 / 朱砂 #e23d2e / 青竹 #8fc4a9 /   */
/* 纸白 #f3efe6                                                        */
/* ================================================================== */
:root {
  --bg: #14161a;
  --surface: #1e2126;
  --surface-muted: #191c21;
  --muted: #99a0ad;
  --line: #2f343d;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  --soft-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
  --display-font: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;

  /* 原设计后台(design-config.json)运行时覆盖的值,现已烤进源码。
     删掉后台后靠这些保证外观不变。 */
  --accent: #e23d2e;
  --accent-strong: #b02a1e;
  --coach: #8fc4a9;
  --ink: #f3efe6;
  --brand-bg: #c22f22;
  --ui-radius: 12px;
  --card-radius: 12px;
  --bubble-radius: 14px;
  --input-radius: 18px;
  --topbar-label-size: 14px;
  --title-size: 22px;
  --score-num-color: #ff6b57;
  --score-num-size: 34px;
  --text-size: 15px;
  --name-size: 12px;
  --boss-bubble-bg: #20242b;
  --user-bubble-bg: #38252a;
}

body {
  background: linear-gradient(180deg, #1a1d23 0%, #14161a 55%, #101216 100%);
}

/* --- 顶部栏:牌匾底色跟随老板指数色带(--score-badge-bg 由 app.js 写入),
       印章红仅作初始/兜底 --- */
.brand-mark {
  background: var(--score-badge-bg, var(--brand-bg));
  box-shadow: inset 0 0 0 1px rgba(243, 239, 230, 0.34), inset 0 0 0 3px var(--score-badge-bg, var(--brand-bg));
  color: var(--score-badge-ink, #fff);
  font-family: var(--display-font);
  transition: background-color 280ms ease, color 280ms ease;
}

.topbar-title {
  font-family: var(--display-font);
  letter-spacing: 0.08em;
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: #cfd4dd;
}

.menu-popover {
  background: var(--surface);
  border-color: #3a404b;
}

.menu-item:hover {
  background: #262a31;
}

/* --- 设置浮层 --- */
.setup-screen {
  background: rgba(16, 18, 22, 0.94);
}

/* --- 英雄区 --- */
.mobile-home-panel {
  background: linear-gradient(150deg, #1d2026 0%, #171a1f 62%, #191b1d 100%);
  border-bottom: 1px solid #262b33;
}

.mobile-home-panel::before {
  background: linear-gradient(115deg, rgba(226, 61, 46, 0.07) 0%, rgba(0, 0, 0, 0) 55%);
}

.summon-visual {
  background: linear-gradient(160deg, #23272e 0%, #1c2026 58%, #241f1c 100%);
  border: 1px solid #343a44;
  box-shadow: inset 0 -1px 0 rgba(243, 239, 230, 0.08), 0 10px 26px rgba(0, 0, 0, 0.42);
}

/* 老板指数驱动的画面冷暖(JS 写入 --hero-tint) */
.summon-visual img {
  filter: var(--hero-tint, none);
}

.visual-score-card {
  background: rgba(18, 20, 25, 0.72);
  border: 1px solid rgba(80, 87, 99, 0.55);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.visual-score-card span {
  color: #aab0bc;
}

.visual-score-card em {
  color: #d5cfc2;
}

.visual-fact b {
  color: var(--ink);
}

/* 暗底上的正负分颜色需要更亮的档位(色带徽章未生效时的兜底) */
.boss-score-topline .score-value-negative,
.visual-score-card .score-value-negative {
  color: #ff6b57;
}

.boss-score-topline .score-value-positive,
.visual-score-card .score-value-positive {
  color: #58c98b;
}

/* 老板指数 21 色徽章:底色由 app.js 按分数档位写入
   (-10 深红→-1 浅黄,0 白,+1 浅蓝→+5 深蓝,+6 浅绿→+10 深绿) */
#bossScoreValue,
#mobileBossScoreValue {
  background: var(--score-badge-bg, #ffffff);
  border-radius: 10px;
  color: var(--score-badge-ink, #1a1c20);
  display: inline-block;
  min-width: 2.1em;
  padding: 2px 8px;
  text-align: center;
  transition: background-color 280ms ease, color 280ms ease;
}

/* 英雄图上的迷你卡空间有限,徽章缩一档避免压到标签文字 */
.visual-score-card #mobileBossScoreValue {
  font-size: calc(var(--score-num-size, 34px) - 9px);
  min-width: 1.9em;
  padding: 3px 7px;
}

/* --- 大宗师锦囊卡 --- */
.mobile-coach-card {
  background: #1b2622;
  border: 1px solid #31463d;
  position: relative;
}

.coach-card-head span {
  font-family: var(--display-font);
  font-size: calc(var(--name-size) + 2px);
  letter-spacing: 0.12em;
}

.coach-history-button {
  background: rgba(26, 34, 30, 0.88);
  border: 1px solid #3a5347;
}

/* --- 聊天区 --- */
.chat-window {
  background: #16181d;
}

.boss-message {
  background: var(--boss-bubble-bg);
  border: 1px solid #313742;
}

.boss-message .message-meta {
  color: #ff8a7a;
}

.user-message {
  background: var(--user-bubble-bg);
  border: 1px solid #55333a;
}

/* 正在被大宗师卡回放的那一轮:青竹绿高亮,与大宗师卡呼应 */
.user-message.is-active-coach {
  border-color: #8fc4a9;
  box-shadow: 0 0 0 2px rgba(143, 196, 169, 0.5);
}

@media (hover: hover) {
  .user-message:hover {
    border-color: rgba(143, 196, 169, 0.7);
  }
}

.coach-message {
  background: #1b2622;
  border: 1px solid #31463d;
}

/* “正在输入”气泡 */
.typing-message .chat-body {
  align-items: center;
  display: flex;
  gap: 6px;
  min-height: 18px;
}

.typing-dots span {
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  opacity: 0.35;
  width: 7px;
}

/* --- 老板指数轨道(侧栏卡,当前布局隐藏,保持一致以防复用) --- */
.score-track {
  background: linear-gradient(90deg, #6e2a24, #2a2e35 50%, #2d5443);
}

.score-zero {
  background: rgba(243, 239, 230, 0.35);
}

.score-marker {
  background: var(--score-badge-bg, #f3efe6);
  border: 2px solid #14161a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.trait-cloud span {
  background: #232830;
  border: 1px solid #363d49;
  color: #b6c1d1;
}

/* --- 输入区 --- */
.bottom-composer {
  background: rgba(26, 29, 35, 0.94);
  border: 1px solid rgba(64, 70, 81, 0.9);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.composer-box {
  background: #14171b;
  border: 1px solid #343a44;
}

textarea::placeholder {
  color: #6d7480;
}

button:focus-visible,
.segmented input:focus-visible + span {
  outline: 3px solid rgba(226, 61, 46, 0.4);
}

/* --- 动效(尊重系统减少动态设置) --- */
@media (prefers-reduced-motion: no-preference) {
  .summon-visual img {
    transition: filter 700ms ease;
  }

  .turn-fresh .message {
    animation: messageIn 260ms ease backwards;
  }

  .typing-dots span {
    animation: typingPulse 1.2s ease-in-out infinite;
  }

  .typing-dots span:nth-child(2) {
    animation-delay: 0.18s;
  }

  .typing-dots span:nth-child(3) {
    animation-delay: 0.36s;
  }

  .score-hit-negative {
    animation: scoreShake 400ms ease;
  }

  .score-hit-positive {
    animation: scorePulse 400ms ease;
  }
}

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

@keyframes typingPulse {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes scoreShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}

@keyframes scorePulse {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.045);
  }
}

/* ------------------------------------------------------------------ */
/* 矮视口逃生舱(横屏手机、极矮窗口):视口锁定装不下完整界面时,        */
/* 退回整页滚动,保证聊天和输入框永远可达。                            */
/* ------------------------------------------------------------------ */
@media (max-height: 560px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .simulation-panel {
    flex: none;
  }

  .chat-window {
    max-height: 45vh;
    min-height: 160px;
  }
}
