/* 重置基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --split-viewer-pct: 50;
  --split-handle-width: 6px;
}

body {
  background-color: #fcfcfc;
  min-height: 100vh;
  overflow: hidden;
  opacity: 0;
  animation: pageFadeIn 1.2s ease-out forwards;
}

/* 进入时整体由空白淡入 + 细微浮动效果 */
@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes softFloatIn {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 核心容器：铺满浏览器窗口，自适应大小 */
.container {
  width: 100vw;
  height: 100vh;
  position: relative;
  background-color: #ffffff;
  overflow: hidden;
  animation: softFloatIn 1.1s ease-out forwards;
}

/* 让主要可视元素在进入时都有细微浮动效果（卡片由 landing 交互单独控制） */
.title-area,
.subtitle-area {
  animation: softFloatIn 1.1s ease-out forwards;
  animation-delay: 0.1s;
}

/* 极光 + 星星：作为 container 的背景伪元素，61.8% 高度 */
.container::before,
.container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
}

.container::before {
  height: 100%;
  background-image:
    linear-gradient(
      to right,
      rgba(186, 152, 255, 0.2) 0%,
      rgba(164, 132, 255, 0.65) 25%,
      rgba(236, 225, 255, 0.25) 55%,
      rgba(175, 145, 255, 0.7) 80%,
      rgba(206, 184, 255, 0.25) 100%
    ),
    linear-gradient(
      to bottom,
      rgba(232, 216, 255, 1) 0%,
      rgba(244, 235, 255, 0.95) 40%,
      rgba(255, 255, 255, 0) 100%
    );
  background-size: 260% 100%;
  background-position: 0 0;
  filter: blur(12px);
  opacity: 0.95;
  animation: auroraScroll 20s linear infinite alternate;
  z-index: 0;
}

.container::after {
  height: 61.8%;
  z-index: 1;
  width: 2px;
  height: 2px;
  top: 18px;
  left: 30px;
  background-color: #ffffff;
  box-shadow:
    40px 40px 0 #ffffff,
    120px 60px 0 #f5ecff,
    260px 80px 0 #fdf8ff,
    420px 50px 0 #ffffff,
    620px 90px 0 #f5ecff,
    840px 40px 0 #ffffff,
    1040px 70px 0 #fdf8ff,
    1240px 55px 0 #ffffff,
    1440px 95px 0 #f5ecff,
    1640px 65px 0 #ffffff,
    80px 140px 0 #ffffff,
    260px 160px 0 #f5ecff,
    460px 130px 0 #fdf8ff,
    700px 150px 0 #ffffff,
    920px 135px 0 #f5ecff,
    1180px 155px 0 #ffffff,
    1380px 145px 0 #fdf8ff,
    1580px 165px 0 #ffffff;
  opacity: 0.85;
  image-rendering: pixelated;
  animation: starTwinkle 6s ease-in-out infinite alternate;
}

@keyframes auroraScroll {
  from {
    background-position: 0% 0;
  }
  to {
    background-position: 100% 0;
  }
}

@keyframes starTwinkle {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
}

/* 顶部信息栏：左 Prod.redy + 右设置图标 */
.top-bar {
  position: absolute;
  top: 24px;
  left: 40px;
  right: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
  pointer-events: none;
}

