/* ==========================================================================
   Tools — Styles for free SEO tool pages (hub + 6 individual tool pages)
   Loaded by pages that do NOT load pages.css or blog.css.
   ========================================================================== */

/* ==========================================================================
   Section 1: Breadcrumbs
   Duplicated from pages.css because tool pages don't load pages.css.
   ========================================================================== */

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  margin-bottom: var(--space-lg);
}

.breadcrumbs a {
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.breadcrumbs .breadcrumb-separator {
  color: var(--color-text-tertiary);
}

.breadcrumbs .breadcrumb-separator::after {
  content: '›';
}

.breadcrumbs .breadcrumb-current {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   Section 2: Tool Page Header
   Title, description, emoji/icon styling for individual tool pages.
   ========================================================================== */

.tool-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.tool-header-icon {
  font-size: var(--text-display-large);
  line-height: 1;
  margin-bottom: var(--space-md);
  display: block;
}

.tool-header h1 {
  font-size: var(--text-heading-large);
  line-height: var(--text-heading-large-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-sm);
}

.tool-header p {
  font-size: var(--text-body-large);
  line-height: var(--text-body-large-lh);
  color: var(--color-text-secondary);
  margin: 0;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   Section 3: Form Inputs
   Duplicated from pages.css contact form patterns (dark bg, purple focus ring).
   ========================================================================== */

.tool-input,
.tool-select,
.tool-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius-sm);
  font-family: inherit;
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-input::placeholder,
.tool-textarea::placeholder {
  color: var(--color-text-tertiary);
}

.tool-input:focus,
.tool-select:focus,
.tool-textarea:focus {
  outline: none;
  border-color: var(--color-purple);
  box-shadow: 0 0 0 3px var(--color-purple-dim);
}

.tool-textarea {
  min-height: 120px;
  resize: vertical;
}

.tool-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999999' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: var(--space-xl);
  cursor: pointer;
}

.tool-label {
  display: block;
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.tool-label-hint {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-regular);
  margin-left: var(--space-xs);
}

.tool-form-group {
  margin-bottom: var(--space-lg);
}

/* ==========================================================================
   Section 4: Tool UI Containers
   Wrapper, control area, and result area for tool interactive sections.
   ========================================================================== */

.tool-ui {
  max-width: 800px;
  margin: 0 auto;
}

.tool-controls {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.tool-controls-header {
  font-size: var(--text-heading-medium);
  line-height: var(--text-heading-medium-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-lg);
}

.tool-results {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius);
  padding: var(--space-lg);
}

.tool-results-header {
  font-size: var(--text-heading-medium);
  line-height: var(--text-heading-medium-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-results-placeholder {
  text-align: center;
  padding: var(--space-xxl) var(--space-lg);
  color: var(--color-text-tertiary);
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
}

/* ==========================================================================
   Section 5: Result Displays
   Styled output cards and code-block style output.
   ========================================================================== */

.tool-result-card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.tool-result-card:last-child {
  margin-bottom: 0;
}

.tool-result-card-title {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-purple);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-xs);
}

.tool-result-card-value {
  font-size: var(--text-heading-medium);
  line-height: var(--text-heading-medium-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
}

.tool-result-card-desc {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-text-tertiary);
  margin: var(--space-xxs) 0 0;
}

.tool-result-code {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius-sm);
  padding: var(--space-md) var(--space-lg);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: var(--text-body-small);
  line-height: var(--text-body-large-lh);
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}

.tool-result-code .copy-hint {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-sm);
  font-size: var(--text-caption);
  line-height: var(--text-caption-lh);
  color: var(--color-text-tertiary);
  font-family: var(--font-family);
}

/* ==========================================================================
   Section 6: Range Slider
   Custom range input styling with keycap-inspired track and thumb.
   ========================================================================== */

.tool-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--space-xs);
  background: var(--color-border);
  border-radius: var(--space-xxs);
  outline: none;
  cursor: pointer;
}

