:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --border: #e5e7eb;
  --ok: #065f46;
  --ok-bg: #d1fae5;
  --radius: 16px;
  --tool-icon-bg: #e7ecf8;
}

body.dark {
  --bg: #0b1020;
  --panel: #121a2d;
  --text: #e5e7eb;
  --muted: #98a2b3;
  --primary: #8b5cf6;
  --primary-2: #4f46e5;
  --border: #243047;
  --ok: #34d399;
  --ok-bg: #052e2b;
  --tool-icon-bg: #1d2740;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(99, 102, 241, 0.08), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(14, 165, 233, 0.09), transparent 35%);
  transition: background-color 0.45s ease, color 0.45s ease;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

body.resize-editor-mode .container {
  width: 100%;
  max-width: 100%;
  padding-left: 8px;
  padding-right: 8px;
}

body.resize-editor-mode .main-content {
  padding: 0.35rem 0 0.7rem;
}

body.resize-editor-mode .tool-panel {
  padding: 0.45rem;
  border-radius: 10px;
}

body.resize-editor-mode .resize-editor-shell {
  gap: 0.4rem;
}

body.crop-editor-mode .container {
  width: min(1600px, 96vw);
}

.crop-editor-page {
  background: transparent;
}

.crop-editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 0.8rem;
  align-items: start;
}

.crop-stage-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, #fff 6%);
  padding: 0.7rem;
  overflow-x: hidden;
  overflow-y: visible;
}

.crop-stage {
  position: relative;
  margin: 0 auto;
}

.crop-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.crop-rect {
  position: absolute;
  border: 2px solid #8b5cf6;
  background: color-mix(in srgb, #8b5cf6 14%, transparent);
  cursor: move;
}

.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 1px solid #fff;
}

.crop-handle-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.crop-handle-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.crop-handle-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.crop-handle-se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.crop-side-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
  padding: 0.65rem;
  display: grid;
  gap: 0.45rem;
}

.crop-side-panel h3 {
  margin: 0 0 0.3rem;
  font-size: 0.96rem;
}

.age-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}

.age-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.age-head strong {
  display: block;
}

.age-head p {
  margin: 0.12rem 0 0;
}

.age-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 18%, #ffffff);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
}

.inline-check input {
  width: auto;
}

.age-mode-wrap {
  width: 100%;
}

.age-mode-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.age-mode-toggle {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-areas:
    "pill title"
    "pill sub";
  gap: 0.08rem 0.55rem;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: 12px;
  padding: 0.52rem 0.65rem;
  cursor: pointer;
  background: color-mix(in srgb, var(--panel) 85%, var(--primary) 15%);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.age-mode-toggle:hover {
  transform: translateY(-1px);
}

.age-mode-pill {
  grid-area: pill;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #64748b;
  position: relative;
  transition: background 0.2s ease;
}

.age-mode-pill::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: left 0.2s ease;
}

.age-mode-title {
  grid-area: title;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.1;
}

.age-mode-sub {
  grid-area: sub;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.1;
}

.age-mode-input:checked + .age-mode-toggle {
  border-color: color-mix(in srgb, var(--primary) 75%, var(--border));
  background: color-mix(in srgb, var(--panel) 73%, var(--primary) 27%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent);
}

.age-mode-input:checked + .age-mode-toggle .age-mode-pill {
  background: var(--primary);
}

.age-mode-input:checked + .age-mode-toggle .age-mode-pill::after {
  left: 19px;
}

.site-header {
  background: #fff;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.45s ease, border-color 0.45s ease;
}

body.dark .site-header {
  background: #0f172a;
  border-bottom-color: #25324a;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

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

body.dark .brand {
  color: #e5e7eb;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #3730a3;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

body.dark .brand-mark {
  background: #1f2a44;
  color: #c7d2fe;
}

.hero {
  padding: 1rem;
}

.hero h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

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

.hero-badges {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.hero-badges span {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.87rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.04);
  transition: background-color 0.45s ease, border-color 0.45s ease;
}

.hero-unique {
  position: relative;
  overflow: hidden;
}

.hero-unique::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 180px;
  height: 180px;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.15), rgba(14, 165, 233, 0.15));
  border-radius: 30px;
  transform: rotate(18deg);
}

.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--primary);
}

.main-content {
  padding: 2rem 0 3rem;
}

section {
  margin-bottom: 1.9rem;
}

h2 {
  margin: 0 0 0.85rem;
}

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

.tool-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  padding: 1.14rem;
  min-height: 108px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.45s ease, color 0.45s ease;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.03);
}

.tool-link {
  text-decoration: none;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 12px 22px rgba(79, 70, 229, 0.14);
}

.tool-card .name {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.03rem;
}

.tool-card .type {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.28rem;
  line-height: 1.45;
  display: block;
}

.tool-icon {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  font-size: 1.12rem;
  background: color-mix(in srgb, var(--primary) 16%, #ffffff);
}

.tool-icon-image {
  width: 2.45rem;
  height: 2.45rem;
  object-fit: contain;
  padding: 3px;
  border-radius: 9px;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  background: var(--tool-icon-bg);
}

.tool-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

#toolWorkspace {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
}

.uploader {
  border: 2px dashed var(--border);
  border-radius: 12px;
  min-height: 190px;
  padding: 2.2rem 1.2rem;
  text-align: center;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.35;
  background: color-mix(in srgb, var(--panel) 90%, var(--primary) 10%);
}

.uploader.dragover {
  border-color: var(--primary);
}

/* Dedicated tool routes (data-tool): simpler surfaces, same markup & SEO */
body[data-tool] .tool-panel {
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 18px 44px rgba(15, 23, 42, 0.07);
  padding: clamp(1.15rem, 2.8vw, 1.7rem) clamp(1.05rem, 3vw, 1.75rem);
}

body[data-tool] .tool-panel > h1 {
  font-size: clamp(1.32rem, 3.1vw, 1.72rem);
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.2;
  margin: 0 0 0.52rem;
}

