:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --border: #d7dbe2;
  --text: #1f2937;
  --muted: #5f6b7a;
  --link: #1d5fbf;
  --link-soft: #edf4ff;
  --button: #2f6fda;
  --button-border: #255ebd;
  --success-bg: #f1f9ec;
  --success-border: #b9d3af;
  --success-text: #346b1e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Arial, Helvetica, sans-serif;
}

a {
  color: var(--link);
}

code {
  padding: 1px 4px;
  background: #eef2f7;
  border: 1px solid var(--border);
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: auto minmax(320px, 560px);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1400px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}

.brand-stone {
  position: absolute;
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
  animation-name: brand-stone-float;
  animation-duration: 4.8s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  will-change: transform;
}

.brand-stone-space {
  top: 2px;
  left: 14px;
  width: 9px;
  height: 9px;
  background: #3f6df6;
  animation-duration: 5.1s;
  animation-delay: -1.3s;
}

.brand-stone-mind {
  top: 10px;
  left: 26px;
  width: 8px;
  height: 8px;
  background: #f3c430;
  animation-duration: 4.3s;
  animation-delay: -0.8s;
}

.brand-stone-reality {
  top: 18px;
  left: 4px;
  width: 9px;
  height: 9px;
  background: #df4d57;
  animation-duration: 5.6s;
  animation-delay: -2.1s;
}

.brand-stone-power {
  top: 19px;
  left: 18px;
  width: 11px;
  height: 11px;
  background: #8258f4;
  animation-duration: 4.9s;
  animation-delay: -1.7s;
}

.brand-stone-time {
  top: 27px;
  left: 28px;
  width: 8px;
  height: 8px;
  background: #34b46b;
  animation-duration: 5.4s;
  animation-delay: -0.4s;
}

.brand-stone-soul {
  top: 29px;
  left: 12px;
  width: 9px;
  height: 9px;
  background: #ff8b33;
  animation-duration: 4.5s;
  animation-delay: -2.4s;
}

.brand-stone-space {
  --stone-float-start-x: -1px;
  --stone-float-start-y: 0px;
  --stone-float-mid-x: 2px;
  --stone-float-mid-y: -3px;
  --stone-float-end-x: 1px;
  --stone-float-end-y: 2px;
}

.brand-stone-mind {
  --stone-float-start-x: 1px;
  --stone-float-start-y: 1px;
  --stone-float-mid-x: -2px;
  --stone-float-mid-y: -2px;
  --stone-float-end-x: 0px;
  --stone-float-end-y: 2px;
}

.brand-stone-reality {
  --stone-float-start-x: 0px;
  --stone-float-start-y: 2px;
  --stone-float-mid-x: 3px;
  --stone-float-mid-y: -1px;
  --stone-float-end-x: -1px;
  --stone-float-end-y: -2px;
}

.brand-stone-power {
  --stone-float-start-x: 0px;
  --stone-float-start-y: -1px;
  --stone-float-mid-x: -2px;
  --stone-float-mid-y: 2px;
  --stone-float-end-x: 2px;
  --stone-float-end-y: -2px;
}

.brand-stone-time {
  --stone-float-start-x: -1px;
  --stone-float-start-y: 1px;
  --stone-float-mid-x: 2px;
  --stone-float-mid-y: -2px;
  --stone-float-end-x: -1px;
  --stone-float-end-y: -1px;
}

.brand-stone-soul {
  --stone-float-start-x: 1px;
  --stone-float-start-y: -1px;
  --stone-float-mid-x: -3px;
  --stone-float-mid-y: 1px;
  --stone-float-end-x: 2px;
  --stone-float-end-y: 2px;
}

@keyframes brand-stone-float {
  0% {
    transform: translate(var(--stone-float-start-x, 0px), var(--stone-float-start-y, 0px));
  }

  50% {
    transform: translate(var(--stone-float-mid-x, 0px), var(--stone-float-mid-y, 0px));
  }

  100% {
    transform: translate(var(--stone-float-end-x, 0px), var(--stone-float-end-y, 0px));
  }
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.05;
}

.brand-subtitle {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.1;
}

.search-shell {
  position: relative;
  min-width: 0;
}

.search-form {
  margin: 0;
}

.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bcc4d0;
  background: #fff;
}

.search-input:focus {
  outline: 2px solid #cfe0ff;
  border-color: #88aef0;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.08);
}

.search-results-label {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.search-result-item:last-child {
  border-bottom: 0;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--link-soft);
  outline: none;
}

.search-result-item.active {
  background: var(--link-soft);
  outline: 1px solid #a8c4f3;
}

.search-result-name {
  font-weight: 700;
}

