@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- Color tokens: LIGHT (source of truth: design-system-spec.md) ---- */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #131722;
  --muted: #55606f;                /* AA on --surface and --bg */
  --line: #e4e9f0;
  --line-strong: #cfd6e2;          /* stronger dividers/inputs */
  --primary: #0a7488;              /* cyan-teal, AA as link text on white */
  --primary-strong: #086072;       /* hover/active */
  --on-primary: #ffffff;           /* text/icon ON a primary fill */
  --focus: #0a7488;
  --danger: #c62828;               /* AA on white */
  --danger-strong: #9f2020;        /* danger hover/active */
  --success: #0f7052;              /* AA on white */
  --warn-fill: #e0a106;            /* fill */
  --warn-text: #8a6100;            /* AA text on light */
  --on-warn: #241a00;              /* dark ink on the amber warn fill (both themes) */
  --radius: 0.9rem;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.05);
  --shadow: 0 6px 20px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.05);
  --shadow-lg: 0 18px 44px rgba(15,23,42,0.12);
  --header-bg: rgba(255,255,255,0.82);
  --input-bg: #f7f9fc;
  --pill-bg: #ffffff;
  --pill-hover: #eef2f8;
  --frame-bg: #eef2f8;
  --heading-strong: #0f1420;
  --menu-item: #232b38;
  --menu-hover: #ecf5f8;
  --accent: #0a7488;               /* selected-pill fill = brand */
  --on-accent: #ffffff;            /* text on selected pill */
  --overlay: rgba(15,20,30,0.42);
  --focus-ring: rgba(10,116,136,0.30);
  --hero-grad-1: rgba(255,255,255,0.98);
  --hero-grad-2: rgba(236,246,250,0.98);
  --tile-bg-1: #ffffff;
  --tile-bg-2: #f2f6fb;
  --tile-border: #e4e9f0;
  --tile-text: #1a2130;
  --tile-hover-1: #ffffff;
  --tile-hover-2: #e9f4f7;
  --tile-hover-border: #a9d3de;
  --drag-bg: #e4f3f7;
  --muted-surface: #eef2f8;
  --muted-line: #dbe2ec;
  --star-active: #e0a106;
  --cat-upper: #1e3a5f;
  --cat-lower: #475569;
  --cat-numbers: #b4460c;
  --cat-symbols: #1f5fd0;

  /* ---- Scale tokens (theme-independent) ---- */
  --font-sans: "IBM Plex Sans", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "Menlo", "Consolas", "SFMono-Regular", monospace;
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem;
  --r-sm: .45rem; --r-md: .65rem; --r-lg: .9rem; --r-xl: 1.25rem; --r-pill: 999px;
  --dur: 160ms; --ease: cubic-bezier(.4, 0, .2, 1);
  --fs-display: clamp(1.9rem, 5vw, 2.9rem); --fs-h1: clamp(1.5rem, 4vw, 2.1rem);
  --fs-h2: 1.35rem; --fs-h3: 1.06rem; --fs-small: .875rem; --fs-mono: .9rem;
  --lh-tight: 1.15; --lh-snug: 1.3; --lh-normal: 1.6;
}

/* Dark palette shared by OS-default and manual toggle.
   Keep the two selectors below (prefers-color-scheme + [data-theme="dark"])
   in sync with this list. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e14;
    --surface: #12161f;
    --surface-elevated: #171d28;
    --text: #e7ecf3;
    --muted: #99a3b3;
    --line: #242b38;
    --line-strong: #313a49;
    --primary: #3fb6d6;              /* brighter cyan, AA text on dark surfaces */
    --primary-strong: #63c8e4;
    --on-primary: #06222b;           /* dark text ON the light-cyan fill */
    --focus: #3fb6d6;
    --danger: #f26d63;
    --danger-strong: #f58a82;
    --success: #34d399;
    --warn-fill: #f5b915;
    --warn-text: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 22px 50px rgba(0,0,0,0.6);
    --header-bg: rgba(11,14,20,0.82);
    --input-bg: #0e131b;
    --pill-bg: #171d28;
    --pill-hover: #1f2733;
    --frame-bg: #0e131b;
    --heading-strong: #eef2f8;
    --menu-item: #cdd5e1;
    --menu-hover: #1c2430;
    --accent: #3fb6d6;
    --on-accent: #06222b;
    --overlay: rgba(0,0,0,0.66);
    --focus-ring: rgba(63,182,214,0.40);
    --hero-grad-1: rgba(23,29,40,0.98);
    --hero-grad-2: rgba(18,22,31,0.98);
    --tile-bg-1: #161c26;
    --tile-bg-2: #12161f;
    --tile-border: #242b38;
    --tile-text: #e7ecf3;
    --tile-hover-1: #1b2330;
    --tile-hover-2: #151b25;
    --tile-hover-border: #2f4a56;
    --drag-bg: #0f2b34;
    --muted-surface: #0e131b;
    --muted-line: #242b38;
    --star-active: #f5c542;
    --cat-upper: #7aa7d4;
    --cat-lower: #a3b0c2;
    --cat-numbers: #f0863f;
    --cat-symbols: #6ea8ff;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #12161f;
  --surface-elevated: #171d28;
  --text: #e7ecf3;
  --muted: #99a3b3;
  --line: #242b38;
  --line-strong: #313a49;
  --primary: #3fb6d6;
  --primary-strong: #63c8e4;
  --on-primary: #06222b;
  --focus: #3fb6d6;
  --danger: #f26d63;
  --danger-strong: #f58a82;
  --success: #34d399;
  --warn-fill: #f5b915;
  --warn-text: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  --shadow: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 22px 50px rgba(0,0,0,0.6);
  --header-bg: rgba(11,14,20,0.82);
  --input-bg: #0e131b;
  --pill-bg: #171d28;
  --pill-hover: #1f2733;
  --frame-bg: #0e131b;
  --heading-strong: #eef2f8;
  --menu-item: #cdd5e1;
  --menu-hover: #1c2430;
  --accent: #3fb6d6;
  --on-accent: #06222b;
  --overlay: rgba(0,0,0,0.66);
  --focus-ring: rgba(63,182,214,0.40);
  --hero-grad-1: rgba(23,29,40,0.98);
  --hero-grad-2: rgba(18,22,31,0.98);
  --tile-bg-1: #161c26;
  --tile-bg-2: #12161f;
  --tile-border: #242b38;
  --tile-text: #e7ecf3;
  --tile-hover-1: #1b2330;
  --tile-hover-2: #151b25;
  --tile-hover-border: #2f4a56;
  --drag-bg: #0f2b34;
  --muted-surface: #0e131b;
  --muted-line: #242b38;
  --star-active: #f5c542;
  --cat-upper: #7aa7d4;
  --cat-lower: #a3b0c2;
  --cat-numbers: #f0863f;
  --cat-symbols: #6ea8ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  color-scheme: light dark;
}

