:root {
  color-scheme: light;
  --ink: #18272b;
  --muted: #68777b;
  --quiet: #8a9699;
  --paper: #ffffff;
  --canvas: #f2f4f3;
  --line: #dce2df;
  --line-strong: #c9d2ce;
  --sidebar: #17383b;
  --sidebar-muted: #9eb2b1;
  --teal: #167c73;
  --teal-soft: #e3f1ee;
  --coral: #d96849;
  --yellow: #d8ad3d;
  --danger: #b94b43;
  --shadow: 0 8px 24px rgba(24, 39, 43, 0.08);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--canvas);
}

body,
button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(22, 124, 115, 0.26);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 22px 16px 18px;
  color: #ffffff;
  background: var(--sidebar);
}

.brand-lockup {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand-lockup small {
  margin-top: 5px;
  color: var(--sidebar-muted);
  font-size: 10px;
  font-weight: 700;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  background: #f7faf9;
}

.brand-mark span {
  position: absolute;
  display: block;
  height: 4px;
  border-radius: 4px;
  background: var(--teal);
}

.brand-mark span:nth-child(1) {
  top: 9px;
  left: 7px;
  width: 22px;
}

.brand-mark span:nth-child(2) {
  top: 16px;
  left: 11px;
  width: 18px;
  background: var(--coral);
}

.brand-mark span:nth-child(3) {
  top: 23px;
  left: 7px;
  width: 15px;
  background: var(--yellow);
}

.primary-nav {
  display: grid;
  gap: 5px;
  margin-top: 30px;
}

.nav-button,
.category-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 6px;
  color: #dce7e5;
  background: transparent;
  text-align: left;
}

a.nav-button {
  text-decoration: none;
}

.nav-button {
  padding: 0 11px;
  font-size: 14px;
  font-weight: 650;
}

.nav-button:hover,
.nav-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-button.active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: #67d3c6;
  content: "";
}

.nav-count {
  min-width: 22px;
  height: 21px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 10px;
  color: #dbe8e6;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  line-height: 21px;
  text-align: center;
}

.sidebar-section {
  margin-top: 30px;
  padding: 0 5px;
}

.sidebar-label {
  padding: 0 7px 8px;
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 750;
}

.category-nav {
  display: grid;
  gap: 3px;
}

.category-button {
  position: relative;
  justify-content: space-between;
  padding: 0 8px;
  color: #bfd0ce;
  font-size: 13px;
}

.category-button:hover,
.category-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.category-button small {
  color: #829c9a;
  font-size: 9px;
  font-weight: 750;
}

.privacy-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 13px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.privacy-status strong,
.privacy-status small {
  display: block;
}

.privacy-status strong {
  font-size: 12px;
}

.privacy-status small {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border: 2px solid #17383b;
  border-radius: 50%;
  background: #68d0a4;
  box-shadow: 0 0 0 2px rgba(104, 208, 164, 0.28);
}