.tool-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--space-lg);
  height: var(--space-lg);
  background: var(--color-accent);
  border-radius: 50%;
  border: 2px solid var(--color-text-primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.tool-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.tool-range::-moz-range-thumb {
  width: var(--space-lg);
  height: var(--space-lg);
  background: var(--color-accent);
  border-radius: 50%;
  border: 2px solid var(--color-text-primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tool-range::-moz-range-track {
  height: var(--space-xs);
  background: var(--color-border);
  border-radius: var(--space-xxs);
}

.tool-range:focus-visible {
  outline: 2px solid var(--color-purple);
  outline-offset: 4px;
}

.tool-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-caption);
  line-height: var(--text-caption-lh);
  color: var(--color-text-tertiary);
  margin-top: var(--space-xxs);
}

.tool-range-value {
  font-size: var(--text-heading-medium);
  line-height: var(--text-heading-medium-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  text-align: center;
  margin-bottom: var(--space-xs);
}

/* ==========================================================================
   Section 7: Color Chips
   Thumbnail preview color selection styled as small circles.
   ========================================================================== */

.tool-color-chips {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.tool-color-chip {
  width: var(--space-xl);
  height: var(--space-xl);
  border-radius: 50%;
  border: 2px solid var(--color-border);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
  position: relative;
}

.tool-color-chip:hover {
  transform: scale(1.1);
}

.tool-color-chip--selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.tool-color-chip--selected::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-body-small);
  font-weight: var(--font-weight-bold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Color chip backgrounds use inline styles for actual color values.
   The named variants below use design-system token colors only. */
.tool-color-chip--white {
  background: var(--color-text-primary);
}

.tool-color-chip--yellow {
  background: var(--color-gold);
}

.tool-color-chip--red {
  background: var(--color-destructive);
}

.tool-color-chip--cyan {
  background: var(--color-accent);
}

.tool-color-chip--dark {
  background: var(--color-bg);
}

/* ==========================================================================
   Section 8: Preview Canvas
   16:9 aspect ratio preview area for thumbnail tool.
   ========================================================================== */

.tool-preview-canvas {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--corner-radius);
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(
    135deg,
    var(--color-surface) 0%,
    var(--color-surface-elevated) 50%,
    var(--color-surface) 100%
  );
}

.tool-preview-text {
  font-weight: var(--font-weight-bold);
  text-align: center;
  padding: var(--space-md);
  word-break: break-word;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

.tool-preview-canvas--shadow .tool-preview-text {
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   Section 9: Hub Page
   Hero, tool card grid for the tools landing (hub) page.
   ========================================================================== */

.tool-hub-hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.tool-hub-hero h1 {
  font-size: var(--text-heading-large);
  line-height: var(--text-heading-large-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-sm);
}

.tool-hub-hero p {
  font-size: var(--text-body-large);
  line-height: var(--text-body-large-lh);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-xl);
}

.tool-hub-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

.tool-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: border-color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  border-color: var(--color-purple);
  transform: translateY(-2px);
}

.tool-card-icon {
  font-size: var(--text-display-medium);
  line-height: 1;
}

.tool-card h3 {
  font-size: var(--text-heading-medium);
  line-height: var(--text-heading-medium-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.tool-card p {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  color: var(--color-text-secondary);
  margin: 0;
  flex: 1;
}

.tool-card-link {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  font-weight: var(--font-weight-medium);
  color: var(--color-purple);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}

.tool-card-link::after {
  content: '→';
}

/* ==========================================================================
   Section 10: CTA Banner
   Duplicated from pages.css because tool pages don't load pages.css.
   ========================================================================== */

.cta-banner {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-xxxl) 0;
}

.cta-banner-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 var(--screen-padding);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.cta-banner h2 {
  font-size: var(--text-heading-large);
  line-height: var(--text-heading-large-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
}

.cta-banner p {
  font-size: var(--text-body-large);
  line-height: var(--text-body-large-lh);
  color: var(--color-text-secondary);
  max-width: 480px;
  margin: 0;
}

/* ==========================================================================
   Section 11: Benefits Section
   "Why use this tool" grid for each tool page.
   ========================================================================== */

.tool-benefits {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.tool-benefit {
  text-align: center;
  padding: var(--space-lg);
}

.tool-benefit-icon {
  font-size: var(--text-display-medium);
  line-height: 1;
  margin-bottom: var(--space-sm);
  display: block;
}

.tool-benefit h3 {
  font-size: var(--text-heading-medium);
  line-height: var(--text-heading-medium-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-xs);
}

.tool-benefit p {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  color: var(--color-text-secondary);
  margin: 0;
}

/* ==========================================================================
   Section 12: Chip Group (tool page selector rows)
   Horizontal chip layout for tool option selectors.
   ========================================================================== */

.tool-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tool-chip-group--center {
  justify-content: center;
}

/* ==========================================================================
   Section 13: Specs Display
   Platform specs for video size guide tool.
   ========================================================================== */

.tool-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

/* 3-column variant: stacks to 1 on mobile, 3 on tablet+ */
.tool-specs-grid--3col {
  grid-template-columns: 1fr;
}

.tool-spec-item {
  background: var(--color-surface-elevated);
  border-radius: var(--corner-radius-sm);
  padding: var(--space-md);
}

.tool-spec-label {
  font-size: var(--text-caption);
  line-height: var(--text-caption-lh);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-xxs);
}

.tool-spec-value {
  font-size: var(--text-body-large);
  line-height: var(--text-body-large-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
}

.tool-aspect-box {
  aspect-ratio: 9 / 16;
  max-height: 200px;
  border: 2px solid var(--color-purple);
  border-radius: var(--corner-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-lg) auto 0;
  background: var(--color-surface-elevated);
}

.tool-aspect-label {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-purple);
  font-weight: var(--font-weight-semibold);
}

/* ==========================================================================
   Section 14: Hashtag Chips Display
   Flex-wrap hashtag display for the hashtag generator tool.
   ========================================================================== */

.tool-hashtag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tool-hashtag {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--corner-radius-sm);
  padding: var(--space-xxs) var(--space-sm);
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-accent);
  font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   Section 15: Script Timeline
   Card-based timeline layout for the script template tool.
   ========================================================================== */

.tool-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: relative;
}

.tool-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--space-md);
  width: 2px;
  background: var(--color-border);
}