/* Keep native controls (scrollbars, form fields) in step with a manual toggle. */
:root[data-theme="dark"] {
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: var(--lh-normal);
}

main {
  flex: 1;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.container {
  width: min(100% - 2rem, 74rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -1000rem;
  top: 0.5rem;
  z-index: 30;
  background: var(--surface);
  border: 2px solid var(--focus);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.skip-link:focus-visible {
  left: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.header-inner {
  min-height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.62rem;
  box-shadow: var(--shadow-sm);
  object-fit: contain;
  background: transparent;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.brand-text {
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand-main {
  color: var(--heading-strong);
}

.brand-tools {
  color: var(--primary);
}

@media (max-width: 40rem) {
  .brand-text {
    font-size: 1.02rem;
  }
}

.menu-toggle {
  min-height: 2.35rem;
  border-radius: 0.85rem;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  color: var(--heading-strong);
  padding: 0.45rem 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.menu-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.menu-toggle-icon {
  width: 1rem;
  display: grid;
  gap: 0.17rem;
}

.menu-toggle-icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--heading-strong);
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 35;
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(22rem, 90vw);
  border-left: 1px solid var(--line);
  background: var(--surface-elevated);
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.14);
  z-index: 40;
  padding: 1rem;
  transform: translateX(102%);
  transition: transform 220ms ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .menu-drawer {
  transform: translateX(0);
}

.menu-drawer-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.menu-home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--pill-bg);
  color: var(--menu-item);
  text-decoration: none;
}

.menu-home:hover {
  color: var(--primary);
  background: var(--menu-hover);
}

.menu-drawer-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.menu-close {
  margin-left: auto;
  min-width: 2rem;
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--pill-bg);
  font-size: 1.25rem;
  line-height: 1;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.menu-search-wrap {
  margin-bottom: 0.7rem;
}

.menu-tool-search {
  font-size: 0.95rem;
}

.menu-list a {
  display: block;
  text-decoration: none;
  color: var(--menu-item);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.72rem 0.8rem;
  background: var(--pill-bg);
  font-weight: 600;
}

.menu-list a[aria-current="page"] {
  color: var(--primary);
}

.menu-list a:hover {
  color: var(--primary);
  background: var(--menu-hover);
}

.menu-drawer-footer {
  margin-top: auto;
  padding: 1rem 0.8rem;
  font-size: 0.85rem;
}

.menu-drawer-footer a {
  color: var(--muted);
  text-decoration: none;
}

.menu-drawer-footer a:hover {
  color: var(--primary);
}

.hero {
  padding: 2rem 0 1.5rem;
}

.hero.container {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background:
    linear-gradient(90deg, var(--hero-grad-1), var(--hero-grad-2)),
    var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

h1,
h2,
h3 {
  line-height: var(--lh-tight);
}

h1 {
  margin: 0;
  font-size: var(--fs-h1);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

.hero h1 {
  font-size: clamp(1.25rem, 5.8vw, 1.95rem);
}

.lede {
  color: var(--muted);
  max-width: 65ch;
}

.hero .lede {
  max-width: none;
  font-size: clamp(0.9rem, 2.7vw, 1.05rem);
}

.trust-list {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
}

.trust-list li {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}

/* Stacked variant for prose lists whose items are full sentences (e.g. the
   About "what you will never run into" list); the 4-column hero layout would
   overflow and clip long items. */
.trust-list.trust-list-stack {
  grid-template-columns: 1fr;
  justify-content: start;
  gap: 0.4rem;
}

.trust-list li::before {
  content: "\2713\00a0";
  color: var(--primary);
  font-weight: 700;
}

.section {
  padding: 1rem 0 2rem;
}

.tool-search-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.tool-search {
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.tool-search:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.tool-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}

.tool-search-clear:hover {
  color: var(--text);
}

.tool-search-clear[hidden] {
  display: none;
}

.tool-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.tool-tile {
  position: relative;
  width: 100%;
  min-height: 10.25rem;
  border-radius: 1.1rem;
  border: 1px solid var(--tile-border);
  background: linear-gradient(180deg, var(--tile-bg-1), var(--tile-bg-2));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 1rem;
  text-decoration: none;
  color: var(--tile-text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.tool-tile-link:hover {
  border-color: var(--tile-hover-border);
  background: linear-gradient(180deg, var(--tile-hover-1), var(--tile-hover-2));
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.tool-tile-link:active {
  transform: translateY(0);
}

.tool-tile-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tool-tile-desc {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 0.2rem;
}

.tool-tile-badge {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tool-tile-disabled {
  font: inherit;
  opacity: 0.7;
  cursor: not-allowed;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  min-height: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--text);
  text-decoration: underline;
}

.btn,
button {
  font: inherit;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}

.btn[disabled],
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Primary = confident FILLED brand button (tool hero action). Keep width:100%. */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: var(--on-primary);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* Secondary = tonal neutral button */
.btn-secondary {
  background: var(--pill-bg);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--pill-hover);
  border-color: var(--line-strong);
}

/* Ghost = transparent, brand text */
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--menu-hover);
  color: var(--primary-strong);
}

/* Native file inputs: style the picker button + filename text to match the
   design system so they stop reading as a raw OS "Choose File" control. */
input[type="file"] {
  font: inherit;
  color: var(--muted);
  max-width: 100%;
}

input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 0.75rem;
  padding: 0.5rem 1rem;
  min-height: 2.4rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--pill-bg);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

input[type="file"]::file-selector-button:hover {
  background: var(--pill-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  padding: 0;
}

.tool-main {
  padding: 0.75rem 0 2rem;
}

.tool-heading {
  margin-bottom: 0.25rem;
}

.tool-heading h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin-bottom: 0.1rem;
}

.tool-heading .lede {
  margin: 0;
}

.tool-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.tool-add     { order: 1; display: flex; flex-direction: column; min-height: 12rem; }
.tool-add .dropzone,
.tool-add .image-loaded-state { flex: 1; }
.tool-preview { order: 2; }
.tool-resize  { order: 3; }
.tool-export  { order: 4; }
.tool-download{ order: 5; }
.tool-about   { order: 6; }

.card h2 {
  margin: 0 0 0.5rem;
}

.card {
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.15rem 1.35rem 1.3rem;
  box-shadow: var(--shadow);
}

/* Tool workspace hero: the primary tool card reads as the visual anchor. */
.tool-hero {
  position: relative;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
  /* Accent strip painted as a background layer so it clips to the card's
     rounded corners (an absolute ::before ran straight across the curve). */
  background:
    linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 45%, transparent)) top / 100% 3px no-repeat,
    var(--surface-elevated);
}

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  background: var(--input-bg);
  text-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.dropzone:hover {
  border-color: var(--primary);
}

.dropzone.drag-active,
.dropzone.dropzone-active {
  border-color: var(--primary);
  background: var(--drag-bg);
}

/* State variants for status regions (used across tools). */
.status-error {
  color: var(--danger);
}

.status-ok {
  color: var(--success);
}

.status-warn {
  color: var(--warn-text);
}

.image-loaded-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  text-align: center;
}

.image-loaded-state[hidden] {
  display: none;
}

.image-loaded-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  word-break: break-all;
}

