/* ─────────────────────────────────────────
   Letter tone tool - page-local styles.
   Imports the shared site design system via the
   page <link> tag; this file only adds the
   tool-specific components.
   ───────────────────────────────────────── */

/* ─── Tool hero (matches other tool pages) ─────────────────────────────── */
.tool-hero {
  max-width: 1280px;
  margin: 1.5rem auto 1rem;
  padding: 0 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.tool-hero-text { min-width: 0; flex: 1 1 auto; }
.tool-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.tool-hero p {
  font-size: 1rem;
  color: var(--text-2);
  margin: 0;
}
.tool-data-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.tool-data-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 30px;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
}
.tool-data-btn:hover,
.tool-data-btn:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.tool-data-confirm {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.25rem 0.6rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-inline-start: 0.25rem;
  animation: clear-confirm-in 160ms ease-out both;
}
.tool-data-confirm[hidden] { display: none !important; }
.tool-data-actions.is-confirming > .tool-data-btn { display: none; }
.tool-data-confirm span { font-size: 0.75rem; color: var(--text-2); padding: 0 0.2rem; }
.tool-data-confirm button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 26px;
}
.tool-data-confirm button.is-danger {
  background: oklch(96% 0.05 25);
  border-color: oklch(75% 0.18 25);
  color: oklch(40% 0.18 25);
}
body.dark .tool-data-confirm button.is-danger {
  background: oklch(20% 0.08 25);
  border-color: oklch(38% 0.18 25);
  color: oklch(82% 0.16 25);
}

/* ─── Two-column workspace ─────────────────────────────────────────────── */
/* On wide screens, input card sits on the left (sticky) and the results
   stack lives on the right. They scroll independently inside the page.
   On ≤900px we fall back to a single column with results below. */
.workspace {
  max-width: 1280px;
  margin: 0 auto 2rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
}

.workspace-left {
  position: sticky;
  top: 70px;
}
@media (max-width: 900px) {
  .workspace-left { position: static; }
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}


/* ─── Section labels inside the tool card ──────────────────────────────── */
.section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin: 0 0 0.5rem;
}

/* ─── Collapsible Tone / Compose sections ──────────────────────────────── */
.tool-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.875rem;
}
.tool-section:last-child { margin-bottom: 0; }
.tool-section-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  user-select: none;
}
.tool-section-summary::-webkit-details-marker { display: none; }
.tool-section-summary .section-label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text);
  opacity: 1;
}
/* Group undo + chevron so the parent's space-between puts label on the
   left and the action cluster on the right - in both open and collapsed
   states. Previously the two siblings drifted apart visually when the
   quick-scroll preset bar was hidden (open mode). */
.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.section-icon {
  display: block;
  width: 20px;
  height: 20px;
}
/* The SVGs ship with a dark-navy stroke (#1d1b2a) for light theme. On
   dark theme we invert so the stroke reads as near-white against the
   dark background. */
body.dark .section-icon {
  filter: invert(1);
}
/* The chevron.svg is drawn as ∧ (up). For the "click to expand" affordance
   we want ∨ (down) when collapsed and ∧ (up) when open. Default base is
   rotated; [open] un-rotates back to the SVG's natural orientation. */
.section-chevron {
  display: inline-flex;
  align-items: center;
  opacity: 1;
  transition: transform 0.18s ease;
  padding: 0;
  transform: rotate(180deg);
}
.section-undo-btn {
  background: transparent;
  border: none;
  margin: 0;
  padding: 4px;
  line-height: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.15s ease;
}
.section-undo-btn:hover:not(:disabled) { opacity: 0.7; }
.section-undo-btn:disabled { opacity: 0.3; cursor: default; }
.section-undo-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.tool-section[open] > .tool-section-summary .section-chevron {
  transform: rotate(0deg);
}
.tool-section-summary:hover .section-chevron { opacity: 1; }
.tool-section-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-section-body {
  padding: 0.25rem 0.875rem 0.875rem;
}