body[data-tool] .tool-panel > #panelDescription {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.62;
  max-width: 65ch;
}

body[data-tool] #toolWorkspace {
  margin-top: 1.05rem;
  gap: 0.85rem;
}

body[data-tool] #toolForm {
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
}

body[data-tool] .uploader {
  min-height: 152px;
  padding: 1.65rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  border-width: 1px;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--border) 78%, var(--primary) 22%);
  background: color-mix(in srgb, var(--panel) 97%, var(--primary) 3%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

body.dark[data-tool] .uploader {
  box-shadow: none;
}

body[data-tool] .uploader.dragover {
  border-style: solid;
  border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
  background: color-mix(in srgb, var(--panel) 88%, var(--primary) 12%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

body[data-tool] #toolForm .muted,
body[data-tool] .uploader ~ .muted {
  font-size: 0.84rem;
  line-height: 1.48;
}

body[data-tool] #toolForm #runTool.btn-primary {
  width: 100%;
  margin-top: 0.1rem;
  padding: 0.74rem 1.2rem;
  font-size: 0.98rem;
  border-radius: 12px;
  border: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 30%, transparent);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

body[data-tool] #toolForm #runTool.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

body[data-tool] #toolForm #runTool.btn-primary:active {
  transform: translateY(0);
}

body[data-tool] #toolProgress {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 0.1rem;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--border) 45%, var(--panel) 55%);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

body[data-tool] #toolProgress::-webkit-progress-bar {
  background: transparent;
  border-radius: 999px;
}

body[data-tool] #toolProgress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

body[data-tool] #toolProgress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

body[data-tool] #toolMeta {
  padding-top: 1.05rem;
  margin-top: 0.2rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  display: grid;
  gap: 1.2rem;
}

body[data-tool] #toolMeta .meta-block {
  margin-top: 0;
}

body[data-tool] #toolMeta .meta-block h2 {
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

body[data-tool] #toolMeta .meta-block .muted {
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0;
}

body[data-tool] #toolMeta .feature-grid {
  gap: 0.65rem;
}

body[data-tool] #toolMeta .feature-card {
  border: none;
  border-radius: 14px;
  padding: 0.78rem 0.95rem;
  background: color-mix(in srgb, var(--bg) 42%, var(--panel) 58%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

body.dark[data-tool] #toolMeta .feature-card {
  background: color-mix(in srgb, var(--panel) 90%, var(--primary) 10%);
  box-shadow: none;
}

body[data-tool] #toolMeta .feature-head h3 {
  font-size: 0.91rem;
  font-weight: 700;
}

body[data-tool] #toolMeta .feature-card p {
  font-size: 0.82rem;
  line-height: 1.38;
}

body[data-tool] #toolMeta .feature-icon {
  width: 1.38rem;
  height: 1.38rem;
  border-radius: 8px;
  font-size: 0.78rem;
}

body[data-tool] .tool-panel > .meta-block {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
}

body[data-tool] .tool-panel > .meta-block h2 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 0.4rem;
}

body[data-tool] .tool-panel > .meta-block .muted {
  font-size: 0.93rem;
  line-height: 1.55;
  margin: 0 0 0.65rem;
}

body[data-tool] .tool-link-chip {
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  padding: 0.4rem 0.82rem;
  background: color-mix(in srgb, var(--panel) 94%, var(--bg) 6%);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

body[data-tool] .tool-link-chip:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: color-mix(in srgb, var(--panel) 86%, var(--primary) 14%);
  transform: translateY(-1px);
}

body[data-tool] .merge-preview-card {
  border: none;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  background: color-mix(in srgb, var(--panel) 98%, var(--bg) 2%);
}

body.dark[data-tool] .merge-preview-card {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

body[data-tool] .merge-preview-pages {
  border: none;
  background: color-mix(in srgb, var(--bg) 48%, var(--panel) 52%);
}

body[data-tool] .merge-preview-scroll {
  padding: 0.25rem 0.2rem 0.45rem 0;
}

body[data-tool] .main-content > .how-card {
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 14px 36px rgba(15, 23, 42, 0.06);
  padding: clamp(1rem, 2.6vw, 1.35rem) clamp(1rem, 2.6vw, 1.5rem);
}

body[data-tool] .main-content > .how-card .process-card {
  border: none;
  background: color-mix(in srgb, var(--panel) 93%, var(--bg) 7%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

body.dark[data-tool] .main-content > .how-card .process-card {
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
  box-shadow: none;
}

body[data-tool] .main-content section.card.how-card h2 {
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

body[data-tool] #stats {
  margin: 0;
  font-size: 0.87rem;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.option-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.option-card input {
  width: auto;
  margin: 0;
}

.option-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.option-text {
  display: grid;
  gap: 0.1rem;
}

.option-text strong {
  font-size: 0.9rem;
  line-height: 1.1;
}

.option-text span {
  font-size: 0.76rem;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary) 6%, #ffffff),
    var(--panel)
  );
  padding: 0.6rem 0.7rem;
  display: grid;
  gap: 0.2rem;
}

body.dark .stat-card {
  background: #2a3142;
  border-color: #3a4358;
  box-shadow: none;
}

.stat-label {
  font-size: 0.76rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-value {
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}

.stat-icon {
  width: 1rem;
  height: 1rem;
  display: inline-grid;
  place-items: center;
  font-size: 0.85rem;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.case-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 0.6rem;
  min-height: 170px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.45rem;
}

.case-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.case-copy-btn {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 10%, var(--panel));
}

.case-output {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg) 8%);
  font-weight: 700;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 105px;
  max-height: 190px;
  overflow: auto;
}

.password-output-box {
  border: 2px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
  border-radius: 12px;
  padding: 0.65rem;
  display: grid;
  gap: 0.4rem;
  animation: popIn 0.2s ease;
}

.password-output-box.is-hidden {
  display: none;
}