.btn-danger {
  background: var(--danger);
  color: var(--on-primary);
  border-color: var(--danger);
  width: 100%;
}

.btn-danger:hover {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
}

.btn-warning {
  background: var(--warn-fill);
  color: var(--on-warn);
  border-color: var(--warn-fill);
}

.btn-warning:hover {
  background: color-mix(in srgb, var(--warn-fill) 88%, #000);
  border-color: color-mix(in srgb, var(--warn-fill) 88%, #000);
}

.input-row {
  margin-top: 1.25rem;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.input-grid select,
.input-grid input {
  width: 100%;
  min-width: 0;
}

.mode-grid {
  /* Flex-wrap instead of a fixed column grid: short-label pill sets (5 "Solve
     For" pills) sit balanced in one row, while long-label sets (8 case-converter
     options) wrap by content width instead of overflowing/clipping. Children keep
     their intrinsic min width (default min-width:auto) so labels never clip. */
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mode-grid > * {
  flex: 1 1 auto;
}

/* .chips modifier: many-option pickers (mock-data fields, crop ratios) should
   size to content and wrap left-aligned instead of growing to fill each row,
   which otherwise strands a lone trailing item as an oversized full-width tile. */
.mode-grid.chips > * {
  flex: 0 1 auto;
}

.mode-grid-pill {
  margin: 0;
  padding: 0.45rem 0.3rem;
  font-weight: 500;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  background: var(--pill-bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.mode-grid-pill input[type="radio"],
.mode-grid-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-grid-pill:has(input:checked) {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.mode-grid-pill:hover:not(:has(input:checked)) {
  background: var(--pill-hover);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

input,
select {
  font: inherit;
}

input[type="number"],
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  min-height: 2.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

textarea {
  min-height: 6rem;
  line-height: var(--lh-normal);
  resize: vertical;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input[type="range"] {
  width: 100%;
  border: none;
  padding: 0;
  background: transparent;
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* Checkboxes/radios must keep their intrinsic size inside .input-stack and
   .toggle-line; otherwise the `.input-stack input { width:100% }` rule stretches
   them across the row and shoves the label to the far edge. */
.toggle-line input[type="checkbox"],
.toggle-line input[type="radio"],
.input-stack input[type="checkbox"],
.input-stack input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  margin: 0;
}

.toggle-line label {
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

fieldset + fieldset {
  margin-top: 1.25rem;
}

legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.mode-list {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  overflow: hidden;
}

.mode-pill {
  flex: 1;
  margin: 0;
  padding: 0.45rem 0.9rem;
  font-weight: 500;
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  background: var(--pill-bg);
  color: var(--text);
  border: none;
  border-right: 1px solid var(--line);
  transition: background 0.15s, color 0.15s;
}

.mode-pill:last-child {
  border-right: none;
}

.mode-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-pill:has(input:checked) {
  background: var(--accent);
  color: var(--on-accent);
}

.mode-pill:hover:not(:has(input:checked)) {
  background: var(--pill-hover);
}

.preview-frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  overflow: hidden;
  background: var(--frame-bg);
  aspect-ratio: 1 / 1;
}

.preview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(var(--preview-scale, 1));
  transform-origin: center center;
}

.preview-image:not([src]),
.preview-image[src=""] {
  display: none;
}

.meta-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 0.35rem;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.vector-compare {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.vector-pane {
  margin: 0;
}

.vector-pane figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.vector-pane figcaption .muted {
  font-weight: 400;
}

@media (min-width: 48rem) {
  .vector-compare { grid-template-columns: 1fr 1fr; }
}

.card-muted {
  background: var(--muted-surface);
  border-color: var(--muted-line);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
}

.content-card {
  margin-top: 0;
}

.content-card h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.content-card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

.content-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
  margin: 0 0 0.75rem;
}

.content-card a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content-card a:hover {
  color: var(--primary-strong);
}

.content-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.25rem 0;
}

.content-section {
  margin-bottom: 2rem;
}

.related-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.related-list li {
  font-size: 0.95rem;
}

.status {
  font-size: 0.92rem;
  color: var(--muted);
}

.qr-generating {
  color: var(--primary);
  animation: pulse-gen 1.2s ease infinite;
}

@keyframes pulse-gen {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (min-width: 48rem) {
  .hero {
    text-align: center;
  }

  .trust-list {
    grid-template-columns: repeat(4, max-content);
    justify-content: center;
  }

  .tool-layout {
    grid-template-columns: minmax(24rem, 1.35fr) minmax(17rem, 0.85fr);
    align-items: start;
  }

  .tool-add      { order: 0; grid-column: 1; }
  .tool-preview  { order: 0; grid-column: 2; grid-row: 1 / 5; }
  .tool-resize   { order: 0; grid-column: 1; }
  .tool-export   { order: 0; grid-column: 1; }
  .tool-download { order: 0; grid-column: 1; }
  .tool-about    { order: 0; grid-column: 1 / -1; }

  .tool-layout-single { grid-template-columns: 1fr; }
  .tool-layout-single .tool-add { grid-column: 1 / -1; }

  .tool-layout-matched .tool-add,
  .tool-layout-matched .tool-preview { align-self: stretch; }
}

.crop-canvas-outer {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  overflow: hidden;
  background: var(--frame-bg);
  min-height: 16rem;
}

.crop-canvas-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
  user-select: none;
  touch-action: none;
}

.crop-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  border-radius: 0.35rem;
}

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

.crop-region {
  position: absolute;
  top: 0;
  left: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
  cursor: move;
  touch-action: none;
  overflow: visible;
  z-index: 2;
}

.crop-region[hidden] {
  display: none;
}

.crop-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  pointer-events: none;
}

.crop-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent 33.33%, rgba(255,255,255,0.35) 33.33%, rgba(255,255,255,0.35) calc(33.33% + 1px), transparent calc(33.33% + 1px),
      transparent 66.66%, rgba(255,255,255,0.35) 66.66%, rgba(255,255,255,0.35) calc(66.66% + 1px), transparent calc(66.66% + 1px)),
    linear-gradient(to bottom, transparent 33.33%, rgba(255,255,255,0.35) 33.33%, rgba(255,255,255,0.35) calc(33.33% + 1px), transparent calc(33.33% + 1px),
      transparent 66.66%, rgba(255,255,255,0.35) 66.66%, rgba(255,255,255,0.35) calc(66.66% + 1px), transparent calc(66.66% + 1px));
}

.crop-handle {
  position: absolute;
  touch-action: none;
  z-index: 2;
}

.crop-handle::before,
.crop-handle::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.crop-handle-nw,
.crop-handle-ne,
.crop-handle-sw,
.crop-handle-se {
  width: 32px;
  height: 32px;
}

.crop-handle-nw::before, .crop-handle-ne::before,
.crop-handle-sw::before, .crop-handle-se::before {
  width: 4px;
  height: 32px;
}

.crop-handle-nw::after, .crop-handle-ne::after,
.crop-handle-sw::after, .crop-handle-se::after {
  width: 32px;
  height: 4px;
}

.crop-handle-nw { top: -2px; left: -2px; cursor: nw-resize; }
.crop-handle-nw::before { top: 0; left: 0; }
.crop-handle-nw::after { top: 0; left: 0; }

.crop-handle-ne { top: -2px; right: -2px; left: auto; cursor: ne-resize; }
.crop-handle-ne::before { top: 0; right: 0; left: auto; }
.crop-handle-ne::after { top: 0; right: 0; left: auto; }

.crop-handle-sw { bottom: -2px; left: -2px; top: auto; cursor: sw-resize; }
.crop-handle-sw::before { bottom: 0; left: 0; top: auto; }
.crop-handle-sw::after { bottom: 0; left: 0; top: auto; }

.crop-handle-se { bottom: -2px; right: -2px; top: auto; left: auto; cursor: se-resize; }
.crop-handle-se::before { bottom: 0; right: 0; top: auto; left: auto; }
.crop-handle-se::after { bottom: 0; right: 0; top: auto; left: auto; }

.crop-handle-n,
.crop-handle-s {
  width: 40px;
  height: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.crop-handle-n { top: -2px; cursor: n-resize; }
.crop-handle-s { bottom: -2px; top: auto; cursor: s-resize; }

.crop-handle-n::before,
.crop-handle-s::before {
  width: 40px;
  height: 4px;
  left: 0;
}

.crop-handle-n::before { top: 0; }
.crop-handle-s::before { bottom: 0; top: auto; }
.crop-handle-n::after, .crop-handle-s::after { display: none; }

.crop-handle-e,
.crop-handle-w {
  width: 16px;
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
}

.crop-handle-e { right: -2px; left: auto; cursor: e-resize; }
.crop-handle-w { left: -2px; cursor: w-resize; }

.crop-handle-e::before,
.crop-handle-w::before {
  width: 4px;
  height: 40px;
  top: 0;
}

.crop-handle-e::before { right: 0; left: auto; }
.crop-handle-w::before { left: 0; }
.crop-handle-e::after, .crop-handle-w::after { display: none; }

.crop-preview-card {
  min-height: 12rem;
}

.crop-ratio-list {
  flex-wrap: wrap;
}

.counter-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.counter-input-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.counter-textarea {
  width: 100%;
  min-height: 7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  background: var(--input-bg);
  color: var(--text);
}

.counter-textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.counter-clear {
  align-self: flex-end;
  width: auto;
  padding: 0.4rem 1.25rem;
  min-height: 2.25rem;
  font-size: 0.88rem;
}

.counter-clear[hidden] {
  display: none;
}

.counter-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.counter-group {
  padding: 1rem;
}

.counter-group-row {
  display: flex;
  justify-content: space-evenly;
  gap: 1rem;
}

.counter-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 0.5rem 0.25rem;
}

.counter-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.counter-stat-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.3rem;
}

@media (min-width: 48rem) {
  .counter-layout {
    grid-template-columns: 1.5fr 1fr;
    align-items: start;
  }

  .counter-stats {
    grid-column: 2;
    grid-row: 1;
  }

  .counter-input-card {
    grid-column: 1;
    grid-row: 1;
  }

  .counter-about {
    grid-column: 1 / -1;
  }
}

.utility-layout {
  display: grid;
  gap: 1rem;
}

.pw-length-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pw-length-row input[type="range"] {
  flex: 1;
}

.pw-length-input {
  width: 4.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--input-bg);
  color: var(--text);
}

.password-options {
  display: grid;
  gap: 0.65rem;
}

.password-options label {
  margin-bottom: 0;
}

.pw-cat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pw-cat-upper { background: var(--cat-upper); }
.pw-cat-lower { background: var(--cat-lower); }
.pw-cat-numbers { background: var(--cat-numbers); }
.pw-cat-symbols { background: var(--cat-symbols); }

.pw-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pw-row:last-child {
  margin-bottom: 1rem;
}

.pw-row-copy {
  flex-shrink: 0;
  align-self: center;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
}

.pw-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  line-height: 1.6;
  word-break: break-all;
  padding: 0.65rem 0.85rem;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  min-height: 2.5rem;
  flex: 1;
}