.top-bar-left,
.top-bar-right {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.brand-mark {
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 2px;
  color: #c5b1ec;
  text-shadow: 0 2px 4px rgba(248, 246, 251, 0.962);
}

.brand-mark:hover {
  color: #b19cd9;
  transition: transform 0.2s ease;
  transform: scale(1.05);
}

.settings-button {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(166, 133, 226, 0.6);
  background: radial-gradient(circle at 30% 20%, #ffffff, #f4ecff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(166, 133, 226, 0.35);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.settings-button:hover {
  transform: translateY(-2px) rotate(10deg);
  box-shadow: 0 10px 18px rgba(166, 133, 226, 0.45);
}

.settings-button:active {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 4px 10px rgba(166, 133, 226, 0.35);
}

.settings-icon {
  width: 20px;
  height: 20px;
}

/* 上半部分：薰衣草色到白色的不规则飘带状渐变背景 */
.ribbon-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%; /* 占据上方二分之一 */
  z-index: 1;
}

/* 顶部四分之一处：Essay Forest 标题区域 */
.title-area {
  position: relative;
  margin: 0 auto;
  top: 7%; /* 上方四分之一 */
  text-align: center;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

.title-text {
  font-family: "Dancing Script", cursive; /* 细花体 */
  font-size: 120px;
  /* 白、淡紫渐变 */
  background: linear-gradient(180deg, #ffffff 0%, #d8bfd8 100%);
  -webkit-background-clip: text;
  text-align: center;
  color: transparent;
  /* 字体边缘带有边框 */
  -webkit-text-stroke: 2px #b19cd9;
  text-shadow: 2px 4px 6px rgba(211, 188, 253, 0.723);
}

.title-text:hover {
  transition: transform 0.2s ease;
  transform: translateY(-5px);
}

/* 顶部三分之一处：两行楷体小字 */
.subtitle-area {
  position: relative;
  margin: 0 auto;
  top: 8%; /* 上方三分之一 */
  transform: translate(-50%, 0);
  text-align: center;
  color: hsla(278, 78%, 75%, 0.989);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  z-index: 2;
  /* 给白色字体加一点柔和的阴影，防止在浅色背景上看不清 */
  text-shadow: 1px 1px 3px rgba(160, 103, 160, 0.523);
}

.subtitle-line1,
.subtitle-line2:hover {
  transition: transform 0.2s ease;
  transform: translateY(-5px);
}

.subtitle-line1 {
  font-size: 20px; /* 第一行小一些 */
  margin-bottom: 8px;
  letter-spacing: 2px;
  font-weight: 200;
}

.subtitle-line2 {
  font-size: 28px; /* 第二行大一些 */
  letter-spacing: 3px;
  font-weight: 300;
}

/* 下方四分之一区域：三个方框的容器 */
.cards-area {
  position: absolute;
  bottom: 13%; /* 大致在下方四分之一的中心 */
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 90px; /* 均匀间隔 */
  z-index: 2;
}

/* 首屏：底部引导提示（呼吸式隐现） */
.start-tip {
  position: fixed;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: none;
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: rgba(100, 72, 150, 0.72);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  opacity: 0.55;
  animation: startTipBreathe 2.4s ease-in-out infinite;
  transition: opacity 0.25s ease;
}

body.landing-cards-active .start-tip {
  opacity: 0;
  animation: none;
}

@keyframes startTipBreathe {
  0%,
  100% {
    opacity: 0.28;
  }
  50% {
    opacity: 0.88;
  }
}

/* 初始：整块卡片区域在视口下方不可见 */
body:not(.landing-cards-active) .cards-area {
  opacity: 0;
  transform: translate3d(0, min(48vh, 420px), 0);
  pointer-events: none;
}

/* 自下而上飞入（应用在 .cards-area 容器）：前段近似匀加速，末段略过冲后回弹，总时长 0.3s */
@keyframes cardsAreaFlyEnter {
  0% {
    opacity: 0;
    transform: translate3d(0, min(48vh, 420px), 0);
  }
  82% {
    opacity: 1;
    transform: translate3d(0, -10px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

body.landing-cards-active .cards-area {
  pointer-events: auto;
  animation: cardsAreaFlyEnter 0.3s cubic-bezier(0.32, 0, 0.67, 1) forwards;
}

/* 系统设置减少动效：直接显示卡片区域与页脚，跳过飞入 */
body.landing-reduce-motion.landing-cards-active .cards-area {
  animation: none;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* 400x250 方框 */
.card {
  width: 350px;
  height: 220px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #faf8fc;
  border-radius: 25px;
  /* 方框的白、淡紫渐变以及边框 */
  border: 3px solid transparent;
  background-image:
    linear-gradient(#faf8fc, #faf8fc),
    linear-gradient(180deg, #ffffff 0%, #d8bfd8 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 8px 20px rgba(216, 191, 216, 0.25);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  transform-origin: center center;
  cursor: pointer;
  opacity: 0.8;
}

.card:hover {
  transition: transform 0.2s ease;
  transform: scale(1.08);
  opacity: 1;
}

/* 给方框整体再加一个外部轮廓线，满足“边缘都带有边框”的要求 */
.card::before {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  bottom: -4px;
  left: -4px;
  border: 1px solid #c8b6e6;
  border-radius: 23px;
  pointer-events: none;
}

/* 渐变文字通用样式 (字体整体为白、淡紫渐变，边缘带边框) */
.gradient-stroke-text {
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 32px;
  font-weight: 150;
  margin-top: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #d8bfd8 100%);
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(194, 173, 234, 0.497); /* 边缘边框 */
}

/* SVG 图标样式 */
.card-icon {
  width: 80px;
  height: 80px;
}

/* 悬停弹窗（在鼠标位置出现） */
.sprite-tooltip {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  min-height: 365px;
  max-height: 60vh;
  pointer-events: none;
  background-color: #faf8fc;
  border-radius: 18px;
  padding: 18px 20px;
  overflow: auto;
  box-shadow: 0 14px 40px rgba(168, 134, 226, 0.22);
  border: 2px solid transparent;
  background-image:
    linear-gradient(#faf8fc, #faf8fc),
    linear-gradient(180deg, #ffffff 0%, #d8bfd8 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

/* 页面底部说明文字 */
.page-footer-note {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  font-size: 18px;
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 300;
  color: rgba(80, 50, 130, 0.9);
  text-align: center;
  z-index: 10;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s linear;
}

body.landing-cards-active .page-footer-note {
  opacity: 1;
  visibility: visible;
}

body.upload-panel-open .top-bar,
body.upload-panel-open .title-area,
body.upload-panel-open .subtitle-area,
body.upload-panel-open .start-tip,
body.upload-panel-open .page-footer-note,
body.upload-panel-open .cards-area .card {
  filter: blur(5px);
  opacity: 0.45;
  transition:
    filter 0.35s ease,
    opacity 0.35s ease;
}

body.upload-panel-open .brand-mark,
body.upload-panel-open .title-area,
body.upload-panel-open .title-text,
body.upload-panel-open .subtitle-area,
body.upload-panel-open .cards-area .card {
  pointer-events: none;
}

.card-upload {
  position: relative;
  z-index: 25;
}

body.upload-panel-open .card-upload {
  box-shadow: 0 14px 30px rgba(166, 133, 226, 0.35);
}

.file-viewer-drawer {
  position: fixed;
  left: 0;
  top: 0;
  width: calc(var(--split-viewer-pct, 50) * 1%);
  min-width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f7f1ff 100%);
  box-shadow: inset -20px 0 30px rgba(183, 162, 223, 0.2);
  transform: translateX(100%);
  transition:
    transform 0.45s ease,
    width 0.2s ease;
  z-index: 24;
  overflow: hidden;
}

body.viewer-open .file-viewer-drawer {
  transform: translateX(0);
}

/* 拖拽手柄叠在阅读器与分析面板边界上，外观无缝衔接，仍可拖动调整 */
.split-resize-handle {
  display: none;
  position: fixed;
  left: calc(var(--split-viewer-pct, 50) * 1% - 3px);
  top: 0;
  width: var(--split-handle-width);
  height: 100vh;
  z-index: 31;
  cursor: col-resize;
  background: transparent;
  transition:
    left 0.2s ease,
    background 0.15s ease;
}

.split-resize-handle::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(179, 156, 218, 0.5);
  pointer-events: none;
}

.split-resize-handle:hover::after {
  background: rgba(166, 133, 226, 0.7);
}

body.viewer-open .split-resize-handle {
  display: block;
}

body.split-resizing .file-viewer-drawer,
body.split-resizing .analysis-panel,
body.split-resizing .split-resize-handle {
  transition: none;
}

.file-viewer-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 20px;
  font-weight: 400;
  color: rgba(102, 70, 155, 0.95);
  border-bottom: 1px solid rgba(185, 165, 220, 0.35);
}

.save-archive-btn {
  border: 1px solid rgba(166, 133, 226, 0.55);
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  color: rgba(109, 77, 165, 0.95);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  display: none;
}

.save-archive-btn.is-visible {
  display: inline-block;
}

.file-viewer-body {
  height: calc(100vh - 64px);
  padding: 18px;
  overflow: auto;
}

.file-viewer-placeholder {
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(175, 152, 220, 0.4);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(130, 96, 182, 0.85);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
}

.file-viewer-placeholder-segment {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 14px;
  overflow: auto;
  font-size: 15px;
  line-height: 1.6;
}

.file-preview-frame,
.file-preview-image,
.file-preview-text {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(191, 168, 230, 0.3);
}

.file-preview-image {
  object-fit: contain;
}

.file-preview-text {
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  color: #2c2c2c;
}

.analysis-panel {
  position: fixed;
  top: 0;
  left: calc(var(--split-viewer-pct, 50) * 1%);
  width: calc((100 - var(--split-viewer-pct, 50)) * 1%);
  min-width: 280px;
  height: 100vh;
  padding: 24px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(248, 240, 255, 0.98)
  );
  box-shadow: -12px 0 30px rgba(162, 132, 217, 0.25);
  transform: translateX(100%);
  transition:
    transform 0.45s ease,
    left 0.2s ease,
    width 0.2s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

body.upload-panel-open .analysis-panel {
  transform: translateX(0);
}

.analysis-panel-top-row {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  z-index: 31;
}

.get-summary-btn {
  width: 100px;
  height: 40px;
  display: none;
  border: 1px solid rgba(166, 133, 226, 0.55);
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  color: rgba(109, 77, 165, 0.95);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.get-summary-btn:hover {
  box-shadow: 0 4px 12px rgba(166, 133, 226, 0.3);
}

.get-summary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.analysis-panel:has(.analysis-result.is-visible) .get-summary-btn {
  display: inline-block;
}

.analysis-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(166, 133, 226, 0.55);
  background: radial-gradient(circle at 30% 20%, #ffffff, #f4ecff);
  color: rgba(126, 92, 186, 0.95);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  z-index: 30;
}

.analysis-close-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 16px rgba(166, 133, 226, 0.32);
}

.quota-display {
  font-size: 14px;
  color: rgba(96, 63, 150, 0.9);
  transform: translateY(-40px);
  transition: transform 0.2s ease;
  /* 顶部按钮行已绝对定位不占流，此处补足原第一行高度 + gap，恢复下方元素位置 */
  margin-top: 48px;
}

.upload-trigger-btn {
  width: 100%;
  max-width: 400px;
  min-width: 0;
  height: 250px;
  margin: 0 auto;
  border-radius: 20px;
  border: 3px solid transparent;
  background-image:
    linear-gradient(#faf8fc, #faf8fc),
    linear-gradient(180deg, #ffffff 0%, #d8bfd8 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 10px 22px rgba(216, 191, 216, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s ease;
}

.upload-trigger-btn:hover {
  transform: translateY(-4px);
}

/* 上传按钮右上角说明图标（仿 sprite-help-icon） */
.upload-trigger-help-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(166, 133, 226, 0.65);
  background: radial-gradient(circle at 30% 20%, #ffffff, #f4ecff);
  box-shadow: 0 6px 14px rgba(166, 133, 226, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  user-select: none;
  color: rgba(140, 108, 200, 0.95);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.upload-trigger-help-icon:hover {
  transform: translateY(-2px) rotate(6deg);
  box-shadow: 0 10px 18px rgba(166, 133, 226, 0.35);
  opacity: 0.98;
}

.upload-trigger-help-icon:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 4px 10px rgba(166, 133, 226, 0.25);
}

.upload-trigger-help {
  color: rgba(75, 48, 119, 0.95);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

.upload-trigger-btn.is-batch-ready {
  height: 250px;
  border-radius: 14px;
  flex-direction: row;
  justify-content: center;
  gap: 10px;

  justify-content: center;
  display: flex;
  flex-direction: column;
  position: relative;
}

.upload-trigger-icon {
  width: 88px;
  height: 88px;
}

.upload-trigger-btn.is-batch-ready .upload-trigger-icon {
  width: 88px;
  height: 88px;
}

.upload-trigger-text {
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
  font-size: 20px;
  color: #000000;
}

.upload-trigger-btn.is-batch-ready .upload-trigger-text {
  font-size: 20px;
}

.upload-trigger-btn.is-loading {
  pointer-events: none;
  opacity: 0.9;
}

.upload-trigger-btn.is-hidden-when-has-results {
  display: none !important;
}

.upload-loading {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(166, 133, 226, 0.2);
  border-top-color: rgba(166, 133, 226, 0.95);
  border-radius: 50%;
  display: none;
  animation: uploadSpin 0.9s linear infinite;
}

.upload-trigger-btn.is-loading .upload-loading {
  display: block;
}

@keyframes uploadSpin {
  to {
    transform: rotate(360deg);
  }
}

.paper-file-input {
  display: none;
}

.segment-textarea-wrap {
  display: none;
  min-width: 0;
  width: 100%;
}

.analysis-panel.is-text-mode .segment-textarea-wrap {
  display: block;
}

.analysis-panel.is-text-mode.has-segment-results .segment-textarea-wrap {
  display: none;
}

.analysis-panel.is-text-mode .paper-file-input {
  display: none;
}

.segment-textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 70vh;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(177, 155, 216, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(75, 48, 119, 0.95);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}

.segment-textarea::placeholder {
  color: rgba(120, 86, 170, 0.6);
}

.upload-trigger-btn.is-text-mode {
  height: 80px;
  border-radius: 14px;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
}

.upload-trigger-btn.is-text-mode .upload-trigger-icon {
  width: 26px;
  height: 26px;
}

.upload-trigger-btn.is-text-mode .upload-trigger-text {
  font-size: 16px;
}

.analysis-result {
  flex: 0;
  min-height: 78vh;
  max-height: 78vh;
  min-width: 0;
  border-radius: 14px;
  padding: 16px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(177, 155, 216, 0.35);
  color: rgb(0, 0, 0);
  font-family:
    "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
  display: none;
}

.analysis-result.is-visible {
  display: block;
}

.analysis-result-heading {
  font-weight: bold;
  font-size: 1.15em;
  display: block;
}

.analysis-result-before-hash {
  font-size: 12px;
  color: #666;
  display: block;
  white-space: pre-wrap;
}

.analysis-result-before-hash br {
  display: block;
  content: "";
}

.analysis-result-wrapper {
  position: relative;
}

.analysis-result-copy-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #000;
  opacity: 0.8;
  display: none;
  align-items: center;
  justify-content: center;
}

.analysis-result-copy-icon:hover {
  opacity: 0.5;
}

.analysis-result-wrapper:has(.analysis-result.is-visible)
  .analysis-result-copy-icon {
  display: flex;
}

.archive-list {
  display: none;
  border-radius: 14px;
  padding: 12px;
  overflow-y: auto;
  max-height: 28vh;
  min-width: 0;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(177, 155, 216, 0.35);
  opacity: 0;
  transform: translateY(6px);
  transition:
    max-height 0.32s ease,
    opacity 0.25s ease,
    transform 0.25s ease;
}

.archive-list.is-visible {
  display: block;
  opacity: 1;
  transform: translateY(0px);
  transition: transform 0.2s ease;
}

.archive-list.is-collapsed {
  max-height: 56px;
  overflow: hidden;
  transform: translateY(-8px);
}

/* 有分析结果时：单行 + 右侧展开，展开后拉出全部条目（非滚动） */
.archive-list.has-results {
  overflow: hidden;
  max-height: 72px;
  transform: translateY(-15px);
  transition: max-height 0.3s ease;
}

.archive-list.has-results.is-expanded {
  overflow: visible;
  max-height: 80vh;
}

.archive-item-expand-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(166, 133, 226, 0.2);
  color: rgba(96, 63, 150, 0.95);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease;
}

.archive-item-expand-btn:hover {
  background: rgba(166, 133, 226, 0.4);
}

.archive-expand-icon {
  font-size: 12px;
  line-height: 1;
  user-select: none;
}

.archive-empty {
  color: rgba(120, 86, 170, 0.75);
  font-size: 14px;
}

.archive-item {
  display: flex;
  height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(185, 165, 220, 0.5);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.2s ease;
}

.archive-item:hover {
  background: #faf7ff;
}

.archive-item:last-child {
  margin-bottom: 0;
}

.archive-item-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: rgba(96, 63, 150, 0.95);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-item-status {
  flex-shrink: 0;
  font-size: 12px;
  color: rgba(120, 86, 170, 0.78);
}

.archive-item-remove {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #ff4d4f;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.archive-item-remove:hover {
  background: #f5222d;
}

.archive-item-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.archive-item.is-active {
  border-color: rgba(166, 133, 226, 0.9);
  background: rgba(248, 240, 255, 0.9);
}

.archive-list.is-collapsed .archive-item {
  display: none;
}

.archive-list.is-collapsed .archive-item.is-active {
  display: flex;
}

.archive-list-toggle-hint {
  flex-shrink: 0;
  font-size: 12px;
  color: rgba(120, 86, 170, 0.8);
}

.analysis-panel-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.continue-load-btn {
  display: none;
  border: 1px solid rgba(166, 133, 226, 0.55);
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  color: rgba(109, 77, 165, 0.95);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.continue-load-btn.is-visible {
  display: inline-block;
}

.prompt-select-btn {
  display: none;
  border: 1px solid rgba(166, 133, 226, 0.55);
  background: #ffffff;
  color: rgba(109, 77, 165, 0.95);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.prompt-select-btn.is-visible {
  display: inline-block;
}

.prompt-select-btn:hover {
  box-shadow: 0 2px 8px rgba(166, 133, 226, 0.25);
}

.continue-load-btn:hover {
  box-shadow: 0 2px 8px rgba(166, 133, 226, 0.25);
}

.reset-panel-btn {
  position: absolute;
  right: 20px;
  bottom: 18px;
  border: 1px solid rgba(166, 133, 226, 0.55);
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  color: rgba(109, 77, 165, 0.95);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  display: none;
}

.reset-panel-btn.is-visible {
  display: inline-block;
}

/* 设置面板 */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(75, 48, 119, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.settings-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.settings-panel {
  background: linear-gradient(180deg, #ffffff, #f8f5ff);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(75, 48, 119, 0.2);
  border: 1px solid rgba(166, 133, 226, 0.4);
  min-width: 320px;
  max-width: 90vw;
}

.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(166, 133, 226, 0.25);
}

.settings-panel-title {
  margin: 0;
  font-size: 18px;
  color: rgba(75, 48, 119, 0.95);
}

.settings-panel-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(109, 77, 165, 0.9);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.settings-panel-close:hover {
  background: rgba(166, 133, 226, 0.2);
}

.settings-panel-body {
  padding: 16px 18px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row-label {
  font-size: 15px;
  color: rgba(75, 48, 119, 0.95);
}

/* 夜间模式开关：左右平移，关=红底，开=绿底 */
.night-mode-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border: none;
  border-radius: 12px;
  background: #c0392b;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.25s ease;
}

.night-mode-switch.is-on {
  background: #27ae60;
}

.night-mode-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
}

.night-mode-switch.is-on .night-mode-switch-thumb {
  transform: translateX(20px);
}

/* 夜间模式切换时颜色短时渐变 */
body,
body .container,
body .container::before,
body .container::after,
body .card,
body .file-viewer-drawer,
body .analysis-panel,
body .archive-list,
body .archive-item,
body .analysis-result,
body .segment-textarea,
body .upload-trigger-btn,
body .get-summary-btn,
body .continue-load-btn,
body .prompt-select-btn,
body .reset-panel-btn,
body .split-resize-handle,
body .analysis-close-btn,
body .save-archive-btn,
body .settings-panel,
body .settings-panel-header,
body .settings-panel-close,
body .top-bar .brand-mark,
body .subtitle-line1,
body .subtitle-line2,
body .start-tip,
body .page-footer-note,
body .title-text,
body .gradient-stroke-text,
body .file-viewer-header span,
body .quota-display,
body .upload-trigger-text,
body .archive-item-title,
body .settings-panel-title,
body .settings-row-label {
  transition:
    background-color 0.28s ease,
    background 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    opacity 0.28s ease;
}

body .card svg,
body .upload-trigger-btn svg {
  transition: stroke 0.28s ease;
}

/* 保留 drawer 与 analysis-panel 的滑动动画（transition 不能缺少 transform） */
body .file-viewer-drawer,
body .analysis-panel {
  transition:
    background-color 0.28s ease,
    background 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    opacity 0.28s ease,
    transform 0.45s ease,
    width 0.2s ease,
    left 0.2s ease;
}

/* 夜间模式：页面背景黑，字体与边框白 */
body.night-mode,
body.night-mode .container {
  background-color: #0a0a0a !important;
}

body.night-mode,
body.night-mode .top-bar .brand-mark,
body.night-mode .subtitle-line1,
body.night-mode .subtitle-line2,
body.night-mode .start-tip,
body.night-mode .page-footer-note,
body.night-mode .gradient-stroke-text,
body.night-mode .title-text,
body.night-mode .file-viewer-header span,
body.night-mode .analysis-panel,
body.night-mode .quota-display,
body.night-mode .upload-trigger-text,
body.night-mode .analysis-result,
body.night-mode .archive-item-title,
body.night-mode .get-summary-btn,
body.night-mode .continue-load-btn,
body.night-mode .prompt-select-btn,
body.night-mode .reset-panel-btn,
body.night-mode .save-archive-btn,
body.night-mode .analysis-close-btn,
body.night-mode .settings-panel-title,
body.night-mode .settings-row-label {
  color: #fff !important;
}

body.night-mode .container::before,
body.night-mode .container::after {
  opacity: 0;
}

body.night-mode .card,
body.night-mode .file-viewer-drawer,
body.night-mode .analysis-panel,
body.night-mode .archive-list,
body.night-mode .analysis-result,
body.night-mode .segment-textarea,
body.night-mode .upload-trigger-btn,
body.night-mode .continue-load-btn,
body.night-mode .prompt-select-btn,
body.night-mode .reset-panel-btn,
body.night-mode .split-resize-handle,
body.night-mode .settings-panel,
body.night-mode .settings-panel-header {
  border-color: rgba(255, 255, 255, 0.5) !important;
}

body.night-mode .card {
  background: #000 !important;
}

body.night-mode .file-viewer-drawer,
body.night-mode .archive-item,
body.night-mode .get-summary-btn,
body.night-mode .continue-load-btn,
body.night-mode .prompt-select-btn,
body.night-mode .reset-panel-btn,
body.night-mode .analysis-close-btn,
body.night-mode .analysis-result {
  background: #000 !important;
}

body.night-mode .analysis-result-before-hash {
  color: #999;
}

body.night-mode .analysis-panel,
body.night-mode .archive-list,
body.night-mode .upload-trigger-btn,
body.night-mode .segment-textarea {
  background: rgba(20, 20, 20, 0.9) !important;
}

body.night-mode .settings-panel {
  background: linear-gradient(180deg, #1a1a1a, #111) !important;
}

body.night-mode .settings-panel-close {
  color: #fff;
}

body.night-mode .card svg,
body.night-mode .upload-trigger-btn svg {
  stroke: rgba(255, 255, 255, 0.9);
}
