:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-strong: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0f766e;
  --accent-strong: #0d9488;
  --accent-light: rgba(13, 148, 136, 0.08);
  --ember: #f97316;
  --gold: #eab308;
  --blue: #3b82f6;
  --red: #ef4444;
  --checkerboard: #e2e8f0;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 20px 25px -5px rgba(13, 148, 136, 0.1), 0 8px 10px -6px rgba(13, 148, 136, 0.05);
  --border-radius-card: 16px;
  --border-radius-btn: 12px;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", Arial, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: "Cascadia Code", "Cascadia Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
  font-family: var(--font-sans);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090d16;
  --surface: #111827;
  --surface-strong: #1f2937;
  --ink: #f3f4f6;
  --muted: #9ca3af;
  --line: #374151;
  --line-strong: #4b5563;
  --accent: #0d9488;
  --accent-strong: #14b8a6;
  --accent-light: rgba(20, 184, 166, 0.15);
  --ember: #f97316;
  --gold: #facc15;
  --blue: #60a5fa;
  --red: #f87171;
  --checkerboard: #1f2937;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 20px 25px -5px rgba(20, 184, 166, 0.15), 0 8px 10px -6px rgba(20, 184, 166, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(13, 148, 136, 0.07), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(59, 130, 246, 0.02), transparent 35%),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 50% 0%, rgba(20, 184, 166, 0.12), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.04), transparent 40%),
    var(--bg);
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent-strong);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent);
}

button,
.button-link {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 600;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.55rem 1rem;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

button:hover,
.button-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

button.is-active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-strong);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.25);
  outline-offset: 2px;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 0.72rem 0.78rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15), 0 0 16px rgba(13, 148, 136, 0.06);
}

textarea {
  min-height: 9rem;
  resize: vertical;
  font-family: var(--font-mono);
  line-height: 1.45;
  font-size: 0.95rem;
}