.pw-char { display: inline; }
.pw-char-upper { color: var(--cat-upper); }
.pw-char-lower { color: var(--cat-lower); }
.pw-char-numbers { color: var(--cat-numbers); }
.pw-char-symbols { color: var(--cat-symbols); }

.pw-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pw-actions .btn {
  width: 100%;
}

/* Secondary tonal button (non-hero actions next to the primary). */
.btn-solid {
  background: var(--pill-bg);
  color: var(--text);
  border-color: var(--line-strong);
  white-space: nowrap;
}

.btn-solid:hover {
  background: var(--pill-hover);
  border-color: var(--line-strong);
}

.codec-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.codec-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.codec-textarea {
  width: 100%;
  min-height: 6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: 1.6;
  resize: vertical;
  background: var(--input-bg);
  color: var(--text);
}

.codec-textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (min-width: 48rem) {
  .codec-panels {
    grid-template-columns: 1fr 1fr;
  }
}

.recorder-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1rem;
  text-align: center;
}

.recorder-timer {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.btn-record {
  min-width: 12rem;
  min-height: 3.5rem;
  font-size: 1.05rem;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.btn-record:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-record.recording {
  background: var(--danger);
  color: var(--on-primary);
  border-color: var(--danger);
  animation: pulse-rec 1.4s ease infinite;
}

.btn-record.recording:hover {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
}

@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 35%, transparent); }
  50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--danger) 0%, transparent); }
}