.workspace {
  position: relative;
  display: grid;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  grid-template-rows: 66px minmax(0, 1fr);
  background: var(--canvas);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.search-box {
  display: flex;
  width: min(620px, 62vw);
  min-width: 220px;
  height: 40px;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: #f8faf9;
}

.search-box:focus-within {
  border-color: var(--teal);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(22, 124, 115, 0.1);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}

.search-box input::placeholder {
  color: #919b9e;
}

.search-result-count {
  flex: 0 0 auto;
  color: var(--quiet);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-button,
.command-button,
.text-button {
  display: inline-flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  color: #405257;
  background: #ffffff;
}

.icon-button:hover {
  border-color: #9eaaa7;
  background: #f5f7f6;
}

.icon-button.active,
.icon-button.is-favorite {
  border-color: #b8ded8;
  color: var(--teal);
  background: var(--teal-soft);
}

.icon-button.is-favorite .icon {
  fill: currentColor;
}

.command-button {
  padding: 0 14px;
  border: 1px solid var(--teal);
  color: #ffffff;
  background: var(--teal);
  font-size: 13px;
}

.command-button:hover {
  border-color: #116b63;
  background: #116b63;
}

.command-button.secondary {
  border-color: var(--line-strong);
  color: #35474c;
  background: #ffffff;
}

.command-button.secondary:hover {
  background: #f3f6f5;
}

.command-button.wide {
  width: 100%;
}

.text-button {
  padding: 0 10px;
  border: 0;
  color: var(--teal);
  background: transparent;
  font-size: 13px;
}

.text-button:hover {
  background: var(--teal-soft);
}

.mobile-only {
  display: none;
}

.main-content {
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 26px 28px 100px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head h1,
.detail-title h1,
.compare-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.18;
}

.page-head p,
.compare-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page-eyebrow,
.dialog-eyebrow,
.detail-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.mobile-categories {
  display: none;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 16px;
}

.archive-favorites-link {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  text-decoration: none;
}

.archive-favorites-link > span,
.archive-favorites-link > b {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.archive-favorites-link .icon {
  color: var(--teal);
}

.archive-favorites-link small {
  color: var(--muted);
}

.archive-favorites-link > b {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 12px;
}

.resource-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 3px 12px rgba(24, 39, 43, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.resource-card:hover {
  border-color: #aebbb7;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.resource-card-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.scan-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #081315;
}

.scan-thumb canvas,
.viewer-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scan-badge,
.image-count-badge {
  position: absolute;
  top: 10px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  color: #ffffff;
  background: rgba(11, 22, 24, 0.72);
  font-size: 10px;
  font-weight: 750;
  line-height: 24px;
}

.scan-badge {
  left: 10px;
}

.image-count-badge {
  right: 10px;
}

.card-copy {
  padding: 15px 15px 12px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.accent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.card-copy h2 {
  margin: 8px 0 0;
  font-size: 18px;
  line-height: 1.28;
}

.english-name {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--quiet);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-summary {
  display: -webkit-box;
  min-height: 42px;
  overflow: hidden;
  margin: 10px 0 0;
  color: #58676b;
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tag-row {
  display: flex;
  min-height: 27px;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #e0e5e3;
  border-radius: 12px;
  color: #637175;
  background: #f8faf9;
  font-size: 10px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #edf0ef;
}

.card-actions .icon-button {
  width: 34px;
  height: 34px;
}

.card-actions .open-label {
  margin-left: auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
}

.empty-state {
  display: grid;
  min-height: 380px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state .icon {
  width: 36px;
  height: 36px;
  color: #9ba9a6;
}

.empty-state h2 {
  margin: 14px 0 5px;
  color: var(--ink);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.startup-state {
  min-height: min(70vh, 620px);
}

.startup-state.is-error h2 {
  color: #8f2f2a;
}

.startup-state .command-button {
  margin-top: 10px;
}

.media-error-state {
  position: absolute;
  inset: 16px;
  z-index: 30;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  color: #f8fbfa;
  text-align: center;
  background: rgba(21, 39, 41, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.media-error-state strong,
.media-error-state span {
  display: block;
}

.detail-page {
  max-width: 1380px;
  margin: 0 auto;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-toolbar .detail-actions {
  display: flex;
  gap: 7px;
  margin-left: auto;
}

.detail-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.detail-title .english-title {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.detail-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.detail-chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #59686c;
  background: #ffffff;
  font-size: 11px;
  line-height: 27px;
}

.detail-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.48fr) minmax(310px, 0.72fr);
  gap: 20px;
}

.viewer-column,
.detail-info-column {
  min-width: 0;
}

.viewer-tool {
  overflow: hidden;
  border: 1px solid #27383b;
  border-radius: 8px;
  background: #081315;
  box-shadow: 0 8px 30px rgba(8, 19, 21, 0.15);
}

.viewer-head {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #2a3a3d;
  color: #dfe9e7;
  background: #122326;
}

.viewer-head strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-head small {
  color: #91a6a3;
  font-size: 10px;
}

.viewer-head .viewer-tools {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.viewer-head .icon-button {
  width: 32px;
  height: 32px;
  border-color: #405255;
  color: #d7e4e2;
  background: #1a2d30;
}

.viewer-head .icon-button.active {
  border-color: #67cfc2;
  color: #67d3c6;
  background: #173b3a;
}

.viewer-stage {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 310px;
  place-items: center;
  overflow: hidden;
  background: #061012;
}

.viewer-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-watermark {
  position: absolute;
  right: 11px;
  bottom: 10px;
  z-index: 3;
  padding: 4px 6px;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(0, 0, 0, 0.5);
  font-size: 9px;
  font-weight: 750;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 36px;
  height: 44px;
  margin-top: -22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  color: #ffffff;
  background: rgba(8, 19, 21, 0.72);
}

.viewer-nav.prev {
  left: 10px;
}

.viewer-nav.next {
  right: 10px;
}

.viewer-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.overlay-callout {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  display: flex;
  align-items: center;
  color: var(--callout);
  transform: translate(-5px, -50%);
}

.overlay-callout::before {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: rgba(5, 14, 16, 0.82);
  box-shadow: 0 0 0 3px rgba(5, 14, 16, 0.46);
  content: "";
}

.overlay-callout::after {
  width: 24px;
  height: 1px;
  flex: 0 0 auto;
  background: currentColor;
  content: "";
}

.overlay-callout span {
  padding: 4px 6px;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: #ffffff;
  background: rgba(4, 12, 14, 0.8);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.viewer-filmstrip {
  display: flex;
  min-height: 82px;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border-top: 1px solid #26373a;
  background: #101f22;
}

.film-thumb {
  position: relative;
  width: 100px;
  height: 60px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  background: #081315;
}

.film-thumb.active {
  border-color: #67d3c6;
}

.film-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.film-thumb img,
.film-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.film-thumb .delete-thumb {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: #ffffff;
  background: rgba(8, 19, 21, 0.78);
}

.film-thumb .delete-thumb .icon {
  width: 13px;
  height: 13px;
}

.film-label {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  overflow: hidden;
  color: #ffffff;
  font-size: 8px;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000000;
  white-space: nowrap;
}

.image-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.image-disclaimer .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--coral);
}

.detail-summary {
  margin: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  color: #4e5e62;
  font-size: 14px;
  line-height: 1.75;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.fact-cell {
  min-width: 0;
  min-height: 76px;
  padding: 12px;
  background: #ffffff;
}

.fact-cell small,
.fact-cell strong {
  display: block;
}

.fact-cell small {
  color: var(--quiet);
  font-size: 10px;
}

.fact-cell strong {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.4;
}

.detail-tabs {
  display: flex;
  gap: 3px;
  margin-top: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.detail-tab.active {
  color: var(--teal);
  background: var(--teal-soft);
}

.detail-panel {
  min-height: 230px;
  padding-top: 14px;
}

.detail-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  position: relative;
  padding-left: 18px;
  color: #4c5c60;
  font-size: 13px;
  line-height: 1.6;
}

.detail-list li::before {
  position: absolute;
  top: 8px;
  left: 1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, var(--teal));
  content: "";
}

.notes-panel {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.notes-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.notes-head strong {
  font-size: 13px;
}

.save-status {
  margin-left: auto;
  color: var(--quiet);
  font-size: 10px;
}

.notes-panel textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 11px;
  outline: 0;
  color: #34464a;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.65;
}

.notes-panel textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 124, 115, 0.1);
}

.compare-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.compare-selectors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.compare-selectors select,
.dialog select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 34px 0 10px;
  background: #ffffff;
  font-size: 13px;
}

.versus-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--coral);
  font-size: 11px;
  font-weight: 800;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.compare-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compare-column .scan-thumb {
  aspect-ratio: 16 / 8;
}

.compare-copy {
  padding: 16px;
}

.compare-copy h2 {
  margin: 0;
  font-size: 19px;
}

.compare-copy .english-name {
  margin-bottom: 14px;
}

.compare-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid #edf0ef;
  font-size: 12px;
  line-height: 1.55;
}

.compare-row dt {
  color: var(--quiet);
}

.compare-row dd {
  margin: 0;
  color: #405156;
}

.compare-tray {
  position: absolute;
  right: 22px;
  bottom: 18px;
  z-index: 16;
  display: none;
  min-width: 340px;
  max-width: calc(100% - 44px);
  min-height: 54px;
  align-items: center;
  gap: 9px;
  padding: 8px 9px 8px 13px;
  border: 1px solid #2a4748;
  border-radius: 8px;
  color: #ffffff;
  background: #17383b;
  box-shadow: 0 12px 32px rgba(17, 42, 44, 0.24);
}

.compare-tray.visible {
  display: flex;
}

.compare-tray strong {
  font-size: 12px;
}

.compare-tray .tray-items {
  display: flex;
  min-width: 0;
  gap: 5px;
}

.compare-tray .tray-pill {
  overflow: hidden;
  max-width: 120px;
  padding: 5px 7px;
  border-radius: 4px;
  color: #d9e8e5;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-tray .command-button {
  height: 34px;
  margin-left: auto;
  border-color: #ffffff;
  color: #17383b;
  background: #ffffff;
}

.dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(13, 34, 36, 0.25);
}

.dialog::backdrop {
  background: rgba(14, 29, 31, 0.58);
}

.dialog-panel {
  margin: 0;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-body {
  padding: 18px 20px 22px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.import-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.import-option {
  display: flex;
  min-width: 0;
  min-height: 96px;
  align-items: center;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.import-option:hover {
  border-color: var(--teal);
  background: #f6fbfa;
}

.import-option .icon {
  width: 26px;
  height: 26px;
  color: var(--teal);
}

.import-option strong,
.import-option small {
  display: block;
}

.import-option strong {
  font-size: 13px;
}

.import-option small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.local-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.local-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--teal);
}

.storage-summary {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf9;
}

.storage-summary > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.storage-track {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 5px;
  background: #dce4e1;
}

.storage-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 220ms ease;
}

.backup-coverage {
  margin: 0 0 16px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--teal);
}

.backup-coverage strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.backup-coverage p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.settings-actions {
  display: grid;
  gap: 9px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 6px;
  color: #ffffff;
  background: #17383b;
  box-shadow: 0 10px 28px rgba(20, 38, 41, 0.22);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.nav-scrim {
  display: none;
}

@media (max-width: 1080px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-info-column {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 20px;
  }

  .notes-panel {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(270px, 84vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(12, 28, 30, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.nav-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar {
    padding: 0 14px;
  }

  .search-box {
    width: auto;
    min-width: 0;
    flex: 1;
  }

  .topbar-actions .command-button span {
    display: none;
  }

  .topbar-actions .command-button {
    width: 38px;
    padding: 0;
  }

  .main-content {
    padding: 22px 18px 100px;
  }

  .mobile-categories {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    margin: -5px -18px 18px;
    padding: 5px 18px;
  }

  .mobile-category {
    min-width: 64px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--line-strong);
    border-radius: 17px;
    color: var(--muted);
    background: #ffffff;
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-category.active {
    border-color: var(--teal);
    color: #ffffff;
    background: var(--teal);
  }
}

@media (max-width: 680px) {
  .page-head,
  .detail-title,
  .compare-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-chip-row {
    justify-content: flex-start;
  }

  .resource-grid,
  .compare-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .compare-selectors {
    grid-template-columns: minmax(0, 1fr);
  }

  .versus-mark {
    width: 34px;
    height: 34px;
    margin: -3px auto;
  }

  .detail-info-column {
    display: block;
  }

  .notes-panel {
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
  }

  .viewer-stage {
    min-height: 230px;
  }

  .import-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .compare-tray {
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 8px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions > .icon-button:not(:last-child) {
    display: none;
  }

  .search-result-count {
    display: none;
  }

  .main-content {
    padding: 18px 13px 96px;
  }

  .mobile-categories {
    margin-right: -13px;
    margin-left: -13px;
    padding-right: 13px;
    padding-left: 13px;
  }

  .page-head h1,
  .detail-title h1,
  .compare-head h1 {
    font-size: 22px;
  }

  .detail-toolbar .command-button {
    width: 38px;
    padding: 0;
  }

  .detail-toolbar .command-button span {
    display: none;
  }

  .viewer-stage {
    aspect-ratio: 4 / 3;
    min-height: 210px;
  }

  .overlay-callout::after {
    width: 12px;
  }

  .overlay-callout span {
    font-size: 8px;
  }

  .fact-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .compare-tray strong {
    display: none;
  }

  .dialog-body,
  .dialog-header {
    padding-right: 15px;
    padding-left: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ANSO-inspired image workspace */
.detail-page {
  max-width: 1540px;
}

.detail-toolbar {
  min-height: 54px;
  margin-bottom: 12px;
}

.detail-heading {
  min-width: 0;
  margin-left: 3px;
}

.detail-heading h1 {
  overflow: hidden;
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-heading .detail-eyebrow {
  margin-bottom: 3px;
}

.detail-heading .english-title {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anso-viewer {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #263235;
  border-radius: 8px;
  background: #05090a;
  box-shadow: 0 10px 30px rgba(8, 19, 21, 0.17);
}

.anso-viewer-bar {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid #394447;
  color: #18272b;
  background: #c7cccb;
}

.viewer-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

.viewer-title strong,
.viewer-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-title strong {
  max-width: 46vw;
  font-size: 12px;
}

.viewer-title span {
  color: #536165;
  font-size: 10px;
}

.viewer-bar-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #536165;
  font-size: 10px;
  font-weight: 700;
}

.viewer-delete {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: #6c3b38;
  background: rgba(255, 255, 255, 0.42);
}

.viewer-delete:hover {
  color: var(--danger);
  background: #ffffff;
}

.viewer-delete .icon {
  width: 15px;
  height: 15px;
}

.detail-toolbar .icon-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.source-watermark {
  justify-self: end;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 3px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.76);
  line-height: 1;
  font-size: 9px;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-watermark:hover {
  border-color: #ffffff;
  background: rgba(0, 0, 0, 0.92);
}

.anso-viewer-grid {
  display: grid;
  height: clamp(440px, 64vh, 720px);
  min-width: 0;
  grid-template-columns: 80px minmax(0, 1fr) 252px;
}

.case-rail {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 38px minmax(0, 1fr) auto;
  border-right: 1px solid #2d393c;
  color: #d4dfdd;
  background: #111819;
}

.viewer-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid #2b3739;
  font-size: 10px;
  font-weight: 750;
}

.viewer-rail-head small {
  color: #7f9390;
  font-size: 9px;
}

.viewer-case-list {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 7px;
  overflow-y: auto;
  padding: 8px;
}

.case-thumb {
  position: relative;
  width: 62px;
  height: 48px;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0;
  border: 2px solid #3c494b;
  border-radius: 5px;
  background: #061012;
}

.case-thumb:hover {
  border-color: #80928f;
}

.case-thumb.active {
  border-color: #67d3c6;
  box-shadow: 0 0 0 1px rgba(103, 211, 198, 0.22);
}

.case-thumb img,
.case-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-thumb span {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  place-items: center;
  border-radius: 3px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.72);
  font-size: 8px;
  font-weight: 800;
}

.viewer-reference-tools {
  display: grid;
  gap: 5px;
  padding: 8px;
  border-top: 1px solid #2b3739;
}

.rail-tool {
  display: grid;
  width: 62px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid #394648;
  border-radius: 5px;
  color: #9badab;
  background: #182123;
}

.rail-tool:hover,
.rail-tool.active {
  border-color: #75918d;
  color: #ffffff;
  background: #263638;
}

.rail-tool.active {
  color: #70d7ca;
}

.rail-tool .icon {
  width: 17px;
  height: 17px;
}

.image-workspace {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 30px minmax(0, 1fr) 32px;
  background: #020506;
}

.image-orientation,
.viewer-caption {
  display: grid;
  min-width: 0;
  align-items: center;
  color: #dce3e2;
  background: #090d0e;
  font-size: 10px;
}

.image-orientation {
  grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr);
  padding: 0 12px;
  border-bottom: 1px solid #202a2c;
  font-weight: 750;
}

.image-orientation span:last-child {
  text-align: right;
}

.image-orientation strong {
  overflow: hidden;
  padding: 0 10px;
  color: #82928f;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
  background: #020506;
}

.viewer-visual {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform-origin: center;
  transition: transform 160ms ease;
}

.viewer-visual.is-flipped {
  transform: scaleX(-1);
}

.viewer-visual img,
.viewer-visual canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-visual img {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
}

.viewer-caption {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px;
  border-top: 1px solid #202a2c;
  color: #7f918e;
}

.viewer-caption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-caption span:nth-child(2) {
  text-align: center;
}

.viewer-caption span:last-child {
  text-align: right;
}

.viewer-nav {
  width: 34px;
  height: 54px;
  margin-top: -27px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(3, 8, 9, 0.58);
  opacity: 0;
  transition: opacity 150ms ease, background 150ms ease;
}

.viewer-stage:hover .viewer-nav,
.viewer-nav:focus-visible {
  opacity: 1;
}

.viewer-nav:hover {
  background: rgba(23, 56, 59, 0.88);
}

.viewer-nav:disabled {
  opacity: 0;
}

.overlay-layer {
  z-index: 4;
}

.target-zone {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--target-width) * 1%);
  height: calc(var(--target-height) * 1%);
  border: 2px dashed var(--callout);
  border-radius: 50%;
  background: color-mix(in srgb, var(--callout) 16%, transparent);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.24);
  transform: translate(-50%, -50%);
}

.target-zone span {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  padding: 3px 5px;
  border-radius: 3px;
  color: #ffffff;
  background: rgba(3, 8, 9, 0.78);
  font-size: 8px;
  font-weight: 750;
  white-space: nowrap;
  transform: translateX(-50%);
}

.layer-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid #2d393c;
  color: #d5dfde;
  background: #0d1314;
}

.layer-panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-bottom: 1px solid #2b3739;
  background: #151e20;
}

.layer-panel-head strong {
  font-size: 11px;
}

.layer-panel-head span {
  color: #82928f;
  font-size: 9px;
}

.layer-row {
  display: grid;
  width: 100%;
  min-height: 44px;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid #242d2f;
  color: #9baaa8;
  background: transparent;
  font-size: 10px;
  text-align: left;
}

.layer-row:hover {
  color: #f2f5f4;
  background: #182123;
}

.layer-row.active {
  color: #ffffff;
  background: #131c1d;
}

.layer-row small {
  color: #6f807d;
  font-size: 8px;
}

.layer-master {
  font-weight: 750;
}

.layer-swatch {
  width: 11px;
  height: 11px;
  border: 2px solid var(--layer-color, #849693);
  border-radius: 50%;
  background: color-mix(in srgb, var(--layer-color, #849693) 28%, transparent);
}

.layer-swatch.master {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: #8faaa6;
  background: #202b2d;
}

.layer-swatch.master .icon {
  width: 13px;
  height: 13px;
}

.layer-swatch.target {
  border-style: dashed;
}

.layer-check {
  display: grid;
  place-items: center;
  color: #70d7ca;
}

.layer-check .icon {
  width: 14px;
  height: 14px;
}

.layer-divider {
  display: flex;
  min-height: 29px;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #242d2f;
  color: #647572;
  background: #090e0f;
  font-size: 8px;
  font-weight: 800;
}

.reference-layer-note {
  display: grid;
  justify-items: start;
  gap: 9px;
  padding: 18px 14px;
  color: #9eaeab;
}

.reference-layer-note > .icon {
  width: 22px;
  height: 22px;
  color: #70d7ca;
}

.reference-layer-note strong {
  color: #f1f5f4;
  font-size: 11px;
}

.reference-layer-note p {
  margin: 0;
  font-size: 10px;
  line-height: 1.65;
}

.detail-reference-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 28px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
}

.reference-content,
.notes-panel {
  min-width: 0;
}

.detail-reference-grid .notes-panel {
  margin-top: 0;
  padding: 0 0 0 24px;
  border-top: 0;
  border-left: 1px solid var(--line);
}

.detail-reference-grid .detail-panel {
  min-height: 150px;
}

.reference-sources {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.reference-sources-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.reference-sources-head .icon {
  width: 16px;
  height: 16px;
  color: var(--teal);
}

.reference-sources-head strong {
  font-size: 13px;
}

.reference-sources-head span {
  margin-left: auto;
  color: var(--quiet);
  font-size: 9px;
}

.reference-source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.reference-source-list a {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
  text-decoration: none;
}

.reference-source-list a:hover {
  background: #f3f8f7;
}

.reference-source-list a > span {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
  font-size: 11px;
  line-height: 1.4;
}

.reference-source-list a strong {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 9px;
}

.reference-source-list a small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .anso-viewer-grid {
    grid-template-columns: 72px minmax(0, 1fr) 220px;
  }

  .case-thumb,
  .rail-tool {
    width: 54px;
  }

  .detail-reference-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-reference-grid .notes-panel {
    padding: 20px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .anso-viewer-grid {
    height: auto;
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .case-rail {
    height: min(64vh, 600px);
  }

  .image-workspace {
    height: min(64vh, 600px);
  }

  .layer-panel {
    display: grid;
    max-height: 280px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid #2d393c;
    border-left: 0;
  }

  .layer-panel-head,
  .layer-divider {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .detail-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .detail-heading {
    width: calc(100% - 50px);
    flex: 1;
  }

  .detail-heading h1 {
    font-size: 18px;
  }

  .detail-toolbar .detail-actions {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }

  .anso-viewer-bar {
    padding: 0 9px;
  }

  .viewer-title span {
    display: none;
  }

  .viewer-title strong {
    max-width: 62vw;
  }

  .anso-viewer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-rail {
    display: grid;
    width: 100%;
    height: 70px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    border-right: 0;
    border-bottom: 1px solid #2d393c;
  }

  .viewer-rail-head {
    align-content: center;
    flex-direction: column;
    justify-content: center;
    padding: 0 5px;
    border-right: 1px solid #2b3739;
    border-bottom: 0;
  }

  .viewer-case-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 7px;
  }

  .case-thumb {
    width: 64px;
    height: 52px;
  }

  .viewer-reference-tools {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 6px;
    border-top: 0;
    border-left: 1px solid #2b3739;
  }

  .rail-tool {
    width: 34px;
    height: 34px;
  }

  .image-workspace {
    height: min(56vh, 500px);
    min-height: 330px;
  }

  .image-orientation {
    grid-template-columns: minmax(60px, 1fr) minmax(80px, auto) minmax(60px, 1fr);
    padding: 0 8px;
  }

  .overlay-callout::after {
    width: 12px;
  }

  .overlay-callout span {
    font-size: 8px;
  }

  .layer-panel {
    max-height: 320px;
    grid-template-columns: minmax(0, 1fr);
  }

  .layer-panel-head,
  .layer-divider {
    grid-column: 1;
  }

  .viewer-nav {
    opacity: 1;
  }

  .reference-source-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .detail-toolbar .icon-button,
  .detail-toolbar .command-button {
    width: 36px;
    height: 36px;
  }

  .detail-heading .english-title {
    max-width: 72vw;
  }

  .image-workspace {
    height: 50vh;
    min-height: 300px;
  }

  .image-orientation strong {
    max-width: 110px;
  }

  .viewer-caption {
    gap: 4px;
    padding: 0 8px;
    font-size: 9px;
  }

  .layer-row {
    min-height: 42px;
  }
}

.procedure-page {
  max-width: 1240px;
  margin: 0 auto;
}

.procedure-page-head {
  margin-bottom: 18px;
}

.procedure-scope-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

.procedure-scope-tabs button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 58px;
  gap: 2px 8px;
  padding: 9px 11px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.procedure-scope-tabs button:hover {
  background: #f2f7f6;
}

.procedure-scope-tabs button.active {
  color: #ffffff;
  background: var(--teal);
}

.procedure-scope-tabs strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.procedure-scope-tabs span {
  align-self: start;
  min-width: 25px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--ink);
  background: #e8f1ef;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.procedure-scope-tabs button.active span {
  color: var(--teal-deep);
  background: #ffffff;
}

.procedure-scope-tabs small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
  font-size: 9px;
  line-height: 1.35;
}

.procedure-filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.procedure-filter-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.procedure-filter-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.procedure-filter-field select {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper);
  font-size: 13px;
}

.procedure-reset {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--teal);
  background: #ffffff;
  font-size: 12px;
  font-weight: 750;
}

.procedure-reset:hover {
  border-color: #9bbcb6;
  background: var(--teal-soft);
}

.procedure-boundary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-left: 4px solid var(--yellow);
  color: #5b5134;
  background: #fff8df;
}

.procedure-boundary .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #987625;
}

