/* ===========================================================================
   Engineering Utility Platform — design system
   ---------------------------------------------------------------------------
   Tailwind (built locally to css/tailwind.css) provides layout and spacing
   utilities. This file owns the two things utilities cannot:

   1. The semantic colour tokens, as CSS custom properties, so one set of class
      names — bg-surface, text-muted, border-border — is correct in both light
      and dark mode and the markup needs no `dark:` variants.
   2. Component classes (.btn, .card, .field, .panel, .badge…), so a button is
      one class rather than fifteen utilities repeated across 31 tools.

   Load order is deliberate and load-bearing: this file first, Tailwind second,
   so a utility can always override a component. Reversed, `.empty-state
   { display: flex }` beats `.hidden { display: none }`.

   Everything is deliberately low-contrast in its decoration and high-contrast
   in its text: subtle borders, minimal shadows, no gradients.
   ======================================================================== */

:root {
  color-scheme: light;

  --bg: 250 250 250;
  --bg-elevated: 255 255 255;
  --surface: 255 255 255;
  --surface-2: 244 244 245;
  --surface-3: 235 235 238;

  --border: 228 228 231;
  --border-strong: 209 209 214;

  --fg: 24 24 27;
  --fg-muted: 82 82 91;
  --fg-subtle: 113 113 122;

  --accent: 79 70 229;
  --accent-hover: 67 56 202;
  --accent-fg: 255 255 255;
  --accent-soft: 238 242 255;
  --accent-ring: 129 140 248;

  --success: 21 128 61;
  --success-soft: 240 253 244;
  --warning: 180 83 9;
  --warning-soft: 255 251 235;
  --danger: 185 28 28;
  --danger-soft: 254 242 242;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dark {
  color-scheme: dark;

  --bg: 9 9 11;
  --bg-elevated: 24 24 27;
  --surface: 22 22 25;
  --surface-2: 32 32 36;
  --surface-3: 44 44 49;

  --border: 39 39 42;
  --border-strong: 63 63 70;

  --fg: 250 250 250;
  --fg-muted: 161 161 170;
  --fg-subtle: 120 120 130;

  --accent: 129 140 248;
  --accent-hover: 165 180 252;
  --accent-fg: 17 17 20;
  --accent-soft: 30 27 63;
  --accent-ring: 129 140 248;

  --success: 74 222 128;
  --success-soft: 8 37 21;
  --warning: 251 191 36;
  --warning-soft: 41 27 6;
  --danger: 248 113 113;
  --danger-soft: 45 15 15;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 16px -4px rgb(0 0 0 / 0.5);
}

/* --------------------------------------------------------------------- base */

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* A flat single-colour page reads as cheap at this size, so the body carries
   two quiet layers instead of the bg-bg utility: a top-anchored lightening
   that gives the page a sense of depth, and a very fine grain so large
   stretches of empty surface don't look like a solid PNG fill. Both are
   subtle enough to disappear next to actual content — this is atmosphere,
   not decoration competing for attention. */
body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01';
  font-variation-settings: 'opsz' 32;
  background-color: rgb(var(--bg));
  background-image:
    radial-gradient(120% 60% at 50% 0%, rgb(var(--surface) / 0.7) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
}

code,
kbd,
pre,
samp,
.font-mono {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

::selection {
  background: rgb(var(--accent) / 0.25);
}

/* One consistent focus treatment everywhere. Never removed, only shaped. */
:focus-visible {
  outline: 2px solid rgb(var(--accent-ring));
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  background: rgb(var(--accent));
  color: rgb(var(--accent-fg));
  font-size: 0.875rem;
  font-weight: 500;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 1rem;
}

/* Scrollbars: present, but quiet. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--border-strong)) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgb(var(--border-strong));
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--fg-subtle));
  background-clip: padding-box;
}

/* Icons.
   Each icon is an <svg class="icon"><use href="#i-name"></use></svg> pointing
   at the inlined sprite. Presentation attributes on the sprite's root element
   do NOT apply to content referenced through <use>, so the stroke styling has
   to arrive as *inherited CSS properties* on the referencing element — which
   do cross into the referenced content. Without this, every icon renders as a
   filled black blob. */
.icon {
  display: inline-block;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------- components */

.card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
}

.card-hover {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card-hover:hover {
  border-color: rgb(var(--border-strong));
  box-shadow: var(--shadow-md);
}
@media (hover: hover) {
  .card-hover:hover {
    transform: translateY(-1px);
  }
}

.panel {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid rgb(var(--border));
  background: rgb(var(--surface-2));
  min-height: 2.875rem;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgb(var(--fg-muted));
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Result metadata can be long ("1024 addresses · private (RFC 1918)"), and it
   must never push the panel title onto a second line. */
.panel-title [data-meta] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.5rem 0.875rem;
  min-height: 2.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  user-select: none;
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: rgb(var(--accent));
  color: rgb(var(--accent-fg));
}
.btn-primary:hover:not(:disabled) {
  background: rgb(var(--accent-hover));
}

.btn-secondary {
  background: rgb(var(--surface));
  border-color: rgb(var(--border));
  color: rgb(var(--fg));
}
.btn-secondary:hover:not(:disabled) {
  background: rgb(var(--surface-2));
  border-color: rgb(var(--border-strong));
}

.btn-ghost {
  background: transparent;
  color: rgb(var(--fg-muted));
}
.btn-ghost:hover:not(:disabled) {
  background: rgb(var(--surface-2));
  color: rgb(var(--fg));
}

.btn-danger {
  background: transparent;
  border-color: rgb(var(--border));
  color: rgb(var(--danger));
}
.btn-danger:hover:not(:disabled) {
  background: rgb(var(--danger-soft));
  border-color: rgb(var(--danger) / 0.4);
}

.btn-sm {
  padding: 0.3125rem 0.625rem;
  min-height: 1.875rem;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 0.4375rem;
  min-height: 2rem;
  min-width: 2rem;
}

/* Touch targets stay comfortable on small screens. */
@media (max-width: 640px) {
  .btn {
    min-height: 2.5rem;
  }
  .btn-icon {
    min-height: 2.5rem;
    min-width: 2.5rem;
  }
}

/* Form controls ------------------------------------------------------------ */

.field {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  min-height: 2.25rem;
  background: rgb(var(--bg-elevated));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-sm);
  color: rgb(var(--fg));
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.12s ease;
}
.field:hover {
  border-color: rgb(var(--border-strong));
}
.field:focus {
  border-color: rgb(var(--accent));
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent) / 0.15);
}
.field::placeholder {
  color: rgb(var(--fg-subtle));
}
.field[aria-invalid='true'] {
  border-color: rgb(var(--danger));
}
.field-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