.recorder-playback {
  width: 100%;
}

.recorder-playback audio {
  width: 100%;
  margin-bottom: 0.75rem;
}

.scanner-mode-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.scanner-mode-btn {
  flex: 1;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.scanner-mode-btn.active {
  opacity: 1;
}

.scanner-camera-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.scanner-video {
  width: 100%;
  max-width: 32rem;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: #000;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.input-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-stack label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.input-stack input,
.input-stack select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 1rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}

.input-stack input:read-only {
  background: var(--frame-bg);
  font-weight: 600;
}

.input-stack input.tvm-result-field {
  background: var(--drag-bg);
  border-color: var(--primary);
  color: var(--primary-strong);
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ci-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ci-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ci-summary-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.ci-summary-value {
  font-size: 1.35rem;
  font-weight: 700;
}

.ci-table,
.tz-table,
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ci-table th,
.ci-table td,
.tz-table th,
.tz-table td,
.ref-table th,
.ref-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.ci-table th,
.tz-table th,
.ref-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.ci-table td:not(:first-child),
.tz-table td:nth-child(3) {
  font-variant-numeric: tabular-nums;
}

@media (min-width: 48rem) {
  .ci-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

.coin-visual {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--line);
  margin: 0 auto;
  font-size: 2.5rem;
  font-weight: 700;
  transition: border-color 0.2s;
}

.coin-flipping {
  animation: coin-bounce 0.3s ease;
}

@keyframes coin-bounce {
  0% { transform: scale(1) rotateY(0deg); }
  50% { transform: scale(1.1) rotateY(90deg); }
  100% { transform: scale(1) rotateY(0deg); }
}

.flip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0.15rem;
}

.flip-badge-h {
  background: var(--primary);
  color: var(--on-primary);
}

.flip-badge-t {
  background: var(--line);
  color: var(--text);
}

/* Centered reading column for prose/legal pages (privacy, about) so the content
   card is a comfortable measure centered in the viewport, not pinned left. */
.prose-layout {
  max-width: 48rem;
  margin-inline: auto;
}

/* Composable layout helpers: center a block and/or cap its width so a small
   result cluster does not float alone in a very wide card. */
.center-block { margin-inline: auto; }
.measure { max-width: 34rem; }
.stack-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}