.procedure-boundary p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
}

.procedure-boundary strong {
  margin-right: 7px;
  color: #6e581b;
}

.procedure-boundary a {
  color: #6e581b;
  font-weight: 750;
}

.procedure-result-overview {
  margin-bottom: 24px;
  padding: 15px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.procedure-result-overview > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.procedure-result-overview > header span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.procedure-result-overview > header h2 {
  margin: 3px 0 0;
  font-size: 16px;
}

.procedure-result-overview > header p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.procedure-jump-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.procedure-jump-list button {
  display: grid;
  min-width: 0;
  min-height: 72px;
  gap: 3px;
  padding: 10px 12px 10px 15px;
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--procedure-accent);
  border-radius: 5px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.procedure-jump-list button:hover,
.procedure-jump-list button:focus-visible {
  border-color: var(--procedure-accent);
  background: #f7faf9;
  outline: none;
}

.procedure-jump-list button span {
  color: var(--procedure-accent);
  font-size: 9px;
  font-weight: 850;
}

.procedure-jump-list button strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.procedure-jump-list button small {
  color: var(--muted);
  font-size: 9px;
}

.procedure-list {
  display: grid;
  gap: 26px;
}

.procedure-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--procedure-accent);
  border-radius: 7px;
  background: var(--paper);
  box-shadow: 0 3px 12px rgba(24, 39, 43, 0.04);
  scroll-margin-top: 20px;
}

