:root {
  --sd-bg: #f7f6f3;
  --sd-panel: #ffffff;
  --sd-line: rgba(20, 20, 24, 0.1);
  --sd-text: #1a1a1e;
  --sd-mute: rgba(26, 26, 30, 0.55);
  --sd-red: #e23d3d;
  --sd-soft: #fff5f5;
  --sd-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sd-font);
  background: var(--sd-bg);
  color: var(--sd-text);
}

a {
  color: inherit;
  text-decoration: none;
}

.sd-app {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(226, 61, 61, 0.1), transparent 55%),
    linear-gradient(180deg, #fbfaf8 0%, var(--sd-bg) 36%);
  padding-bottom: 48px;
}

/* 剧场副条：站内通用顶栏之下 */
.sd-theater-bar {
  margin: 0;
  padding: 8px 32px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--sd-line);
  background: rgba(255, 255, 255, 0.72);
}

.sd-theater-bar b {
  color: var(--sd-red);
  font-weight: 800;
}

.sd-theater-bar span {
  margin-left: 8px;
  color: var(--sd-mute);
  font-weight: 600;
  font-size: 12px;
}

/* 顶栏变量兜底（本页未走首页深色主题时） */
body {
  --ink: #0a0a0a;
}

.sd-landing {
  max-width: 720px;
  margin: 0 auto;
  padding: 8vh 20px 20px;
  text-align: center;
}

.sd-h1 {
  margin: 0 0 24px;
  font-size: clamp(1.55rem, 4.2vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.sd-announce {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--sd-mute);
}

.sd-prompt {
  text-align: left;
  background: var(--sd-panel);
  border: 1px solid var(--sd-line);
  border-radius: 22px;
  padding: 14px 14px 12px;
  box-shadow: 0 18px 48px rgba(20, 16, 16, 0.08);
}

.sd-prompt textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: vertical;
  min-height: 88px;
  background: transparent;
  color: var(--sd-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
}

.sd-prompt textarea::placeholder {
  color: rgba(26, 26, 30, 0.38);
}

.sd-prompt-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.sd-wall-fold {
  max-width: 1080px;
  margin: 8px auto 0;
  padding: 0 16px 24px;
}

.sd-wall-fold > summary {
  cursor: pointer;
  list-style: none;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px dashed rgba(226, 61, 61, 0.35);
  border-radius: 14px;
  background: var(--sd-soft);
  color: #8a3030;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  user-select: none;
}

.sd-wall-fold > summary::-webkit-details-marker {
  display: none;
}

.sd-wall-fold > summary::before {
  content: "▸ ";
}

.sd-wall-fold[open] > summary {
  margin-bottom: 14px;
  border-style: solid;
}

.sd-wall-fold[open] > summary::before {
  content: "▾ ";
}

.sd-tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 0 4px;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.sd-tabs button {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--sd-line);
  background: #fff;
  color: var(--sd-mute);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.sd-tabs button:hover {
  border-color: rgba(226, 61, 61, 0.45);
  color: var(--sd-red);
}

.sd-tabs button.active {
  background: var(--sd-red);
  border-color: var(--sd-red);
  color: #fff;
}

.sd-wall-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 0 8px;
}

.sd-summary {
  margin: 0 0 8px;
  font-size: 12px;
  color: #8a3030;
  line-height: 1.5;
}

.sd-summary[hidden] {
  display: none !important;
}

.sd-status {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--sd-mute);
  min-height: 1.2em;
}

.sd-landing .sd-status {
  margin-top: 12px;
  text-align: center;
}

.sd-status.err {
  color: #c62828;
}