.password-output-input {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.75rem 0.8rem;
  border-width: 2px;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem 0.7rem;
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease;
}

textarea {
  min-height: 120px;
}

.row {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.slug-output-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: start;
}

.slug-output {
  min-height: 44px;
  height: 44px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.slug-copy-btn {
  min-width: 64px;
  height: 36px;
  padding: 0 0.9rem;
  border-radius: 12px;
  border: 1px solid #e4e2f4;
  background: #f0eefc;
  color: #1f2430;
  font-size: 1rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.slug-copy-btn:hover {
  background: #e9e5fb;
  border-color: #dcd6fa;
}

body.dark .slug-copy-btn {
  background: #cfc8f4;
  border-color: #bdb2ec;
  color: #0f172a;
}

.format-switch-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: end;
}

.format-switch-row .btn {
  height: 40px;
  min-width: 44px;
  font-size: 1rem;
}

.qr-preview-box {
  min-height: 180px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 90%, var(--primary) 10%);
  display: grid;
  place-items: center;
  padding: 0.8rem;
}

#qrPreviewImg {
  display: none;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
}

.color-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 0.45rem 0.55rem 0.55rem;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

input[type="color"] {
  width: 52px;
  min-width: 52px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
  border-radius: 8px;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.watermark-preview {
  position: relative;
  min-height: 190px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.wm-preview-canvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  display: block;
}


.wm-preview-text {
  position: absolute;
  left: var(--wm-left, 50%);
  top: var(--wm-top, 50%);
  color: color-mix(in srgb, var(--text) 70%, #6b7280 30%);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.wm-preview-logo {
  position: absolute;
  display: none;
  max-width: 220px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* PDF watermark: settings sidebar + live preview */
.wm-layout {
  display: grid;
  grid-template-columns: minmax(272px, 360px) minmax(0, 1fr);
  grid-template-areas: "wm-side wm-preview";
  gap: 1rem 1.35rem;
  align-items: start;
  width: 100%;
}

.wm-sidebar {
  grid-area: wm-side;
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
  min-width: 0;
  position: sticky;
  top: 0.85rem;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 0.1rem 0.4rem 0.35rem 0;
  scrollbar-gutter: stable;
}

.wm-sidebar .row.wm-sidebar-controls {
  grid-template-columns: 1fr;
}

.wm-main {
  grid-area: wm-preview;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.wm-preview-heading {
  display: grid;
  gap: 0.2rem;
}

.wm-preview-label {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.wm-preview-hint {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.wm-preview-panel {
  min-height: clamp(260px, 52vh, 560px);
}

.wm-preview-panel .wm-preview-canvas {
  max-height: min(72vh, 720px);
}

@media (max-width: 900px) {
  .wm-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "wm-preview"
      "wm-side";
    gap: 1rem;
  }

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

.wm-logo-block {
  margin-top: 0.35rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--panel) 88%, var(--primary) 12%) 0%,
    color-mix(in srgb, var(--panel) 96%, var(--primary) 4%) 100%
  );
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 50%, transparent),
    0 12px 28px color-mix(in srgb, var(--primary) 12%, transparent);
  display: grid;
  gap: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark .wm-logo-block {
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}

.wm-logo-block.is-dragover {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent),
    0 14px 32px color-mix(in srgb, var(--primary) 16%, transparent);
}

.wm-logo-head {
  display: grid;
  gap: 0.4rem;
}

.wm-logo-title {
  margin: 0;
  font-size: clamp(1.02rem, 2.4vw, 1.14rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.wm-logo-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 22%, var(--panel));
  color: color-mix(in srgb, var(--primary) 95%, var(--text));
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
}

.wm-logo-lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 62ch;
}

.wm-logo-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.wm-logo-status {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}

.wm-logo-status strong {
  color: var(--text);
  font-weight: 700;
}

.wm-logo-remove {
  flex: 0 0 auto;
}

.logo-upload-btn {
  border: 2px dashed color-mix(in srgb, var(--primary) 42%, var(--border));
  border-radius: 14px;
  min-height: 118px;
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  cursor: pointer;
  background: color-mix(in srgb, var(--panel) 82%, var(--primary) 18%);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.wm-logo-block.is-dragover .logo-upload-btn {
  border-style: solid;
  border-color: color-mix(in srgb, var(--primary) 65%, var(--border));
  background: color-mix(in srgb, var(--panel) 72%, var(--primary) 28%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent);
}

.logo-upload-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 14%, transparent);
}

.logo-upload-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.logo-upload-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--panel) 55%, var(--primary) 45%);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 20%, transparent);
  margin-bottom: 0.15rem;
}

.logo-upload-icon {
  font-size: 1.55rem;
  line-height: 1;
}

.logo-upload-text {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  max-width: 22ch;
}

.logo-upload-sub {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

body.dark .btn-ghost {
  background: #1d2841;
  border-color: #2b3b5f;
}

#themeToggle.theme-switch {
  width: 74px;
  height: 36px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #eef2ff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

body.dark #themeToggle.theme-switch {
  background: #273146;
  border-color: #3a4969;
}

.theme-side {
  font-size: 0.85rem;
  line-height: 1;
  z-index: 2;
}

.theme-knob {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
  transition: transform 0.35s ease, background-color 0.35s ease;
}

body.dark .theme-knob {
  transform: translateX(36px);
  background: #e2e8f0;
}

.result {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border-radius: 10px;
  display: none;
}

.result.ok {
  display: block;
  background: var(--ok-bg);
  color: var(--ok);
}

.result.warn {
  display: block;
  background: #fef3c7;
  color: #92400e;
}

.result.error {
  display: block;
  background: #fee2e2;
  color: #991b1b;
}

body.dark .result.warn {
  background: #3a2b12;
  color: #f8d58d;
}

body.dark .result.error {
  background: #3a1016;
  color: #ffb4c0;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.35rem;
}

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

progress {
  width: 100%;
}

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

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