.search-result-meta {
  color: var(--muted);
  font-size: 12px;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
  width: min(1400px, calc(100% - 24px));
  margin: 16px auto 24px;
  align-items: start;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) minmax(120px, 160px);
  gap: 16px;
  width: min(1760px, calc(100% - 24px));
  margin: 16px auto 24px;
  align-items: start;
}

.page-layout .app-shell {
  width: 100%;
  margin: 0;
}

.ad-rail {
  min-width: 0;
}

.ad-rail-sticky {
  position: sticky;
  top: 16px;
}

.ad-card {
  min-height: 620px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
  border: 1px solid var(--border);
}

.ad-rail-live .ad-card {
  padding: 0;
  background: transparent;
  border: 0;
}

.ad-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-height: 584px;
  padding: 14px 10px;
  border: 1px dashed #b7c7df;
  background: #f8fbff;
  text-align: center;
}

.ad-rail-live .ad-body {
  min-height: 620px;
  padding: 0;
  border: 0;
  background: transparent;
}

.ad-body strong {
  font-size: 15px;
}

.ad-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.utility-ad-slot {
  width: 100%;
  min-height: 560px;
  background: #fff;
}

.ad-rail-live .utility-ad-slot {
  min-height: 620px;
}

.sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.sidebar-box,
.intro-card,
.tool-page-card,
.directory-group,
.directory-card,
.favorite-group {
  background: var(--panel);
  border: 1px solid var(--border);
}

.sidebar-box {
  padding: 14px;
  margin-bottom: 12px;
}

.sidebar-label,
.section-kicker,
.group-label,
.tool-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.sidebar-box h1,
.tool-page-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.sidebar-copy,
.section-copy,
.intro-card p,
.tool-summary,
.tool-page-copy,
.group-copy,
.directory-card p,
.search-empty,
.related-tools p {
  margin: 0;
  color: var(--muted);
}

.tool-nav {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
}

.tool-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--link);
  text-decoration: none;
}

.tool-link span:first-child {
  min-width: 0;
}

.tool-link-favorite {
  flex: 0 0 auto;
  color: #d39a00;
  font-size: 16px;
  line-height: 1;
}

.tool-link:last-child {
  border-bottom: 0;
}

.tool-link:hover,
.tool-link.active {
  background: var(--link-soft);
  color: #0f4aa3;
}

.content {
  min-width: 0;
}

.intro-card,
.tool-page-card,
.directory-group,
.favorite-group {
  padding: 16px;
  margin-bottom: 14px;
}

.intro-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

.directory-grid,
.tool-meta-grid,
.related-grid {
  display: grid;
  gap: 14px;
}
.directory-card:hover,
.category-more-card:hover,
.related-tool-link:hover {
  border-color: #adc2ea;
  background: #fcfdff;
}

.directory-card strong,
.category-more-card strong,
.related-tool-link strong {
  display: block;
  margin-bottom: 4px;
}

.directory-card span,
.category-more-card span,
.back-link {
  color: var(--link);
}

.directory-groups {
  display: grid;
  gap: 14px;
}

.directory-header {
  margin-bottom: 12px;
}

.directory-header h3,
.tool-page-header h1,
.related-tools h3 {
  margin: 0 0 8px;
}

.directory-grid,
.related-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.directory-card,
.category-more-card,
.related-tool-link {
  display: block;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}

.tool-card {
  position: relative;
}

.tool-card-body {
  display: block;
  color: inherit;
  text-decoration: none;
}

.favorite-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 0;
  width: auto;
  height: auto;
  color: #8091a7;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 22px;
  line-height: 1;
}

.favorite-toggle:hover {
  color: #af8400;
  background: transparent;
}

.favorite-toggle.active {
  color: #d39a00;
  background: transparent;
}

.favorite-toggle:focus,
.favorite-toggle:focus-visible {
  outline: none;
  box-shadow: none;
}

.tool-card-title {
  display: block;
  margin-bottom: 4px;
  padding-right: 36px;
}

.card-meta,
.related-tool-link small,
.tool-status-badge,
.tool-category-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
}

.category-more-card {
  border: 1px dashed #b7c7df;
  background: #f8fbff;
}

.category-more-card p {
  margin: 0;
  color: var(--muted);
}

.category-page-header {
  margin-bottom: 14px;
}

.tool-page-header {
  margin-bottom: 14px;
  position: relative;
}

.back-link {
  display: inline-block;
  margin-bottom: 10px;
  text-decoration: none;
}

.tool-page-favorite {
  top: 0;
  right: 0;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}

.tool-status-badge,
.tool-category-badge {
  padding: 3px 8px;
  border: 1px solid var(--border);
  background: #f4f5f7;
  color: #6a7482;
}