.tool-timeline-item {
  position: relative;
  padding-left: var(--space-xl);
  padding-right: var(--space-md);
}

.tool-timeline-dot {
  position: absolute;
  left: calc(var(--space-md) - 5px);
  top: var(--space-sm);
  width: var(--space-sm);
  height: var(--space-sm);
  border-radius: 50%;
  background: var(--color-purple);
  border: 2px solid var(--color-surface);
}

.tool-timeline-time {
  font-size: var(--text-caption);
  line-height: var(--text-caption-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-purple);
  margin: 0 0 var(--space-xxs);
}

.tool-timeline-title {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-xxs);
}

.tool-timeline-desc {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-text-tertiary);
  margin: 0;
}

/* ==========================================================================
   Section 16: Credit Display
   Credit total, plan badges, cost breakdown for the calculator tool.
   ========================================================================== */

.tool-credit-total {
  text-align: center;
  padding: var(--space-lg);
  background: var(--color-surface-elevated);
  border-radius: var(--corner-radius);
  margin-bottom: var(--space-lg);
}

.tool-credit-total-label {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-xs);
}

.tool-credit-total-value {
  font-size: var(--text-display-large);
  line-height: var(--text-display-large-lh);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  margin: 0;
}

.tool-credit-total-sub {
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  color: var(--color-text-secondary);
  margin: var(--space-xs) 0 0;
}

.tool-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--corner-radius-sm);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-body-small);
  line-height: var(--text-body-small-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
}

.tool-cost-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.tool-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--color-border);
}

.tool-cost-row:last-child {
  border-bottom: none;
}

.tool-cost-label {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  color: var(--color-text-secondary);
}

