/* ============ Design tokens ============ */
:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --primary-light: #ff6b7a;
  --accent: #f4a261;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #14151f;
  --text-secondary: #52596a;
  --text-muted: #9099a8;
  --accent-solid: #e63946; /* signature crimson primary */
  --accent-text: #e63946; /* text-color accent, light mode */
  --accent-bg: rgba(230, 57, 70, 0.07);
  --accent-border: rgba(230, 57, 70, 0.18);
  --accent-rgb: 230, 57, 70;
  --success: #15803d;
  --focus-ring: #e63946;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.1);
  --shadow-red: 0 16px 48px rgba(230, 57, 70, 0.18);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --header-h: 64px;
  --font-heading: "Sora", sans-serif;
  --font-body:
    "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font: var(--font-body);
}
[data-theme="dark"] {
  --bg: #0c0e13;
  --bg-subtle: #10131b;
  --surface: #13161f;
  --surface-2: #1a1e2b;
  --border: #1e2232;
  --text: #edf0f8;
  --text-secondary: #8c95a8;
  --text-muted: #525c6e;
  --accent-solid: #e63946;
  --accent-text: #ff6b7a;
  --accent-bg: rgba(230, 57, 70, 0.12);
  --accent-border: rgba(230, 57, 70, 0.25);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-red: 0 16px 48px rgba(230, 57, 70, 0.25);
}

/* ============ Reset & base ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}
p {
  margin: 0 0 1em;
}
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--accent-solid);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 12px;
}
:focus-visible {
  outline: 2.5px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}
.logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo-text span,
.logo > span span {
  color: var(--accent-text);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}
.icon-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent-text);
  transform: scale(1.05);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}
.recovery-btn {
  position: relative;
}
.recovery-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-solid);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent-solid);
  animation: recoveryPulse 2s infinite ease-in-out;
}
@keyframes recoveryPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 380px;
}
.toast.toast-info {
  border-left: 4px solid var(--accent-solid);
}
.toast.toast-error {
  border-left: 4px solid #ef4444;
}
.toast.toast-success {
  border-left: 4px solid #10b981;
}
.toast.toast-clickable {
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}
.toast.toast-clickable:hover {
  transform: translateY(-2px);
  border-color: var(--accent-solid);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-border);
}
.toast-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-solid);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
  transition:
    opacity 0.15s ease,
    transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(230, 57, 70, 0.25);
}
.toast-btn:hover {
  opacity: 0.95;
  transform: scale(1.04);
}
.toast-leaving {
  animation: toastFadeOut 0.25s forwards;
}
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toastFadeOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}
.theme-toggle .sun {
  display: none;
}
[data-theme="dark"] .theme-toggle .sun {
  display: block;
}
[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

/* Hamburger + drawer nav */
.hamburger {
  position: relative;
}
.hamburger .bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}
.hamburger .bars span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}
.hamburger[aria-expanded="true"] .bars span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .bars span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] .bars span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 19, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 150;
}
.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 151;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}
.nav-drawer.is-open {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.drawer-head span {
  font-weight: 800;
  font-size: 1.05rem;
}
.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}
.drawer-nav a {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text-secondary);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.drawer-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}
.drawer-home {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--accent-text);
  padding: 13px 14px;
  border-radius: var(--radius-sm);
}
.drawer-home:hover {
  background: var(--accent-bg);
}

/* ============ Breadcrumb ============ */
.breadcrumb {
  padding: 14px 0;
  font-size: 0.87rem;
  color: var(--text-muted);
}
.breadcrumb a {
  color: var(--text-muted);
}
.breadcrumb a:hover {
  color: var(--accent-text);
}
.breadcrumb .sep {
  margin: 0 6px;
}
.breadcrumb .current {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============ Hero ============ */
.hero {
  padding: 28px 0 40px;
  text-align: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-bg);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 18ch;
  margin: 0 auto 0.5em;
}
.hero h1 em {
  color: var(--accent-text);
  font-style: normal;
}
.hero p.lead {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 56ch;
  margin: 0 auto 22px;
}
.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}
.hero-features span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hero-features svg {
  width: 15px;
  height: 15px;
  color: var(--success);
  flex-shrink: 0;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.96rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    opacity 0.15s ease;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--accent-solid);
  color: #fff;
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.3);
}
.btn-primary:hover {
  background: var(--primary-dark, #c1121f);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(230, 57, 70, 0.4);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--accent-solid);
  color: var(--accent-text);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn-sm {
  padding: 9px 16px;
  font-size: 0.85rem;
}
.btn-block {
  width: 100%;
}

/* ============ Sections (generic) ============ */
section {
  padding: 64px 0;
}
.section-alt {
  background: var(--bg-subtle);
}
.eyebrow {
  color: var(--accent-text);
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: block;
}
.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}
.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
}
.section-head p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  margin: 0;
}

