/* Shared ChaoZhi interpret countdown + background-task dock (zeri).
   Theme colors come from each page (:root --accent / --title / --accent-rgb …). */
:root {
  --chart-muted: #888;
}

.interpret-mini-dock {
  position: fixed;
  right: max(0.8rem, env(safe-area-inset-right));
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  z-index: 10060;
  width: auto;
  min-width: 10.4rem;
  max-width: 12.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding: 0.65rem 0.75rem 0.68rem;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--dock-bg-from, #ffffff), var(--dock-bg-to, rgba(var(--accent-rgb), 0.08)));
  box-shadow: 0 10px 26px rgba(80, 50, 20, 0.2);
  color: var(--title, #3d2a18);
  text-align: left;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
  animation: interpret-mini-in 0.28s ease;
}

.interpret-mini-close {
  position: absolute;
  top: -0.42rem;
  right: -0.42rem;
  z-index: 2;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border: 1px solid rgba(80, 50, 20, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #8a8176;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(80, 50, 20, 0.16);
  touch-action: manipulation;
}
.interpret-mini-close:hover,
.interpret-mini-close:focus {
  color: #fff;
  background: #c45c4a;
  border-color: #c45c4a;
  outline: none;
}

.interpret-mini-dock.is-dragging {
  cursor: grabbing;
  box-shadow: 0 14px 30px rgba(80, 50, 20, 0.28);
}

.interpret-mini-dock.hidden {
  display: none;
}

.interpret-mini-dock.is-ready {
  border-color: rgba(46, 139, 87, 0.35);
  background: linear-gradient(180deg, #f7fff9, #eaf8ef);
  animation: interpret-mini-pulse 1.6s ease-in-out infinite;
}

.interpret-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.42rem;
}

.interpret-mini-head strong {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--title, #3d2a18);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.interpret-mini-pct {
  flex: 0 0 auto;
  color: var(--accent-dark, #9a5c1a);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.interpret-mini-bar {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.14);
  overflow: hidden;
}

.interpret-mini-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent, #3977cf), var(--title, #214f8e));
  transition: width 0.12s linear;
}

.interpret-mini-foot {
  color: var(--thinking-muted, #8a97a8);
  font-size: 0.7rem;
  line-height: 1.35;
  white-space: nowrap;
}

.interpret-mini-dock.is-ready .interpret-mini-foot {
  color: #2e8b57;
  font-weight: 600;
}

@keyframes interpret-mini-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes interpret-mini-pulse {
  0%, 100% { box-shadow: 0 12px 32px rgba(46, 139, 87, 0.18); }
  50% { box-shadow: 0 14px 36px rgba(46, 139, 87, 0.32); }
}

@media (prefers-reduced-motion: reduce) {
  .interpret-mini-dock,
  .interpret-mini-dock.is-ready {
    animation: none;
  }
}

.interpret-body-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.interpret-body-shell > .interpret-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.interp-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--chart-muted);
  font-size: 0.9rem;
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  box-sizing: border-box;
}

.interp-loading-chaozhi {
  gap: 0.7rem;
  width: 100%;
  max-width: min(360px, 100%);
  margin: 0 auto;
  justify-items: center;
  text-align: center;
}

.interp-loading-liang {
  justify-content: space-between;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.15rem 0 0.35rem;
  text-align: left;
  min-height: 100%;
  height: 100%;
  box-sizing: border-box;
}

.liang-thinking-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  max-height: none;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--thinking-panel-from, #ffffff), var(--thinking-panel-to, rgba(var(--accent-rgb), 0.08)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.liang-thinking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.liang-thinking-head strong {
  font-size: 0.86rem;
  color: var(--title, #214f8e);
}

.liang-thinking-status {
  font-size: 0.72rem;
  color: var(--accent-dark, #285fae);
  white-space: nowrap;
}

.liang-thinking-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--thinking-text, #5a6573);
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.liang-thinking-body.is-formatted,
.liang-thinking-result-body.is-formatted {
  white-space: normal;
}

.liang-thinking-body:empty::before {
  content: "等待模型开始思考…";
  color: var(--thinking-muted, #8a97a8);
}

/* 思考内容排版：仅布局，字号/颜色继承当前思考区样式 */
.liang-thinking-body .th-p,
.liang-thinking-result-body .th-p {
  margin: 0 0 0.55em;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
.liang-thinking-body .th-h,
.liang-thinking-result-body .th-h {
  margin: 0.7em 0 0.35em;
  font-weight: 700;
  color: inherit;
  font-size: inherit;
  line-height: 1.45;
}
.liang-thinking-body .th-h:first-child,
.liang-thinking-result-body .th-h:first-child {
  margin-top: 0.15em;
}
.liang-thinking-body .th-label,
.liang-thinking-result-body .th-label {
  margin: 0.55em 0 0.18em;
  font-weight: 600;
  color: inherit;
  font-size: inherit;
  opacity: 0.92;
}
.liang-thinking-body .th-ul,
.liang-thinking-result-body .th-ul {
  margin: 0.15em 0 0.55em;
  padding: 0 0 0 1.15em;
  list-style: disc;
}
.liang-thinking-body .th-li,
.liang-thinking-result-body .th-li {
  margin: 0.22em 0;
  padding-left: 0.1em;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
.liang-thinking-body .th-spacer,
.liang-thinking-result-body .th-spacer {
  height: 0.35em;
}

.liang-progress-panel {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  text-align: center;
  width: 100%;
  padding-top: 0.15rem;
}

.liang-progress-panel .chaozhi-progress,
.liang-progress-panel .chaozhi-progress-long {
  max-width: none;
  width: 100%;
}

.liang-thinking-result {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem 0.7rem;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 12px;
  background: var(--thinking-result-bg, rgba(var(--accent-rgb), 0.06));
}

.liang-thinking-result summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--title, #214f8e);
  list-style: none;
}

.liang-thinking-result summary::-webkit-details-marker { display: none; }
.liang-thinking-result summary::after {
  content: "展开";
  float: right;
  font-weight: 500;
  color: var(--accent-dark, #285fae);
  font-size: 0.72rem;
}
.liang-thinking-result[open] summary::after { content: "收起"; }

.liang-thinking-result-body {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--thinking-text, #5a6573);
  font-size: 0.76rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
  font-family: inherit;
}

.chaozhi-progress-pct {
  margin: 0.15rem 0 0 !important;
  font-size: 1.15rem !important;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent, #3977cf);
  font-variant-numeric: tabular-nums;
  text-align: center;
  width: 100%;
}

.chaozhi-progress {
  width: 100%;
  max-width: 280px;
  height: 6px;
  background: rgba(var(--accent-rgb), 0.14);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto;
}

.chaozhi-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent, #3977cf), var(--title, #214f8e));
  border-radius: inherit;
  transition: width 0.12s linear;
}

.chaozhi-progress-hint {
  color: var(--chart-muted);
  font-size: 0.78rem !important;
  text-align: center;
  width: 100%;
}

.chaozhi-progress-hint.hidden {
  display: none;
}

.chaozhi-progress-long {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0.65rem 0 0 !important;
  padding: 0.85rem 1rem 0.9rem;
  width: 100%;
  max-width: 280px;
  box-sizing: border-box;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(255, 244, 232, 0.9));
  box-shadow: 0 8px 20px rgba(160, 82, 45, 0.06);
  text-align: center;
}

.chaozhi-progress-long.hidden {
  display: none;
}

.chaozhi-progress-long.is-wait-done .chaozhi-long-time {
  display: none;
}

.chaozhi-progress-long.is-wait-done .chaozhi-long-label {
  font-size: 0;
  letter-spacing: 0;
}

.chaozhi-progress-long.is-wait-done .chaozhi-long-label::before {
  content: "请稍后";
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-dark, #285fae);
}

.chaozhi-progress-long.is-wait-done .chaozhi-long-label::after {
  content: "";
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-dark, #285fae);
  animation: chaozhi-wait-dots 1.4s steps(1, end) infinite;
}

@keyframes chaozhi-wait-dots {
  0% { content: ""; }
  14% { content: "."; }
  28% { content: ".."; }
  42% { content: "..."; }
  56% { content: "...."; }
  70% { content: "....."; }
  84% { content: "......"; }
  100% { content: "......."; }
}

.chaozhi-progress-long.is-wait-done {
  padding: 0.65rem 0.9rem 0.75rem;
  border-style: dashed;
  background: rgba(var(--accent-rgb), 0.05);
  gap: 0.35rem;
}

.chaozhi-long-label {
  color: var(--thinking-muted, #8a97a8);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.chaozhi-long-time {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.14rem;
  margin: 0.05rem 0 0.4rem;
  color: var(--accent-dark, #285fae);
  line-height: 1;
}

.chaozhi-long-time em {
  font-style: normal;
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.chaozhi-long-time i {
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent, #3977cf);
}

.chaozhi-bg-task {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: auto;
  min-height: 0;
  margin: 0.15rem 0 0;
  padding: 0.42rem 0.95rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, var(--accent-2, #4f8ee0), var(--accent, #3977cf) 55%, var(--accent-dark, #285fae));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.24);
  animation: chaozhi-bg-breathe 2.4s ease-in-out infinite;
}

.chaozhi-bg-task::before {
  content: "";
  position: relative;
  z-index: 1;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
  animation: chaozhi-bg-dot 1.6s ease-in-out infinite;
}

.chaozhi-bg-task::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.34) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  animation: chaozhi-bg-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}

.chaozhi-bg-task > * {
  position: relative;
  z-index: 1;
}

.interp-loading-chaozhi > .chaozhi-bg-task {
  width: auto;
  margin-top: 0.65rem;
}

.chaozhi-bg-task:hover {
  filter: brightness(1.04);
  animation-play-state: paused;
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.36);
}

.chaozhi-bg-task:hover::after {
  animation-play-state: paused;
}

.chaozhi-bg-task:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(var(--accent-rgb), 0.24);
}

.chaozhi-bg-task.hidden {
  display: none;
}

@keyframes chaozhi-bg-breathe {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.22);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.38);
  }
}

@keyframes chaozhi-bg-dot {
  0%, 100% {
    opacity: 0.7;
    transform: scale(0.9);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.28);
  }
}

@keyframes chaozhi-bg-shine {
  0%, 35% { transform: translateX(-120%); }
  60%, 100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
  .chaozhi-bg-task,
  .chaozhi-bg-task::before,
  .chaozhi-bg-task::after {
    animation: none;
  }
}

@media (max-width: 860px) {
  .interp-loading.interp-loading-liang {
    padding: 0;
    gap: 0.65rem;
  }
  .liang-thinking-panel {
    padding: 0.65rem 0.7rem;
    border-radius: 12px;
  }
}