input[readonly],
textarea[readonly] {
  background: var(--surface-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

th {
  color: var(--muted);
  font-size: 0.85rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  padding: 0.5rem 0.75rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
.workspace,
.site-footer {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 1rem 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 800;
  font-family: var(--font-display);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(13, 148, 136, 0.3);
  border-radius: var(--border-radius-btn);
  background: var(--accent-light);
  color: var(--accent-strong);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

/* Theme Toggle Button Styling */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  margin-left: auto; /* Push language switcher to the right */
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background-color: var(--surface-strong);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.theme-toggle .auto-icon,
.theme-toggle .sun-icon,
.theme-toggle .moon-icon,
.theme-toggle .time-icon {
  display: none;
}

[data-theme-mode="auto"] .theme-toggle .auto-icon,
[data-theme-mode="light"] .theme-toggle .sun-icon,
[data-theme-mode="dark"] .theme-toggle .moon-icon,
[data-theme-mode="time"] .theme-toggle .time-icon {
  display: block;
}

.language-switch {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface-strong);
}

.language-switch button {
  min-height: 32px;
  border-color: transparent;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
  background: transparent;
}

.language-switch button:hover {
  background: var(--surface);
  transform: none;
}

.language-switch button[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--shadow-soft);
}

.standalone-language-switch {
  margin-left: auto;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 800;
  margin: 0 0 0.75rem;
  background: linear-gradient(135deg, var(--accent-strong) 0%, #3b82f6 50%, var(--accent-strong) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientFlow 6s ease infinite;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--muted);
  max-width: 600px;
  margin: 0;
  line-height: 1.6;
  animation: fadeInUp 0.25s ease-out both 0.05s;
}

.eyebrow,
.tool-category {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.tool-finder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.field {
  display: grid;
  gap: 0.38rem;
}

.field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.field.tall textarea {
  min-height: 12rem;
}

.field.short {
  max-width: 10rem;
}

.workspace {
  padding-bottom: 3rem;
}

.home-view {
  display: grid;
  gap: 1.5rem;
}

.category-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.75rem;
}

.category-tile {
  display: grid;
  justify-items: start;
  justify-content: start;
  align-content: start;
  min-height: 110px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.category-tile:hover,
.category-tile.is-active {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.category-tile strong {
  font-size: 1.05rem;
  font-weight: 700;
  display: block;
  margin-top: 0.25rem;
}

.category-tile small {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.category-icon,
.tool-icon {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface-strong);
  color: var(--accent-strong);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.category-icon svg,
.tool-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.category-icon {
  width: 42px;
  height: 36px;
  margin-bottom: 0.55rem;
}

.catalog-section {
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.section-heading,
.tool-heading,
.tool-view-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.catalog-count,
.tool-crumb {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.tool-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  color: var(--ink);
  padding: 1rem;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.tool-card.is-hidden {
  display: none;
}

.tool-icon {
  width: 54px;
  height: 54px;
}

.tool-icon svg {
  width: 24px;
  height: 24px;
}

.tool-card strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
}

.tool-card small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.88rem;
  line-height: 1.3;
}

.empty-state {
  margin: 0.5rem 0 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--border-radius-card);
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.tool-view {
  display: grid;
  gap: 1rem;
}

.tool-landing {
  display: grid;
  gap: 1.25rem;
  padding: 2rem 0 3rem;
}

.tool-landing-card,
.landing-section {
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.tool-landing h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.12;
}

.tool-landing p {
  color: var(--muted);
  margin: 0;
}

.tool-landing .actions {
  margin-top: 1.25rem;
}

.landing-section h2 {
  margin-bottom: 0.75rem;
}

.landing-section ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.landing-section li + li {
  margin-top: 0.45rem;
}

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

.tool-view-bar {
  align-items: center;
  min-height: 48px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.back-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--surface-strong);
}

.back-link::before {
  content: "";
  width: 0.56rem;
  height: 0.56rem;
  margin-right: 0.45rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.tool-stack {
  display: grid;
  gap: 1rem;
}

.tool-panel {
  display: none;
  scroll-margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.tool-panel.is-active {
  display: block;
  animation: fadeInUp 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tool-heading {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.local-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(13, 148, 136, 0.3);
  border-radius: 999px;
  color: var(--accent-strong);
  background: linear-gradient(90deg, var(--accent-light) 0%, rgba(13, 148, 136, 0.18) 50%, var(--accent-light) 100%);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.split,
.image-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: end;
}

.uuid-extra-options {
  margin-top: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 1.25rem 0;
}

.actions.single {
  margin: 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.check-grid label:hover {
  border-color: var(--accent);
  background-color: var(--surface-strong);
}

.check-grid input {
  width: auto;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  padding: 0.55rem 0.75rem;
}

.toggle-field input {
  width: auto;
}

.mono-output {
  min-height: 10rem;
}

.mono-output.compact-output {
  min-height: 5.5rem;
}

.websocket-log {
  min-height: 13rem;
  white-space: pre;
}

.status {
  min-height: 1.35rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.status.is-error {
  color: var(--red);
}

.status.is-ok {
  color: var(--accent-strong);
}

.finance-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  margin-top: 0.85rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

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

.corner-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.result-grid output {
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface-strong);
  padding: 0.68rem 0.75rem;
  word-break: break-word;
  color: var(--ink);
}

.contrast-preview {
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  padding: 1rem;
  font-weight: 700;
  text-align: center;
}

.gradient-preview {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  margin-top: 1rem;
  box-shadow: var(--shadow-soft);
}

.inline-form .field:not(.short) {
  flex: 1 1 16rem;
}

.base64-file-row {
  align-items: stretch;
  margin-top: 1rem;
}

.base64-file-row .compact-file-drop {
  flex: 1 1 18rem;
  min-width: min(100%, 18rem);
  padding: 1rem;
}

.base64-file-row .field {
  flex: 1 1 12rem;
}

.markdown-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.markdown-editor-field textarea {
  min-height: 34rem;
  font-family: var(--font-mono);
}

.markdown-preview-panel {
  min-height: 34rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  overflow: hidden;
}

.markdown-preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 0.7rem 0.9rem;
}

.markdown-preview-heading output {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.markdown-preview {
  min-height: calc(34rem - 49px);
  max-height: 42rem;
  overflow: auto;
  padding: 1.1rem;
  line-height: 1.7;
}

.markdown-preview > *:first-child {
  margin-top: 0;
}

.markdown-preview > *:last-child {
  margin-bottom: 0;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  line-height: 1.25;
  margin: 1.15em 0 0.55em;
}

.markdown-preview h1 {
  font-size: 1.8rem;
}

.markdown-preview h2 {
  font-size: 1.35rem;
}

.markdown-preview h3 {
  font-size: 1.12rem;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview blockquote,
.markdown-preview table,
.markdown-preview pre {
  margin: 0 0 1rem;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 1.4rem;
}

.markdown-preview code {
  border-radius: 6px;
  background: var(--surface-strong);
  padding: 0.08rem 0.32rem;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.markdown-preview pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface-strong);
  padding: 0.85rem;
}

.markdown-preview pre code {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
}

.markdown-preview blockquote {
  border-left: 4px solid var(--accent);
  color: var(--muted);
  padding-left: 0.9rem;
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  overflow-wrap: anywhere;
}

.markdown-preview th,
.markdown-preview td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.markdown-preview th {
  background: var(--surface-strong);
}

.markdown-preview a {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.result-list {
  display: grid;
  gap: 0.45rem;
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface-strong);
  padding: 0.75rem;
}

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

.match-item {
  display: grid;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  padding: 0.65rem 0.75rem;
}

.match-item code {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
}

.match-item small,
.match-meta,
.result-empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.result-empty {
  margin: 0;
}

.file-drop {
  display: grid;
  gap: 0.55rem;
  position: relative;
  border: 1px dashed var(--line-strong);
  border-radius: var(--border-radius-card);
  padding: 1.5rem;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: var(--accent);
  background-color: var(--surface);
}

.file-drop:focus-within {
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.file-drop.is-dragover {
  border-color: var(--accent);
  background-color: var(--accent-light);
  color: var(--accent-strong);
}

.file-drop > span,
.file-drop small {
  pointer-events: none;
}

.file-drop small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.file-drop:has(input[type="file"]:disabled) {
  cursor: not-allowed;
  opacity: 0.68;
}

.file-drop:has(input[type="file"]:disabled) input[type="file"] {
  cursor: not-allowed;
}

.file-picker-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  width: min(100%, 34rem);
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  padding: 0.45rem;
  text-align: left;
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: calc(var(--border-radius-btn) - 4px);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.36rem 0.8rem;
  white-space: nowrap;
}

.file-picker-name {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-drop.has-file .file-picker-control {
  border-color: rgba(13, 148, 136, 0.45);
  background: var(--accent-light);
}

.file-drop.has-file .file-picker-name {
  color: var(--ink);
}

.url-param-input {
  min-width: min(12rem, 68vw);
  padding: 0.5rem 0.6rem;
}

.url-param-remove {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
}

.canvas-frame,
.preview-box {
  display: grid;
  place-items: center;
  min-height: 320px;
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background:
    linear-gradient(45deg, var(--checkerboard) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checkerboard) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checkerboard) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checkerboard) 75%);
  background-size: 22px 22px;
  background-position:
    0 0,
    0 11px,
    11px -11px,
    -11px 0;
  overflow: hidden;
}

canvas,
.preview-box img {
  max-width: 100%;
  max-height: 520px;
}

.preview-box img {
  display: none;
  object-fit: contain;
}

.preview-box img.has-image {
  display: block;
}

.color-readout,
.settings-grid {
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

/* Quality and Range control customization */
.quality-control-row,
.range-control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quality-control-row input[type="range"],
.range-control-row input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  outline: none;
}

.quality-input-wrapper,
.range-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--border-radius-btn);
  padding: 0 0.5rem;
  width: 5.2rem;
  height: 2.2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.quality-input-wrapper:focus-within,
.range-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.quality-input-wrapper input[type="number"],
.range-input-wrapper input[type="number"] {
  width: 100% !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  outline: none !important;
  box-shadow: none !important;
  -moz-appearance: textfield;
}

.quality-input-wrapper input[type="number"]::-webkit-outer-spin-button,
.quality-input-wrapper input[type="number"]::-webkit-inner-spin-button,
.range-input-wrapper input[type="number"]::-webkit-outer-spin-button,
.range-input-wrapper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quality-input-wrapper .unit,
.range-input-wrapper .unit {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 0.25rem;
}

.field-tip {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 0.2rem;
}

.picker-readout-group {
  display: grid;
  gap: 0.65rem;
}

.picker-readout-group + .picker-readout-group {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.color-replace-swatch-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.picker-readout-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.picker-readout-heading strong {
  font-size: 0.95rem;
  min-width: 0;
}

.picker-readout-heading output {
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.swatch {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface-strong);
}

.swatch.compact {
  min-height: 58px;
}

.swatch.small {
  display: inline-block;
  width: 100%;
  min-height: 42px;
}

.range-field output {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.progress-field progress {
  width: 100%;
  height: 0.75rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-strong);
  accent-color: var(--accent);
}

.progress-field progress::-webkit-progress-bar {
  background: var(--surface-strong);
  border-radius: 999px;
}

.progress-field progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.progress-field progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

.progress-text,
.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.privacy-note {
  margin: -0.35rem 0 1rem;
}

.environment-panel {
  display: grid;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface-strong);
  padding: 0.85rem;
}

.environment-panel strong {
  font-size: 0.95rem;
}

.check-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.check-list li {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
  overflow-wrap: anywhere;
}

.check-list li::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  margin-top: 0.42rem;
  border-radius: 50%;
  background: var(--line-strong);
}

.check-list li.is-ok {
  color: var(--accent-strong);
}

.check-list li.is-warning {
  color: var(--ember);
}

.check-list li.is-error {
  color: var(--red);
}

.check-list li.is-ok::before {
  background: var(--accent-strong);
}

.check-list li.is-warning::before {
  background: var(--ember);
}

.check-list li.is-error::before {
  background: var(--red);
}

.bg-removal-grid {
  align-items: start;
}

.bg-removal-preview canvas,
.compare-preview canvas {
  max-width: 100%;
  max-height: 520px;
}

.bg-removal-output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.bg-removal-output-grid figure {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  min-width: 0;
}

.bg-removal-output-grid figcaption {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.bg-removal-output-grid .preview-box {
  min-height: 180px;
  margin-top: 0;
  padding: 0.4rem;
}

.bg-removal-output-grid .preview-box img {
  display: none;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.bg-removal-output-grid .preview-box img.has-image {
  display: block;
}

.checker-preview {
  background:
    linear-gradient(45deg, var(--checkerboard) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checkerboard) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checkerboard) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checkerboard) 75%);
  background-size: 22px 22px;
  background-position:
    0 0,
    0 11px,
    11px -11px,
    -11px 0;
}

.white-preview {
  background: #fff;
}

.dark-preview {
  background: #111827;
}

.compare-preview {
  background: var(--surface-strong);
}

.sprite-splitter-grid {
  align-items: start;
}

.sprite-splitter-preview canvas {
  max-width: 100%;
  max-height: 520px;
}

.sprite-settings-row {
  gap: 0.65rem;
}

.sprite-preview-panel {
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface-strong);
  padding: 0.85rem;
}

.sprite-preview-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.sprite-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 0.65rem;
  max-height: 420px;
  overflow: auto;
  padding-right: 0.15rem;
}

.sprite-preview-card {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--border-radius-btn);
  background: var(--surface);
  padding: 0.55rem;
}

.sprite-preview-card canvas {
  width: 100%;
  max-height: 112px;
  border: 1px solid var(--line);
  border-radius: calc(var(--border-radius-btn) - 4px);
  background:
    linear-gradient(45deg, var(--checkerboard) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checkerboard) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checkerboard) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checkerboard) 75%);
  background-size: 18px 18px;
  background-position:
    0 0,
    0 9px,
    9px -9px,
    -9px 0;
}