/* ============ Tool card ============ */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(16px, 4vw, 32px);
}
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: clamp(28px, 6vw, 48px) 20px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent-solid);
  background: var(--accent-bg);
}
.dropzone svg {
  width: 38px;
  height: 38px;
  color: var(--text-muted);
  margin: 0 auto 14px;
}
.dropzone h3 {
  font-size: 1.08rem;
  margin-bottom: 4px;
}
.dropzone p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.dropzone .hint {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.file-row .f-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-row .f-icon svg {
  width: 18px;
  height: 18px;
}
.file-row .f-info {
  flex: 1;
  min-width: 0;
}
.file-row .f-name {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row .f-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.file-row .f-remove {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.file-row .f-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
[data-theme="dark"] .file-row .f-remove:hover {
  background: rgba(230, 57, 70, 0.18);
  color: #ff6b7a;
  border-color: rgba(230, 57, 70, 0.35);
}
.file-row .f-status {
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.add-more-row {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

/* Segmented tabs */
.seg-tabs {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 2px;
  width: 100%;
}
.seg-tabs button {
  flex: 1;
  padding: 10px 14px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.88rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.seg-tabs button svg {
  width: 16px;
  height: 16px;
}
.seg-tabs button.is-active {
  background: var(--accent-solid);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* Form controls */
.control-group {
  margin-top: 20px;
}
.control-group > label,
.control-label {
  display: block;
  font-weight: 700;
  font-size: 0.86rem;
  margin-bottom: 8px;
  color: var(--text);
}
.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}
input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent-solid);
}
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.chip:hover {
  border-color: var(--accent-solid);
  color: var(--accent-text);
}
.chip.is-active {
  background: var(--accent-solid);
  color: #fff;
  border-color: var(--accent-solid);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--accent-solid);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent-solid);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--accent-solid);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent-solid);
  cursor: pointer;
}
.slider-val {
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text-secondary);
}
input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-row input[type="text"] {
  flex: 1;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 180px;
}
.pos-grid button {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.pos-grid button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.pos-grid button.is-active {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
}
.pos-grid button.is-active::before {
  background: #fff;
}
.pos-with-tile {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
}
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background-color 0.15s ease;
  cursor: pointer;
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .track {
  background: var(--accent-solid);
}
.switch input:checked + .track::before {
  transform: translateX(18px);
}
.switch input:focus-visible + .track {
  outline: 2.5px solid var(--focus-ring);
  outline-offset: 2px;
}
.toggle-label {
  font-weight: 700;
  font-size: 0.88rem;
}
.toggle-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.layer-note {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 10px;
}
.layer-note svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-muted);
}

/* 2D Page-Ratio Spatial Position Pad */
.pos-pad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 200px;
}
.pos-pad {
  position: relative;
  width: 100%;
  max-width: 220px;
  height: 150px;
  aspect-ratio: 0.707;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.pos-pad:hover,
.pos-pad.is-dragging {
  border-color: var(--accent-solid);
  box-shadow: var(--shadow-md);
}
.pos-pad-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      to right,
      color-mix(in srgb, var(--border) 70%, transparent) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--border) 70%, transparent) 1px,
      transparent 1px
    );
  background-size: 50% 50%;
  opacity: 0.5;
}
.pos-pad-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pos-pad-crosshair::before,
.pos-pad-crosshair::after {
  content: "";
  position: absolute;
  background: color-mix(in srgb, var(--accent-solid) 40%, transparent);
}
.pos-pad-crosshair::before {
  top: 0;
  bottom: 0;
  left: var(--cross-x, 50%);
  width: 1px;
}
.pos-pad-crosshair::after {
  left: 0;
  right: 0;
  top: var(--cross-y, 50%);
  height: 1px;
}
.pos-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-solid);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  cursor: grab;
  transition:
    transform 0.05s ease,
    box-shadow 0.15s ease;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-handle::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
}
[data-theme="dark"] .pos-handle {
  border-color: #13161f;
}
.pos-handle:active,
.pos-handle.is-grabbing {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.pos-readout {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  gap: 14px;
}

/* Live preview */
.preview-wrap {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.preview-stage {
  position: relative;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.preview-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.preview-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.preview-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 40px 20px;
  text-align: center;
}
.preview-placeholder svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 16px 0;
  min-height: 20px;
}
.status-line svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.status-line.is-error {
  color: #b91c1c;
}
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-solid);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 16px;
}
.progress-bar > div {
  height: 100%;
  background: var(--accent-solid);
  border-radius: 999px;
  transition: width 0.2s ease;
  width: 0%;
}