select.field {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
}

.label {
  display: block;
  margin-bottom: 0.3125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgb(var(--fg-muted));
}

.hint {
  margin-top: 0.3125rem;
  font-size: 0.75rem;
  color: rgb(var(--fg-subtle));
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgb(var(--fg));
  cursor: pointer;
  padding: 0.25rem 0;
}
.checkbox-row input[type='checkbox'],
.checkbox-row input[type='radio'] {
  width: 1rem;
  height: 1rem;
  accent-color: rgb(var(--accent));
  flex: none;
  cursor: pointer;
}

/* Segmented control (used for modes and options) -------------------------- */

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: rgb(var(--surface-2));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-sm);
}
.segmented > button {
  padding: 0.3125rem 0.6875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgb(var(--fg-muted));
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.segmented > button:hover {
  color: rgb(var(--fg));
}
.segmented > button[aria-pressed='true'],
.segmented > button[aria-selected='true'] {
  background: rgb(var(--surface));
  color: rgb(var(--fg));
  box-shadow: var(--shadow-sm);
}

/* Badges + status ---------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface-2));
  color: rgb(var(--fg-muted));
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-accent {
  background: rgb(var(--accent-soft));
  border-color: rgb(var(--accent) / 0.25);
  color: rgb(var(--accent));
}
.badge-success {
  background: rgb(var(--success-soft));
  border-color: rgb(var(--success) / 0.3);
  color: rgb(var(--success));
}
.badge-warning {
  background: rgb(var(--warning-soft));
  border-color: rgb(var(--warning) / 0.3);
  color: rgb(var(--warning));
}
.badge-danger {
  background: rgb(var(--danger-soft));
  border-color: rgb(var(--danger) / 0.3);
  color: rgb(var(--danger));
}

/* Inline messages: errors and successes never use browser dialogs. */
.message {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.message-error {
  background: rgb(var(--danger-soft));
  border-color: rgb(var(--danger) / 0.3);
  color: rgb(var(--danger));
}
.message-success {
  background: rgb(var(--success-soft));
  border-color: rgb(var(--success) / 0.3);
  color: rgb(var(--success));
}
.message-warning {
  background: rgb(var(--warning-soft));
  border-color: rgb(var(--warning) / 0.3);
  color: rgb(var(--warning));
}
.message-info {
  background: rgb(var(--surface-2));
  border-color: rgb(var(--border));
  color: rgb(var(--fg-muted));
}
.message-title {
  font-weight: 600;
}
.message-detail {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.85;
}

/* Keyboard hints ----------------------------------------------------------- */

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  padding: 0.125rem 0.375rem;
  border-radius: 5px;
  border: 1px solid rgb(var(--border));
  border-bottom-width: 2px;
  background: rgb(var(--surface-2));
  color: rgb(var(--fg-muted));
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Editors ------------------------------------------------------------------ */

.editor-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-surface {
  position: relative;
  flex: 1 1 auto;
  min-height: 14rem;
  background: rgb(var(--bg-elevated));
}

@media (min-width: 1024px) {
  .editor-surface {
    min-height: 22rem;
  }
}

.editor-textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 0.875rem;
  border: 0;
  background: transparent;
  color: rgb(var(--fg));
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  resize: vertical;
  tab-size: 2;
}
.editor-textarea:focus {
  outline: none;
}
.editor-textarea::placeholder {
  color: rgb(var(--fg-subtle));
}

/* Monaco mounts into this once (and if) it loads. Height matches the textarea
   it replaces so nothing shifts — CLS is a feature, not an afterthought. */
.monaco-host {
  width: 100%;
  min-height: 14rem;
}
@media (min-width: 1024px) {
  .monaco-host {
    min-height: 22rem;
  }
}
.monaco-host .monaco-editor,
.monaco-host .monaco-editor .overflow-guard {
  border-radius: 0;
}
.monaco-host .monaco-editor,
.monaco-host .monaco-editor-background,
.monaco-host .monaco-editor .margin {
  background-color: rgb(var(--bg-elevated)) !important;
}

.output-surface {
  padding: 0.875rem;
  margin: 0;
  overflow: auto;
  max-height: 32rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  white-space: pre;
  color: rgb(var(--fg));
  tab-size: 2;
}
.output-surface[data-wrap='true'] {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Empty + loading states --------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: rgb(var(--fg-subtle));
}
.empty-state-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: rgb(var(--surface-2));
  border: 1px solid rgb(var(--border));
  color: rgb(var(--fg-subtle));
}
.empty-state-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(var(--fg-muted));
}
.empty-state-body {
  font-size: 0.8125rem;
  max-width: 26rem;
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgb(var(--surface-2)) 25%,
    rgb(var(--surface-3)) 50%,
    rgb(var(--surface-2)) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgb(var(--border-strong));
  border-top-color: rgb(var(--accent));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.is-busy {
  cursor: progress;
}

/* Tables ------------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgb(var(--border));
  background: rgb(var(--surface-2));
  color: rgb(var(--fg-muted));
  font-weight: 600;
  white-space: nowrap;
}
.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgb(var(--border));
  vertical-align: top;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover td {
  background: rgb(var(--surface-2) / 0.6);
}
.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.kv-list {
  display: grid;
  gap: 0;
}
.kv-row {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgb(var(--border));
  font-size: 0.8125rem;
}
.kv-row:last-child {
  border-bottom: 0;
}
.kv-key {
  color: rgb(var(--fg-muted));
  font-weight: 500;
}
.kv-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  word-break: break-all;
}
@media (max-width: 640px) {
  .kv-row {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }
}

/* Command palette ---------------------------------------------------------- */

/* The palette is a native <dialog>, so focus trapping, Escape-to-close and
   inert background content come from the platform instead of from script. */
.palette-dialog {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}
.palette-dialog:not([open]) {
  display: none;
}
.palette-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(2px);
}
.palette-dialog > .palette {
  margin: 4rem auto 1rem;
}
@media (max-width: 640px) {
  .palette-dialog > .palette {
    margin: auto auto 0.75rem;
    max-height: 78vh;
  }
  .palette-dialog {
    display: flex;
    align-items: flex-end;
  }
  .palette-dialog:not([open]) {
    display: none;
  }
}