/* ─── Tone summary row (collapsed mobile header + quick presets) ───────── */
.tone-summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.tone-header-quick-scroll {
  display: flex;
  flex-direction: row;
  flex: 1 1 0px;
  min-width: 0;
  width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  padding: 0 4px;
  scrollbar-width: none;
}
.tone-header-quick-scroll::-webkit-scrollbar { display: none; }
.tone-header-quick-scroll[hidden] { display: none !important; }
.tone-header-quick-btn-wrap {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.tone-header-quick-btn {
  min-height: 36px;
  min-width: 44px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color 0.13s;
  line-height: 1;
}
.tone-header-quick-btn:hover { color: var(--accent); }
.tone-header-quick-btn.is-active { color: var(--accent); }
.tone-header-quick-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tone-header-quick-divider {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
  align-self: center;
}

.workspace-left .tool-card {
  overflow-x: hidden;
  max-width: 100%;
}
#section-tone {
  overflow-x: hidden;
  min-width: 0;
  max-width: 100%;
}

/* ─── Field help text (above textareas / fields) ────────────────────────── */
.field-help {
  margin: 0 0 0.4rem;
  font-size: 0.78125rem;
  line-height: 1.45;
  color: var(--text-2);
  opacity: 0.9;
}

/* ─── Recipient/From dropdown affordance + popover ─────────────────────── */
.recipient-input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}
.recipient-input-wrap .recipient-input {
  padding-inline-end: 2rem;
  width: 100%;
}
.recipient-dropdown-btn {
  position: absolute;
  inset-inline-end: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0.55;
  transition: opacity 0.13s, background 0.13s, color 0.13s;
}
.recipient-dropdown-btn:hover { opacity: 1; background: var(--accent-dim); color: var(--accent); }
.recipient-dropdown-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }
.recipient-dropdown-btn[hidden] { display: none; }
.recipient-popover {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem;
}
.recipient-popover[hidden] { display: none; }
.recipient-popover-item {
  display: block;
  width: 100%;
  text-align: start;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
}
.recipient-popover-item:hover,
.recipient-popover-item:focus-visible { background: var(--accent-dim); color: var(--accent); outline: none; }
.recipient-popover-empty {
  padding: 0.5rem 0.6rem;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-style: italic;
}

/* ─── Rules list (Advanced tab) ────────────────────────────────────────── */
.rules-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.rule-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  outline: none;
}
.rule-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.rule-add-btn {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.13s;
}
.rule-add-btn:hover { background: var(--accent-hover); }
.rule-add-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.rules-list:empty { display: none; }
.rule-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
}
.rule-chip-text { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.rule-chip-remove {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-size: 1.125rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
  opacity: 0.65;
}
.rule-chip-remove:hover { opacity: 1; color: oklch(58% 0.2 25); }

/* ─── Tone preset chips ─────────────────────────────────────────────────── */
.tone-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.875rem;
}
.tone-chip {
  padding: 0.3rem 0.625rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.78125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
  min-height: 30px;
  white-space: nowrap;
}
.tone-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.tone-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tone-chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Sliders row ───────────────────────────────────────────────────────── */
/* Slider bank - one shared panel housing all 4 faders. */
.sliders {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0.875rem 0.5rem 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px oklch(0% 0 0 / 0.04);
  -webkit-user-select: none;
  user-select: none;
}
.slider-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0 0.25rem;
  border-right: 1px solid var(--border-sub);
}
.slider-col:last-child { border-right: 0; }
.slider-top {
  text-align: center;
  margin-bottom: 0.375rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.slider-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.slider-value {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.1;
}
.slider-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 108px;
  width: 28px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  position: relative;
}
/* Single vertical groove behind each thumb. Decorative only - it sits
   over the range input, so it MUST NOT intercept the pointer or it
   creates a ~2px-wide dead strip down the slider's centre where
   hover/click never reach the input. */
.slider-wrap::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
  pointer-events: none;
}
input[type="range"].slider-vertical {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  /* Fill the wrap (28px) rather than 24px - a wider hit target on a
     vertical range input, which is fiddly to grab at the best of times. */
  width: 28px;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}
