:root {
  --cell-size: 260px;
  --gap: 12px;
  --page: #ebe8e1;
  --panel: #f3f0e9;
  --panel-strong: #dedad0;
  --cell: #f8f6f1;
  --glyph-background: #ffffff;
  --line: #c7c2b7;
  --ink: #25231f;
  --muted: #746f65;
  --accent: #343a32;
  --accent-hover: #465046;
  --danger: #8b3830;
  --guide-color: #cc3b2f;
  --guide-line-color: rgba(204, 59, 47, 0.62);
  --guide-label-background: rgba(255, 255, 255, 0.90);
  --guide-label-border: rgba(37, 35, 31, 0.18);
  --guide-opacity: 0.62;
  --guide-weight: 1px;
  --ascender: 12%;
  --cap-height: 17%;
  --x-height: 39%;
  --baseline: 79%;
  --descender: 92%;
  --left-margin: 14%;
  --right-margin: 86%;
  --shadow: 0 10px 28px rgba(37, 35, 31, 0.12);
}

* { box-sizing: border-box; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
html { background: var(--page); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
}
button, input, select { font: inherit; }
button { color: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(235, 232, 225, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 48px;
  padding: 0 10px;
  color: #f2f3ef;
  background: #0c0c11;
  border-bottom: 1px solid #373b38;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-right: 4px;
  user-select: none;
}
.brand a { display: block; flex: 0 0 auto; }
.brand-logo { display: block; width: 30px; height: 30px; object-fit: contain; }
.brand-name {
  color: #f2f3ef;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.version {
  color: #858a86;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand-secondary {
  padding-left: 10px;
  border-left: 1px solid #373b38;
  color: #a6aaa5;
  font-size: 0.72rem;
  white-space: nowrap;
}
.topbar-spacer { flex: 1 1 auto; }
.privacy-note { color: #a6aaa5; font-size: 0.7rem; white-space: nowrap; }
.topbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #373b38;
  border-radius: 9px;
  color: #f2f3ef;
  background: #242725;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}
.topbar-button:hover { border-color: #d7bb69; background: #202321; }
.topbar-button-ghost { background: transparent; }
.topbar .topbar-button:focus-visible { outline-color: #f2d778; }

.actionbar,
.controlbar {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 7px 12px;
}
.actionbar {
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.project-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.project-status {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}
.project-status strong { color: var(--ink); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.controlbar {
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 10px 8px;
  overflow-x: auto;
  color: var(--muted);
  font-size: 12px;
  scrollbar-width: thin;
}
.range-control,
.check-control,
.text-control,
.select-control,
.color-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.controlbar input[type="range"] { width: 88px; }
.color-control input[type="color"] {
  width: 30px;
  height: 27px;
  padding: 2px;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}
.color-control .hex-color-input {
  width: 72px;
  min-height: 27px;
  padding: 3px 6px;
  color: var(--ink);
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
}
.text-control input[type="text"] { width: 78px; }
#cellSizeValue {
  width: 58px;
  min-height: 27px;
  padding: 3px 4px;
  color: var(--ink);
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 3px;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.range-control .unit-label { margin-left: -2px; color: var(--muted); }

.button {
  min-height: 29px;
  padding: 4px 8px;
  color: var(--ink);
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover:not(:disabled) { background: #fff; border-color: #9f9a8f; }
.button:disabled { opacity: 0.42; cursor: not-allowed; }
.button-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button-primary:hover:not(:disabled), .button-strong:hover:not(:disabled) { background: var(--accent-hover); }
.button-strong { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.button-danger { color: var(--danger); }
.toggle-button {
  min-width: 142px;
  font-weight: 700;
}
.toggle-button.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-button.is-active:hover:not(:disabled) { background: var(--accent-hover); }
.export-toggle-setting {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}
.export-setting-disabled { opacity: 0.45; }

input[type="text"],
input[type="number"],
select {
  min-height: 27px;
  padding: 3px 6px;
  color: var(--ink);
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 3px;
}
input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}
input[type="color"] {
  width: 46px;
  height: 28px;
  padding: 2px;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.button:focus-visible,
.topbar-button:focus-visible,
input:focus-visible,
select:focus-visible,
.glyph-cell:focus-visible,
.cell-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.guide-settings {
  display: none;
  padding: 12px 16px 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 10px 20px rgba(37, 35, 31, 0.08);
}
.guide-settings.is-open { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr); gap: 18px; }
.settings-group h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 12px;
}
.setting {
  display: grid;
  grid-template-columns: minmax(78px, 1fr) 70px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}
.setting-number {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.setting-number input[type="number"] { width: 100%; min-width: 0; text-align: right; }
.setting-unit { min-width: 12px; color: var(--muted); font-size: 10px; }
.setting-color { grid-template-columns: minmax(78px, 1fr) 48px; }
.export-settings { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 8px 12px; }
.export-settings > label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.inline-range { display: flex; align-items: center; gap: 6px; }
.inline-range input { min-width: 0; flex: 1 1 auto; }
.inline-range output { min-width: 34px; color: var(--ink); font-variant-numeric: tabular-nums; }
.settings-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.settings-note { margin: 0; color: var(--muted); font-size: 10px; }

main { padding: 14px; }
.intro-section {
  margin: 0 0 16px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.intro-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  color: var(--ink);
  background: var(--panel-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
}
.intro-toggle:hover { background: #d5d0c5; }
.intro-toggle:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.intro-toggle-icon {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}
.intro-toggle[aria-expanded="true"] .intro-toggle-icon { transform: rotate(225deg); }
.intro-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}
.intro-panel[hidden] { display: none; }
.intro-panel > div { display: grid; gap: 3px; padding: 10px 12px; background: var(--panel); }
.intro-panel strong { font-family: Georgia, "Times New Roman", serif; font-size: 14px; font-weight: 400; }
.intro-panel span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.character-section + .character-section { margin-top: 26px; }
.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 12px 3px;
}
h2.section-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
}
.section-count { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.section-note { margin: 0 12px 7px; color: var(--muted); font-size: 11px; }
.empty-filter-message { margin: 12px; padding: 18px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 5px; font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; overflow-y: hidden; }
table { width: auto; border-collapse: separate; border-spacing: var(--gap); table-layout: fixed; }
td {
  position: relative;
  width: var(--cell-size);
  min-width: var(--cell-size);
  max-width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  vertical-align: middle;
  overflow: hidden;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.glyph-cell {
  cursor: pointer;
  transition: outline-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.glyph-cell:hover { box-shadow: inset 0 0 0 2px rgba(52, 58, 50, 0.18); }
.glyph-cell.is-dragover { outline: 4px solid var(--accent); outline-offset: -4px; transform: scale(0.985); }
.glyph-cell.reference-cell { outline: 3px solid var(--accent); outline-offset: -3px; }
.glyph-cell.is-processing::after {
  content: "Processing…";
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(37, 35, 31, 0.72);
  font-size: 12px;
  font-weight: 700;
}
.character-image { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--glyph-background); }
.guide-overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
body:not(.show-guides) .guide-overlay { display: none; }
.guide-line { position: absolute; color: var(--guide-line-color); }
.guide-line.horizontal { left: 0; right: 0; height: 0; border-top: var(--guide-weight) solid currentColor; }
.guide-line.vertical { top: 0; bottom: 0; width: 0; border-left: var(--guide-weight) dashed currentColor; }
.guide-line.ascender { top: var(--ascender); border-top-style: dashed; }
.guide-line.cap-height { top: var(--cap-height); }
.guide-line.x-height { top: var(--x-height); border-top-style: dashed; }
.guide-line.baseline { top: var(--baseline); }
.guide-line.descender { top: var(--descender); border-top-style: dashed; }
.guide-line.left-margin { left: var(--left-margin); }
.guide-line.right-margin { left: var(--right-margin); }
.guide-name {
  position: absolute;
  right: 4px;
  top: -13px;
  padding: 1px 3px;
  color: var(--guide-color);
  background: var(--guide-label-background);
  border: 1px solid var(--guide-label-border);
  box-shadow: 0 1px 2px rgba(37, 35, 31, 0.16);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.vertical .guide-name { top: 4px; right: auto; left: 3px; transform: rotate(90deg); transform-origin: top left; }
body:not(.show-guide-labels) .guide-name { display: none; }
.character-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 6;
  min-width: 28px;
  max-width: calc(100% - 16px);
  padding: 4px 7px;
  overflow: hidden;
  color: #fff;
  background: rgba(30, 29, 26, 0.78);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
body:not(.show-glyph-labels) .character-label { display: none; }
.reference-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  max-width: calc(100% - 72px);
  padding: 4px 7px;
  overflow: hidden;
  color: #fff;
  background: rgba(52, 58, 50, 0.88);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.cell-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 8;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.glyph-cell:hover .cell-actions,
.glyph-cell:focus-within .cell-actions,
.missing .cell-actions { opacity: 1; transform: translateY(0); }
.cell-action {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: #fff;
  background: rgba(37, 35, 31, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cell-action:hover { background: rgba(37, 35, 31, 0.98); }
.cell-action.remove-image { background: rgba(139, 56, 48, 0.88); }
body:not(.show-file-names) .source-info { display: none; }
.source-info {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 5;
  max-width: calc(100% - 70px);
  padding: 3px 5px;
  overflow: hidden;
  color: var(--muted);
  background: rgba(248, 246, 241, 0.86);
  border-radius: 3px;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.missing {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  color: var(--muted);
  background: linear-gradient(45deg, transparent 49.5%, rgba(80,77,70,0.10) 49.5%, rgba(80,77,70,0.10) 50.5%, transparent 50.5%), var(--cell);
  text-align: center;
}
.missing-content { pointer-events: none; }
.missing-glyph { display: block; font-family: Georgia, "Times New Roman", serif; font-size: clamp(44px, 7vw, 90px); line-height: 0.9; }
.missing-text { display: block; margin-top: 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.missing-file { display: block; margin-top: 5px; font-family: Consolas, "Courier New", monospace; font-size: 9px; letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; }
.missing-cta { display: inline-block; margin-top: 9px; padding: 4px 7px; color: #fff; background: var(--accent); border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: 0.03em; }
.empty-cell { height: 0; padding: 0; visibility: hidden; border: 0; }

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 20px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10px;
}
.status {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 10020;
  max-width: min(420px, calc(100vw - 28px));
  padding: 9px 12px;
  color: #fff;
  background: rgba(37, 35, 31, 0.94);
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.status.is-visible { opacity: 1; transform: translateY(0); }
.status.is-error { background: rgba(139, 56, 48, 0.96); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(37, 35, 31, 0.64);
}
.modal.open { display: flex; }
.modal-card {
  width: min(680px, 100%);
  max-height: min(780px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0,0,0,0.32);
}
.modal-card-wide { width: min(840px, 100%); }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(243, 240, 233, 0.98);
  border-bottom: 1px solid var(--line);
}
.modal-title { font-family: Georgia, "Times New Roman", serif; font-size: 18px; }
.modal-body { padding: 14px; }
.modal-body .muted { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.apps-links { display: grid; gap: 8px; }
.app-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  color: inherit;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
}
.app-link:hover { border-color: var(--accent); background: #fff; }
.app-icon { display: grid; place-items: center; width: 32px; height: 32px; }
.app-icon img { display: block; width: 26px; height: 26px; object-fit: contain; }
.app-text { display: grid; gap: 2px; }
.app-name { font-size: 12px; font-weight: 700; }
.app-desc { color: var(--muted); font-size: 10px; line-height: 1.35; }
.help-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.help-content section { padding: 12px; background: var(--cell); border: 1px solid var(--line); border-radius: 7px; }
.help-content h2 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 400; }
.help-content p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
code { padding: 1px 4px; color: var(--ink); background: #e5e1d8; border-radius: 3px; font-family: Consolas, "Courier New", monospace; font-size: 0.92em; }
.noscript { margin: 20px; padding: 14px; color: #fff; background: var(--danger); border-radius: 6px; }

@media (max-width: 1120px) {
  .brand-secondary { display: none; }
  .privacy-note { display: none; }
  .guide-settings.is-open { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; }
  .topbar-spacer { display: none; }
  .actionbar { align-items: flex-start; flex-direction: column; }
  .project-status { align-self: stretch; justify-content: flex-end; }
  .intro-panel { grid-template-columns: 1fr; }
  .help-content { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 8px 9px; }
  .brand-name { font-size: 1rem; }
  .version { display: none; }
  .actionbar, .controlbar { padding: 7px 9px; }
  .project-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .project-actions .button { width: 100%; }
  .guide-settings { padding: 12px 9px; }
  .export-settings { grid-template-columns: 1fr; }
  main { padding: 6px; }
  .section-heading-row { margin-left: 6px; margin-right: 6px; }
  .section-note { margin-left: 6px; }
  .app-footer { flex-direction: column; }
}

/* Review, comparison and non-destructive glyph adjustment */
.character-image {
  transform-origin: 50% 50%;
  will-change: transform;
}
.glyph-cell.adjusted-cell::before {
  content: "ADJUSTED";
  position: absolute;
  top: 7px;
  left: 50%;
  z-index: 7;
  padding: 3px 5px;
  color: #fff;
  background: rgba(116, 111, 101, 0.86);
  border-radius: 3px;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
  pointer-events: none;
}
.export-adjustment-setting {
  align-self: end;
  min-height: 29px;
  padding: 4px 0;
  color: var(--ink);
  font-size: 11px;
}

.review-modal { padding: 8px; }
.review-modal-card {
  width: min(1500px, calc(100vw - 16px));
  height: min(920px, calc(100vh - 16px));
  max-height: none;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 10px;
}
.review-modal-card:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
}
.review-modal-head { position: relative; }
.review-subtitle { margin-top: 2px; color: var(--muted); font-size: 10px; }
.review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
}
.review-tabs { display: flex; align-items: center; gap: 4px; }
.review-tab {
  min-height: 30px;
  padding: 5px 10px;
  color: var(--muted);
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.review-tab:hover { color: var(--ink); background: #fff; }
.review-tab.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }
.review-zoom-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.review-zoom-controls input[type="range"] { width: 120px; }
.review-zoom-controls input[type="number"] { width: 58px; text-align: right; }
.review-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
.review-controls {
  min-height: 0;
  overflow: auto;
  padding: 10px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.review-control-panel { display: grid; gap: 10px; }
.review-control-heading {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.review-select-label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.review-select-label select { width: 100%; color: var(--ink); }
.nudge-block { display: grid; gap: 6px; }
.nudge-pad {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-areas: ". up ." "left . right" ". down .";
  justify-content: center;
  gap: 4px;
}
.nudge-pad [data-nudge-y="-1"] { grid-area: up; }
.nudge-pad [data-nudge-x="-1"] { grid-area: left; }
.nudge-pad [data-nudge-x="1"] { grid-area: right; }
.nudge-pad [data-nudge-y="1"] { grid-area: down; }
.nudge-pad .button { width: 34px; min-height: 30px; padding: 0; font-size: 15px; }
.review-slider-group { display: grid; gap: 5px; }
.review-slider-group > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}
.review-slider-group > label span:last-child { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); }
.review-slider-group input[type="number"] { width: 62px; min-height: 24px; padding: 2px 4px; text-align: right; }
.review-slider-group input[type="range"] { width: 100%; }
.review-slider-reset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}
.review-slider-reset {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 9px;
  white-space: nowrap;
}
.review-inspect-option {
  width: 100%;
  padding: 7px 8px;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.review-control-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.review-control-actions-stack { display: grid; }
.review-control-actions-stack .button { width: 100%; }
.review-range-label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.review-range-label input[type="range"] { grid-column: 1 / -1; width: 100%; }
.review-range-label output { color: var(--ink); font-variant-numeric: tabular-nums; }
.review-layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px;
  background: var(--cell);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
}
.review-viewport {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background-color: #d7d3ca;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.24) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.24) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.24) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.24) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  outline: none;
}
.review-viewport:focus-visible { box-shadow: inset 0 0 0 3px rgba(52, 58, 50, 0.44); }
.review-stage {
  min-width: min-content;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.review-stage.is-side { align-items: flex-start; }
.review-panel { display: grid; justify-items: center; gap: 7px; }
.review-panel-caption {
  max-width: 100%;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.review-panel-caption small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 400; }
.review-canvas {
  position: relative;
  flex: 0 0 auto;
  width: var(--review-canvas-size, 720px);
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--review-canvas-background, var(--glyph-background));
  border: 1px solid rgba(37, 35, 31, 0.32);
  border-radius: 4px;
  box-shadow: 0 12px 34px rgba(37, 35, 31, 0.22);
}
.review-canvas.ignore-background {
  --review-canvas-background: transparent;
  background-color: #eee;
  background-image:
    linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
    linear-gradient(-45deg, transparent 75%, #d8d8d8 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.review-glyph-layer {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
.review-glyph-layer img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.review-analysis-box {
  position: absolute;
  z-index: 3;
  border: 2px solid rgba(36, 106, 180, 0.92);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.78) inset;
  pointer-events: none;
}
.review-glyph-layer.layer-b .review-analysis-box { border-color: rgba(184, 70, 46, 0.94); }
.review-glyph-layer.layer-c .review-analysis-box { border-color: rgba(97, 116, 47, 0.94); }
.review-center-mark {
  position: absolute;
  z-index: 4;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 1px solid rgba(37, 35, 31, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.9);
  pointer-events: none;
}
.review-center-mark::before,
.review-center-mark::after {
  content: "";
  position: absolute;
  background: rgba(37, 35, 31, 0.95);
}
.review-center-mark::before { left: 9px; top: -5px; width: 1px; height: 28px; }
.review-center-mark::after { left: -5px; top: 9px; width: 28px; height: 1px; }
.review-layer-label {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 8;
  padding: 4px 6px;
  color: #fff;
  background: rgba(37,35,31,0.82);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  pointer-events: none;
}
.review-split-layer { overflow: hidden; }
.review-split-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
  width: 2px;
  background: rgba(37,35,31,0.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.75);
  pointer-events: none;
}
.review-stage.blink-off .review-blink-layer { opacity: 0 !important; }
.review-empty {
  align-self: center;
  padding: 22px;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 7px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .review-toolbar { align-items: flex-start; flex-direction: column; }
  .review-workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .review-zoom-controls { width: 100%; overflow-x: auto; }
}
@media (max-width: 680px) {
  .review-modal { padding: 0; }
  .review-modal-card { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
  .review-workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .review-controls { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .review-stage { align-items: flex-start; justify-content: flex-start; }
  .review-tabs { width: 100%; }
  .review-tab { flex: 1 1 0; padding-left: 5px; padding-right: 5px; }
}
.review-layer-mask {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.review-canvas .review-guide-overlay { display: block !important; z-index: 6; }
.review-canvas .review-guide-overlay.hide-guide-labels .guide-name { display: none !important; }
.loaded-cell { background: var(--glyph-background); }
.review-control-panel[hidden] { display: none !important; }
.modal-head > .topbar-button {
  color: var(--ink);
  background: var(--cell);
  border-color: var(--line);
}
.modal-head > .topbar-button:hover { color: var(--ink); background: #fff; border-color: #9f9a8f; }
.review-temp-files {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.review-temp-files[hidden] { display: none !important; }
.review-temp-files p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.review-temp-file-count {
  color: var(--muted);
  font-size: 9px;
}