.sprite-preview-card span {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.sprite-preview-card strong,
.sprite-preview-card small {
  overflow-wrap: anywhere;
}

.sprite-preview-card strong {
  font-size: 0.84rem;
}

.sprite-preview-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.sprite-preview-note {
  grid-column: 1 / -1;
}

.confirm-dialog {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: var(--border-radius-card);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-hover);
  padding: 0;
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.confirm-dialog form {
  display: grid;
  gap: 0.9rem;
  padding: 1.25rem;
}

.confirm-dialog h3 {
  margin: 0;
  font-size: 1.2rem;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

.color-preview {
  display: grid;
  align-content: end;
}

.button-link.disabled {
  pointer-events: none;
  opacity: 0.55;
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.site-footer {
  color: var(--muted);
  padding: 0 0 3rem;
}

.footer-inner {
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
}

.footer-note {
  margin: 0;
  font-size: 0.9rem;
}

.footer-records {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem 0.65rem;
}

.footer-records a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.2s ease;
}

.footer-record-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  object-fit: contain;
}

.footer-records a:hover {
  color: var(--accent-strong);
}

/* ===================== Keyframe Animations ===================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===================== Global Polish ===================== */
::selection {
  background: rgba(13, 148, 136, 0.2);
  color: var(--ink);
}

[data-theme="dark"] ::selection {
  background: rgba(20, 184, 166, 0.3);
}

::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

/* ===================== Staggered Page Entrance ===================== */
.tool-finder {
  animation: fadeInUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) both 0.04s;
}