.palette {
  width: 100%;
  max-width: 34rem;
  max-height: min(30rem, 80vh);
  display: flex;
  flex-direction: column;
  background: rgb(var(--bg-elevated));
  border: 1px solid rgb(var(--border-strong));
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -12px rgb(0 0 0 / 0.35);
  overflow: hidden;
}

.palette-input-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgb(var(--border));
}
.palette-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: rgb(var(--fg));
  font-size: 0.9375rem;
}
.palette-input:focus {
  outline: none;
}
.palette-results {
  overflow-y: auto;
  padding: 0.375rem;
}
.palette-group-label {
  padding: 0.5rem 0.625rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(var(--fg-subtle));
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  color: rgb(var(--fg));
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.palette-item[aria-selected='true'] {
  background: rgb(var(--accent-soft));
  color: rgb(var(--accent));
}
.palette-item-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgb(var(--fg-subtle));
}
.palette-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.875rem;
  border-top: 1px solid rgb(var(--border));
  background: rgb(var(--surface-2));
  font-size: 0.6875rem;
  color: rgb(var(--fg-subtle));
}

/* Toasts ------------------------------------------------------------------- */

#toast-region {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  background: rgb(var(--fg));
  color: rgb(var(--bg));
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.18s ease;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Prose (tool explanations and guides) ------------------------------------ */