.split-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 48rem) {
  .split-2col {
    grid-template-columns: 1fr 1fr;
  }
}

.table-wrap {
  overflow-x: auto;
}

/* ===========================================================
   P2 shell: dark-mode toggle + discovery components
   =========================================================== */

/* Theme toggle (injected into the header by main.js) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 0.85rem;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  color: var(--heading-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--menu-hover);
}

.theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Category navigation: wrapping row of pill links, sticky under header */
.category-nav {
  position: sticky;
  top: 3.75rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0.6rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.category-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--pill-bg);
  color: var(--menu-item);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.category-nav a:hover,
.category-nav a:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--menu-hover);
}

/* Favorites / recents shelves + category sections */
.tool-shelf {
  margin-bottom: 1.75rem;
}

.tool-shelf[hidden] {
  display: none;
}

.tool-shelf > h2,
.tool-category > h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  color: var(--heading-strong);
}

.tool-category {
  margin-bottom: 2.25rem;
  scroll-margin-top: 7.5rem;
}

.tool-shelf {
  scroll-margin-top: 7.5rem;
}

.tool-category > h2 {
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

/* Favorite star toggle overlaid on each homepage tile */
.tool-grid > li {
  position: relative;
}

.fav-star {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.fav-star:hover {
  background: var(--pill-hover);
  color: var(--primary);
}

.fav-star[aria-pressed="true"] {
  color: var(--star-active);
}

.fav-star svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

/* Command palette (Cmd/Ctrl+K), injected into <body> by main.js */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
}

body.cmd-palette-open {
  overflow: hidden;
}

.cmd-palette-backdrop[hidden],
.cmd-palette[hidden] {
  display: none;
}

.cmd-palette {
  position: fixed;
  z-index: 61;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(100% - 2rem, 34rem);
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
}

.cmd-palette-input {
  flex-shrink: 0;
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 0.95rem 1.1rem;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.cmd-palette-input::placeholder {
  color: var(--muted);
}

.cmd-palette-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  flex: 1;
}

.cmd-palette-list:empty {
  display: none;
}

.cmd-palette-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.cmd-palette-item[aria-selected="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

.cmd-palette-item-cat {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.cmd-palette-item[aria-selected="true"] .cmd-palette-item-cat {
  color: color-mix(in srgb, var(--on-primary) 82%, transparent);
}

/* Smart-paste suggestion row inside the palette. */
.cmd-palette-suggest {
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  border: 1px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.cmd-palette-suggest-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cmd-palette-suggest-badge,
.smart-suggest-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: var(--on-primary);
}
.cmd-palette-suggest-note {
  font-size: 0.75rem;
  color: var(--muted);
}
.cmd-palette-item.cmd-palette-suggest[aria-selected="true"] {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--text);
}
.cmd-palette-item.cmd-palette-suggest[aria-selected="true"] .cmd-palette-suggest-note {
  color: var(--muted);
}

/* Smart-paste suggestion banner under the homepage search. */
.smart-suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin: 0.7rem auto 0;
  max-width: 40rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--primary);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.smart-suggest-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.smart-suggest-action:hover .smart-suggest-label {
  text-decoration: underline;
}
.smart-suggest-alt {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: underline;
}
.smart-suggest-note {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Tool chaining: "Send to" affordance on output panels. */
.send-to {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin-top: 0.85rem;
}
.send-to:empty {
  display: none;
}
.send-to-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.send-to-label::after {
  content: "\2192";
  margin-left: 0.3rem;
  color: var(--primary);
}

/* ===========================================================
   NEW component library (design overhaul)
   =========================================================== */

/* Output / result panel: mono, framed, scrollable. */
.output-panel {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: 1.6;
  background: var(--frame-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  color: var(--text);
}

/* Wrapping variant (for long prose-like output). */
.output-panel-wrap {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: visible;
}

/* Readonly output textarea matches the panel look. */
textarea.output-panel {
  width: 100%;
  resize: vertical;
}

/* Relative wrapper so a copy button can float top-right over a field/panel. */
.copy-field {
  position: relative;
}

.copy-field .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
}

/* Small copy pill button. */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.3rem 0.75rem;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
  background: var(--pill-bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}

.copy-btn:hover {
  color: var(--primary);
  background: var(--pill-hover);
  border-color: var(--primary);
}

.copy-btn svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

/* Copied toast (created/reused by window.CleanTools.toast). */
.ct-toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(0.5rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 0.95rem;
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-small);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.ct-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ct-toast svg {
  width: 1rem;
  height: 1rem;
  color: var(--success);
  flex-shrink: 0;
}

@media (min-width: 48rem) {
  .ct-toast {
    left: auto;
    right: 1.5rem;
    transform: translateX(0) translateY(0.5rem);
  }

  .ct-toast.is-visible {
    transform: translateX(0) translateY(0);
  }
}

/* Badges (small status/marker pills). */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--r-pill);
  background: var(--muted-surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.badge-accent {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}

/* Breadcrumb chip (back to category), placed above the h1. */
.tool-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--pill-bg);
  color: var(--menu-item);
  text-decoration: none;
  font-size: var(--fs-small);
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}

.tool-breadcrumb:hover,
.tool-breadcrumb:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--menu-hover);
}