.result-panel {
  text-align: center;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  margin-top: 18px;
}
.result-panel svg {
  width: 34px;
  height: 34px;
  color: var(--success);
  margin: 0 auto 10px;
}
.result-panel h3 {
  margin-bottom: 4px;
  font-size: 1.1rem;
}
.result-panel p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.warning-note {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.82rem;
  margin: 12px 0;
}
[data-theme="dark"] .warning-note {
  background: rgba(244, 162, 97, 0.1);
  border-color: rgba(244, 162, 97, 0.25);
  color: #f4a261;
}
.warning-note svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============ What-is-it / diagram ============ */
.wii-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 44px;
  align-items: center;
}
.wii-copy p {
  color: var(--text-secondary);
}
.wii-copy strong {
  color: var(--text);
}
.wii-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}
.wm-demo-page {
  width: 180px;
  height: 230px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}
.wm-demo-page .line {
  height: 7px;
  border-radius: 4px;
  background: var(--border);
}
.wm-demo-page .line:nth-child(1) {
  width: 70%;
}
.wm-demo-page .line:nth-child(2) {
  width: 90%;
}
.wm-demo-page .line:nth-child(3) {
  width: 55%;
}
.wm-demo-page .stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--accent-solid);
  opacity: 0.3;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* ============ Feature / benefit grids ============ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.feature-card .f-icon-lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.feature-card .f-icon-lg svg {
  width: 22px;
  height: 22px;
}
.feature-card h3 {
  font-size: 1.03rem;
  margin-bottom: 6px;
}
.feature-card p {
  color: var(--text-secondary);
  font-size: 0.89rem;
  margin: 0;
}

/* ============ How to use ============ */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  counter-reset: step;
}
.step {
  position: relative;
  padding-top: 8px;
}
.step .step-num {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-solid);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 1rem;
}
.step h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}
.step p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 28px;
}
.benefit-item {
  display: flex;
  gap: 14px;
}
.benefit-item .b-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent-bg);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.benefit-item .b-icon svg {
  width: 19px;
  height: 19px;
}
.benefit-item h4 {
  font-size: 0.96rem;
  margin-bottom: 4px;
}
.benefit-item p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ============ FAQ ============ */
.faq-list {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.faq-item summary {
  padding: 17px 20px;
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.faq-item summary .chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}
.faq-item[open] summary .chevron {
  transform: rotate(180deg);
}
.faq-item .faq-a {
  padding: 0 20px 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============ Related tools ============ */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}
.related-card:hover {
  border-color: var(--accent-solid);
  transform: translateY(-2px);
}
.related-card h3 {
  font-size: 0.98rem;
  margin-bottom: 6px;
}
.related-card p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  flex: 1;
  margin-bottom: 14px;
}
.related-card .use-link {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ============ Contact ============ */
.contact-box {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}
.contact-box p {
  color: var(--text-secondary);
}

/* ============ Footer ============ */
footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
.footer-brand .logo {
  margin-bottom: 12px;
}
.footer-brand p {
  color: var(--text-muted);
  font-size: 0.87rem;
  max-width: 32ch;
}
.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-col a:hover {
  color: var(--accent-text);
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.83rem;
}
.footer-bottom .legal-links {
  display: flex;
  gap: 18px;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .preview-wrap {
    position: static;
  }
  .wii-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .wii-visual {
    order: -1;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .steps-grid {
    grid-template-columns: 1fr 1fr;
  }
  .benefit-grid {
    grid-template-columns: 1fr 1fr;
  }
  .related-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  section {
    padding: 44px 0;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .steps-grid {
    grid-template-columns: 1fr;
  }
  .benefit-grid {
    grid-template-columns: 1fr;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .control-row {
    grid-template-columns: 1fr;
  }
  .hero-features {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .pos-with-tile {
    flex-direction: column;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
