:root {
  --bg: #f1f0e9;
  --surface: #faf9f3;
  --surface-2: #e8e7de;
  --sidebar: #101815;
  --sidebar-muted: #8a9690;
  --text: #17211d;
  --muted: #6d7772;
  --line: #d1d2c9;
  --accent: #d8ff3e;
  --accent-strong: #c2ef10;
  --danger: #d95647;
  --shadow: 0 16px 40px rgba(24, 32, 28, 0.08);
  --radius: 8px;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #111713;
  --surface: #18211d;
  --surface-2: #222d28;
  --text: #eff1ea;
  --muted: #9ba79f;
  --line: #344039;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  transition: background 0.2s, color 0.2s;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.site-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 270px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  background: var(--sidebar);
  color: #eff3ed;
  border-right: 1px solid #29332e;
}

.sidebar-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.mobile-nav-close {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
  margin: 0 8px 35px;
}

.brand-mark {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 34px;
  height: 34px;
  transform: rotate(8deg);
}

.brand-mark span {
  background: var(--accent);
  border-radius: 1px;
}

.brand-mark span:first-child {
  border-radius: 8px 1px 1px 1px;
}

.brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.12em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  width: 17px;
  fill: none;
  stroke: var(--sidebar-muted);
  stroke-width: 1.8;
}

.search-wrap input {
  width: 100%;
  padding: 11px 38px;
  outline: 0;
  border: 1px solid #36413c;
  border-radius: 5px;
  background: #1b2521;
  color: white;
  font-size: 13px;
}

.search-wrap input:focus {
  border-color: #718078;
}

.search-wrap kbd {
  position: absolute;
  right: 10px;
  padding: 1px 6px;
  border: 1px solid #46524c;
  border-radius: 3px;
  color: var(--sidebar-muted);
  font: 10px var(--mono);
}

.nav-label {
  margin: 0 10px 9px;
  color: #68746e;
  font: 10px var(--mono);
  letter-spacing: 0.14em;
}

.tool-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 3px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #38443e transparent;
}

.nav-group {
  margin-bottom: 16px;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #aeb8b2;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.nav-item:hover {
  background: #1b2521;
  color: white;
}

.nav-item.is-active {
  background: var(--accent);
  color: #121a16;
}

.nav-icon {
  display: grid;
  place-items: center;
  height: 28px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 10px var(--mono);
}

.nav-item em {
  opacity: 0.55;
  font: normal 9px var(--mono);
}

.empty-search {
  display: none;
  padding: 20px 10px;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #34413b;
  border-radius: 5px;
  background: #18221e;
}

.privacy-note p {
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 1.6;
}

.privacy-note strong {
  color: #d7ded9;
  font-weight: 500;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(216, 255, 62, 0.1);
}

main {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 42px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font: 10px var(--mono);
  letter-spacing: 0.12em;
}