.procedure-card:focus {
  outline: 3px solid color-mix(in srgb, var(--procedure-accent) 30%, transparent);
  outline-offset: 3px;
}

.procedure-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 10px;
}

.procedure-title-copy {
  min-width: 0;
}

.procedure-heading-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 6px;
}

.procedure-sequence {
  padding: 3px 7px;
  border-radius: 4px;
  color: #ffffff;
  background: var(--procedure-accent);
  font-size: 9px;
  font-weight: 850;
}

.procedure-region-label {
  display: block;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.procedure-title-copy h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.procedure-english {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.procedure-intent {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-left: 3px solid var(--coral);
  color: #784434;
  background: #fff2ed;
  font-size: 10px;
  font-weight: 750;
}

.procedure-card-meta {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  justify-items: end;
}

.procedure-evidence {
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: #f7f9f8;
  font-size: 9px;
  font-weight: 800;
}

.procedure-evidence.is-guideline {
  border-color: #a6cbc4;
  color: #11675f;
  background: #e8f4f1;
}

.procedure-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 20px 14px;
}

.procedure-tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #f8faf9;
  font-size: 10px;
}

.procedure-incision {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #edf3f1;
}

.procedure-incision span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.procedure-incision strong {
  font-size: 12px;
  line-height: 1.55;
}

