:root {
  --dp-primary: #2f6fe4;
  --dp-primary-soft: #eaf1ff;
  --dp-text: #1c2738;
  --dp-muted: #68768c;
  --dp-line: #dfe5ee;
  --dp-surface: #ffffff;
  --dp-canvas: #edf1f6;
  --dp-danger: #d94c4c;
  --dp-shadow: 0 18px 48px rgba(22, 36, 60, .16);
}

.dp-root,
.dp-root * { box-sizing: border-box; }
.dp-root [hidden] { display: none !important; }
.dp-root button:focus-visible, .dp-root input:focus-visible, .dp-root [tabindex]:focus-visible {
  outline: 3px solid #75a5ff; outline-offset: 2px;
}

.dp-root {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 520px;
  overflow: hidden;
  color: var(--dp-text);
  background: var(--dp-surface);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.dp-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 15, 30, .68);
  backdrop-filter: blur(8px);
}

.dp-modal > .dp-root {
  width: min(1480px, 96vw);
  height: min(920px, 94vh);
  border-radius: 16px;
  box-shadow: var(--dp-shadow);
}

.dp-toolbar {
  z-index: 4;
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 8px 12px 8px 18px;
  border-bottom: 1px solid var(--dp-line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}

.dp-title-wrap { min-width: 0; margin-right: auto; }
.dp-title-wrap { flex: 1; }
.dp-title { overflow: hidden; max-width: min(40vw, 520px); font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.dp-subtitle { margin-top: 2px; color: var(--dp-muted); font-size: 11px; }
.dp-actions { display: flex; align-items: center; gap: 4px; margin-left: 14px; }

.dp-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: #48566d;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  transition: background .18s, color .18s, transform .18s;
}

.dp-button:hover { color: var(--dp-primary); background: var(--dp-primary-soft); }
.dp-button:active { transform: translateY(1px); }
.dp-button:disabled { opacity: .38; pointer-events: none; }
.dp-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.dp-button-text { min-width: auto; gap: 6px; }
.dp-button-text svg { width: 16px; height: 16px; }

.dp-page-control { display: flex; align-items: center; gap: 4px; padding: 0 4px; color: var(--dp-muted); font-size: 12px; }
.dp-page-input { width: 46px; height: 30px; padding: 0 5px; border: 1px solid var(--dp-line); border-radius: 7px; text-align: center; font: inherit; outline: none; }
.dp-page-input:focus { border-color: var(--dp-primary); }
.dp-zoom-label { min-width: 48px; color: var(--dp-muted); text-align: center; font-size: 12px; }

.dp-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--dp-canvas);
  scrollbar-color: #b5bfcd transparent;
  scrollbar-width: thin;
}

.dp-empty,
.dp-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
}