.tool-status-badge.ready {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.tool-workspace,
.related-tools {
  margin-top: 14px;
}

.work-card,
.simple-card,
.placeholder-card,
.related-tool-link {
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.drop-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;
  padding: 14px;
  border: 1px dashed #aeb7c4;
  background: #fff;
}

.drop-area-button {
  width: 100%;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: none;
}

.drop-area-button.dragover {
  border-color: #2f6fe4;
  background: #eaf2ff;
  box-shadow: inset 0 0 0 1px #2f6fe4;
}

.drop-area span,
.queue-item small {
  color: var(--muted);
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.queue-list {
  margin-top: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.split-file-card {
  margin-bottom: 12px;
}

.split-preview-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid var(--border);
  background: #fff;
}

.split-preview-card {
  flex: 0 0 auto;
  width: 96px;
  padding: 6px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.split-preview-card.selected {
  box-shadow: inset 0 0 0 1px currentColor;
}

.split-preview-card.split-group-0 {
  color: #2f6fe4;
  border-color: #2f6fe4;
  background: #eaf2ff;
}

.split-preview-card.split-group-1 {
  color: #d9480f;
  border-color: #d9480f;
  background: #fff1ea;
}

.split-preview-card.split-group-2 {
  color: #2b8a3e;
  border-color: #2b8a3e;
  background: #edf9f0;
}

.split-preview-card.split-group-3 {
  color: #7b2cbf;
  border-color: #7b2cbf;
  background: #f5edff;
}

.split-preview-card.split-group-4 {
  color: #a61e4d;
  border-color: #a61e4d;
  background: #fff0f6;
}

.split-preview-card.split-group-5 {
  color: #8f5b00;
  border-color: #8f5b00;
  background: #fff8e1;
}

.split-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #d8dee8;
  background: #fff;
}

.split-preview-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.queue-item-main {
  min-width: 0;
}

.queue-item-main strong {
  display: block;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.queue-item-actions button {
  padding: 6px 9px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
}

.queue-item:last-child {
  border-bottom: 0;
}

.queue-empty,
.tool-inline-note {
  color: var(--muted);
}

.queue-empty {
  padding: 12px;
}

.tool-inline-note {
  margin-top: 10px;
}

.tool-inline-note.error {
  color: #b42318;
}

.tool-inline-note.success {
  color: #256b1b;
}

.action-row,
.option-list,
.chip-row,
.tool-meta-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-row {
  margin-top: 12px;
}

button,
select,
input {
  font: inherit;
}

button {
  padding: 8px 12px;
  color: #fff;
  background: var(--button);
  border: 1px solid var(--button-border);
  cursor: pointer;
}

button.secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--border);
}

.download-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--link);
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #bcc4d0;
  background: #fff;
}

textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bcc4d0;
  background: #fff;
  font: inherit;
}

.option-list label {
  margin: 0;
  font-weight: 400;
}

.resize-controls-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: end;
}

.resize-quality-field {
  min-width: 0;
}

.resize-inline-options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 8px;
}

.convert-controls-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: end;
}

.convert-format-field {
  min-width: 0;
}

.convert-inline-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 8px;
}

.convert-inline-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 400;
}

.convert-inline-options label span {
  color: var(--muted);
  font-size: 13px;
}

.convert-inline-options input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.resize-inline-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 400;
}

.resize-inline-options input[type="checkbox"] {
  width: auto;
  margin: 0;
}

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

.chip {
  display: inline-block;
  padding: 5px 8px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
}

.placeholder-card {
  color: var(--muted);
}

.tool-meta-grid {
  margin-top: 12px;
}

.tool-meta-grid.compact {
  margin-top: 0;
  margin-bottom: 12px;
}

.tool-meta-item {
  min-width: 160px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.inline-value {
  font-weight: 400;
  color: var(--muted);
}

.tool-meta-item strong {
  display: block;
  margin-bottom: 4px;
}

.favorite-empty {
  padding: 10px 12px;
  color: var(--muted);
  border: 1px dashed var(--border);
  background: #fafbfd;
}

.search-empty {
  padding: 10px 12px;
}

.edit-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.edit-sidebar-card,
.edit-canvas-card {
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.edit-sidebar-card h3 {
  margin: 0 0 8px;
}

.edit-page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.edit-page-card {
  padding: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}

.edit-page-card.selected {
  border-color: #2f6fe4;
  box-shadow: inset 0 0 0 1px #2f6fe4;
}

.edit-page-card.removed {
  opacity: 0.55;
  background: #f7f7f7;
}

.edit-page-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid #d8dee8;
  background: #fff;
}

.edit-page-preview img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  transform: rotate(var(--page-rotation, 0deg));
  transform-origin: center center;
}