.breadcrumb i {
  opacity: 0.4;
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.local-time {
  color: var(--muted);
  font: 10px var(--mono);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.menu-button {
  display: none;
}

.menu-button span {
  font-size: 12px;
  font-weight: 600;
}

.workspace {
  width: min(1080px, calc(100% - 80px));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 64px 0 90px;
}

.tool-panel {
  display: none;
  animation: panel-in 0.3s ease both;
}

.tool-panel.is-visible {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 38px;
}

.eyebrow {
  color: var(--muted);
  font: 10px var(--mono);
  letter-spacing: 0.13em;
}

.panel-heading h1 {
  margin: 9px 0 9px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.heading-badge {
  flex: 0 0 100px;
  width: 100px;
  height: 100px;
  padding: 13px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, transparent 49.5%, var(--line) 50%, transparent 50.5%);
}

.heading-badge span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.heading-badge strong {
  display: block;
  margin-top: 28px;
  text-align: right;
  font: 500 24px var(--mono);
}

.editor-card,
.form-card,
.converter-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 10px var(--mono);
  letter-spacing: 0.08em;
}

.traffic-lights {
  display: flex;
  gap: 5px;
  margin-right: 17px;
}

.traffic-lights i {
  width: 7px;
  height: 7px;
  border: 1px solid #879089;
  border-radius: 50%;
}

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

.text-button,
.pane-head button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.text-button:hover,
.pane-head button:hover {
  color: var(--text);
}

.code-editor-wrap {
  display: grid;
  grid-template-columns: 48px 1fr;
  height: 390px;
}

.line-numbers {
  overflow: hidden;
  padding: 20px 12px;
  border-right: 1px solid var(--line);
  color: #9ba29e;
  background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
  text-align: right;
  white-space: pre-line;
  font: 12px/1.75 var(--mono);
  user-select: none;
}

.code-editor,
.large-input,
.text-analyzer,
.converter-pane textarea {
  width: 100%;
  resize: none;
  outline: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.code-editor {
  padding: 20px;
  font: 13px/1.75 var(--mono);
  tab-size: 2;
}

textarea::placeholder,
input::placeholder {
  color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 10px var(--mono);
}

.editor-footer i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #9ca39f;
}

.editor-footer .status-ok {
  background: #63b64d;
}

.editor-footer .status-error {
  background: var(--danger);
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.secondary-button {
  min-height: 45px;
  padding: 0 22px;
  border: 1px solid var(--text);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  background: var(--text);
  color: var(--bg);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button kbd {
  opacity: 0.55;
  font: 10px var(--mono);
}

.secondary-button {
  background: transparent;
  border-color: var(--line);
}

.secondary-button:hover {
  background: var(--surface);
}

.full {
  width: 100%;
  margin-top: 18px;
}

.metric-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 22px 26px;
  border-radius: var(--radius);
  background: var(--sidebar);
  color: white;
}

.metric-strip span {
  display: block;
  margin-bottom: 5px;
  color: #8f9b94;
  font-size: 11px;
}

.metric-strip strong {
  font: 500 24px var(--mono);
}

.copy-chip {
  padding: 7px 12px;
  border: 1px solid #46514b;
  border-radius: 4px;
  background: transparent;
  color: #d5ddd8;
  font-size: 11px;
  cursor: pointer;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-card {
  padding: 24px;
}

.card-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
  color: var(--muted);
  font: 10px var(--mono);
  letter-spacing: 0.08em;
}

.form-card label,
.generator-settings > label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.field {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  outline: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
}

.field:focus {
  border-color: var(--text);
}

.result-box {
  min-height: 76px;
  margin-top: 12px;
  padding: 13px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--muted);
  font: 11px/1.7 var(--mono);
  white-space: pre-line;
}

.converter-card {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  min-height: 420px;
}

.converter-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-head {
  display: flex;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 10px var(--mono);
}

.converter-pane textarea {
  flex: 1;
  min-height: 350px;
  padding: 20px;
  font: 13px/1.7 var(--mono);
}

.converter-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-inline: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.converter-controls button {
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.converter-controls button:hover {
  border-color: var(--text);
  color: var(--text);
}

.large-input {
  display: block;
  min-height: 300px;
  padding: 24px;
  font: 14px/1.8 var(--mono);
}

.action-row.inset {
  padding: 0 20px 20px;
  margin-top: 0;
}

.generator-settings {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stepper {
  display: flex;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.stepper button,
.stepper input {
  width: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
}

.stepper input {
  width: 48px;
  border-inline: 1px solid var(--line);
  font: 12px var(--mono);
  -moz-appearance: textfield;
}

.stepper input::-webkit-inner-spin-button {
  appearance: none;
}

.check-control {
  display: flex !important;
  align-items: center;
  gap: 8px;
  height: 43px;
  margin: 0 auto 0 0 !important;
  cursor: pointer;
}

.check-control input {
  position: absolute;
  opacity: 0;
}

.check-control span {
  width: 17px;
  height: 17px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.check-control input:checked + span {
  border-color: var(--text);
  background: var(--text);
  box-shadow: inset 0 0 0 4px var(--surface);
}

.uuid-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.uuid-row {
  display: grid;
  grid-template-columns: 35px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.uuid-row:last-child {
  border-bottom: 0;
}

.uuid-row span {
  color: var(--muted);
  font: 10px var(--mono);
}

.uuid-row code {
  overflow: hidden;
  font: 13px var(--mono);
  text-overflow: ellipsis;
}

.uuid-row button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.copy-all {
  margin-top: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.stats-grid > div {
  padding: 17px;
  background: var(--surface);
}

.stats-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
}

.stats-grid strong {
  font: 500 20px var(--mono);
}

.text-analyzer {
  display: block;
  min-height: 350px;
  padding: 24px;
  font-size: 15px;
  line-height: 1.9;
}

.watermark-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: start;
}

.watermark-workbench,
.watermark-guide,
.watermark-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 430px;
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone.is-dragging {
  border-color: var(--text);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.upload-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #142019;
  font: 30px var(--mono);
}

.upload-zone strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
}

.upload-zone small {
  color: var(--muted);
  font-size: 11px;
}

.watermark-toolbar {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 62px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.file-summary {
  min-width: 0;
  margin-right: auto;
}

.file-summary span,
.file-summary small {
  display: block;
  overflow: hidden;
  max-width: 170px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary span {
  font: 11px var(--mono);
}

.file-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.brush-tools {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
}

.brush-tools button {
  padding: 6px 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.brush-tools button.is-active {
  background: var(--text);
  color: var(--bg);
}

.brush-size {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.brush-size input {
  width: 74px;
  accent-color: var(--text);
}

.brush-size output {
  width: 18px;
  font: 9px var(--mono);
}

.image-stage-wrap {
  display: grid;
  place-items: center;
  min-height: 430px;
  padding: 20px;
  overflow: auto;
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.image-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #d9d9d9;
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.18);
  touch-action: none;
  user-select: none;
}

.image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.image-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: none;
}

.brush-cursor {
  position: absolute;
  z-index: 2;
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #101815;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.image-stage:hover .brush-cursor {
  display: block;
}

.watermark-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 17px;
  border-top: 1px solid var(--line);
}

.auto-repair-control {
  display: grid;
  grid-template-columns: auto minmax(180px, 240px);
  align-items: center;
  gap: 5px 10px;
  min-width: 0;
}

.auto-repair-control label {
  color: var(--muted);
  font-size: 10px;
}

.auto-repair-control select {
  min-width: 0;
  padding: 9px 30px 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
}

.auto-repair-control select:focus {
  border-color: var(--text);
}

.auto-repair-control small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.watermark-submit-actions {
  display: flex;
  gap: 9px;
  flex-shrink: 0;
}

.watermark-submit-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.watermark-submit p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.watermark-submit p i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
}

.button-loader {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid color-mix(in srgb, var(--bg) 35%, transparent);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.is-loading .button-loader {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.watermark-guide {
  padding: 24px;
}

.watermark-guide ol {
  padding: 0;
  margin: 28px 0 30px;
  list-style: none;
}

.watermark-guide li {
  display: grid;
  grid-template-columns: 27px 1fr;
  gap: 12px;
  padding: 0 0 25px;
  position: relative;
}

.watermark-guide li:not(:last-child)::after {
  position: absolute;
  top: 25px;
  bottom: 4px;
  left: 11px;
  width: 1px;
  background: var(--line);
  content: "";
}

.watermark-guide li em {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font: normal 8px var(--mono);
}

.watermark-guide li strong {
  font-size: 12px;
}

.watermark-guide li p,
.guide-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.guide-note {
  padding: 14px;
  border-left: 3px solid var(--accent-strong);
  background: var(--bg);
}

.guide-note strong {
  font-size: 11px;
}

.watermark-result {
  margin-top: 16px;
  overflow: hidden;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.result-heading h2 {
  margin: 5px 0 0;
  font-size: 22px;
}

.result-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font: 10px var(--mono);
}

.result-heading a {
  text-decoration: none;
}

.result-image-wrap {
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface-2);
}

.result-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 680px;
  box-shadow: var(--shadow);
}

.local-processing-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 45%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--muted);
  font-size: 10px;
}

.local-processing-note i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
}

.image-lab,
.pdf-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.compact-upload {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
}

.image-lab > .compact-upload {
  min-height: 310px;
  margin: 16px;
}

.compact-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.compact-upload span {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
}

.compact-upload small {
  color: var(--muted);
  font-size: 10px;
}

.image-lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  min-height: 520px;
}