.dp-state-card { width: min(440px, 90%); }
.dp-state-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  color: var(--dp-primary);
  background: var(--dp-primary-soft);
}
.dp-state-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.dp-state h3 { margin: 0 0 8px; font-size: 17px; }
.dp-state p { margin: 0; color: var(--dp-muted); font-size: 13px; line-height: 1.7; }
.dp-state-error .dp-state-icon { color: var(--dp-danger); background: #fff0f0; }
.dp-progress { height: 7px; margin-top: 20px; overflow: hidden; border-radius: 999px; background: #dde5f1; }
.dp-progress-bar { width: 8%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f6fe4, #57a3ff); transition: width .35s ease; }

.dp-pdf-pages { display: grid; justify-content: center; gap: 18px; min-width: max-content; padding: 24px; }
.dp-pdf-page {
  position: relative;
  width: 794px;
  min-height: 1123px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 3px 16px rgba(23, 37, 58, .15);
  transition: width .15s, min-height .15s;
}
.dp-pdf-page canvas { display: block; width: 100%; height: auto; }
.dp-page-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #a2adbd; font-size: 12px; }

.dp-image-wrap { display: grid; width: 100%; min-height: 100%; place-items: center; padding: 28px; overflow: auto; }
.dp-image { display: block; max-width: none; transform-origin: center center; border-radius: 4px; box-shadow: 0 6px 26px rgba(26, 39, 61, .18); transition: width .15s; }

.dp-text-wrap { min-height: 100%; padding: 24px; }
.dp-text-card { width: min(1100px, 100%); min-height: calc(100vh - 180px); margin: 0 auto; padding: 28px 32px; border-radius: 10px; background: #fff; box-shadow: 0 3px 16px rgba(23,37,58,.1); }
.dp-pre { margin: 0; overflow-wrap: anywhere; color: #263247; font: 13px/1.78 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; tab-size: 4; }
.dp-markdown { color: #28364a; font-size: 15px; line-height: 1.8; }
.dp-markdown h1, .dp-markdown h2, .dp-markdown h3 { margin: 1.2em 0 .55em; line-height: 1.35; }
.dp-markdown h1:first-child, .dp-markdown h2:first-child { margin-top: 0; }
.dp-markdown code { padding: 2px 6px; border-radius: 5px; background: #eef2f7; font-family: "Cascadia Code", Consolas, monospace; }
.dp-markdown pre { overflow: auto; padding: 16px; border-radius: 9px; background: #162033; color: #e6edf8; }
.dp-markdown pre code { padding: 0; background: transparent; }
.dp-markdown a { color: var(--dp-primary); }
.dp-markdown table { border-collapse: collapse; display: block; max-width: 100%; overflow: auto; }
.dp-markdown th, .dp-markdown td { padding: 8px 12px; border: 1px solid var(--dp-line); }

.dp-media { display: grid; width: 100%; height: 100%; place-items: center; padding: 24px; }
.dp-media video { width: min(1100px, 100%); max-height: 82vh; border-radius: 12px; background: #101318; box-shadow: var(--dp-shadow); }
.dp-media audio { width: min(720px, 90%); }

.dp-download-card .dp-button { display: inline-flex; margin: 20px auto 0; padding: 0 18px; color: #fff; background: var(--dp-primary); }

.dp-root:fullscreen { min-height: 100vh; border-radius: 0; }

.dp-sheet { display: flex; flex-direction: column; height: 100%; }
.dp-sheet-hint { padding: 9px 14px; color: #526078; background: #f6f8fc; font-size: 12px; border-bottom: 1px solid var(--dp-line); }
.dp-sheet-viewport { position: relative; flex: 1; min-height: 160px; overflow: auto; }
.dp-sheet-spacer { position: relative; min-width: 100%; }
.dp-sheet-table { position: absolute; border-collapse: separate; border-spacing: 0; background: white; font-size: 13px; table-layout: fixed; }
.dp-sheet-table th, .dp-sheet-table td { min-width: 140px; max-width: 280px; height: 34px; padding: 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid #e3e8ef; border-bottom: 1px solid #e3e8ef; }
.dp-sheet-table th { background: #f0f4fa; color: #526078; font-weight: 600; }
.dp-sheet-table th:first-child { min-width: 60px; }
.dp-sheet-tabs { display: flex; flex-shrink: 0; gap: 5px; overflow: auto; padding: 8px 12px; border-top: 1px solid var(--dp-line); background: white; }
.dp-sheet-tab { padding: 9px 15px; border: 0; border-radius: 6px; background: #f4f7fb; color: #526078; cursor: pointer; white-space: nowrap; }
.dp-sheet-tab[aria-selected="true"] { background: #e6efff; color: #205dc4; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .dp-root * { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 720px) {
  .dp-root { min-height: 440px; }
  .dp-modal { padding: 0; }
  .dp-modal > .dp-root { width: 100vw; height: 100vh; border-radius: 0; }
  .dp-toolbar { min-height: 52px; padding: 6px 10px; flex-wrap: wrap; gap: 4px; }
  .dp-title-wrap { flex-basis: 100%; }
  .dp-title { max-width: 100%; font-size: 13px; }
  .dp-subtitle, .dp-button-text span, .dp-page-control .dp-total-prefix { display: none; }
  .dp-actions { gap: 0; margin-left: 4px; }
  .dp-button { min-width: 44px; height: 44px; padding: 0 8px; }
  .dp-actions { width: 100%; justify-content: center; flex-wrap: wrap; gap: 2px; }
  .dp-page-control { gap: 0; padding: 0; flex-basis: 100%; justify-content: center; }
  .dp-pdf-pages { gap: 10px; padding: 10px; }
  .dp-text-wrap { padding: 10px; }
  .dp-text-card { padding: 20px 16px; }
}