input[type="range"].slider-vertical::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 22px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs), inset 0 1px 0 oklch(100% 0 0 / 0.4);
  cursor: grab;
  transition: box-shadow 0.13s, transform 0.13s;
}
input[type="range"].slider-vertical::-webkit-slider-thumb:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input[type="range"].slider-vertical:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.04);
}
input[type="range"].slider-vertical::-moz-range-thumb {
  width: 28px;
  height: 22px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: grab;
}
input[type="range"].slider-vertical:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px var(--accent-dim);
}

/* ─── Section divider ───────────────────────────────────────────────────── */
.section-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ─── Recipient field ───────────────────────────────────────────────────── */
.recipient-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.recipient-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
}
.recipient-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  flex: 0 0 auto;
}
.recipient-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.recipient-input::placeholder { color: var(--text-2); opacity: 0.6; }
.recipient-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.recipient-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}
.recipient-chip {
  padding: 0.3rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
  font-family: inherit;
  min-height: 28px;
}
.recipient-chip:hover, .recipient-chip.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.recipient-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.recipient-hint {
  font-size: 0.75rem;
  color: var(--text-2);
  font-style: italic;
  margin: 0 0 0.875rem;
  opacity: 0.8;
}

/* ─── Compose tabs (Message / Advanced) ────────────────────────────────── */
.compose-tabs { margin-top: 0.25rem; }
.compose-tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.compose-tab {
  padding: 0.3rem 0.75rem;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.13s, border-color 0.13s;
  min-height: 28px;
}
.compose-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.compose-tab:hover:not(.is-active) { color: var(--text); }
.compose-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.tab-dot[hidden] { display: none; }
.compose-tab-panel { padding-top: 0.5rem; }
.compose-tab-panel[hidden] { display: none; }

/* ─── Tone info button (ⓘ on result-card meta) ──────────────────────────── */
.tone-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--text-2);
  background: none;
  padding: 0;
  margin-left: 0.25rem;
  font-family: Georgia, serif;
  font-size: 0.6rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  color: var(--text-2);
  opacity: 0.6;
  cursor: help;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.tone-info-btn:hover,
.tone-info-btn:focus { opacity: 1; outline: none; }
.tone-info-btn:hover .tone-tooltip,
.tone-info-btn:focus-within .tone-tooltip,
.tone-info-btn:focus .tone-tooltip { display: block; }
.tone-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  inset-inline-start: 0;
  white-space: nowrap;
  background: var(--text);
  color: var(--card);
  font-size: 0.7rem;
  font-weight: 500;
  font-style: normal;
  font-family: inherit;
  letter-spacing: 0.01em;
  line-height: 1.5;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

/* ─── Compose textarea ──────────────────────────────────────────────────── */
.compose-field { margin-top: 0.25rem; }
.compose-field label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.compose-textarea {
  width: 100%;
  min-height: 110px;
  padding: 0.625rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.compose-textarea::placeholder { color: var(--text-2); opacity: 0.6; }
.compose-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.privacy-note {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.78125rem;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--bg-2);
  border-inline-start: 3px solid oklch(75% 0.18 25);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.privacy-note .privacy-line {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.privacy-note .privacy-icon {
  flex: 0 0 auto;
  font-size: 0.9375rem;
  line-height: 1.4;
}
.privacy-note .privacy-personal { color: oklch(40% 0.18 25); font-weight: 600; }
body.dark .privacy-note .privacy-personal { color: oklch(82% 0.16 25); }
.privacy-note .privacy-ai { opacity: 0.85; }

/* ─── Translate control (on the result preview, beside Copy) ────────────── */
.result-card-translate { position: relative; display: inline-flex; }
.result-card-translate-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.result-card-translate-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.result-card-translate-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.result-card-translate-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 9rem;
  display: flex;
  flex-direction: column;
  padding: 0.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 20;
}
.result-card-translate-menu[hidden] { display: none; }
.result-card-translate-item {
  text-align: start;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
}
.result-card-translate-item:hover { background: var(--accent-dim); color: var(--accent); }
.result-card-translate-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Translated-output pill + the verify-before-sending caption on its card. */
.result-card-ai-pill.is-translated { color: var(--accent); }
.result-card-verify {
  margin: 0.5rem 1rem 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: oklch(52% 0.19 25);
  unicode-bidi: isolate;
}
body.dark .result-card-verify { color: oklch(76% 0.16 25); }

.compose-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.875rem;
  margin-top: 0.875rem;
}
.compose-bottom .generate-btn { flex: 0 0 auto; }
.generate-hint {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--text-2);
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}
.generate-hint:empty { display: none; }
.generate-hint.is-low { color: oklch(50% 0.16 65); opacity: 1; }
.generate-hint.is-limit,
.generate-hint.is-locked { color: oklch(52% 0.19 25); opacity: 1; }
body.dark .generate-hint.is-low { color: oklch(80% 0.15 65); }
body.dark .generate-hint.is-limit,
body.dark .generate-hint.is-locked { color: oklch(76% 0.16 25); }