.crop-workspace {
  display: grid;
  place-items: center;
  align-content: center;
  min-width: 0;
  padding: 22px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.crop-workspace canvas {
  display: block;
  max-width: 100%;
  max-height: 560px;
  background: #d7d7d7;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  cursor: crosshair;
  touch-action: none;
}

.crop-workspace p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.settings-card {
  padding: 22px;
}

.settings-card > label {
  display: flex;
  justify-content: space-between;
  margin: 18px 0 7px;
  color: var(--muted);
  font-size: 10px;
}

.settings-card select {
  appearance: none;
}

.range-field {
  width: 100%;
  accent-color: var(--text);
}

.dimension-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
  margin-top: 18px;
}

.dimension-fields label {
  color: var(--muted);
  font-size: 10px;
}

.dimension-fields input {
  margin-top: 7px;
  padding-inline: 8px;
}

.dimension-fields span {
  padding-bottom: 15px;
  color: var(--muted);
}

.lab-check {
  justify-content: flex-start !important;
  margin: 15px 0 !important;
}

.settings-card .full + .full {
  margin-top: 8px;
}

.image-lab-result {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 260px) auto;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.image-lab-result div strong,
.image-lab-result div span {
  display: block;
}

.image-lab-result div strong {
  font: 12px var(--mono);
}

