:root {
  --case-controls-top: 24px;
  --case-controls-side: 32px;
  --case-controls-height: 81px;
  --case-return-height: 81px;
  --case-return-width: 210px;
  --case-nav-top: 0px;
  --case-nav-height: 81px;
  --case-nav-width: 672px;
  --case-nav-font: 21px;
  --header-height: calc(var(--case-controls-top) + var(--case-controls-height));
}

.case-detail-document { scroll-padding-top: 0; }
.case-controls {
  position: fixed;
  inset: var(--case-controls-top) 0 auto;
  z-index: 100;
  height: var(--case-controls-height);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}
.case-controls .case-controls-inner {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}
.case-controls .case-return {
  position: absolute;
  inset: 0 auto auto var(--case-controls-side);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: var(--case-return-width);
  height: var(--case-return-height);
  margin: 0;
  padding: 0 24px;
  border: 1.5px solid #61558b;
  border-radius: 999px;
  background: #090e23eb;
  color: #d9daea;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 19.5px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(16px);
  pointer-events: auto;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, box-shadow 220ms ease, scale 220ms ease;
}
.case-controls .case-return > span { font-size: 27px; line-height: 1; }
.case-controls .chapter-nav {
  position: absolute;
  inset: var(--case-nav-top) auto auto 50%;
  width: var(--case-nav-width);
  height: var(--case-nav-height);
  margin: 0;
  transform: translateX(-50%);
  pointer-events: auto;
}
.case-controls .chapter-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 7.5px;
  border: 1.5px solid #514064;
  border-radius: 999px;
  background: #15121ceb;
  backdrop-filter: blur(16px);
}
.case-controls .chapter-tabs > :is(button, a) {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #c2bbd0;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: var(--case-nav-font);
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, box-shadow 220ms ease, scale 220ms ease;
}
.case-controls .chapter-tabs > [aria-selected="true"],
.case-controls .chapter-tabs > [aria-current="page"] { background: #765991; color: #fff; box-shadow: 0 3px 12px #76599126; }
.case-controls :focus-visible { outline: 2px solid #d4b5f4; outline-offset: 4px; }

.case-detail-document .case-content { margin-top: calc(var(--header-height) + 32px); }
body.dashboard-case { padding-top: calc(var(--header-height) + 32px); }
.dashboard-case .page { scroll-margin-top: calc(var(--header-height) + 24px); }
.case-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #070c18;
  overflow-x: hidden;
  overflow-y: auto;
}
.case-dialog #case-content { width: min(1080px, calc(100% - 64px)); margin: calc(var(--header-height) + 32px) auto 48px; background: #0a1122; border-radius: 22px; }
.case-dialog [data-case-section] { scroll-margin-top: calc(var(--header-height) + 24px); }

@media (hover: hover) and (pointer: fine) {
  .case-controls .case-return:hover { color: #fff; border-color: #bca2df; scale: 1.035; box-shadow: 0 0 18px #cfaeef45; }
  .case-controls .chapter-tabs > :is(button, a):hover { color: #fff; box-shadow: 0 0 15px #cfaeef38; scale: 1.035; }
}
@media (max-width: 1200px) {
  :root { --case-controls-top: 20px; --case-controls-side: 24px; --case-controls-height: 167px; --case-return-height: 72px; --case-nav-top: 86px; --case-nav-width: min(672px, calc(100vw - 48px)); }
}
@media (max-width: 600px) {
  :root { --case-controls-top: 12px; --case-controls-side: 12px; --case-controls-height: 153px; --case-return-height: 66px; --case-return-width: 198px; --case-nav-top: 78px; --case-nav-height: 75px; --case-nav-width: calc(100vw - 24px); --case-nav-font: clamp(14px, 4.6vw, 18px); }
  .case-controls .case-return { font-size: 18px; }
  .case-controls .chapter-tabs { padding: 6px; gap: 4.5px; }
  .case-controls .chapter-tabs > :is(button, a) { padding-inline: 2px; }
  .case-detail-document .case-content, .case-dialog #case-content { margin-top: calc(var(--header-height) + 24px); }
  .case-dialog #case-content { width: calc(100% - 24px); }
  body.dashboard-case { padding-top: calc(var(--header-height) + 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .case-controls .case-return, .case-controls .chapter-tabs > :is(button, a) { transition: none !important; scale: none !important; }
}
@media print {
  .case-controls { display: none !important; }
  body.dashboard-case { padding-top: 0 !important; }
}