body.dark .site-footer {
  background: #0f172a;
  border-top-color: #25324a;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.legal-note {
  padding-bottom: 1.3rem;
}

.brand-footer-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.6rem;
}

.brand-footer-logo {
  width: min(62vw, 220px);
  max-width: 220px;
  height: auto;
  display: block;
  opacity: 0.95;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0 1.5rem;
  flex-wrap: wrap;
}

.back-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid #d9dceb;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  display: inline-block;
  margin-top: 0.35rem;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.back-link:hover {
  transform: scale(1.06);
  background: #ffffff;
  border-color: #c8cde0;
  box-shadow: 0 9px 20px rgba(15, 23, 42, 0.14);
}

.back-link:active {
  transform: scale(1.02);
}

body.dark .back-link {
  background: #1f2a3e;
  border-color: #334562;
  box-shadow: 0 6px 16px rgba(3, 8, 20, 0.5);
}

body.dark .back-link:hover {
  background: #26344d;
  border-color: #41577a;
  box-shadow: 0 10px 22px rgba(3, 8, 20, 0.62);
}

.meta-block {
  margin-top: 0.9rem;
}

.meta-block h2 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.45rem;
}

.feature-card {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  padding: 0.55rem 0.6rem;
  box-shadow: none;
}

.feature-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.feature-head h3 {
  margin: 0;
  font-size: 0.86rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.feature-icon {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
  font-size: 0.72rem;
}

.tool-link-chip {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--text);
  background: var(--panel);
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.7rem;
}

.trust-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
}

.trust-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
}

.trust-card p {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.trust-icon {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
  font-size: 0.82rem;
}

body.dark .trust-card {
  background: #20293a;
  border-color: #313d54;
}

.ad-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.7rem;
}

.ad-slot {
  border: 1px dashed var(--border);
  border-radius: 12px;
  min-height: 90px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 92%, var(--bg) 8%);
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.7rem;
}

.process-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
}

.process-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
}

.process-card p {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.process-icon {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
  font-size: 0.82rem;
}

body.dark .process-card {
  background: #20293a;
  border-color: #313d54;
}

/* Icon badges mix primary with white — in dark mode that reads as “white on white” with light emoji/text */
body.dark .process-icon,
body.dark .about-pill-icon,
body.dark .feature-icon,
body.dark .trust-icon,
body.dark .option-icon,
body.dark .age-icon {
  background: var(--tool-icon-bg);
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--primary) 12%);
  color: #ddd6fe;
}

.rotate-controls {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
}

.rotate-slider-shell {
  position: relative;
  margin-top: 0.45rem;
  padding: 0.35rem 0 0.2rem;
  --rot-fill: 0%;
  --rot-pos: 0%;
}

.rotate-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 84%, var(--border) 16%);
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}

.rotate-track.dragging {
  cursor: grabbing;
}

.rotate-track-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--rot-fill);
  background: var(--primary);
  transition: width var(--rot-dur, 1.5s) ease;
}

.rotate-track-start-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  transform: translate(-2px, -50%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
  z-index: 2;
}

.rotate-track-dot {
  position: absolute;
  top: 50%;
  left: var(--rot-pos);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--primary);
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35), 0 0 0 6px color-mix(in srgb, var(--primary) 22%, transparent);
  transform: translate(-50%, -50%);
  transition: left var(--rot-dur, 1.5s) ease;
  z-index: 3;
  pointer-events: auto;
  cursor: grab;
}

.rotate-track.dragging .rotate-track-dot {
  cursor: grabbing;
}

.rotate-controls input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin: 0;
  height: 32px;
  opacity: 0;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.rotate-controls input[type="range"]:focus {
  outline: none;
}

.rotate-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.rotate-controls input[type="range"]::-moz-range-thumb {
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  background: transparent;
}

.rotate-marks {
  margin-top: 0.7rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
}

.rotate-mark-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 88px;
  text-align: center;
  cursor: pointer;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.rotate-mark-btn:first-child {
  text-align: left;
  margin-left: -2px;
}

.rotate-mark-btn:last-child {
  text-align: right;
  margin-right: -2px;
}

.rotate-mark-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.rotate-mark-btn.active {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 20%, transparent);
}

.rotate-meta {
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
}

.rotate-meta strong {
  color: var(--text);
  font-size: 1rem;
}

.rotate-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
}

.rotate-preview-stage {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, #ffffff 8%);
  padding: 0.9rem;
  overflow: auto;
}

.rotate-preview-canvas {
  max-width: 100%;
  height: auto;
  transition: transform var(--rot-dur, 1.5s) ease;
  transform-origin: center center;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.14);
  border-radius: 6px;
}

.merge-preview-scroll {
  max-height: min(55vh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.15rem 0.35rem 0.35rem 0;
  margin: 0 -0.15rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.merge-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
  align-content: start;
}

.merge-preview-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  background: var(--panel);
  cursor: grab;
  user-select: none;
  position: relative;
}

.merge-preview-card.dragging {
  opacity: 0.55;
}

.merge-preview-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 24%, transparent);
}

.jpg-order-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  min-width: 28px;
  height: 28px;
  padding: 0 0.4rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--primary) 82%, #ffffff);
  color: #fff;
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.merge-preview-pages {
  min-height: 120px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  background: color-mix(in srgb, var(--panel) 90%, #ffffff 10%);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.45rem;
}

.merge-preview-pages.loading {
  display: grid;
  place-items: center;
  animation: pulsePreview 1s ease-in-out infinite;
}

.merge-preview-img {
  display: block;
  width: 100%;
  height: auto;
}

.merge-page-thumb {
  flex: 0 0 96px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  position: relative;
}

.merge-page-no {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 18%, #ffffff);
  color: var(--text);
  font-weight: 700;
}

.merge-preview-meta {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.15rem;
}

.merge-preview-meta strong {
  font-size: 0.86rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.compress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.compress-meta strong {
  color: var(--text);
}

.compress-file-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 0.7rem 0.85rem;
  display: grid;
  gap: 0.25rem;
}

.compress-preview-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}