.image-lab-result div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.image-lab-result img {
  display: block;
  max-width: 100%;
  max-height: 130px;
}

.image-lab-result a,
.qr-download {
  text-decoration: none;
}

.tool-tabs {
  display: flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.tool-tabs button {
  padding: 8px 14px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.tool-tabs button.is-active {
  background: var(--text);
  color: var(--bg);
}

.pdf-card {
  padding: 22px;
}

.pdf-mode {
  display: none;
}

.pdf-mode.is-visible {
  display: block;
}

.pdf-mode > label:not(.compact-upload) {
  display: block;
  margin: 20px 0 7px;
  color: var(--muted);
  font-size: 10px;
}

.file-list {
  margin: 14px 0;
}

.file-list:empty {
  display: none;
}

.file-list-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.file-list-row:first-child {
  border-top: 1px solid var(--line);
}

.file-list-row em {
  color: var(--muted);
  font: normal 9px var(--mono);
}

.file-list-row button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.field-help {
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 9px;
}

.diff-options {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.diff-options .check-control {
  margin: 0 !important;
}

.diff-options .primary-button {
  margin-left: auto;
}

.diff-editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.diff-editors label + label {
  border-left: 1px solid var(--line);
}

.diff-editors label > span {
  display: block;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 10px var(--mono);
}

.diff-editors textarea {
  display: block;
  width: 100%;
  min-height: 280px;
  padding: 16px;
  resize: vertical;
  outline: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 12px/1.7 var(--mono);
}

.diff-summary {
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font: 10px var(--mono);
}

.diff-output {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.diff-line {
  display: grid;
  grid-template-columns: 42px 22px minmax(max-content, 1fr);
  min-height: 27px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  font: 11px/1.7 var(--mono);
}

.diff-line:last-child {
  border-bottom: 0;
}

.diff-line span {
  padding: 4px 8px;
}

.diff-line .diff-number {
  color: var(--muted);
  text-align: right;
  user-select: none;
}

.diff-line.is-added {
  background: color-mix(in srgb, #57b95d 13%, var(--surface));
}

.diff-line.is-removed {
  background: color-mix(in srgb, #dc6255 13%, var(--surface));
}

.qr-text {
  width: 100%;
  min-height: 115px;
  padding: 12px;
  resize: vertical;
  outline: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.qr-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.qr-settings label {
  color: var(--muted);
  font-size: 10px;
}

.qr-settings select {
  margin-top: 6px;
}

#qrCanvas {
  display: block;
  max-width: 100%;
  margin: 18px auto 12px;
  border: 1px solid var(--line);
  background: white;
}

.qr-download {
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-download[hidden] {
  display: none;
}

.qr-upload {
  margin-top: 9px;
}

.qr-result {
  min-height: 120px;
  margin-top: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 9px var(--mono);
  letter-spacing: 0.1em;
}

footer p {
  margin: 0;
}

.toast {
  position: fixed;
  z-index: 40;
  right: 24px;
  bottom: 24px;
  padding: 12px 17px;
  border: 1px solid #3f4b45;
  border-radius: 5px;
  background: var(--sidebar);
  color: white;
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s;
}

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

.mobile-overlay {
  display: none;
}

@media (max-width: 900px) {
  .site-shell {
    display: block;
  }

  main {
    margin-left: 0;
  }

  .sidebar {
    inset: auto 12px 12px;
    width: auto;
    max-height: calc(100dvh - 24px);
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(8, 14, 11, 0.28);
    transform: translateY(calc(100% + 32px));
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0.32s;
  }

  .sidebar.is-open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .sidebar-heading {
    align-items: center;
  }

  .sidebar .brand {
    margin: 0;
  }

  .sidebar .brand-mark {
    width: 30px;
    height: 30px;
  }

  .sidebar .brand strong {
    font-size: 15px;
  }

  .sidebar .brand small {
    color: var(--muted);
  }

  .mobile-nav-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
  }

  .mobile-nav-close svg {
    width: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.7;
  }

  .sidebar .search-wrap {
    margin: 18px 0 16px;
  }

  .sidebar .search-wrap input {
    min-height: 44px;
    border-color: var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
  }

  .sidebar .search-wrap svg {
    stroke: var(--muted);
  }

  .sidebar .search-wrap kbd {
    border-color: var(--line);
    color: var(--muted);
  }

  .sidebar .tool-nav {
    gap: 0;
    padding-right: 2px;
    scrollbar-color: var(--line) transparent;
  }

  .sidebar .nav-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
  }

  .sidebar .nav-label {
    grid-column: 1 / -1;
    margin: 0 2px 1px;
    color: var(--muted);
    font-size: 9px;
  }

  .sidebar .nav-item {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
    min-height: 58px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.25;
  }

  .sidebar .nav-item > span:nth-child(2) {
    font-size: 13px;
  }

  .sidebar .nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .sidebar .nav-item.is-active {
    border-color: var(--accent-strong);
    background: var(--accent);
    color: #111914;
  }

  .sidebar .nav-icon {
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: var(--surface-2);
  }

  .sidebar .nav-item.is-active .nav-icon {
    background: rgba(17, 25, 20, 0.1);
  }

  .sidebar .nav-item em {
    display: none;
  }

  .sidebar .empty-search {
    color: var(--muted);
  }

  .sidebar .privacy-note {
    display: none;
  }

  .mobile-overlay.is-visible {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: block;
    background: rgba(8, 14, 11, 0.42);
    backdrop-filter: blur(5px);
  }

  .menu-button {
    display: inline-flex;
    width: auto;
    padding: 0 12px;
    gap: 7px;
    border-radius: 999px;
  }

  .menu-button svg {
    width: 14px;
  }

  .topbar {
    padding: 0 22px;
  }

  .workspace {
    width: min(100% - 40px, 760px);
    padding-top: 45px;
  }
}

@media (max-width: 660px) {
  .local-time,
  .heading-badge {
    display: none;
  }

  .workspace {
    width: min(100% - 28px, 560px);
    padding: 36px 0 60px;
  }

  .panel-heading {
    margin-bottom: 28px;
  }

  .panel-heading h1 {
    font-size: 36px;
  }

  .panel-heading p {
    line-height: 1.7;
  }

  .two-column,
  .converter-card {
    grid-template-columns: 1fr;
  }

  .watermark-layout {
    grid-template-columns: 1fr;
  }

  .watermark-guide {
    display: none;
  }

  .watermark-workbench {
    margin-inline: -14px;
    border-inline: 0;
    border-radius: 0;
  }

  .upload-zone {
    min-height: 300px;
    padding: 26px 18px;
    border-inline: 0;
    border-radius: 0;
  }

  .watermark-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    padding: 12px 14px;
  }

  .file-summary {
    grid-column: 1 / -1;
    width: auto;
  }

  .file-summary span,
  .file-summary small {
    max-width: calc(100vw - 56px);
  }

  .brush-tools {
    justify-content: stretch;
  }

  .brush-tools button {
    flex: 1;
    padding-block: 9px;
  }

  .brush-size {
    width: 100%;
  }

  .brush-size input {
    flex: 1;
    min-width: 60px;
  }

  .watermark-toolbar > .text-button {
    min-height: 35px;
    border: 1px solid var(--line);
    border-radius: 4px;
  }

  #clearMask {
    margin-left: 0;
  }

  .image-stage-wrap {
    min-height: 240px;
    max-height: 62vh;
    padding: 10px;
  }

  .watermark-submit {
    align-items: stretch;
    flex-direction: column;
  }

  .auto-repair-control {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 3px;
  }

  .auto-repair-control select,
  .auto-repair-control small {
    grid-column: 1;
  }

  .auto-repair-control select {
    min-height: 44px;
    font-size: 12px;
  }

  .watermark-submit .primary-button {
    width: 100%;
  }

  .watermark-submit-actions {
    flex-direction: column;
  }

  .watermark-submit-actions button {
    width: 100%;
  }

  .watermark-result {
    margin-inline: -14px;
    border-inline: 0;
    border-radius: 0;
  }

  .result-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 17px 14px;
  }

  .result-heading .primary-button {
    width: 100%;
  }

  .image-lab-grid {
    grid-template-columns: 1fr;
  }

  .crop-workspace {
    min-height: 310px;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .crop-workspace canvas {
    max-height: 55vh;
  }

  .image-lab-result {
    grid-template-columns: 1fr;
  }

  .image-lab-result img {
    max-height: 220px;
    margin: auto;
  }

  .image-lab-result a {
    width: 100%;
  }

  .diff-options {
    flex-wrap: wrap;
    gap: 10px;
  }

  .diff-options .primary-button {
    width: 100%;
    margin-left: 0;
  }

  .diff-editors {
    grid-template-columns: 1fr;
  }

  .diff-editors label + label {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .diff-editors textarea {
    min-height: 210px;
  }

  .converter-controls {
    flex-direction: row;
    border: 0;
    border-block: 1px solid var(--line);
  }

  .converter-controls button {
    flex: 1;
  }

  .converter-pane textarea {
    min-height: 220px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid > div:last-child {
    grid-column: span 2;
  }

  .generator-settings {
    flex-wrap: wrap;
    align-items: center;
  }

  .generator-settings > label:first-child {
    width: 100%;
  }

  .generator-settings .primary-button {
    width: 100%;
  }

  .check-control {
    margin-left: auto !important;
  }

  .action-row {
    flex-wrap: wrap;
  }

  .action-row .primary-button {
    flex: 1 0 100%;
  }

  .action-row .secondary-button {
    flex: 1;
  }

  footer {
    justify-content: center;
    padding-inline: 18px;
  }

  footer span {
    display: none;
  }
}

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