/* ==========================================================================
   Tool pages — hero, workspace, results, features, FAQ
   ========================================================================== */

.tool-hero { padding-bottom: clamp(32px, 5vw, 48px); }

.tool-hero-icon {
  --a1: #4f8cff;
  --a2: #8b5cf6;
  display: grid;
  place-items: center;
  width: 72px; height: 72px;
  margin: 0.5rem auto 0;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.45), transparent 45%),
    linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 18px 50px -12px color-mix(in srgb, var(--a2) 85%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.tool-hero-icon svg { width: 34px; height: 34px; }

.tool-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
}
.tool-hero-meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.85rem;
}
.tool-hero-meta .icon { width: 15px; height: 15px; color: var(--lilac); }

/* Workspace ---------------------------------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 50px 100px -50px rgba(0, 0, 0, 0.9), 0 -10px 80px -40px rgba(124, 92, 255, 0.45);
}
@media (max-width: 960px) { .workspace { grid-template-columns: 1fr; } }

.ws-pane { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; padding: clamp(20px, 3vw, 36px); }
.ws-output { border-left: 1px solid var(--border); background: var(--ws-output-bg); }
@media (max-width: 960px) { .ws-output { border-left: 0; border-top: 1px solid var(--border); } }

.ws-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.ws-title { display: flex; align-items: center; gap: 0.6rem; font-size: 1.1rem; letter-spacing: -0.02em; }
.ws-step {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--grad-soft);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: var(--lilac);
  font: 700 0.78rem/1 var(--font-body);
}
.ws-head-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.ws-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin-top: -0.6rem; color: var(--muted); font-size: 0.8rem; }

.ws-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ws-fields .span-2 { grid-column: 1 / -1; }
@media (max-width: 520px) { .ws-fields { grid-template-columns: 1fr; } }

/* Segmented control (radio group) */
.segmented { margin: 0; padding: 0; border: 0; min-width: 0; }
.segmented legend { margin-bottom: 0.5rem; padding: 0; color: var(--text); font-size: 0.88rem; font-weight: 600; }
.segmented-options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.segmented label:hover { color: var(--text); border-color: rgba(var(--ink), 0.24); }
.segmented input:checked + label { color: var(--on-soft); background: var(--grad-soft); border-color: rgba(139, 92, 246, 0.6); }
.segmented input:focus-visible + label { outline: 2px solid var(--lilac); outline-offset: 2px; }

.ws-submit { align-self: stretch; }
.form-error {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.08);
  color: var(--danger-text);
  font-size: 0.88rem;
}

/* Output ------------------------------------------------------------------- */
.output-empty {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  min-height: 300px;
  padding: 2rem;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.output-empty .empty-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--lilac);
}
.output-empty .empty-icon svg { width: 26px; height: 26px; }
.output-empty p { margin: 0; max-width: 280px; }

.output-body { display: flex; flex-direction: column; gap: 1rem; animation: fade-up 0.5s var(--ease); }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.result-card {
  position: relative;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.result-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.result-label { color: var(--lilac); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.result-text { color: var(--text); font-size: 0.97rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-text.mono { font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.65; }
.result-list { margin: 0; padding: 0; list-style: none; }
.result-list li { position: relative; padding-left: 1.3rem; margin-bottom: 0.7rem; color: var(--text); line-height: 1.65; }
.result-list li:last-child { margin-bottom: 0; }
.result-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.6em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
}
.result-list.numbered { counter-reset: n; }
.result-list.numbered li { padding-left: 2rem; }
.result-list.numbered li::before {
  counter-increment: n;
  content: counter(n);
  top: 0.1em;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  box-shadow: none;
  color: var(--lilac);
  font-size: 0.72rem;
  font-weight: 700;
}
.result-foot { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.7rem; color: var(--muted); font-size: 0.78rem; }
.result-foot .warn { color: var(--danger-text); }

.tldr {
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.12), rgba(139, 92, 246, 0.12));
  color: var(--text);
}
.tldr strong { color: var(--lilac); }