.procedure-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
}

.procedure-options,
.procedure-limitations {
  min-width: 0;
  padding: 17px 20px 18px;
}

.procedure-limitations {
  border-left: 1px solid var(--line);
  background: #fcf9f5;
}

.procedure-options h3,
.procedure-limitations h3 {
  margin: 0 0 11px;
  color: var(--ink);
  font-size: 13px;
}

.procedure-option-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.procedure-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 11px 10px 11px 13px;
  border-left: 4px solid var(--option-color, var(--teal));
  background: #ffffff;
}

.procedure-option.tone-primary {
  --option-color: var(--teal);
}

.procedure-option.tone-alternative {
  --option-color: var(--yellow);
}

.procedure-option.tone-adjunct {
  --option-color: var(--coral);
}

.procedure-option-copy {
  min-width: 0;
}

.procedure-option-head {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  align-items: baseline;
}

.procedure-option-head strong {
  font-size: 13px;
}

.procedure-option-head span {
  color: var(--option-color, var(--teal));
  font-size: 10px;
  font-weight: 750;
}

.procedure-option p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.procedure-block-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid #9fc4bd;
  border-radius: 5px;
  color: var(--teal);
  background: #f4faf8;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.procedure-block-link:hover {
  background: var(--teal-soft);
}

.procedure-block-link .icon {
  width: 14px;
  height: 14px;
}