.edit-page-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.edit-page-meta strong,
.edit-page-meta span,
.edit-text-item strong,
.edit-text-item span {
  display: block;
}

.edit-page-meta span,
.edit-text-item span {
  color: var(--muted);
  font-size: 12px;
}

.edit-page-actions,
.edit-text-item {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.edit-page-actions button,
.edit-text-item button {
  padding: 6px 8px;
}

.edit-page-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: #f4f6f9;
  font-size: 12px;
}

.edit-page-tag.removed {
  color: #b42318;
  border-color: #efb3aa;
  background: #fff1ef;
}

.edit-text-item {
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.edit-text-item:last-child {
  border-bottom: 0;
}

.watermark-preview-stage {
  position: relative;
  min-height: 360px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  background: #fff;
}

.watermark-preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid #d8dee8;
  background: #fff;
}

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

.image-preview-card {
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.image-preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(45deg, #f5f7fb 25%, transparent 25%),
    linear-gradient(-45deg, #f5f7fb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f5f7fb 75%),
    linear-gradient(-45deg, transparent 75%, #f5f7fb 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.image-preview-stage img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.08);
}

.ocr-result-box {
  min-height: 320px;
  resize: vertical;
  white-space: pre-wrap;
  line-height: 1.5;
}

.text-counter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.text-counter-editor-card,
.text-counter-stats-card {
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.text-counter-input {
  min-height: 360px;
  resize: vertical;
  line-height: 1.55;
}

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

.text-counter-stats-card .tool-inline-note {
  margin-top: 12px;
}

.json-formatter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 14px;
  margin-top: 14px;
}

.json-formatter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.json-formatter-output {
  min-height: 250px;
  resize: vertical;
  line-height: 1.55;
}

.color-picker-preview {
  width: 100%;
  height: 170px;
  margin-top: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

#color-picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 0;
  clip: rect(0, 0, 0, 0);
}

.color-picker-image-dropzone {
  margin-bottom: 12px;
}

.color-picker-image-stage {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.color-picker-canvas {
  display: block;
  width: 100%;
  max-height: 360px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: crosshair;
}

.swatch-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.swatch-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.swatch-chip {
  width: 100%;
  height: 56px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.regex-flags {
  padding-top: 8px;
  padding-bottom: 0;
}

.regex-preview,
.regex-match-list {
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.regex-preview {
  margin-bottom: 12px;
  white-space: pre-wrap;
  line-height: 1.55;
}

.regex-preview mark {
  padding: 1px 3px;
  background: #fff1a8;
}

.regex-match-list {
  display: grid;
  gap: 10px;
}

.regex-match-item {
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.regex-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.regex-match-value {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
}

.regex-group-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.regex-group-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.regex-group-chip strong {
  min-width: 22px;
}

.queue-empty.small {
  font-size: 13px;
}

.diff-results-card {
  margin-top: 14px;
}

.diff-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.diff-monaco-wrap {
  margin-top: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

.diff-monaco-head {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
  font-weight: 700;
}

.diff-monaco-head span {
  padding: 10px 12px;
}

.diff-monaco-root {
  height: 520px;
}


.image-crop-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(45deg, #f5f7fb 25%, transparent 25%),
    linear-gradient(-45deg, #f5f7fb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f5f7fb 75%),
    linear-gradient(-45deg, transparent 75%, #f5f7fb 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  overflow: hidden;
}

.image-crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.08);
}

.image-crop-overlay {
  position: absolute;
  border: 2px solid #2f80ed;
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.36);
  pointer-events: auto;
  cursor: move;
}

.image-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #2f80ed;
  background: #fff;
  border-radius: 999px;
}

.image-crop-handle[data-handle="nw"] {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}

.image-crop-handle[data-handle="ne"] {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}

.image-crop-handle[data-handle="sw"] {
  bottom: -7px;
  left: -7px;
  cursor: nesw-resize;
}

.image-crop-handle[data-handle="se"] {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

@media (max-width: 1100px) {
  .directory-grid,
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
    width: min(1400px, calc(100% - 24px));
  }

  .ad-rail {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .tool-nav {
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
  }

  .tool-link {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  .tool-link:last-child {
    border-right: 0;
  }

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

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

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

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

}

@media (max-width: 640px) {
  .header-inner {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .intro-card h2 {
    font-size: 20px;
  }

  .field-grid,
  .resize-controls-row,
  .convert-controls-row,
  .text-counter-grid,
  .json-formatter-grid,
  .directory-grid,
  .related-grid,
  .edit-page-grid {
    grid-template-columns: 1fr;
  }
}