.prose-eup {
  color: rgb(var(--fg-muted));
  font-size: 0.9375rem;
  line-height: 1.7;
  max-width: 68ch;
}
.prose-eup > * + * {
  margin-top: 1rem;
}
.prose-eup h2 {
  margin-top: 2rem;
  color: rgb(var(--fg));
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.prose-eup h3 {
  margin-top: 1.5rem;
  color: rgb(var(--fg));
  font-size: 1rem;
  font-weight: 600;
}
.prose-eup a {
  color: rgb(var(--accent));
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prose-eup a:hover {
  text-decoration-thickness: 2px;
}
.prose-eup ul,
.prose-eup ol {
  padding-left: 1.25rem;
}
.prose-eup ul {
  list-style: disc;
}
.prose-eup ol {
  list-style: decimal;
}
.prose-eup li + li {
  margin-top: 0.375rem;
}
.prose-eup code {
  padding: 0.125rem 0.3125rem;
  border-radius: 4px;
  background: rgb(var(--surface-2));
  border: 1px solid rgb(var(--border));
  font-size: 0.8125em;
  color: rgb(var(--fg));
}
.prose-eup pre {
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  background: rgb(var(--surface-2));
  border: 1px solid rgb(var(--border));
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.prose-eup pre code {
  padding: 0;
  border: 0;
  background: none;
}
.prose-eup strong {
  color: rgb(var(--fg));
  font-weight: 600;
}

/* Details / FAQ ----------------------------------------------------------- */

.faq-item {
  border-bottom: 1px solid rgb(var(--border));
}
.faq-item:last-child {
  border-bottom: 0;
}
.faq-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9375rem 0;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgb(var(--fg));
  list-style: none;
}
.faq-summary::-webkit-details-marker {
  display: none;
}
.faq-summary .faq-chevron {
  transition: transform 0.15s ease;
  color: rgb(var(--fg-subtle));
  margin-top: 0.1875rem;
}
details[open] > .faq-summary .faq-chevron {
  transform: rotate(90deg);
}
.faq-body {
  padding-bottom: 1rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: rgb(var(--fg-muted));
  max-width: 68ch;
}

/* Ad slots ---------------------------------------------------------------- */

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 6rem;
  border: 1px dashed rgb(var(--border));
  border-radius: var(--radius);
  color: rgb(var(--fg-subtle));
  font-size: 0.75rem;
  background: rgb(var(--surface-2) / 0.5);
}

/* Utilities --------------------------------------------------------------- */

.divide-border > * + * {
  border-top: 1px solid rgb(var(--border));
}

.sr-only-focusable:not(:focus):not(:focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.grid-tools {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}

.hairline {
  height: 1px;
  background: rgb(var(--border));
}

/* Reveal-on-scroll ----------------------------------------------------------
   Gated behind html.js so a page with JS disabled or broken never hides
   content behind an animation that will never fire — the class name is added
   by an inline script in base.html, before first paint. */

html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* A gentle cascade for grids that reveal together. Plain CSS has no loop, so
   the handful of above-the-fold positions are listed explicitly. */
.grid-tools > .reveal:nth-child(1),
.grid-categories > .reveal:nth-child(1) { transition-delay: 0ms; }
.grid-tools > .reveal:nth-child(2),
.grid-categories > .reveal:nth-child(2) { transition-delay: 45ms; }
.grid-tools > .reveal:nth-child(3),
.grid-categories > .reveal:nth-child(3) { transition-delay: 90ms; }
.grid-tools > .reveal:nth-child(4),
.grid-categories > .reveal:nth-child(4) { transition-delay: 135ms; }
.grid-tools > .reveal:nth-child(5),
.grid-categories > .reveal:nth-child(5) { transition-delay: 180ms; }
.grid-tools > .reveal:nth-child(6),
.grid-categories > .reveal:nth-child(6) { transition-delay: 225ms; }
.grid-tools > .reveal:nth-child(7),
.grid-categories > .reveal:nth-child(7) { transition-delay: 270ms; }
.grid-tools > .reveal:nth-child(8),
.grid-categories > .reveal:nth-child(8) { transition-delay: 315ms; }

/* Hero decoration ------------------------------------------------------------
   A quiet accent-tinted glow behind the hero copy. Built from the existing
   --accent token (no new colour), blurred low enough to read as atmosphere
   rather than a graphic, and it drifts slowly rather than sitting static. */

.hero-glow {
  position: absolute;
  inset: -15% -10% auto -10%;
  height: 28rem;
  background:
    radial-gradient(45% 55% at 25% 25%, rgb(var(--accent) / 0.14), transparent 70%),
    radial-gradient(35% 45% at 85% 15%, rgb(var(--accent) / 0.09), transparent 70%);
  filter: blur(48px);
  pointer-events: none;
  animation: hero-glow-drift 20s ease-in-out infinite alternate;
}
@keyframes hero-glow-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3%, 4%, 0) scale(1.06); }
}

/* Icon tiles: the small icon squares on cards and headers respond when the
   card or link around them is hovered, instead of sitting inert. */
.icon-tile {
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.group:hover .icon-tile {
  transform: scale(1.08);
  background: rgb(var(--accent-soft));
  border-color: rgb(var(--accent) / 0.35);
}

/* Buttons get a light press-down instead of feeling static. */
.btn:active:not(:disabled):not([aria-disabled='true']) {
  transform: scale(0.97);
}

/* A brief highlight when a tool's result changes, so pressing Format/Run
   reads as an action with a visible effect rather than a silent DOM swap. */
@keyframes result-flash {
  from { background-color: rgb(var(--accent-soft)); }
  to { background-color: transparent; }
}
.result-flash {
  animation: result-flash 0.7s ease;
}

/* Respect the user's motion preference. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card-hover:hover {
    transform: none;
  }
}

/* Print: the result is usually what people want on paper. */
@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
}