.compress-preview-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  background: var(--panel);
}

.compress-preview-card p {
  margin: 0 0 0.45rem;
}

.compress-preview-canvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 520px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fff;
  display: block;
  margin: 0 auto;
}

.pdfw-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.pdfw-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  display: block;
}

.pdfw-thumb-more {
  border: 1px dashed var(--border);
  border-radius: 8px;
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.35rem;
}

.wtp-txt-preview {
  margin: 0.45rem 0 0;
  padding: 0.5rem 0.55rem;
  max-height: 180px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, var(--primary) 12%);
}

.ic-top-area {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ic-preview-slot {
  width: 100%;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ic-preview-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ic-run-btn {
  align-self: flex-start;
}

.ic-slider-row {
  align-items: end;
}

.ic-sizes {
  margin: -0.2rem 0 0.2rem;
}

.ic-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
  padding: 0.65rem;
  margin: 0.55rem 0 0.45rem;
}

.ic-preview-wrap p {
  margin: 0 0 0.45rem;
}

.ic-preview-img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, #ffffff 86%, var(--panel) 14%);
  display: block;
}

.resize-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 0.7rem;
  margin: 0.55rem 0 0.8rem;
}

.resize-dimensions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.45rem;
  margin: 0.45rem 0 0.5rem;
}

.resize-dim-chip {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 90%, var(--primary) 10%);
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.1rem;
}

.resize-dim-chip span {
  color: var(--muted);
  font-size: 0.78rem;
}

.resize-dim-chip strong {
  font-size: 0.96rem;
}

.resize-upload-wrap {
  display: grid;
  gap: 0.7rem;
}

.resize-upload-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--panel) 88%, var(--primary) 12%);
}

.resize-upload-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
}

.resize-upload-meta {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
}

.resize-upload-pct {
  font-weight: 700;
}

.resize-editor-page {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.resize-editor-header h3 {
  margin: 0;
}

.resize-editor-header p {
  margin: 0.3rem 0 0.7rem;
}

.resize-editor-shell {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  width: 100%;
  max-width: 100%;
}

.resize-side-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
  padding: 0.6rem;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  width: clamp(140px, 16vw, 190px);
  flex: 0 0 clamp(140px, 16vw, 190px);
  font-size: 0.92rem;
}

.ratio-shortcuts {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, var(--primary) 6%);
  padding: 0.45rem;
}

.ratio-shortcuts > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.84rem;
  list-style: none;
}

.ratio-shortcuts > summary::-webkit-details-marker {
  display: none;
}

.ratio-grid {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.ratio-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.78rem;
}

.ratio-btn:hover {
  border-color: var(--primary);
}

.resize-stage {
  border: 0;
  border-radius: 0;
  min-height: min(82vh, 980px);
  position: relative;
  padding: 0;
  background: transparent;
  overflow-x: hidden;
  overflow-y: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.resize-box {
  resize: none;
  overflow: hidden;
  min-width: 32px;
  min-height: 32px;
  border: 2px dashed color-mix(in srgb, var(--primary) 75%, var(--border) 25%);
  border-radius: 8px;
  background: #fff;
  position: relative;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.resize-box img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.resize-box::after {
  content: none;
}

.resize-handle {
  position: absolute;
  z-index: 2;
  background: color-mix(in srgb, var(--primary) 80%, #ffffff 20%);
  border: 1px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.resize-handle-e {
  top: 50%;
  right: -7px;
  width: 14px;
  height: 44px;
  transform: translateY(-50%);
  border-radius: 8px;
  cursor: ew-resize;
}

.resize-handle-w {
  top: 50%;
  left: -7px;
  width: 14px;
  height: 44px;
  transform: translateY(-50%);
  border-radius: 8px;
  cursor: ew-resize;
}

.resize-handle-n {
  left: 50%;
  top: -8px;
  width: 84px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 10px;
  cursor: ns-resize;
}

.resize-handle-s {
  left: 50%;
  bottom: -8px;
  width: 84px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 10px;
  cursor: ns-resize;
}

.resize-handle-se {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: nwse-resize;
}

.resize-handle-ne {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: nesw-resize;
}

.resize-handle-nw {
  position: absolute;
  left: -8px;
  top: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: nwse-resize;
}

.resize-handle-sw {
  position: absolute;
  left: -8px;
  bottom: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: nesw-resize;
}

@media (max-width: 920px) {
  .resize-editor-shell {
    display: block;
  }
  .resize-side-panel {
    width: 100%;
    margin-top: 0.6rem;
    flex: none;
  }
}

.split-thumb-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  background: var(--panel);
}

.split-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.55rem;
}

.split-thumb-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem;
  background: var(--panel);
  cursor: pointer;
  position: relative;
}

.split-thumb-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 24%, transparent);
}

