:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color-scheme: dark;
  --bg: #101116;
  --surface: #18191f;
  --raised: #202127;
  --hover: #262730;
  --border: #2b2c35;
  --text: #f2f1f7;
  --muted: #91929f;
  --accent: #a38aff;
  --purple: #8261ef;
  --soft: #282238;
  --green: #82d8b3;
  --red: #ff929c;
  --shadow: 0 24px 90px #0005;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f9;
  --surface: #fff;
  --raised: #f0f0f6;
  --hover: #e8e7ef;
  --border: #dfdfe9;
  --text: #24232c;
  --muted: #747383;
  --accent: #7351d4;
  --purple: #7552de;
  --soft: #eee8ff;
  --green: #18815f;
  --red: #b92d48;
  --shadow: 0 24px 80px #39304f16;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  outline-offset: 4px;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button {
  color: inherit;
}
svg.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button svg {
  pointer-events: none;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2.3px;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 30px;
  letter-spacing: -1.1px;
  line-height: 1.2;
  font-weight: 650;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.4px;
  font-weight: 600;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
p {
  color: var(--muted);
}
.btn {
  border: 1px solid var(--border);
  background: var(--raised);
  padding: 10px 16px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 550;
  font-size: 12px;
  white-space: nowrap;
  transition: 0.18s;
}
.btn:hover {
  background: var(--hover);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
  box-shadow: 0 4px 18px #8261ef20;
}
.btn.primary:hover {
  filter: brightness(1.1);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.danger {
  color: var(--red);
}
.btn.small {
  padding: 7px 10px;
  font-size: 11px;
}
.icon-btn {
  padding: 9px;
  display: inline-flex;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover {
  background: var(--hover);
}
input,
select {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 13px;
  width: 100%;
  min-width: 0;
}
input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid #a38aff25;
}
input::placeholder {
  color: var(--muted);
  opacity: 0.65;
}
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--purple);
}
.field {
  margin-bottom: 18px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.spread {
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 13px;
  padding: 24px;
}
.separator {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}
.badge {
  font-size: 9px;
  letter-spacing: 0.65px;
  font-weight: 650;
  border: 1px solid var(--border);
  padding: 4px 7px;
  border-radius: 5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.badge.html {
  background: #8d70ee12;
  color: var(--accent);
  border-color: #8d70ee30;
}
.badge.full {
  background: #68bfe812;
  color: #80bede;
  border-color: #68bfe830;
}
.badge.region {
  background: #e8b96812;
  color: #d8bd8a;
  border-color: #e8b96830;
}
.badge.success {
  color: var(--green);
}
.dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
}
.empty {
  text-align: center;
  padding: 55px 24px;
}
.empty > svg {
  width: 38px;
  height: 38px;
  color: var(--accent);
  margin-bottom: 15px;
}
.empty h3 {
  font-size: 17px;
  margin-bottom: 7px;
}
.empty p {
  max-width: 350px;
  margin: 0 auto 20px;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.boot {
  height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.error {
  color: var(--red);
  background: #ff929c0a;
  padding: 12px 15px;
  border: 1px solid #ff929c26;
  border-radius: 8px;
  font-size: 13px;
}
.notice {
  padding: 13px 16px;
  border-radius: 9px;
  background: var(--soft);
  border: 1px solid #a38aff25;
  font-size: 12px;
  color: var(--accent);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
dialog {
  border: 0;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #07080dcc;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 17px;
  box-shadow: var(--shadow);
  padding: 30px;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
}
.modal.wide {
  width: min(1120px, 100%);
}
.modal h2 {
  font-size: 22px;
  margin-bottom: 8px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.modal-header p {
  margin-bottom: 0;
  font-size: 12px;
}
#toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: grid;
  gap: 10px;
  max-width: calc(100vw - 48px);
}
.toast {
  background: var(--raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 10px;
  padding: 14px 20px;
  animation: appear 0.2s;
}
.toast.bad {
  border-color: var(--red);
  color: var(--red);
}
@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.progress-list {
  display: grid;
  gap: 18px;
  margin: 25px 0;
  color: var(--muted);
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 15px;
}
.progress-step span:first-child {
  width: 25px;
  height: 25px;
  display: grid;
  place-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 11px;
}
.progress-step.active {
  color: var(--accent);
}
.progress-step.done {
  color: var(--green);
}
.progress-step.active span:first-child {
  box-shadow: 0 0 0 4px #8261ef19;
  border-color: var(--accent);
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 26px;
}
.progress-bar > div {
  height: 100%;
  width: 35%;
  background: var(--accent);
  animation: progress 2s infinite ease-in-out;
}
@keyframes progress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}
.capture-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mode-card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 11px;
  padding: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  transition: 0.2s;
}
.mode-card:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.mode-card.selected {
  border-color: var(--accent);
  background: var(--soft);
}
.mode-card.selected:after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 12px;
  color: var(--accent);
  font-size: 11px;
}
.mode-card > svg {
  color: var(--accent);
  width: 24px;
  height: 24px;
}
.mode-card strong {
  font-size: 12px;
}
.mode-card span {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}
.type-line {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}
.capture-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  margin: 15px 0 0;
}
.capture-note svg {
  width: 14px;
  height: 14px;
}
.crop-viewport {
  max-height: 58vh;
  overflow: auto;
  background: #090a0d;
  border: 1px solid var(--border);
  border-radius: 9px;
  text-align: center;
}
.crop-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}
.crop-stage img {
  display: block;
  width: 100%;
  max-width: 100%;
  pointer-events: none;
  user-select: none;
}
.crop-stage.fit img {
  width: auto;
  max-height: 55vh;
}
.selection {
  position: absolute;
  border: 2px solid #b59eff;
  background: #a38aff22;
  cursor: move;
  box-shadow: 0 0 0 99999px #0005;
}
.selection.hidden {
  display: none;
}
.crop-stage {
  overflow: hidden;
}
.handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  background: var(--purple);
  border-radius: 2px;
}
.handle[data-handle="nw"] {
  left: -6px;
  top: -6px;
  cursor: nw-resize;
}
.handle[data-handle="ne"] {
  right: -6px;
  top: -6px;
  cursor: ne-resize;
}
.handle[data-handle="sw"] {
  left: -6px;
  bottom: -6px;
  cursor: sw-resize;
}
.handle[data-handle="se"] {
  right: -6px;
  bottom: -6px;
  cursor: se-resize;
}
.handle[data-handle="n"] {
  left: 50%;
  top: -6px;
  cursor: n-resize;
}
.handle[data-handle="s"] {
  left: 50%;
  bottom: -6px;
  cursor: s-resize;
}
.handle[data-handle="w"] {
  left: -6px;
  top: 50%;
  cursor: w-resize;
}
.handle[data-handle="e"] {
  right: -6px;
  top: 50%;
  cursor: e-resize;
}
.crop-coordinates {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0;
}
.crop-coordinates label {
  font-size: 10px;
  letter-spacing: 0.5px;
}
.crop-coordinates input {
  font-family: monospace;
}
.viewer {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 90;
  display: flex;
  flex-direction: column;
}
.viewer-bar {
  padding: 15px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
}
.viewer-bar p {
  margin: 0;
  font-size: 11px;
}
.viewer-bar strong {
  font-size: 13px;
}
.viewer iframe {
  border: 0;
  width: 100%;
  flex: 1;
  background: white;
}
.image-view {
  overflow: auto;
  flex: 1;
  text-align: center;
  padding: 24px;
}
.image-view img {
  max-width: 100%;
  box-shadow: var(--shadow);
}
.hidden {
  display: none !important;
}