.tool-cost-value {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* ==========================================================================
   Section 17: Toggle Switch
   Simple CSS toggle for options like text shadow.
   ========================================================================== */

.tool-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.tool-toggle-track {
  width: 44px;
  height: var(--space-lg);
  background: var(--color-border);
  border-radius: var(--space-sm);
  position: relative;
  transition: background 0.2s ease;
}

.tool-toggle--active .tool-toggle-track {
  background: var(--color-accent);
}

.tool-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--color-text-primary);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.tool-toggle--active .tool-toggle-thumb {
  transform: translateX(20px);
}

.tool-toggle-label {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Section 18: Utility Classes
   Shared helpers for tool page layouts.
   ========================================================================== */

.tool-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-lg);
}

.tool-actions--center {
  justify-content: center;
}

.tool-inline-cta {
  text-align: center;
  padding: var(--space-lg);
  background: var(--color-surface-elevated);
  border: 1px dashed var(--color-border);
  border-radius: var(--corner-radius);
  margin-top: var(--space-lg);
}

.tool-inline-cta p {
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-lh);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-md);
}

.tool-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-lg) 0;
  border: none;
}

/* ==========================================================================
   Section 19: Responsive Overrides
   ========================================================================== */

@media (min-width: 768px) {
  /* Tool header */
  .tool-header h1 {
    font-size: var(--text-display-medium);
    line-height: var(--text-display-medium-lh);
  }

  /* Hub hero */
  .tool-hub-hero h1 {
    font-size: var(--text-display-medium);
    line-height: var(--text-display-medium-lh);
  }

  /* Benefits grid: 2 columns on tablet */
  .tool-benefits {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Specs grid: stays 2 columns */
  .tool-specs-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 3-column variant: 3 columns on tablet+ */
  .tool-specs-grid--3col {
    grid-template-columns: repeat(3, 1fr);
  }

  /* CTA banner */
  .cta-banner h2 {
    font-size: var(--text-display-medium);
    line-height: var(--text-display-medium-lh);
  }

  /* Tool UI wider padding */
  .tool-controls,
  .tool-results {
    padding: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  /* Tool header */
  .tool-header h1 {
    font-size: var(--text-display-large);
    line-height: var(--text-display-large-lh);
  }

  /* Hub hero */
  .tool-hub-hero h1 {
    font-size: var(--text-display-large);
    line-height: var(--text-display-large-lh);
  }

  /* Benefits grid: 3 columns on desktop */
  .tool-benefits {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Specs grid: 4 columns on desktop */
  .tool-specs-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* CTA banner */
  .cta-banner h2 {
    font-size: var(--text-display-large);
    line-height: var(--text-display-large-lh);
  }

  /* Tool UI max width */
  .tool-ui {
    max-width: 880px;
  }
}

/* ==========================================================================
   Section NEW: Dynamic Tool Result Types
   Result containers for calculator stats, score rings, data tables,
   generated items, color palettes, heatmaps, etc.
   ========================================================================== */

/* --- Stats Grid --- */
.tool-result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tool-stat {
  background: var(--color-surface-elevated);
  border-radius: var(--corner-radius-lg);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}

.tool-stat-value {
  font-size: var(--text-display-small);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
  line-height: 1.2;
  word-break: break-word;
}

.tool-stat-label {
  font-size: var(--text-body-small);
  color: var(--color-text-secondary);
}

/* Stat rating badges */
.tool-stat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-body-small);
  font-weight: var(--font-weight-semibold);
  margin-top: var(--space-xs);
}
.tool-stat-badge--viral { background: rgba(89, 217, 117, 0.15); color: #59D975; }
.tool-stat-badge--great { background: rgba(89, 217, 117, 0.10); color: #59D975; }
.tool-stat-badge--good { background: rgba(255, 170, 0, 0.12); color: #FFAA00; }
.tool-stat-badge--average { background: rgba(255, 255, 255, 0.08); color: var(--color-text-secondary); }
.tool-stat-badge--low { background: rgba(255, 77, 77, 0.12); color: #FF4D4D; }

/* --- Score Ring --- */
.tool-result-score {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.tool-score-ring {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto var(--space-md);
}

.tool-score-ring svg {
  width: 100%;
  height: 100%;
}

.tool-score-arc {
  transition: stroke-dashoffset 0.8s ease, stroke 0.3s ease;
}

.tool-score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-display-small);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.tool-score-label {
  font-size: var(--text-heading-small);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.tool-score-feedback {
  text-align: left;
  max-width: 500px;
  margin: var(--space-md) auto 0;
}

.tool-score-feedback-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-body-small);
}

.tool-score-feedback-item:last-child {
  border-bottom: none;
}

.tool-score-feedback-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.tool-score-feedback-text {
  color: var(--color-text-secondary);
}

.tool-score-feedback-pts {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  font-size: var(--text-body-small);
}

/* --- Data Table --- */
.tool-result-table {
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-small);
}

.tool-table th,
.tool-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.tool-table th {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-table td {
  color: var(--color-text-primary);
}

.tool-table tr:last-child td {
  border-bottom: none;
}

.tool-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Generated Items Grid --- */
.tool-result-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.tool-generated-item {
  background: var(--color-surface-elevated);
  border-radius: var(--corner-radius-lg);
  padding: var(--space-md);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.tool-generated-item-text {
  flex: 1;
  color: var(--color-text-primary);
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
}

.tool-generated-item-copy {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color 0.2s;
}

.tool-generated-item-copy:hover {
  color: var(--color-accent);
}

/* Outline items (sections) */
.tool-generated-item--section {
  flex-direction: column;
}

.tool-generated-item-section {
  font-size: var(--text-body-small);
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 4px;
}

/* --- Color Palette --- */
.tool-result-palette {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.tool-palette-swatch {
  flex: 1;
  min-width: 80px;
  border-radius: var(--corner-radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.tool-palette-swatch:hover {
  transform: translateY(-4px);
}

.tool-palette-color {
  height: 100px;
  width: 100%;
}

.tool-palette-hex {
  background: var(--color-surface-elevated);
  padding: var(--space-xs) var(--space-sm);
  text-align: center;
  font-size: var(--text-caption);
  font-family: var(--font-mono, monospace);
  color: var(--color-text-secondary);
}

/* --- Heatmap --- */
.tool-result-heatmap {
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.tool-heatmap {
  display: grid;
  gap: 3px;
  grid-template-columns: 60px repeat(5, 1fr);
  min-width: 400px;
}

.tool-heatmap-label {
  font-size: var(--text-caption);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  padding-right: var(--space-xs);
}

.tool-heatmap-header {
  font-size: var(--text-caption);
  color: var(--color-text-tertiary);
  text-align: center;
  padding-bottom: 4px;
}

.tool-heatmap-cell {
  border-radius: 6px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--color-text-primary);
  transition: transform 0.2s;
}

.tool-heatmap-cell:hover {
  transform: scale(1.05);
}

.tool-heatmap-cell[data-level="0"] { background: rgba(255,255,255,0.04); color: var(--color-text-tertiary); }
.tool-heatmap-cell[data-level="1"] { background: rgba(89,217,117,0.1); }
.tool-heatmap-cell[data-level="2"] { background: rgba(89,217,117,0.25); }
.tool-heatmap-cell[data-level="3"] { background: rgba(89,217,117,0.45); font-weight: var(--font-weight-semibold); }

/* --- Textarea --- */
textarea.tool-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* --- Result text (for AI output) --- */
.tool-result-text {
  margin-bottom: var(--space-lg);
}

.tool-result-text .tool-result-code {
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Loading state --- */
.keycap.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* --- Number input styling --- */
input[type="number"].tool-input {
  -moz-appearance: textfield;
}

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

/* --- Responsive --- */
@media (max-width: 600px) {
  .tool-result-stats {
    grid-template-columns: 1fr 1fr;
  }
  
  .tool-result-palette {
    flex-wrap: wrap;
  }
  
  .tool-palette-swatch {
    min-width: 60px;
  }
  
  .tool-palette-color {
    height: 70px;
  }
  
  .tool-score-ring {
    width: 110px;
    height: 110px;
  }
}