/* Bidi isolation for dynamically localized strings. Without this, an LTR
   English string rendered inside the RTL Hebrew UI gets its leading/trailing
   punctuation visually displaced (".Inputs go to…"). dir="auto" on the
   elements is the primary fix; this is the CSS belt-and-suspenders. */
.tool-hero h1,
.tool-hero p,
.privacy-note,
.generate-hint { unicode-bidi: isolate; }
.generate-btn {
  padding: 0.625rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.13s, transform 0.13s, opacity 0.13s;
}
.generate-btn:hover { background: var(--accent-hover); }
.generate-btn:active { transform: translateY(1px); }
.generate-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.generate-btn:disabled { opacity: 0.55; cursor: progress; }

.tool-card-padding { padding: 1.5rem 1.75rem; }

/* ─── Results panel ──────────────────────────────────────────────────────── */
/* [hidden] must beat display:flex */
.compare-strip[hidden],
.results-clear-confirm[hidden] { display: none !important; }

.results {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.125rem 1.25rem 1.25rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-width: 0;
}
/* Padding is set per-breakpoint on .results.results-section below. */

/* Collapsible results - matches .tool-section on mobile; summary header on desktop */
.results-section { display: block; }
.results-section > .results-section-summary {
  list-style: none;
  cursor: pointer;
  display: none;
}
.results-section > .results-section-summary::-webkit-details-marker { display: none; }
.results-section-body { min-width: 0; padding: 1rem 1.125rem 1.125rem; }
.results-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-inline-start: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.results-count[hidden] { display: none; }
@media (max-width: 900px) {
  .results.results-section {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: none;
    padding: 0;
    margin-top: 0.625rem;
    margin-bottom: 2rem;
    min-height: 0;
    overflow: visible;
  }
  .results-section:not([open]).is-empty::before { display: none; }
  .results-section > .results-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.875rem;
    border-radius: var(--radius-sm);
    user-select: none;
  }
  .results-section:not([open]) > .results-section-summary { display: flex; }
  .results-section > .results-section-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  .results-section[open] > .results-section-summary .section-chevron {
    transform: rotate(0deg);
  }
  .results-section:not([open]) .results-empty { display: none; }
  .results-section > .results-section-summary .section-label {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--text);
  }
  .results.results-section[open] {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0;
    min-height: 60vh;
    overflow: hidden;
  }
  /* Keep summary + chevron visible when open so the panel can collapse again */
  .results-section[open] > .results-section-summary {
    display: flex;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .results-section[open] .results-header {
    display: flex;
    margin-bottom: 0.875rem;
  }
  .results-section[open] .results-header h2 {
    display: none;
  }
  .results-section:not([open]) .results-header {
    display: none;
  }
}

@media (min-width: 901px) {
  .results-section > .results-section-summary { display: none !important; }
  .results-section-body { padding: 0; }
  .results-section .results-header { display: flex; }
  .results.results-section { padding: 1.5rem 1.75rem; }
}