.sd-wall {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 960px) {
  .sd-wall {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .sd-wall {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

.sd-tile {
  background: #fff;
  border: 1px solid var(--sd-line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
  width: 100%;
  box-shadow: 0 6px 18px rgba(20, 16, 16, 0.05);
}

.sd-tile:hover {
  border-color: rgba(226, 61, 61, 0.45);
}

.sd-tile-main {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #ebe8e2;
}

.sd-tile-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sd-tile-rank {
  position: absolute;
  left: 8px;
  top: 8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 8px;
  background: rgba(20, 16, 16, 0.62);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-tile-main .sd-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(26, 26, 30, 0.45);
  background: linear-gradient(160deg, #fff0f0, #f3efe8);
}

.sd-tile-body {
  padding: 8px 10px 10px;
}

.sd-tile-body h3 {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sd-tile-body p {
  margin: 0;
  font-size: 11px;
  color: var(--sd-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-chip,
.sd-send,
.sd-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
}

.sd-chip {
  background: #f1efea;
  color: var(--sd-mute);
  padding: 8px 14px;
  font-size: 13px;
}

.sd-chip:disabled {
  opacity: 0.55;
  cursor: wait;
}

.sd-send {
  background: var(--sd-red);
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  flex: 0 0 auto;
}

.sd-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.sd-btn-ghost {
  background: #fff;
  color: var(--sd-mute);
  border: 1px solid var(--sd-line);
  padding: 8px 14px;
  font-size: 13px;
}

.sd-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 16, 16, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sd-drawer[hidden] {
  display: none !important;
}

.sd-drawer-panel {
  width: min(980px, 94vw);
  height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--sd-line);
  padding: 16px 18px 18px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.16);
}

.sd-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sd-line);
}

.sd-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
}

.sd-tool-status {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--sd-red);
}

.sd-tool-status.ok {
  color: #3f7d4a;
}

.sd-export-wrap {
  position: relative;
}

.sd-export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 180px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--sd-line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.sd-export-menu[hidden] {
  display: none !important;
}

.sd-export-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--sd-text);
}

.sd-export-menu button:hover {
  background: #f7f6f3;
}

.sd-drawer.is-full {
  padding: 0;
  background: #efece6;
  align-items: stretch;
  justify-content: stretch;
}

.sd-drawer.is-full .sd-drawer-panel {
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  box-shadow: none;
  border: 0;
  padding: 16px 22px 20px;
}

.sd-drawer.is-full .sd-modal-grid {
  grid-template-columns: 0.95fr 1.15fr;
  max-width: 1280px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.sd-drawer-panel h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
}

.sd-drawer-panel .muted {
  color: var(--sd-mute);
  font-size: 12px;
  margin: 4px 0 0;
}

.sd-modal-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 0;
  margin-top: 12px;
}

.sd-pane {
  min-height: 0;
  overflow: auto;
  padding: 4px 12px 8px 0;
}

.sd-pane-ai {
  padding: 4px 0 8px 14px;
  border-left: 1px solid var(--sd-line);
}

.sd-pane-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--sd-red);
}

.sd-pane-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sd-pane-title-row .sd-pane-title {
  margin: 0;
}

.sd-ai-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sd-soft);
  color: #8a3030;
  border: 1px solid rgba(226, 61, 61, 0.25);
}

.sd-ai-badge[hidden] {
  display: none !important;
}

.sd-data-top {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.sd-data-cover {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  background: #ebe8e2;
  flex: 0 0 auto;
}

.sd-data-cover-ph {
  width: 120px;
  height: 160px;
  border-radius: 12px;
  background: linear-gradient(160deg, #fff0f0, #f3efe8);
  flex: 0 0 auto;
}

.sd-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
  align-content: start;
}

.sd-metric {
  background: #f7f6f3;
  border: 1px solid var(--sd-line);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}

.sd-metric b {
  display: block;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.sd-metric span {
  font-size: 11px;
  color: var(--sd-mute);
}

.sd-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.sd-cap {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1efea;
  color: var(--sd-mute);
}

.sd-cap.hot {
  background: var(--sd-soft);
  color: #8a3030;
  border: 1px solid rgba(226, 61, 61, 0.28);
}

.sd-desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--sd-text);
}