.split-thumb-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.split-thumb-no {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: color-mix(in srgb, var(--primary) 86%, #fff);
}

@keyframes pulsePreview {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@media (max-width: 760px) {
  .topbar {
    gap: 0.7rem;
    flex-wrap: wrap;
  }
  .grid,
  .feature-grid,
  .stats-grid,
  .case-grid,
  .process-grid,
  .trust-grid {
    grid-template-columns: 1fr;
  }
  .row,
  .format-switch-row {
    grid-template-columns: 1fr;
  }
  .actions .btn {
    width: 100%;
  }
  .ad-grid {
    grid-template-columns: 1fr;
  }
}

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

.home-main {
  padding-top: 0.85rem;
}

/* —— Landing header (home only) —— */
.site-header--landing {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

body.dark .site-header--landing {
  background: color-mix(in srgb, #0f172a 92%, transparent);
  border-bottom-color: #25324a;
}

.topbar--landing {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.65rem 0;
  flex-wrap: wrap;
}

.topbar--landing .brand {
  flex-shrink: 0;
}

.topbar--landing .site-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.85rem;
  min-width: 0;
}

.topbar--landing .theme-toggle-header {
  flex-shrink: 0;
  margin-left: auto;
}

.site-nav__link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 0.28rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.site-nav__link:hover {
  color: var(--text);
}

.site-nav__link--active {
  color: var(--primary);
  border-bottom-color: color-mix(in srgb, var(--primary) 70%, transparent);
}

.site-nav__link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

body.dark .site-nav__link {
  color: #9aa8c9;
}

body.dark .site-nav__link:hover {
  color: #e5e7eb;
}

.hero-home {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: clamp(1rem, 3vw, 2.25rem);
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(0.25rem, 1vw, 0.5rem);
  background: transparent;
  border-radius: 0;
}

body.dark .hero-home {
  background: transparent;
  border: none;
}

.home-hero-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 4.5vw, 2.85rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.home-hero-gradient {
  background: linear-gradient(105deg, #2563eb 0%, #6366f1 42%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.dark .home-hero-title {
  color: #f1f5f9;
}

.home-hero-subtitle {
  margin: 0;
  max-width: 36rem;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero-home .hero-copy p {
  max-width: 36rem;
}

body.dark .home-hero-subtitle,
body.dark .hero-home .hero-copy p {
  color: #a8b6d4;
}

.home-search-wrap {
  margin-top: 0.75rem;
  position: relative;
}

.home-search-wrap--hero {
  margin-top: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.95rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

.home-search-wrap--hero:focus-within {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent), 0 8px 22px rgba(15, 23, 42, 0.06);
}

.home-search-wrap--hero .home-search-icon {
  position: static;
  transform: none;
  display: flex;
  color: var(--muted);
  flex-shrink: 0;
}

.home-search-wrap--hero input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.35rem 0;
  font-size: 0.95rem;
  box-shadow: none;
}

.home-search-wrap--hero input:focus {
  outline: none;
}

body.dark .home-search-wrap--hero {
  background: #121d35;
  border-color: #2a3b5a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

body.dark .home-search-wrap--hero input {
  color: #e7ecff;
}

body.dark .home-search-wrap--hero input::placeholder {
  color: #92a0bd;
}

.home-search-wrap:not(.home-search-wrap--hero) input {
  padding-right: 2.25rem;
}

body.dark .home-search-wrap:not(.home-search-wrap--hero) input {
  background: #0b1326;
  border-color: #2a3a5a;
  color: #e7ecff;
}

body.dark .home-search-wrap:not(.home-search-wrap--hero) input::placeholder {
  color: #92a0bd;
}

.home-search-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-actions {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.btn-hero-primary {
  text-decoration: none;
  background: linear-gradient(120deg, #4f46e5 0%, #6366f1 45%, #7c3aed 100%);
  border: none;
  color: #fff !important;
  font-weight: 700;
  padding: 0.72rem 1.35rem;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.42);
  filter: brightness(1.04);
}

.btn-hero-primary:active {
  transform: translateY(0);
}

.btn-hero-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0) 65%);
  transform: translateX(-120%);
  transition: transform 0.42s ease;
  pointer-events: none;
}

.btn-hero-primary:hover::after {
  transform: translateX(120%);
}

.btn-hero-secondary {
  text-decoration: none;
  font-weight: 600;
  padding: 0.72rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn-hero-secondary:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--panel) 92%, var(--primary) 8%);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

body.dark .btn-hero-secondary {
  background: #121d35;
  border-color: #2a3b5a;
  color: #e5e7eb;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.55;
  pointer-events: none;
}

.hero-blob--a {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.45) 0%, transparent 70%);
  right: 8%;
  top: 10%;
}

.hero-blob--b {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, transparent 70%);
  left: 5%;
  bottom: 5%;
}

body.dark .hero-blob {
  opacity: 0.35;
}

.home-trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0.5rem 0 1.35rem;
  padding: 0.85rem 0.5rem;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

body.dark .home-trust-strip {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.home-trust-strip .home-bottom-item {
  border-right: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}

.home-trust-strip .home-bottom-item:last-child {
  border-right: 0;
}

.home-trust-strip .home-bottom-item {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
}

.home-trust-strip .home-bottom-item > div {
  justify-items: start;
  text-align: left;
}

.home-bottom-item__icon {
  font-size: 1.15rem;
  line-height: 1;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.home-bottom-item__icon--install {
  background: color-mix(in srgb, #22c55e 18%, var(--panel));
}

.home-bottom-item__icon--lock {
  background: color-mix(in srgb, var(--primary) 16%, var(--panel));
}

.home-bottom-item__icon--free {
  background: color-mix(in srgb, #f97316 16%, var(--panel));
}

.home-popular {
  margin-bottom: 1.75rem;
}

.home-popular__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.home-popular__head h2 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.home-popular__emoji {
  margin-right: 0.25rem;
}

.home-popular__link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.home-popular__link:hover {
  text-decoration: underline;
}

@media (min-width: 1100px) {
  .home-tool-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .topbar--landing .site-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 0.65rem 1rem;
    padding: 0.15rem 0 0.35rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .topbar--landing .theme-toggle-header {
    margin-left: 0;
  }
}

.hero-art {
  min-height: 250px;
  border-radius: 18px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
}

.hero-qt {
  width: 168px;
  height: 168px;
  border-radius: 28px;
  background: #fff;
  border: 1px solid #ececff;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.13);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

body.dark .hero-qt {
  background: #13203a;
  border-color: #2a3a5a;
  box-shadow: 0 12px 26px rgba(10, 18, 35, 0.6);
}

.hero-qt img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
  transition: transform 0.22s ease;
}

.hero-orb {
  position: absolute;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #ececff;
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.12);
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.dark .hero-orb {
  background: #16233e;
  border-color: #2c3e62;
  box-shadow: 0 8px 18px rgba(8, 14, 30, 0.65);
}

.hero-orb img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease;
}

.hero-qt:hover {
  transform: scale(1.045);
  box-shadow: 0 18px 40px rgba(79, 70, 229, 0.2);
}

.hero-qt:hover img {
  transform: scale(1.06);
}

.hero-orb:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 32px rgba(79, 70, 229, 0.2);
}

.hero-orb:hover img {
  transform: scale(1.1);
}

.hero-orb-a { width: 58px; height: 58px; left: 9%; top: 16%; }
.hero-orb-b { width: 54px; height: 54px; right: 12%; top: 22%; }
.hero-orb-c { width: 52px; height: 52px; right: 18%; bottom: 18%; }

.home-chip-row {
  margin-bottom: 0.68rem;
}

@media (max-width: 800px) {
  .home-chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .home-chip-row .chip {
    flex-shrink: 0;
  }
}

.home-chip-row .chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.77rem;
  padding: 0.33rem 0.74rem;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.home-chip-row .chip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.14);
}