.workspace-right { min-width: 0; }
.results-stack { min-width: 0; }
.results-thumbnails-wrap { min-width: 0; max-width: 100%; }
.results-thumbnails { min-width: 0; max-width: 100%; }
.results.is-empty::before {
  /* Static halftone-dot pattern fading from center - borrowed from homepage cat-card */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, oklch(57% 0.22 262 / 0.22) 1.5px, transparent 1.5px);
  background-size: 14px 14px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 55%, black 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 55%, black 0%, transparent 80%);
}
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}
.results-header h2 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin: 0;
}
.results-clear,
.results-iobtn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 30px;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
}
.results-clear:hover,
.results-iobtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#results-clear-zone { display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

.results-clear-confirm {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  animation: clear-confirm-in 160ms ease-out both;
}
@keyframes clear-confirm-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.results-clear-confirm span { font-size: 0.75rem; color: var(--text-2); padding: 0 0.25rem; }
.results-clear-confirm button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 28px;
}
.results-clear-confirm button.is-danger {
  background: oklch(96% 0.05 25);
  border-color: oklch(75% 0.18 25);
  color: oklch(40% 0.18 25);
}
body.dark .results-clear-confirm button.is-danger {
  background: oklch(20% 0.08 25);
  border-color: oklch(38% 0.18 25);
  color: oklch(78% 0.18 25);
}

.results-empty {
  color: var(--text-2);
  text-align: center;
  padding: 3rem 1rem 3.5rem;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  position: relative;
}
.results-empty strong {
  display: block;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.375rem;
}

/* Main letter - one full-width card. Below, a thumbnail row of all
   generated letters: click a thumbnail to swap it into the main slot. */
.results-stack {
  display: flex;
  flex-direction: column;
}

/* ── Hard-block overlay (slur / jailbreak / severe moderation) ───────────── */
.block-overlay[hidden] { display: none !important; }
.block-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: oklch(20% 0.03 255 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: block-overlay-fade 200ms ease-out both;
}
@keyframes block-overlay-fade { from { opacity: 0; } to { opacity: 1; } }
.block-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  max-width: 28rem;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.block-card h3 {
  margin: 0 0 0.625rem;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.block-message {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.55;
}
.block-detail {
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}
.block-detail:empty { display: none; }
.block-dismiss {
  padding: 0.625rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.13s;
}
.block-dismiss:hover { background: var(--accent-hover); }
.block-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── Inline notice (replaces blocking alert dialogs) ──────────────────────── */
.results-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
  padding: 0.625rem 0.875rem;
  background: oklch(96% 0.05 65);
  border: 1px solid oklch(82% 0.12 65);
  border-radius: var(--radius-sm);
  color: oklch(38% 0.15 65);
  font-size: 0.875rem;
  line-height: 1.4;
}
body.dark .results-notice {
  background: oklch(22% 0.06 65);
  border-color: oklch(40% 0.13 65);
  color: oklch(82% 0.15 65);
}
.results-notice[hidden] { display: none !important; }
.results-notice .notice-text { flex: 1 1 auto; }
.results-notice .notice-dismiss {
  background: none;
  border: 0;
  color: inherit;
  font-family: inherit;
  font-size: 1.125rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
  opacity: 0.7;
}
.results-notice .notice-dismiss:hover { opacity: 1; }

/* ── Thumbnail row ───────────────────────────────────────────────────────── */
.results-thumbnails-wrap {
  position: relative;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}
/* Right-edge fade - visible only when the row overflows. Pure decoration;
   the row beneath is still scrollable with mouse/trackpad. */
.results-thumbnails-wrap::after {
  content: '';
  position: absolute;
  top: calc(0.875rem + 3px);
  right: 0;
  bottom: 9px;
  width: 32px;
  pointer-events: none;
  background: linear-gradient(to right, transparent 0%, var(--card) 80%);
}
/* RTL (Hebrew): the strip reverses, so the newest/active card sits on the
   right. Mirror the fade to the left edge, or a var(--card) veil paints over
   the active card ("cloudy white" cutting its right side). i18n.js sets
   dir="rtl" on <html> for Hebrew, so this is pure CSS - no JS needed. */