.sd-sid {
  font-size: 11px;
  color: var(--sd-mute);
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
  margin: 0 0 10px;
}

.sd-block {
  margin: 12px 0;
}

.sd-block h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--sd-red);
}

.sd-block ul {
  margin: 0;
  padding-left: 1.1em;
  line-height: 1.7;
  font-size: 13px;
}

.sd-eps-wrap {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--sd-line);
  border-radius: 10px;
}

.sd-eps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sd-eps-table th,
.sd-eps-table td {
  padding: 8px 8px;
  text-align: left;
  border-bottom: 1px solid var(--sd-line);
  vertical-align: top;
}

.sd-eps-table th {
  position: sticky;
  top: 0;
  background: #f7f6f3;
  font-size: 11px;
  color: var(--sd-mute);
  z-index: 1;
}

.sd-eps-table td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sd-verdict {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--sd-soft);
  border: 1px solid rgba(226, 61, 61, 0.28);
  color: #8a3030;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.sd-toc {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f6f3;
  border: 1px solid var(--sd-line);
  font-size: 11px;
  font-weight: 700;
  color: var(--sd-mute);
  line-height: 1.5;
}

.sd-report-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sd-line);
}

.sd-report-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--sd-text);
}

.sd-report-head span {
  font-size: 11px;
  color: var(--sd-mute);
  font-weight: 600;
}

.sd-pad-note {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff6e8;
  border: 1px solid #f0d2a0;
  color: #8a5a18;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.sd-chart {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--sd-line);
  border-radius: 12px;
  background: #fff;
}

.sd-chart h4 {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--sd-red);
}

.sd-bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 54px;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  font-size: 11px;
}

.sd-bar-lab {
  color: var(--sd-mute);
  font-weight: 700;
  white-space: nowrap;
}

.sd-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #efece6;
  overflow: hidden;
}

.sd-bar-track.tall {
  height: 12px;
  flex: 1;
}

.sd-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e23d3d, #f07171);
}

.sd-bar-fill.alt {
  background: linear-gradient(90deg, #c45c26, #e8a06a);
}

.sd-bar-fill.dur {
  background: linear-gradient(90deg, #3d6fe2, #7aa0f0);
}

.sd-bar-fill.hot {
  background: linear-gradient(90deg, #e23d3d, #ff8a65);
}

.sd-bar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--sd-text);
  font-weight: 700;
}

.sd-ratio {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
}

.sd-ratio b {
  font-size: 18px;
  color: var(--sd-red);
}

.sd-ratio .sd-muted-note {
  grid-column: 1 / -1;
  margin: 0;
}

.sd-pane-ai .sd-block {
  margin: 14px 0;
}

.sd-pane-ai ol {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.65;
  font-size: 13px;
}

.sd-pane-ai ol.sd-ep-plan li {
  margin-bottom: 8px;
}

.sd-check {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sd-check li {
  font-size: 13px;
  line-height: 1.65;
  padding: 2px 0;
}

.sd-next li {
  font-weight: 600;
}

.sd-ai-idle {
  padding: 18px 14px;
  border-radius: 12px;
  background: var(--sd-soft);
  border: 1px dashed rgba(226, 61, 61, 0.35);
}

.sd-ai-idle p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #8a3030;
}

.sd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.sd-muted-note {
  margin-top: 12px;
  font-size: 11px;
  color: var(--sd-mute);
  line-height: 1.5;
}

@media (max-width: 720px) {
  .sd-drawer-panel {
    height: min(90vh, 900px);
    width: min(100%, 96vw);
  }

  .sd-modal-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .sd-pane,
  .sd-pane-ai {
    overflow: visible;
    padding: 8px 0;
  }

  .sd-pane-ai {
    border-left: 0;
    border-top: 1px solid var(--sd-line);
    padding-top: 14px;
  }

  .sd-data-top {
    flex-direction: column;
  }

  .sd-data-cover,
  .sd-data-cover-ph {
    width: 100%;
    height: 200px;
  }
}