.category-strip {
  animation: fadeInUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) both 0.08s;
}

.catalog-section {
  animation: fadeInUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) both 0.12s;
}

/* ===================== Enhanced Interactions ===================== */
button:active,
.button-link:active {
  transform: translateY(1px) !important;
  box-shadow: none !important;
}

.actions button:first-child {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.actions button:first-child:hover {
  background: linear-gradient(135deg, var(--accent-strong) 0%, #3b82f6 100%);
  border-color: var(--accent-strong);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.3);
  color: #fff;
}

.category-tile.is-active {
  border-left: 3px solid var(--accent-strong);
  padding-left: calc(1rem - 2px);
}

.category-tile:hover .category-icon,
.category-tile.is-active .category-icon {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: scale(1.08);
}

.tool-card:hover .tool-icon {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: scale(1.1);
}

.status.is-ok::before,
.status.is-error::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.status.is-ok::before {
  background: var(--accent-strong);
  box-shadow: 0 0 6px rgba(13, 148, 136, 0.4);
}

.status.is-error::before {
  background: var(--red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.result-grid output {
  border-left: 3px solid var(--accent);
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: var(--accent-light);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.2rem;
}

#tool-search:focus {
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15), 0 0 24px rgba(13, 148, 136, 0.06);
}

.footer-inner {
  border-top-color: transparent;
  background-image: linear-gradient(to right, transparent, var(--line-strong), transparent);
  background-repeat: no-repeat;
  background-position: top center;
  background-size: 100% 1px;
}

/* ===================== Reduced Motion ===================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 980px) {
  .tool-grid {
    grid-template-columns: 1fr 1fr;
  }

  .category-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

}

@media (max-width: 720px) {
  .site-header,
  .workspace,
  .site-footer {
    width: min(100% - 20px, 1200px);
  }

  .section-heading,
  .tool-heading,
  .tool-view-bar,
  .footer-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-records {
    justify-content: flex-start;
  }

  .tool-finder,
  .tool-grid,
  .split,
    .markdown-workspace,
    .landing-grid,
    .image-tool-grid,
    .bg-removal-output-grid,
    .grid-3,
    .corner-grid,
    .result-grid,
    .result-grid.dense {
      grid-template-columns: 1fr;
  }

  .category-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-card {
    grid-template-columns: 54px minmax(0, 1fr);
    min-height: 98px;
  }

  .actions {
    align-items: stretch;
  }

  .actions button,
  .actions .button-link,
  .inline-form > button,
  .inline-form > .button-link,
  .inline-form > .field,
  .inline-form > .toggle-field {
    flex: 1 1 100%;
  }

  .url-param-input {
    min-width: 11rem;
  }

  .tool-icon {
    width: 54px;
    height: 54px;
  }

  .tool-panel,
  .catalog-section {
    padding: 1rem;
  }

  .canvas-frame,
  .preview-box {
    min-height: 240px;
  }

  .markdown-editor-field textarea,
  .markdown-preview-panel {
    min-height: 24rem;
  }

  .markdown-preview {
    min-height: 20rem;
  }

  .picker-readout-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .picker-readout-heading output {
    text-align: left;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }
}