.procedure-block-status {
  padding: 4px 6px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.procedure-limitations ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.procedure-limitations li {
  position: relative;
  padding-left: 14px;
  color: #645e57;
  font-size: 11px;
  line-height: 1.6;
}

.procedure-limitations li::before {
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--coral);
  content: "";
}

.procedure-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  align-items: baseline;
  padding: 9px 20px 11px;
  border-top: 1px solid var(--line);
  background: #fafbfa;
}

.procedure-source-list > span {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 800;
}

.procedure-source-list a {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--teal);
  font-size: 9px;
  line-height: 1.45;
  text-decoration: none;
}

.procedure-source-list a:hover {
  text-decoration: underline;
}

.procedure-page .empty-state .procedure-reset {
  margin-top: 16px;
}

@media (max-width: 820px) {
  .procedure-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .procedure-limitations {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 680px) {
  .procedure-scope-tabs button {
    min-height: 48px;
    padding: 8px;
    text-align: center;
  }

  .procedure-scope-tabs strong {
    font-size: 11px;
  }

  .procedure-scope-tabs span {
    justify-self: center;
  }

  .procedure-scope-tabs small {
    display: none;
  }

  .procedure-filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .procedure-card-head {
    display: grid;
    padding: 15px 15px 9px;
  }

  .procedure-result-overview > header {
    display: grid;
    gap: 5px;
  }

  .procedure-jump-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .procedure-intent {
    justify-self: start;
  }

  .procedure-card-meta {
    justify-items: start;
  }

  .procedure-tags {
    padding: 0 15px 12px;
  }

  .procedure-incision {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 10px 15px;
  }

  .procedure-options,
  .procedure-limitations {
    padding: 15px;
  }

  .procedure-option {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .procedure-block-link,
  .procedure-block-status {
    justify-self: start;
  }

  .procedure-source-list {
    display: grid;
    padding: 9px 15px 11px;
  }
}