/* Appearance row + segmented Light/Dark/System control (drawer). */
.menu-appearance {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.menu-appearance-label,
.menu-group-title {
  display: block;
  margin: 0.9rem 0 0.35rem;
  padding: 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.menu-appearance-label {
  margin: 0 0 0.4rem;
}

.menu-group-title:first-child {
  margin-top: 0;
}

.menu-group-title[hidden] {
  display: none;
}

.theme-seg {
  display: inline-flex;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--pill-bg);
}

.theme-seg button {
  flex: 1;
  min-height: 2.4rem;
  padding: 0.4rem 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: none;
  border-right: 1px solid var(--line-strong);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.theme-seg button:last-child {
  border-right: none;
}

.theme-seg button:hover:not([aria-checked="true"]) {
  background: var(--pill-hover);
}

.theme-seg button[aria-checked="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* MCP callout (collapsible details on MCP-backed tool pages). */
.mcp-callout {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
}

.mcp-callout-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  color: var(--heading-strong);
  cursor: pointer;
  list-style: none;
}

.mcp-callout-summary::-webkit-details-marker {
  display: none;
}

.mcp-callout-summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform var(--dur) var(--ease);
}

.mcp-callout[open] .mcp-callout-summary::after {
  transform: rotate(225deg);
}

.mcp-callout-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1.1rem 1.1rem;
}

.mcp-callout-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.mcp-snippet {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mcp-snippet-label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
}

/* Mono code panel with room for a floating copy button. */
.code-block {
  position: relative;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: 1.55;
  background: var(--frame-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.8rem 3.4rem 0.8rem 0.9rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
}

.code-block .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

/* Links row under the API/agents callout and REST snippets. */
.mcp-callout-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
}
.mcp-rest-intro {
  margin-top: 0.9rem;
}

/* Client picker: one compact <select> that swaps a single config block, so a
   long list of MCP clients stays tidy (built by initMcpClients in main.js). */
.mcp-clients {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* No-JS fallback wrapper on /developers/: stacks the static client snippets
   with sensible spacing. main.js clears it and mounts .mcp-clients in its place. */
.mcp-clients-fallback {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mcp-clients-head {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
}

.mcp-clients-label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text);
}

.mcp-clients-select {
  flex: 1 1 12rem;
  min-width: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}

.mcp-clients-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.mcp-clients-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.mcp-clients-generic {
  margin: 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.mcp-clients-generic code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* "Install app" affordance in the footer (matches footer link styling). */
.install-app-btn {
  font: inherit;
  font-size: 0.9rem;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.install-app-btn:hover {
  color: var(--primary-strong);
}

/* Live network-proof badge on file-handling tool pages. */
.net-proof {
  display: inline-flex;
  margin-top: 0.6rem;
  font-variant-numeric: tabular-nums;
}

/* Understated developer discovery line near the homepage bottom. */
.dev-callout {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.dev-callout p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Generic data table (wrap in .table-wrap for overflow). */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.data-table tbody tr:nth-child(even) {
  background: var(--muted-surface);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   Phase 3 utilities
   Generic, page-agnostic helpers so per-tool pages can drop inline style=.
   Additive only; verified against existing selectors (no duplicates).
   ========================================================================= */

/* Spacing helpers */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }

/* Inline label/field rows */
.field-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}
.field-grow {
  flex: 1;
  min-width: 0;
}

/* Non-result button rows (alias of .result-actions for semantics) */
.inline-actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Auto-fit stat/tile grid */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--sp-3);
}