[dir="rtl"] .results-thumbnails-wrap::after {
  right: auto;
  left: 0;
  background: linear-gradient(to left, transparent 0%, var(--card) 80%);
}
.results-thumbnails {
  display: flex;
  gap: 0.5rem;
  /* 3px of vertical padding so the .thumb:hover translateY(-1px) has room
     before the overflow:hidden clip kicks in. */
  padding: 3px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.results-thumbnails::-webkit-scrollbar { height: 6px; }
.results-thumbnails::-webkit-scrollbar-track { background: transparent; }
.results-thumbnails::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.thumb {
  flex: 0 0 auto;
  width: 130px;
  min-height: 76px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.13s, background 0.13s, transform 0.13s, box-shadow 0.13s;
  position: relative;
}
/* Corner-X to delete a thumb. Absolute so it doesn't displace the
   meta-row (timestamp stays put). Always visible - touch users have
   no hover, and the thumb is small enough that an extra icon doesn't
   crowd the layout. */
.thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.13s, background 0.13s, color 0.13s;
}
.thumb-remove:hover {
  opacity: 1;
  background: var(--accent-dim);
  color: var(--accent);
}
.thumb-remove:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.thumb:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.thumb.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.thumb.is-pending {
  opacity: 0.75;
}
.thumb.is-pending .thumb-recipient::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: thumb-pulse 1.1s ease-in-out infinite;
}
@keyframes thumb-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.thumb-meta {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.floating-tooltip {
  position: fixed;
  z-index: 9999;
  white-space: nowrap;
  background: var(--text);
  color: var(--card);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.floating-tooltip[hidden] { display: none !important; }
.thumb-recipient {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thumb-excerpt {
  font-size: 0.6875rem;
  color: var(--text-2);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.8;
}

.thumb.is-translated {
  border-left: 3px solid var(--text-2);
}
.thumb.is-translated.is-active {
  border-left-color: var(--accent);
}
.thumb-translated-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-2);
  opacity: 0.85;
}

@media (max-width: 520px) {
  .thumb { width: 110px; min-height: 64px; }
}

/* ─── Result card ───────────────────────────────────────────────────────── */
.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  animation: result-card-in 220ms ease-out both;
}
@keyframes result-card-in {
  0%   { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.result-card.is-pinned {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim), var(--shadow-xs);
}

.result-card-meta {
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.result-card-meta-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  flex-wrap: wrap;
}
.result-card-meta-line.is-muted {
  font-weight: 500;
  color: var(--text-2);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.result-card-sep { opacity: 0.5; font-weight: 400; margin: 0 0.25rem; }
.result-card-recipient { color: var(--text); }
.result-card-actions { display: inline-flex; gap: 0.4rem; align-items: center; }

.result-card-ai-pill {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-left: 0.4rem;
}

.result-card-pin,
.result-card-remove {
  background: none;
  border: 1px solid transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 26px;
  min-width: 28px;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.result-card-pin:hover,
.result-card-remove:hover { border-color: var(--border); }
.result-card-pin[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.result-card-remove:hover { color: oklch(58% 0.2 25); border-color: oklch(75% 0.18 25); }
.result-card-remove {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  padding: 0.2rem 0.55rem;
  min-height: 32px;
  min-width: 32px;
}
.result-card-pin:focus-visible,
.result-card-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.result-card-body {
  padding: 1.125rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
  /* Fixed reading area - keeps the results panel stable when you switch
     between short and long letters. Long letters scroll inside. */
  height: 18rem;
  overflow-y: auto;
}
.result-card-body::-webkit-scrollbar { width: 6px; }
.result-card-body::-webkit-scrollbar-track { background: transparent; }
.result-card-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
@media (max-width: 900px) {
  .result-card-body { height: 14rem; }
}

.result-card-footer {
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
}
/* If only the Copy button is present (no support prompt), right-align it. */
.result-card-footer > .result-card-copy:only-child {
  margin-left: auto;
}

.result-card-copy {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 32px;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
}
.result-card-copy:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.result-card-copy.is-copied {
  border-color: oklch(60% 0.15 157);
  color: oklch(45% 0.15 157);
  background: oklch(96% 0.04 157);
}
body.dark .result-card-copy.is-copied {
  border-color: oklch(60% 0.15 157);
  color: oklch(82% 0.15 157);
  background: oklch(20% 0.04 157);
}
.result-card-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Skeleton card (renders while waiting for response) ────────────────── */
.result-card.is-skeleton .result-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.skeleton-line {
  height: 0.7rem;
  border-radius: 4px;
  background: linear-gradient(90deg,
    var(--bg-2) 0%,
    var(--accent-dim) 50%,
    var(--bg-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-72 { width: 72%; }
.skeleton-line.w-85 { width: 85%; }
.skeleton-line.w-55 { width: 55%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Compare strip ─────────────────────────────────────────────────────── */
.compare-strip {
  position: sticky;
  top: 70px;
  z-index: 10;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.875rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.compare-strip-rail {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  min-width: 0;
}
.compare-strip-rail .result-card { margin: 0; font-size: 0.8125rem; }
.compare-strip-rail .result-card-body { max-height: 160px; overflow-y: auto; font-size: 0.8125rem; padding: 0.625rem 0.75rem; }
.compare-strip-rail .result-card-meta { padding: 0.5rem 0.75rem 0.375rem; }
.compare-strip-rail .result-card-footer { padding: 0.375rem 0.75rem 0.5rem; }
.compare-unpin-all {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.3rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 0 0 auto;
  min-height: 28px;
}
.compare-unpin-all:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Mobile (≤900px) - bigger, more prominent results ─────────────────── */
@media (max-width: 900px) {
  .results-empty {
    padding: 4rem 1rem 4.5rem;
    font-size: 1rem;
  }
  .results-empty strong {
    font-size: 1.125rem;
  }
  .results-header h2 {
    font-size: 0.875rem;
  }
  .result-card-body {
    font-size: 1rem;
    line-height: 1.65;
  }
  .skeleton-line { height: 0.85rem; }
  .result-card.is-skeleton .result-card-body { gap: 0.75rem; padding: 1.5rem 1.25rem; }
}

/* ─── Mobile (≤520px) ───────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .tool-card-padding { padding: 1rem 0.75rem; }
  .tool-section-body { padding: 0.25rem 0.625rem 0.75rem; }
  .tool-section { margin-bottom: 0.625rem; }
  .privacy-note {
    margin-top: 0.625rem;
    padding: 0.6rem 0.7rem;
    font-size: 0.8125rem;
  }
  .tool-hero { margin: 1rem auto 0.5rem; padding: 0 1rem; }
  .workspace { padding: 0 1rem; }

  .sliders {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .slider-col {
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr 28px;
    align-items: center;
    gap: 0.75rem;
    min-height: 28px;
  }
  .slider-top {
    display: contents;
  }
  .slider-label {
    grid-column: 1;
    justify-self: start;
    align-self: center;
    margin: 0;
    text-align: left;
  }
  .slider-value {
    grid-column: 3;
    text-align: right;
    font-size: 0.9375rem;
    margin: 0;
  }
  .slider-wrap {
    grid-column: 2;
    height: 18px;
    width: 100%;
    padding: 0;
    border-radius: 999px;
    background: var(--bg-2);
    box-shadow: none;
    border: none;
  }
  input[type="range"].slider-vertical {
    -webkit-appearance: none;
    appearance: none;
    writing-mode: horizontal-tb;
    direction: ltr;
    width: 100%;
    height: 18px;
    background: transparent;
  }
  input[type="range"].slider-vertical::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--border);
    border-radius: 999px;
  }
  input[type="range"].slider-vertical::-webkit-slider-thumb {
    margin-top: -8px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
  }
  input[type="range"].slider-vertical::-moz-range-track {
    height: 4px;
    background: var(--border);
    border-radius: 999px;
  }
  input[type="range"].slider-vertical::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 999px;
  }

  .compare-strip { position: static; }
  .compare-strip-rail { grid-template-columns: 1fr; }
  .recipient-row { grid-template-columns: 1fr; }
  .recipient-label { margin: 0; }

  .compose-bottom { flex-direction: column; align-items: stretch; }
  .compose-bottom .generate-btn { width: 100%; }
  .generate-hint { flex-basis: auto; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .result-card, .skeleton-line { animation: none !important; }
  * { transition-duration: 0.001ms !important; }
}