.keyword-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.keyword-chips span {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem;
}

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.stat {
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
.stat strong { display: block; font: 700 1.3rem/1.2 var(--font-display); letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 0.75rem; }

.output-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.output-actions[hidden] { display: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.icon-btn:hover { color: var(--on-soft); border-color: rgba(139, 92, 246, 0.55); background: rgba(139, 92, 246, 0.15); }
.icon-btn .icon { width: 15px; height: 15px; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  translate: -50% 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), translate 0.25s var(--ease);
}
.toast.is-visible { opacity: 1; translate: -50% 0; }
.toast .icon { color: var(--success); }

/* Details ------------------------------------------------------------------ */
.tool-details-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
@media (max-width: 900px) { .tool-details-grid { grid-template-columns: 1fr; } }
.tool-details-grid h2 { margin-bottom: 1.1rem; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.tool-about p { color: var(--text-2); font-size: 1.02rem; line-height: 1.75; }

.features-card { padding: clamp(22px, 3vw, 32px); border-radius: var(--radius-lg); }
.features-card h2 { font-size: 1.3rem; }
.feature-list { margin: 0; padding: 0; list-style: none; }
.feature-list li { display: flex; gap: 0.7rem; padding: 0.65rem 0; border-top: 1px solid var(--border); color: var(--text-2); font-size: 0.95rem; }
.feature-list li:first-child { border-top: 0; padding-top: 0; }
.feature-list .icon { width: 18px; height: 18px; margin-top: 0.2rem; color: var(--success); }

.narrow { max-width: 820px; }
.faq-title { margin-bottom: 1.5rem; font-size: clamp(1.6rem, 3vw, 2.2rem); text-align: center; }
.faq { display: flex; flex-direction: column; gap: 0.75rem; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s, background-color 0.2s;
}
.faq-item[open] { border-color: rgba(139, 92, 246, 0.4); background: var(--surface-2); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { font: 600 1.02rem/1.4 var(--font-body); letter-spacing: 0; }
.faq-icon { position: relative; width: 14px; height: 14px; flex: none; }
.faq-icon::before, .faq-icon::after {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 14px; height: 2px;
  border-radius: 2px;
  background: var(--lilac);
  transition: transform 0.3s var(--ease);
}
.faq-icon::after { transform: rotate(90deg); }
.faq-item[open] .faq-icon::after { transform: rotate(0deg); }
.faq-answer { padding: 0 1.3rem 1.2rem; color: var(--text-2); }
.faq-answer p { margin: 0; }

.section-tight { padding: clamp(56px, 8vw, 96px) 0; }

/* Tool-specific tokens ------------------------------------------------------ */
:root {
  --warn: #f59e0b;
  --warn-text: #fcd34d;
  --serp-link: #99c3ff;
  --serp-text: #bdc1c6;
}
:root[data-theme="light"] {
  --warn: #d97706;
  --warn-text: #b45309;
  --serp-link: #1a0dab;
  --serp-text: #4d5156;
}

.link-btn:disabled { opacity: 0.4; cursor: not-allowed; background: none; color: var(--text-2); }
.link-btn .icon { width: 15px; height: 15px; }

/* Action button groups (Case Converter) ------------------------------------ */
.action-group { display: flex; flex-direction: column; gap: 0.5rem; }
.action-label { margin: 0; color: var(--text); font-size: 0.88rem; font-weight: 600; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip-btn {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.chip-btn:hover { color: var(--on-soft); border-color: rgba(139, 92, 246, 0.55); background: rgba(139, 92, 246, 0.15); }
.chip-btn:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }

.stats-row.stats-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { .stats-row.stats-4 { grid-template-columns: repeat(2, 1fr); } }
.stat strong { overflow-wrap: anywhere; }

.result-card-head:has([data-history-actions]) { flex-wrap: wrap; }
.history-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 340px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.history-item { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.history-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.history-actions { display: flex; flex: none; gap: 0.25rem; }
.icon-btn.icon-only { padding: 0.4rem; }
.history-empty { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* Meter + checks (Meta Checker) -------------------------------------------- */
.meter { height: 8px; margin-top: 0.15rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--muted); transition: width 0.25s var(--ease), background-color 0.25s; }
.meter.is-good span { background: var(--success); }
.meter.is-warn span { background: var(--warn); }
.meter.is-bad span { background: var(--danger); }
.meter-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.75rem; color: var(--muted); font-size: 0.8rem; }
.meter-meta .is-good { color: var(--success); }
.meter-meta .is-warn { color: var(--warn-text); }
.meter-meta .is-bad { color: var(--danger-text); }

.serp {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: Arial, Helvetica, sans-serif;
}
.serp-site { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.4rem; min-width: 0; }
.serp-favicon {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px; font-weight: 700;
}
.serp-site-text { min-width: 0; }
.serp-name { display: block; color: var(--text); font-size: 14px; line-height: 20px; }
.serp-url { display: block; color: var(--serp-text); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
.serp-title { margin: 0 0 0.2rem; color: var(--serp-link); font: 400 20px/26px Arial, Helvetica, sans-serif; letter-spacing: 0; overflow-wrap: anywhere; }
.serp-desc { margin: 0; color: var(--serp-text); font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }
.serp-desc strong { font-weight: 700; }
.serp .is-placeholder { font-style: italic; opacity: 0.6; }

.check-list { display: flex; flex-direction: column; gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.check-item { display: flex; align-items: flex-start; gap: 0.65rem; color: var(--text-2); font-size: 0.92rem; line-height: 1.5; }
.check-item strong { color: var(--text); font-weight: 600; }
.check-dot { display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin-top: 0.05rem; border-radius: 7px; }
.check-dot .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.check-item.is-good .check-dot { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.check-item.is-warn .check-dot { background: rgba(245, 158, 11, 0.16); color: var(--warn-text); }
.check-item.is-bad .check-dot { background: rgba(251, 113, 133, 0.15); color: var(--danger); }
.score-pill { padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 0.78rem; font-weight: 600; }

/* Shared: drop zone, output tabs, code output (Image Compressor, Color Palette, Markdown, JSON, OG Checker) */
.tool-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 2rem 1.5rem;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background-color 0.25s, transform 0.35s var(--ease), min-height 0.3s var(--ease), padding 0.3s var(--ease);
}
.tool-dropzone:hover, .tool-dropzone.drag { border-color: rgba(139, 92, 246, 0.7); background: var(--surface-2); }
.tool-dropzone.drag { transform: scale(1.01); }
.tool-dropzone:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; }
.tool-dz-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 18px;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--glow);
  transition: transform 0.35s var(--ease);
}
.tool-dz-icon .icon { width: 24px; height: 24px; }
.tool-dropzone:hover .tool-dz-icon { transform: translateY(-3px); }
.tool-dz-title { margin: 0.9rem 0 0.3rem; color: var(--text); font: 600 1.2rem/1.2 var(--font-display); letter-spacing: -0.01em; }
.tool-dz-sub { margin: 0; color: var(--text-2); font-size: 0.9rem; }
.tool-dz-link { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.tool-dz-formats { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.04em; }
.has-files .tool-dropzone, .has-image .tool-dropzone { min-height: 0; padding: 1rem; }
.has-files .tool-dz-icon, .has-image .tool-dz-icon { width: 40px; height: 40px; border-radius: 13px; }
.has-files .tool-dz-icon .icon, .has-image .tool-dz-icon .icon { width: 18px; height: 18px; }
.has-files .tool-dz-title, .has-image .tool-dz-title { margin-top: 0.5rem; font-size: 1rem; }
.has-files .tool-dz-formats, .has-image .tool-dz-formats { display: none; }

.tool-tabs { display: inline-flex; gap: 0.25rem; padding: 0.25rem; border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface); }
.tool-tabs [role="tab"] {
  padding: 0.35rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: 600 0.82rem/1.2 var(--font-body);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.tool-tabs [role="tab"]:hover { color: var(--text); }
.tool-tabs [role="tab"][aria-selected="true"] { color: var(--on-soft); background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.55); }
.tool-tabs [role="tab"]:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }

.code-out {
  max-height: 520px;
  margin: 0;
  padding: 1rem 1.1rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font: 0.84rem/1.65 var(--font-mono);
  white-space: pre;
  tab-size: 2;
}
.code-out + .ws-meta, .code-out ~ .ws-meta { margin-top: 0.6rem; }
.code-out:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }
.chip-btn[aria-pressed="true"] { color: var(--on-soft); background: var(--grad-soft); border-color: rgba(139, 92, 246, 0.6); }
.textarea.drag { border-color: rgba(139, 92, 246, 0.8); background: var(--surface-2); }