/* Big numeric readouts */
.readout {
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.readout-sm {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Small button size modifier (used with .btn + variant) */
.btn-sm {
  min-height: 2rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

/* Safety: never let the redesign override the [hidden] show/hide mechanism */
[hidden] { display: none !important; }

/* =========================================================================
   Phase 3 scoped tool CSS
   Namespaced per page. Reproduces genuinely tool-specific inline styles so
   those pages can remove every inline style= (and, for test-print, its
   <style> block) by opting into these classes. No id/JS-hook renames.
   ========================================================================= */

/* ---- test-print (prefix .tp-) --------------------------------------------
   Print calibration patterns. Literal #000/#fff/#1a1a1a are the PRODUCT
   (exact ink/paper reference) and are intentionally theme-independent. ---- */

/* Structure carried over from the page's former <style> block */
.tp-print-btn {
  width: 100%;
  font-size: 1.1rem;
  padding: var(--sp-3);
}
.tp-note {
  margin-top: var(--sp-2);
  font-size: 0.85rem;
  color: var(--muted);
}
.tp-sub {
  font-size: 0.95rem;
  margin-bottom: var(--sp-2);
}
.tp-color-row {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tp-swatch {
  width: 40px;
  height: 40px;
  border-radius: 4px;
}
.tp-swatch-red { background: #ff0000; }
.tp-swatch-green { background: #00ff00; }
.tp-swatch-blue { background: #0000ff; }
.tp-swatch-cyan { background: #00ffff; }
.tp-swatch-magenta { background: #ff00ff; }
.tp-swatch-yellow { background: #ffff00; }
.tp-swatch-black { background: #000000; }
.tp-swatch-white { background: #ffffff; border: 1px solid #cccccc; }
.tp-gray-row {
  display: flex;
  gap: 2px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tp-gray {
  width: 36px;
  height: 36px;
  border-radius: 3px;
}
.tp-gray-0 { background: #ffffff; border: 1px solid #e5e5e5; }
.tp-gray-1 { background: #e5e5e5; }
.tp-gray-2 { background: #cccccc; }
.tp-gray-3 { background: #b2b2b2; }
.tp-gray-4 { background: #999999; }
.tp-gray-5 { background: #7f7f7f; }
.tp-gray-6 { background: #666666; }
.tp-gray-7 { background: #4c4c4c; }
.tp-gray-8 { background: #333333; }
.tp-gray-9 { background: #000000; }
.tp-sample { margin-bottom: var(--sp-2); }
.tp-pt-8 { font-size: 8pt; }
.tp-pt-10 { font-size: 10pt; }
.tp-pt-12 { font-size: 12pt; }
.tp-pt-14 { font-size: 14pt; }
.tp-pt-18 { font-size: 18pt; }
.tp-pt-24 { font-size: 24pt; }
.tp-align {
  width: 200px;
  height: 200px;
  border: 2px solid #000;
  position: relative;
  margin-bottom: 1rem;
}
.tp-align::before,
.tp-align::after {
  content: "";
  position: absolute;
  background: #000;
}
.tp-align::before { width: 1px; height: 100%; left: 50%; top: 0; }
.tp-align::after { width: 100%; height: 1px; top: 50%; left: 0; }
.tp-corner { position: absolute; width: 16px; height: 16px; }
.tp-corner-tl { top: 4px; left: 4px; border-top: 2px solid #000; border-left: 2px solid #000; }
.tp-corner-tr { top: 4px; right: 4px; border-top: 2px solid #000; border-right: 2px solid #000; }
.tp-corner-bl { bottom: 4px; left: 4px; border-bottom: 2px solid #000; border-left: 2px solid #000; }
.tp-corner-br { bottom: 4px; right: 4px; border-bottom: 2px solid #000; border-right: 2px solid #000; }
.tp-rule { width: 100%; margin-bottom: 0.25rem; }
.tp-rule-1 { border-top: 1px solid #000; }
.tp-rule-2 { border-top: 2px solid #000; }
.tp-rule-3 { border-top: 3px solid #000; }
.tp-rule-label {
  font-size: 0.75rem;
  margin-bottom: var(--sp-2);
  color: var(--muted);
}
.tp-timestamp { font-size: 0.9rem; }
/* Fixed white "paper preview" so the diagnostic colors print exactly in
   every theme; page chrome still themes via tokens. */
.tp-area { background: #ffffff; color: #1a1a1a; }
.tp-area h2,
.tp-area h3,
.tp-area .tp-sample,
.tp-area #print-timestamp { color: #1a1a1a; }
/* Print behavior, scoped to the page via body.tp-print-page so no other
   page's print output is affected. */
@media print {
  body.tp-print-page .site-header,
  body.tp-print-page .menu-overlay,
  body.tp-print-page .menu-drawer,
  body.tp-print-page .site-footer,
  body.tp-print-page .tool-heading,
  body.tp-print-page .tp-controls,
  body.tp-print-page .content-card {
    display: none !important;
  }
  body.tp-print-page .tool-main { padding: 0; }
  /* The on-screen .measure/.center-block that keeps patterns from floating in a
     wide card must NOT constrain the printed calibration page: restore full width. */
  body.tp-print-page .tp-patterns { max-width: none; margin-inline: 0; }
  body.tp-print-page .tp-area { break-inside: avoid; }
  body.tp-print-page * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ---- color-contrast (prefix .cc-) ---------------------------------------- */
.cc-field-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
}
.cc-color-input,
.input-stack input.cc-color-input {
  width: 4rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
}
/* mono hex fields (higher-specificity variant beats .input-stack input) */
.cc-hex,
.input-stack input.cc-hex {
  font-family: var(--font-mono);
}
.cc-swatch {
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.cc-suggest-head { margin: 0 0 var(--sp-2); }
.cc-ratio { margin: var(--sp-1) 0; }
.cc-caption { margin-top: 0; }
.cc-sample-box {
  margin-top: var(--sp-4);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.cc-sample-normal { margin: 0 0 var(--sp-2); font-size: 1rem; }
.cc-sample-large { margin: 0; font-size: 1.5rem; font-weight: 700; }

/* ---- typing-speed-test (prefix .tst-) ------------------------------------ */
.tst-stat { padding: 0.55rem 0.65rem; }
.tst-stat-label { font-size: 0.78rem; }
.tst-stat-value { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tst-passage {
  padding: var(--sp-3);
  max-height: 12.5rem;
  overflow: auto;
  background: var(--bg);
}
.tst-mini-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.8rem;
  margin-bottom: 0.35rem;
}
.tst-input { padding-right: 1rem; }
.tst-result {
  margin-top: 0.9rem;
  padding: 0.9rem;
  border: 2px solid var(--focus-ring);
  background: var(--surface-elevated);
}
.tst-status { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text); }
/* Highlight/active word box for the scrolling passage (opt-in for the JS
   unit that renders the word stream). */
.tst-word { border-radius: var(--r-sm); padding: 0 0.1em; }
.tst-word-active {
  background: var(--drag-bg);
  color: var(--text);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

/* ---- prize-wheel + decision-wheel (shared prefix .wheel-) ----------------- */
.wheel-note {
  margin-top: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--muted);
}
.wheel-canvas-wrap { text-align: center; }
.wheel-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}
.wheel-result { text-align: center; min-height: 2rem; }
.wheel-spin {
  width: 100%;
  font-size: 1.1rem;
  padding: var(--sp-3);
}

/* Phase 3 scoped: stopwatch controls (moved out of the page <style> block) */
.sw-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 38rem;
  margin: 0 auto;
}
.sw-controls .btn {
  width: 100%;
  min-height: 3rem;
  font-size: 1.1rem;
}
.sw-controls .btn-primary,
.sw-controls .btn-danger {
  width: 100%;
}
.sw-controls .sw-restart {
  grid-column: 1 / -1;
}
.sw-controls .sw-lap,
.sw-controls .sw-copy {
  min-height: 3.25rem;
}
@media (max-width: 22rem) {
  .sw-controls {
    grid-template-columns: 1fr;
  }
  .sw-controls .sw-restart {
    grid-column: auto;
  }
}
