:root {
  --bg: #f6f1e7;
  --surface: rgba(255, 251, 245, 0.88);
  --surface-strong: #fffaf1;
  --panel: #fbf5ea;
  --text: #1f1c17;
  --muted: #6a6055;
  --line: rgba(31, 28, 23, 0.12);
  --accent: #cb5b2f;
  --success: #1f7a55;
  --danger: #b2332e;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --shadow: 0 20px 40px rgba(66, 38, 16, 0.12);
  --max: 1080px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(203, 91, 47, 0.16), transparent 28%),
    linear-gradient(180deg, #fcf8f1 0%, var(--bg) 48%, #f2eadf 100%);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  padding: 14px 16px;
  color: var(--text);
}
textarea { min-height: 220px; resize: vertical; }

.tool-shell { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; padding: 22px 0 48px; }
.tool-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.brand-home { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; }
.brand-home span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--accent), #e5a042); }
.brand-home img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}
.back-link { color: var(--muted); }

.tool-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; padding: 30px; border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255,255,255,0.72), rgba(250,235,214,0.96)); box-shadow: var(--shadow); margin-bottom: 20px;
}
.tool-hero h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 4.1rem); line-height: 0.95; letter-spacing: -0.05em; }
.tool-hero p { margin: 16px 0 0; max-width: 42rem; line-height: 1.7; color: var(--muted); }
.meta-card { padding: 18px; border-radius: 20px; background: rgba(255, 252, 245, 0.74); border: 1px solid rgba(255, 255, 255, 0.7); }
.meta-card span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.85rem; }
.meta-card strong { display: block; font-size: 1.15rem; }

.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); gap: 18px; }
.panel {
  padding: 22px; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.74); box-shadow: 0 14px 30px rgba(68, 46, 19, 0.08);
}
.panel h2, .panel h3 { margin: 0 0 14px; font-size: 1.05rem; }
.stack { display: grid; gap: 14px; }
.inline-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}
.button:hover, .button:focus-visible { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--text); }
.button-secondary { background: transparent; border-color: var(--line); }
.button-accent { color: #fff; background: var(--accent); }

.status { min-height: 24px; font-size: 0.92rem; color: var(--muted); }
.status.is-success { color: var(--success); }
.status.is-error { color: var(--danger); }

.output-box {
  min-height: 220px; padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid rgba(31, 28, 23, 0.08);
  overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: "IBM Plex Mono", monospace; font-size: 0.94rem; line-height: 1.6;
}
.mono, code, pre { font-family: "IBM Plex Mono", monospace; }
.mini-note, .help-list li { color: var(--muted); line-height: 1.6; }
.help-list { margin: 0; padding-left: 18px; }
.stat-grid, .inline-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-card { padding: 14px; border-radius: 16px; background: var(--surface-strong); }
.stat-card span { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; }
.stat-card strong { font-size: 1.3rem; }
.swatch { width: 100%; height: 110px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(135deg, #ffffff, #f0e5d1); }
.canvas-wrap { display: grid; place-items: center; min-height: 260px; border-radius: 18px; background: var(--panel); border: 1px solid rgba(31, 28, 23, 0.08); }
.canvas-wrap canvas { max-width: 100%; height: auto; border-radius: 8px; background: #fff; }
.match-list { margin: 0; padding-left: 18px; }
.diff-list { display: grid; gap: 12px; }
.diff-item {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid rgba(31, 28, 23, 0.08);
}
.diff-item strong { display: block; margin-bottom: 8px; }
.diff-item code { display: block; white-space: pre-wrap; line-height: 1.5; }
.seo-section {
  margin-top: 20px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 245, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 30px rgba(68, 46, 19, 0.08);
}
.seo-section h2 { margin: 0 0 14px; font-size: 1.5rem; }
.seo-section h3 { margin: 22px 0 10px; font-size: 1.08rem; }
.seo-section p,
.seo-section li {
  color: var(--muted);
  line-height: 1.8;
}
.faq-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.faq-item {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-strong);
}
.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.related-links a {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}
label span, fieldset legend { display: block; margin-bottom: 8px; font-weight: 700; }
fieldset { margin: 0; padding: 0; border: 0; }
.option-row { display: flex; flex-wrap: wrap; gap: 12px; }
.option-row label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--muted); }
.option-row input[type="checkbox"] { width: 16px; height: 16px; padding: 0; }

@media (max-width: 900px) {
  .tool-hero, .tool-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .tool-shell { width: min(calc(100% - 20px), var(--max)); }
  .tool-topbar { flex-direction: column; align-items: flex-start; }
  .tool-hero { padding: 22px; }
  .inline-grid, .stat-grid, .inline-stats { grid-template-columns: 1fr; }
  .actions .button { width: 100%; }
}