.home-chip-row .chip:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(79, 70, 229, 0.16);
}

.home-chip-row .chip:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 62%, transparent);
  outline-offset: 1px;
}

.home-chip-row .chip.active {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 68%, var(--border));
  background: color-mix(in srgb, #fff 72%, var(--primary) 28%);
}

body.dark .home-chip-row .chip {
  background: #121d35;
  border-color: #2a3b5a;
  color: #b8c3de;
}

body.dark .home-chip-row .chip.active {
  background: color-mix(in srgb, #121d35 55%, var(--primary) 45%);
  color: #f0e9ff;
  border-color: color-mix(in srgb, var(--primary) 72%, #2a3b5a);
}

.home-main .card {
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.03);
}

.home-main .tool-card {
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(2, 6, 23, 0.04);
  padding: 1.2rem;
  min-height: 114px;
}

.home-main .tool-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.12);
}

.home-main .tool-card .type {
  font-size: 0.82rem;
  line-height: 1.35;
}

.home-bottom-strip {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-bottom-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.56rem;
  padding: 0.82rem 0.68rem;
  border-right: 1px solid var(--border);
  text-align: center;
}

.home-bottom-item > div {
  display: grid;
  justify-items: center;
  text-align: center;
}

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

.home-bottom-item > span {
  font-size: 1rem;
}

.home-bottom-item strong {
  display: block;
  font-size: 0.82rem;
}

.home-bottom-item small {
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 920px) {
  .hero-home {
    grid-template-columns: 1fr;
  }
  .hero-art {
    min-height: 170px;
  }
  .hero-qt {
    width: 120px;
    height: 120px;
    font-size: 2.8rem;
    border-radius: 20px;
  }
}

@media (max-width: 760px) {
  .home-bottom-strip,
  .home-trust-strip {
    grid-template-columns: 1fr;
  }
  .home-bottom-strip .home-bottom-item,
  .home-trust-strip .home-bottom-item {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .home-bottom-strip .home-bottom-item:last-child,
  .home-trust-strip .home-bottom-item:last-child {
    border-bottom: 0;
  }

  /* Keep mobile crop option bar compact so image stays visible */
  body.crop-editor-mode .crop-editor-shell {
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 0.5rem;
  }
  body.crop-editor-mode .crop-stage-wrap {
    padding: 0.45rem;
  }
  body.crop-editor-mode .crop-side-panel {
    padding: 0.42rem;
    gap: 0.35rem;
    font-size: 0.82rem;
  }
  body.crop-editor-mode .crop-side-panel label {
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
  }
  body.crop-editor-mode .crop-side-panel input,
  body.crop-editor-mode .crop-side-panel button {
    padding: 0.46rem 0.5rem;
    font-size: 0.83rem;
    min-height: 34px;
  }

  /* Resize: keep panel narrow on mobile instead of large full-width block */
  body.resize-editor-mode .resize-editor-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 146px;
    gap: 0.5rem;
    align-items: start;
  }
  body.resize-editor-mode .resize-stage {
    min-height: 56vh;
  }
  body.resize-editor-mode .resize-side-panel {
    width: 146px;
    flex: 0 0 146px;
    margin-top: 0;
    padding: 0.42rem;
    gap: 0.34rem;
    font-size: 0.8rem;
  }
  body.resize-editor-mode .resize-side-panel label {
    font-size: 0.78rem;
    margin-bottom: 0.12rem;
  }
  body.resize-editor-mode .resize-side-panel input,
  body.resize-editor-mode .resize-side-panel button,
  body.resize-editor-mode .resize-side-panel select {
    padding: 0.42rem 0.48rem;
    font-size: 0.8rem;
    min-height: 34px;
  }
  body.resize-editor-mode .ratio-shortcuts {
    padding: 0.35rem;
  }
  body.resize-editor-mode .ratio-grid {
    grid-template-columns: 1fr;
    gap: 0.26rem;
  }
  body.resize-editor-mode .ratio-btn {
    font-size: 0.74rem;
    padding: 0.32rem 0.35rem;
  }
}

.about-hero {
  padding: 1.5rem;
}

.about-kicker {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.about-hero h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  line-height: 1.15;
}

.about-lead {
  margin: 0.55rem 0 0;
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--muted);
}

.about-section {
  margin-top: 1rem;
  padding: 1.3rem;
}

.about-section h2 {
  margin: 0 0 0.8rem;
  font-size: 1.5rem;
}

.about-section p {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.8;
  color: var(--muted);
}

.about-pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.about-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.about-pill-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 14%, #ffffff);
  font-size: 1rem;
  flex: 0 0 auto;
}

.about-pill strong {
  display: block;
  font-size: 1.02rem;
}

.about-pill p {
  margin: 0.22rem 0 0;
  font-size: 0.97rem;
  color: var(--muted);
}

body.dark .about-pill {
  background: #20293a;
  border-color: #313d54;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  margin-top: 0.75rem;
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.95rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--primary);
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-answer {
  border-top: 1px solid var(--border);
  padding: 0.9rem 1rem 1rem;
}

.faq-answer p,
.faq-answer li {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
}

.faq-answer p {
  margin: 0.3rem 0;
}

.faq-answer ul {
  margin: 0.35rem 0 0.45rem 1.1rem;
  padding: 0;
}

body.dark .faq-item {
  background: #20293a;
  border-color: #313d54;
}

/* --- Calculator tool (iOS-inspired; adapts to light/dark) --- */
body[data-tool="calculator"] #toolProgress {
  display: none;
}

.calc-tool {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 1rem;
}

.calc-skin {
  --calc-frame: #c4c4c6;
  --calc-bg: #1c1c1e;
  --calc-display-bg: #000;
  --calc-display-text: #f5f5f7;
  --calc-grid-line: #000;
  --calc-num-bg: #636366;
  --calc-num-color: #fff;
  --calc-fn-bg: #6c6c70;
  --calc-fn-color: #fff;
  --calc-op-bg: #ff9f0a;
  --calc-op-color: #fff;
  --calc-op-active: #cc7f08;
  --calc-hint-bg: color-mix(in srgb, var(--panel) 88%, var(--primary) 12%);
  --calc-sci-bg: #5a5a5e;
  width: min(100%, 320px);
  border-radius: 16px;
  border: 1px solid var(--calc-frame);
  background: var(--calc-bg);
  padding: 0.5rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.calc-skin--scientific {
  width: min(100%, 320px);
  transition: width 0.22s ease, box-shadow 0.22s ease;
}

.calc-skin--scientific.calc-skin--advanced-open {
  width: min(100%, 440px);
}

.calc-advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0 0 0.4rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--calc-grid-line);
  border-radius: 10px;
  background: var(--calc-fn-bg);
  color: var(--calc-fn-color);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.12s ease, background-color 0.12s ease;
}

.calc-advanced-toggle:hover {
  filter: brightness(1.05);
}

.calc-advanced-toggle:active {
  filter: brightness(0.95);
}

.calc-advanced-chevron {
  font-size: 0.65rem;
  opacity: 0.9;
}

.calc-advanced-panel {
  margin-bottom: 0.35rem;
}

.calc-advanced-panel[hidden] {
  display: none !important;
}

body:not(.dark) .calc-skin {
  --calc-sci-bg: #d1d5db;
  --calc-frame: #d1d5db;
  --calc-bg: #e5e7eb;
  --calc-display-bg: #f9fafb;
  --calc-display-text: #111827;
  --calc-grid-line: #d1d5db;
  --calc-num-bg: #fff;
  --calc-num-color: #111827;
  --calc-fn-bg: #e5e7eb;
  --calc-fn-color: #111827;
  --calc-op-bg: #ff9f0a;
  --calc-op-color: #fff;
  --calc-op-active: #e8890b;
  --calc-hint-bg: #fff;
}

.calc-top-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.calc-gear {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--calc-fn-color);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  flex-shrink: 0;
}

.calc-mem-indicator {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 1rem;
  letter-spacing: 0.04em;
}

.calc-angle-row {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.calc-mode-btn {
  margin: 0;
  border: 1px solid var(--calc-grid-line);
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: var(--calc-fn-bg);
  color: var(--calc-fn-color);
  opacity: 0.75;
}

.calc-mode-btn.is-active {
  opacity: 1;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 55%, transparent);
}

.calc-gear:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--calc-fn-bg) 40%, transparent);
}

.calc-hint-panel {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  background: var(--calc-hint-bg);
  border: 1px solid var(--border);
}

.calc-hint-text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.calc-hint-text kbd {
  display: inline-block;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
}

.calc-hint-text code {
  font-size: 0.78rem;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 85%, var(--primary) 15%);
}

.calc-memory-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin-bottom: 0.35rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--calc-grid-line);
  background: var(--calc-grid-line);
}

.calc-btn--mem {
  min-height: 2rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--calc-fn-bg);
  color: var(--calc-fn-color);
}

.calc-grid--sci {
  grid-template-columns: repeat(8, 1fr);
  margin-bottom: 0.35rem;
  border-radius: 10px;
}

.calc-btn--sci {
  min-height: 2.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--calc-sci-bg);
  color: var(--calc-fn-color);
  padding: 0.15rem 0.1rem;
  line-height: 1.15;
}

body:not(.dark) .calc-btn--sci {
  color: var(--calc-num-color);
}

.calc-grid--main {
  border-radius: 12px;
}

.calc-display-wrap {
  border-radius: 12px;
  background: var(--calc-display-bg);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  min-height: 3.4rem;
  max-width: 100%;
  overflow-x: auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.calc-display {
  font-size: clamp(1.85rem, 8vw, 2.45rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--calc-display-text);
  letter-spacing: 0.02em;
  line-height: 1.1;
  word-break: break-all;
  text-align: right;
  width: 100%;
}

.calc-display--expr {
  white-space: nowrap;
  font-size: clamp(1rem, 3.2vw, 1.75rem);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--calc-grid-line);
  border: 1px solid var(--calc-grid-line);
}

.calc-btn {
  margin: 0;
  border: none;
  min-height: 3.35rem;
  font-size: 1.35rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.12s ease, background-color 0.12s ease;
}

.calc-btn:active {
  filter: brightness(0.92);
}

.calc-btn--num {
  background: var(--calc-num-bg);
  color: var(--calc-num-color);
}

.calc-btn--fn {
  background: var(--calc-fn-bg);
  color: var(--calc-fn-color);
  font-size: 1.15rem;
}

.calc-btn--op {
  background: var(--calc-op-bg);
  color: var(--calc-op-color);
}

.calc-btn--op:active {
  background: var(--calc-op-active);
}

.calc-btn--zero {
  grid-column: span 2;
}

@media (max-width: 480px) {
  .calc-btn {
    min-height: 3rem;
    font-size: 1.2rem;
  }
}

