/* numbo.io — liquid glass design system */

:root {
  /* Accent colors — stable across themes */
  --teal-900: #08607d;
  --teal-700: #0e7b9e;
  --teal-500: #1fb8b0;
  --teal-300: #7fd7d2;
  --cream: #fcf6d9;
  --cream-soft: #fdfaea;
  --peach: #fcddb7;
  --peach-soft: #fde9cf;
  --coral: #e96e5d;
  --coral-deep: #c8513f;

  /* Pastel blob palette — used for the background gradients */
  --blob-lavender: #c8b9f5;
  --blob-mint:     #b5e5d0;
  --blob-peach:    #fcd5b5;
  --blob-pink:     #f5c8d8;
  --blob-sky:      #b5d5f5;

  /* LIGHT theme — glass over pastel canvas */
  --ink: #1a1f2a;
  --ink-soft: #3a3f4a;
  --ink-mute: #5a6070;
  --line: rgba(255, 255, 255, 0.55);
  --line-soft: rgba(255, 255, 255, 0.35);
  --paper: #fef9f4;        /* underlying canvas color */
  --paper-soft: rgba(255, 255, 255, 0.5);
  --card: rgba(255, 255, 255, 0.5);
  --card-strong: rgba(255, 255, 255, 0.68);
  --field-bg: rgba(255, 255, 255, 0.4);
  --hero-bg: rgba(20, 30, 50, 0.78);   /* dark glass for hero panels */
  --hero-fg: #fcf6d9;
  --scrim: rgba(20, 30, 50, 0.32);
  --glass-shine: rgba(255, 255, 255, 0.7);
  --glass-edge: rgba(255, 255, 255, 0.85);

  /* Type */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui;
  --font-sans: "Geist", ui-sans-serif, system-ui;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Glass shadow tokens */
  --shadow-soft:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 8px 24px -10px rgba(50, 50, 80, 0.18);
  --shadow-lift:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 24px 48px -18px rgba(50, 50, 100, 0.3);
  --shadow-glow:
    0 0 0 1px rgba(255, 255, 255, 0.5) inset,
    0 8px 32px -8px rgba(200, 185, 245, 0.45);

  /* Mobile safe areas (iOS notch / home indicator) */
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  /* DARK theme — glass over deep gradient canvas */
  --ink: #f4ecd0;
  --ink-soft: #d8d0c0;
  --ink-mute: #8a9094;
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.07);
  --paper: #0a121a;
  --paper-soft: rgba(20, 30, 40, 0.4);
  --card: rgba(30, 40, 55, 0.45);
  --card-strong: rgba(30, 40, 55, 0.62);
  --field-bg: rgba(20, 30, 45, 0.45);
  --hero-bg: rgba(10, 20, 35, 0.78);
  --hero-fg: #fcf6d9;
  --scrim: rgba(0, 5, 15, 0.55);
  --glass-shine: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(255, 255, 255, 0.18);

  --shadow-soft:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 8px 24px -10px rgba(0, 0, 0, 0.55);
  --shadow-lift:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 24px 48px -18px rgba(0, 0, 0, 0.7);
  --shadow-glow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 8px 32px -8px rgba(127, 215, 210, 0.3);
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
}

/* Liquid glass canvas: soft pastel blobs sitting under everything */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -2;
  background:
    radial-gradient(38% 38% at 12% 18%, color-mix(in oklab, var(--blob-lavender) 70%, transparent) 0%, transparent 60%),
    radial-gradient(40% 36% at 88% 14%, color-mix(in oklab, var(--blob-peach) 75%, transparent) 0%, transparent 60%),
    radial-gradient(42% 38% at 82% 78%, color-mix(in oklab, var(--blob-mint) 70%, transparent) 0%, transparent 60%),
    radial-gradient(38% 34% at 18% 82%, color-mix(in oklab, var(--blob-pink) 65%, transparent) 0%, transparent 60%),
    radial-gradient(36% 30% at 50% 50%, color-mix(in oklab, var(--blob-sky) 50%, transparent) 0%, transparent 60%);
  background-color: var(--paper);
  filter: saturate(1.05);
  pointer-events: none;
  /* Static gradient — the slow drift animation forced every backdrop-filter
     element (13+ glass cards) to re-blur a 18-px sample of the page on
     every animation frame, pinning Chrome Helper at ~100% CPU. Visually
     indistinguishable for most users at 32s/2% drift. */
}

/* Subtle caustic so the glass never feels flat. Static, same reason as ::before. */
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(30% 28% at 30% 30%, color-mix(in oklab, var(--blob-sky) 30%, transparent), transparent 70%),
    radial-gradient(28% 26% at 70% 70%, color-mix(in oklab, var(--blob-pink) 30%, transparent), transparent 70%);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.7;
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(40% 38% at 14% 16%, rgba(127, 90, 200, 0.35) 0%, transparent 60%),
    radial-gradient(42% 36% at 86% 18%, rgba(220, 130, 90, 0.28) 0%, transparent 60%),
    radial-gradient(44% 38% at 82% 80%, rgba(31, 184, 176, 0.32) 0%, transparent 60%),
    radial-gradient(40% 34% at 16% 82%, rgba(195, 100, 130, 0.28) 0%, transparent 60%),
    radial-gradient(38% 30% at 50% 50%, rgba(80, 140, 200, 0.25) 0%, transparent 65%);
  background-color: var(--paper);
  filter: saturate(1.2) brightness(0.95);
}
[data-theme="dark"] body::after { opacity: 0.4; mix-blend-mode: lighten; }

/* Glass utility — shared base for any frosted card */
.glass,
.tool-card,
.calc-panel,
.chart-wrap,
.ad-slot,
.related-card,
.qstat,
.rstat,
.hero-demo,
.about-card,
.market-card,
.ccy-card,
.about-stack,
.empty-grid {
  position: relative;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  box-shadow: var(--shadow-soft);
}
.glass::before,
.tool-card::before,
.calc-panel::before,
.chart-wrap::before,
.related-card::before,
.qstat::before,
.rstat::before,
.hero-demo::before,
.about-card::before,
.market-card::before,
.about-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 40%);
  opacity: 0.7;
}
[data-theme="dark"] .glass::before,
[data-theme="dark"] .tool-card::before,
[data-theme="dark"] .calc-panel::before,
[data-theme="dark"] .chart-wrap::before,
[data-theme="dark"] .related-card::before,
[data-theme="dark"] .qstat::before,
[data-theme="dark"] .rstat::before,
[data-theme="dark"] .hero-demo::before,
[data-theme="dark"] .about-card::before,
[data-theme="dark"] .market-card::before,
[data-theme="dark"] .about-stack::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 40%);
}

button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
a.tool-card, a.related-card, a.mobile-result, a.mobile-tool, a.mobile-link, a.foot-tag, a.nav-logo, a.search-pop-item { color: inherit; text-decoration: none; }
a.mobile-link { display: block; }

/* ============ SEO fallback (pre-React render & non-JS crawlers) ============
   This content lives inside #app and is replaced by React on mount. It
   styles itself to look like a real document so the brief flash before
   hydration doesn't look broken. Search engines that don't execute JS
   (Bingbot, Baidu, social card crawlers) see this as the entire page. */
.seo-fallback {
  max-width: 760px;
  margin: 0 auto;
  padding: 80px 24px 96px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  font-family: var(--font-sans);
  color: var(--ink);
  line-height: 1.6;
}
.seo-fallback h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 18px;
  color: var(--ink);
}
.seo-fallback h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 32px 0 12px;
  color: var(--ink);
}
.seo-fallback p, .seo-fallback li, .seo-fallback dd {
  font-size: 16px;
  color: var(--ink-soft);
}
.seo-fallback p.seo-lede { font-size: 17px; margin-bottom: 24px; }
.seo-fallback ul, .seo-fallback ol { padding-left: 22px; }
.seo-fallback li { margin: 6px 0; }
.seo-fallback dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.seo-fallback dt { font-weight: 600; color: var(--ink); }
.seo-fallback dd { margin: 0; }
.seo-fallback strong { color: var(--ink); font-weight: 600; }
@media (max-width: 600px) {
  .seo-fallback { padding: 60px 18px 72px; }
  .seo-fallback dl { grid-template-columns: 1fr; gap: 4px 0; }
  .seo-fallback dt { margin-top: 12px; }
  .seo-fallback dt:first-child { margin-top: 0; }
}

.h-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.02;
  color: var(--ink);
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ============ shell ============ */
.shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 36px;
  padding-left: max(36px, var(--safe-l));
  padding-right: max(36px, var(--safe-r));
  background: color-mix(in oklab, var(--paper) 35%, transparent);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset;
}
[data-theme="dark"] .nav {
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--teal-700);
  display: grid; place-items: center;
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.05em;
  position: relative;
  overflow: hidden;
}
.nav-mark::after {
  content: "";
  position: absolute;
  inset: auto -2px -8px auto;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--coral);
}
.nav-wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.04em;
}
.nav-wordmark span { color: var(--coral); }
.nav-links {
  display: flex; align-items: center; gap: 26px;
  font-size: 14px;
  color: var(--ink-soft);
}
.nav-links a { cursor: pointer; position: relative; padding: 6px 0; }
.nav-links a:hover { color: var(--teal-700); }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after {
  content: "";
  position: absolute;
  bottom: -22px; left: 0; right: 0;
  height: 2px;
  background: var(--coral);
}
.nav-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  padding: 8px 14px;
  min-width: 260px;
  position: relative;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 16px -8px rgba(50,50,80,0.18);
}
[data-theme="dark"] .nav-search { box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 16px -8px rgba(0,0,0,0.4); }
.nav-search input {
  border: none; outline: none; background: transparent;
  flex: 1;
  font-size: 14px;
  min-width: 0;
}
.nav-search kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--line-soft);
  color: var(--ink-mute);
}
.search-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  z-index: 40;
}
.search-pop-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.search-pop-item:last-child { border-bottom: none; }
.search-pop-item:hover { background: var(--field-bg); }
.search-pop-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 3px 8px;
  background: var(--field-bg);
  border-radius: 6px;
}
.search-pop-name {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s ease;
  flex-shrink: 0;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 12px -6px rgba(50,50,80,0.2);
}
[data-theme="dark"] .theme-toggle { box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 12px -6px rgba(0,0,0,0.4); }
.theme-toggle:hover {
  color: var(--teal-700);
  border-color: var(--teal-500);
  transform: rotate(-12deg);
}
[data-theme="dark"] .theme-toggle:hover {
  color: var(--peach);
  border-color: var(--peach);
}

.nav-burger {
  display: none;
  width: 42px; height: 42px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  padding: 0;
  flex-shrink: 0;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 12px -6px rgba(50,50,80,0.2);
}
[data-theme="dark"] .nav-burger { box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 12px -6px rgba(0,0,0,0.4); }
.nav-burger span {
  position: absolute;
  left: 11px; right: 11px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease, top .2s ease;
}
.nav-burger span:nth-child(1) { top: 13px; }
.nav-burger span:nth-child(2) { top: 20px; }
.nav-burger span:nth-child(3) { top: 27px; }
.nav-burger span.is-open:nth-child(1) { top: 20px; transform: rotate(45deg); }
.nav-burger span.is-open:nth-child(2) { opacity: 0; }
.nav-burger span.is-open:nth-child(3) { top: 20px; transform: rotate(-45deg); }

/* ============ mobile drawer ============ */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.mobile-drawer.is-open { opacity: 1; pointer-events: auto; }
.mobile-drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(380px, 90vw);
  background: color-mix(in oklab, var(--paper) 70%, transparent);
  border-left: 1px solid var(--glass-edge);
  padding: 80px 20px 24px;
  padding-top: calc(80px + var(--safe-t));
  padding-bottom: calc(24px + var(--safe-b));
  padding-right: calc(20px + var(--safe-r));
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column; gap: 8px;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.mobile-drawer.is-open .mobile-drawer-panel { transform: translateX(0); }
.mobile-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--field-bg);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 8px;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
}
.mobile-search input {
  flex: 1;
  border: none; outline: none; background: transparent;
  font-size: 16px;
  min-width: 0;
}
.mobile-search-clear {
  background: var(--line);
  color: var(--ink);
  border: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.mobile-section-h {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 12px 4px 6px;
}
.mobile-link {
  display: block;
  text-align: left;
  width: 100%;
  background: transparent;
  border: none;
  padding: 13px 6px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.mobile-link:active { background: var(--field-bg); }
.mobile-results {
  display: flex; flex-direction: column; gap: 4px;
}
.mobile-result {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  text-align: left;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
}
.mobile-result:active { background: var(--field-bg); }
.mobile-result-glyph {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.mobile-result-glyph[data-tone="teal"]   { background: var(--teal-700); color: var(--cream); }
.mobile-result-glyph[data-tone="coral"]  { background: var(--coral);    color: var(--cream); }
.mobile-result-glyph[data-tone="peach"]  { background: var(--peach);    color: var(--coral-deep); }
.mobile-result-glyph[data-tone="cream"]  { background: var(--cream);    color: var(--teal-700); border: 1px solid var(--line); }
.mobile-result-glyph[data-tone="ink"]    { background: var(--hero-bg);  color: var(--hero-fg); }
.mobile-result-glyph[data-tone="bright"] { background: var(--teal-500); color: var(--cream); }
.mobile-result-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.mobile-result-tag {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mobile-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}
.mobile-tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mobile-tool {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.01em;
  text-align: left;
  color: var(--ink);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
}
.mobile-tool:active { background: var(--field-bg); }
.mobile-tool .mobile-result-glyph { width: 32px; height: 32px; border-radius: 8px; }

/* ============ page wrapper ============ */
.layout {
  display: grid;
  /* Single centred column. Side ad rails were removed from the render
     while AD_SLOTS are all null — see app.jsx. When real AdSense slots
     come in, restore the 3-column grid here:
       grid-template-columns: minmax(120px, 1fr) minmax(0, 1180px) minmax(120px, 1fr);
  */
  grid-template-columns: minmax(0, 1180px);
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}
.rail {
  padding: 56px 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.rail-inner {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 160px;
}
.ad-slot {
  width: 160px;
  border: 1px dashed var(--glass-edge);
  background: var(--paper-soft);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.ad-slot.tall { height: 600px; }
.ad-slot.short { height: 250px; }
.ad-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 14px,
      color-mix(in oklab, var(--ink-mute) 6%, transparent) 14px,
      color-mix(in oklab, var(--ink-mute) 6%, transparent) 15px
    );
  pointer-events: none;
}
.ad-slot .ad-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.ad-slot .ad-size {
  font-size: 11px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-weight: 500;
  position: relative;
  z-index: 1;
}
.ad-slot .ad-note {
  font-size: 10px;
  margin-top: 4px;
  color: var(--ink-mute);
  position: relative;
  z-index: 1;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 36px 96px;
  padding-left: max(36px, var(--safe-l));
  padding-right: max(36px, var(--safe-r));
  width: 100%;
}
.page-home {
  padding-top: 36px;
}

/* ============ home hero ============ */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: stretch;
  padding: 36px 0 56px;
  border-bottom: 1px solid var(--line);
}

/* Solo hero: just the calculator, centered */
.hero.hero-solo {
  display: block;
  padding: 32px 0 48px;
}
.hero.hero-solo > .basic-calc {
  margin: 0 auto;
  max-width: 520px;
}

/* Split hero: tile column on the left, calculator on the right.
   align-items: stretch so the left column matches the calculator's
   height; the clock sits at the top of the left column and the tiles
   are pushed to the bottom via margin-top: auto, so the Unit tile's
   bottom edge lines up with the bottom of the calculator on the right. */
.hero.hero-split {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 32px;
  align-items: stretch;
  padding: 28px 0 48px;
}
.hero.hero-split > .basic-calc {
  margin: 0;
  max-width: none;
  align-self: stretch;
}
.hero-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.hero-tiles {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;   /* push tiles to the bottom of .hero-left */
}

/* ── Live hero clock ── */
.hero-clock {
  position: relative;
  padding: 26px 28px 22px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.55) inset,
    0 14px 36px -18px rgba(50,50,100,0.22);
  overflow: hidden;
  /* Two-column layout: clock on the left, quote of the day on the right.
     The clock keeps its natural width (~360px); the quote takes whatever
     remains. On mobile (≤ 760px) the columns collapse to a single column. */
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}
.hero-clock-left {
  position: relative;
  z-index: 1;
  min-width: 0;
}
[data-theme="dark"] .hero-clock {
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 14px 36px -18px rgba(0,0,0,0.5);
}
.hero-clock::before {
  /* Same top-edge sheen used by the other glass surfaces */
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 40%;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0));
  pointer-events: none;
}
[data-theme="dark"] .hero-clock::before {
  background: linear-gradient(to bottom, rgba(255,255,255,0.08), rgba(255,255,255,0));
}
.hero-clock-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  position: relative; z-index: 1;
}
.hero-clock-eyebrow strong {
  color: var(--coral);
  font-weight: 600;
}
.hero-clock-time {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 12px 0 10px;
  color: var(--ink);
  font-feature-settings: "tnum";
  display: flex;
  align-items: baseline;
  position: relative; z-index: 1;
}
.hero-clock-hm {
  font-size: clamp(56px, 7vw, 92px);
}
.hero-clock-sec {
  font-size: 0.42em;
  color: var(--ink-mute);
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  /* Subtle live tick — pulse the opacity of the colon on each second */
  animation: hero-sec-pulse 1s steps(2, end) infinite;
}
@keyframes hero-sec-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.hero-clock-date {
  font-size: 15px;
  color: var(--ink-soft);
  position: relative; z-index: 1;
}

/* Quote of the day — right column of the hero-clock card. Rendered only
   once the /api/quote response arrives; if the Worker is unreachable,
   the component returns null and the layout gracefully collapses to a
   single column (the clock just takes more room). */
.hero-quote {
  position: relative;
  z-index: 1;
  padding-left: 22px;
  border-left: 1px solid var(--line);
  min-width: 0;
  max-width: 460px;
  justify-self: end;
  align-self: center;
  font-family: var(--font-display);
  color: var(--ink);
}
.hero-quote-mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 56px;
  line-height: 0.4;
  color: var(--coral);
  opacity: 0.55;
  margin-bottom: 4px;
  user-select: none;
}
.hero-quote-text {
  font-size: clamp(15px, 1.35vw, 18px);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 8px;
}
.hero-quote-attr {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

/* Below ~760 px the hero-clock collapses to a single column. Hide the
   quote so the time + date stay the visual anchor on small screens —
   adding a long quote underneath the time gets crowded fast. */
@media (max-width: 760px) {
  .hero-clock { grid-template-columns: 1fr; gap: 0; }
  .hero-quote { display: none; }
}
.hero-tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.55) inset,
    0 12px 32px -16px rgba(50,50,80,0.22);
  color: var(--ink);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .hero-tile {
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 12px 32px -16px rgba(0,0,0,0.5);
}
.hero-tile::before {
  /* Top-edge sheen, same convention as other glass cards */
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 40%;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0));
  pointer-events: none;
}
[data-theme="dark"] .hero-tile::before {
  background: linear-gradient(to bottom, rgba(255,255,255,0.08), rgba(255,255,255,0));
}
.hero-tile:hover {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.65) inset,
    0 20px 44px -16px rgba(50,50,100,0.32);
}
.hero-tile-glyph {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.hero-tile-glyph svg { width: 26px; height: 26px; }
.hero-tile[data-tone="teal"]   .hero-tile-glyph { background: var(--teal-700); color: var(--cream); }
.hero-tile[data-tone="coral"]  .hero-tile-glyph { background: var(--coral);    color: var(--cream); }
.hero-tile[data-tone="peach"]  .hero-tile-glyph { background: var(--peach);    color: var(--coral-deep); }
.hero-tile[data-tone="cream"]  .hero-tile-glyph { background: var(--cream);    color: var(--teal-700); border: 1px solid var(--line); }
.hero-tile[data-tone="ink"]    .hero-tile-glyph { background: var(--hero-bg);  color: var(--hero-fg); }
.hero-tile[data-tone="bright"] .hero-tile-glyph { background: var(--teal-500); color: var(--cream); }
.hero-tile-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.hero-tile-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-tile-desc {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-tile-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-top: 2px;
}
.hero-tile-arrow {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--field-bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--ink-mute);
  transition: transform .2s ease, background .2s ease, color .2s ease;
  position: relative;
  z-index: 1;
}
.hero-tile:hover .hero-tile-arrow {
  background: var(--teal-700);
  color: var(--cream);
  transform: translateX(3px);
}
.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.96;
  font-size: clamp(56px, 8vw, 116px);
  margin: 18px 0 24px;
  color: var(--ink);
}
.hero-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--teal-700);
}
.hero-title .dot {
  display: inline-block;
  width: 0.32em; height: 0.32em;
  background: var(--coral);
  border-radius: 50%;
  vertical-align: 0.08em;
  margin-left: 0.08em;
}
.hero-lede {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0 0 28px;
  line-height: 1.5;
}
.hero-ctas {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.hero-demo {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 320px;
  align-self: center;
  width: 100%;
}
.hero-demo-head {
  display: flex; align-items: center; justify-content: space-between;
}
.hero-demo-cta {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-mono);
}
.hero-demo-cta:hover { border-color: var(--teal-500); color: var(--teal-700); }
.hero-demo-summary {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 6px;
}
.hero-demo-big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 5vw, 64px);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 12px 0 4px;
  font-feature-settings: "tnum";
  color: var(--ink);
}
.hero-demo-gain {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--teal-700);
}
[data-theme="dark"] .hero-demo-gain { color: var(--teal-500); }
.hero-demo input[type="range"] { margin-top: 14px; width: 100%; }
.hero-demo-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-top: 16px;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
}
.hero-demo-foot .lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.hero-demo-foot .val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-top: 4px;
  font-feature-settings: "tnum";
}

/* ============ basic calculator (home hero) ============ */
.basic-calc {
  position: relative;
  background: var(--card-strong);
  border: 1px solid var(--glass-edge);
  border-radius: 28px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: stretch;
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 28px 56px -20px rgba(50, 50, 100, 0.32);
}
[data-theme="dark"] .basic-calc {
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 28px 56px -20px rgba(0,0,0,0.6);
}
.basic-calc::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 35%);
}
[data-theme="dark"] .basic-calc::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 35%);
}

.calc-display {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, rgba(15, 25, 40, 0.92) 0%, rgba(8, 50, 70, 0.88) 100%);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 18px 22px;
  color: var(--cream);
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset;
}
.calc-display::after {
  content: "";
  position: absolute;
  inset: auto -30px -50px auto;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(127, 215, 210, 0.55) 0%, rgba(200, 185, 245, 0.3) 40%, transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}
.calc-history {
  position: relative; z-index: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(252, 246, 217, 0.55);
  min-height: 14px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calc-value {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 4.6vw, 56px);
  letter-spacing: -0.035em;
  text-align: right;
  line-height: 1;
  word-break: break-all;
  font-feature-settings: "tnum";
}

.calc-keys {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.key {
  position: relative;
  height: 60px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--card-strong);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.55) inset,
    0 6px 14px -8px rgba(50,50,80,0.22);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .key {
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 6px 14px -8px rgba(0,0,0,0.45);
}
.key::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.55), rgba(255,255,255,0));
  pointer-events: none;
}
[data-theme="dark"] .key::before {
  background: linear-gradient(to bottom, rgba(255,255,255,0.15), rgba(255,255,255,0));
}
.key:hover { filter: brightness(1.04); }
.key:active { transform: translateY(1px) scale(0.98); }

.key.key-wide {
  grid-column: span 2;
  border-radius: 999px;
  text-align: left;
  padding-left: 28px;
}

/* Function keys (AC, ±, %) — slightly warm tint */
.key.key-fn {
  color: var(--ink);
  background: linear-gradient(135deg, color-mix(in oklab, var(--peach) 65%, white), color-mix(in oklab, var(--peach) 45%, white));
}
[data-theme="dark"] .key.key-fn {
  background: linear-gradient(135deg, rgba(252, 221, 183, 0.22), rgba(252, 221, 183, 0.12));
  color: var(--ink);
}

/* Operator keys (÷ × − +) — coral tint */
.key.key-op {
  background: linear-gradient(135deg, #f5b5a0, #f08a7a);
  color: white;
  font-size: 26px;
  font-weight: 500;
}
.key.key-op.is-active {
  background: linear-gradient(135deg, white 0%, #fff6f4 100%);
  color: var(--coral-deep);
  box-shadow:
    0 0 0 2px var(--coral) inset,
    0 6px 18px -6px rgba(233,110,93,0.5);
}

/* Equals key — primary coral pill */
.key.key-eq {
  background: linear-gradient(135deg, #f08a7a 0%, var(--coral) 50%, #d65a4a 100%);
  color: white;
  font-size: 26px;
  font-weight: 600;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.4) inset,
    0 -2px 6px rgba(0,0,0,0.08) inset,
    0 10px 24px -10px rgba(233, 110, 93, 0.65);
}
.key.key-eq::before {
  background: linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0));
}
.key.key-eq:hover {
  filter: brightness(1.05);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.45) inset,
    0 -2px 6px rgba(0,0,0,0.08) inset,
    0 14px 32px -10px rgba(233, 110, 93, 0.8);
}

@media (max-width: 760px) {
  .basic-calc {
    max-width: none;
    margin-left: 0;
    padding: 16px;
    border-radius: 24px;
  }
  .calc-display { padding: 14px 16px; min-height: 96px; border-radius: 16px; }
  .calc-value { font-size: 40px; }
  .calc-keys { gap: 8px; }
  .key { height: 54px; font-size: 20px; }
  .key.key-op, .key.key-eq { font-size: 22px; }
}
@media (max-width: 380px) {
  .key { height: 48px; font-size: 18px; }
  .calc-display { min-height: 86px; }
  .calc-value { font-size: 34px; }
}

/* ============ compact masthead ============ */
.masthead {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: end;
  padding: 56px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.masthead-left .eyebrow {
  margin-bottom: 10px;
}
.masthead-title {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-size: clamp(24px, 2.4vw, 32px);
  color: var(--ink-soft);
  margin: 0;
  max-width: 32ch;
}
.masthead-title em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}
.masthead-title .dot,
.dot-coral {
  display: inline-block;
  width: 0.32em; height: 0.32em;
  background: var(--coral);
  border-radius: 50%;
  vertical-align: 0.08em;
  margin-left: 0.18em;
}
.dot-coral { color: transparent; }
.masthead-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
}
.masthead-right .filter-row {
  justify-content: flex-end;
}
.home-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  padding: 10px 16px;
  width: 280px;
  max-width: 100%;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 4px 14px -8px rgba(50,50,80,0.16);
}
[data-theme="dark"] .home-search { box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 4px 14px -8px rgba(0,0,0,0.4); }
.home-search input {
  border: none; outline: none; background: transparent;
  flex: 1;
  font-size: 14px;
  min-width: 0;
}
.home-search input::-webkit-search-decoration,
.home-search input::-webkit-search-cancel-button,
.home-search input::-webkit-search-results-button,
.home-search input::-webkit-search-results-decoration { display: none; }
.home-search-clear {
  background: var(--line);
  color: var(--ink);
  border: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* ============ tool grid — even tiles ============ */
.filter-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--glass-edge);
  background: var(--card);
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 4px 12px -6px rgba(50,50,80,0.16);
}
[data-theme="dark"] .chip { box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 4px 12px -6px rgba(0,0,0,0.4); }
.chip:hover {
  border-color: color-mix(in oklab, var(--teal-500) 60%, var(--glass-edge));
  color: var(--teal-700);
}
[data-theme="dark"] .chip:hover { color: var(--teal-300); }
.chip.is-active {
  background: linear-gradient(135deg, rgba(20,30,50,0.92), rgba(8,40,55,0.95));
  border-color: rgba(20,30,50,0.95);
  color: var(--hero-fg);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 6px 18px -6px rgba(20,30,50,0.5);
}
[data-theme="dark"] .chip.is-active {
  background: linear-gradient(135deg, rgba(127, 215, 210, 0.3), rgba(31, 184, 176, 0.45));
  border-color: rgba(31, 184, 176, 0.6);
  color: var(--cream);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 6px 18px -6px rgba(31,184,176,0.45);
}
.chip-count {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.chip.is-active .chip-count {
  background: color-mix(in oklab, var(--hero-fg) 18%, transparent);
  color: var(--hero-fg);
}

/* Bento grid: 12 cols, lg=4 cols (3 per row), md=3 cols (4 per row).
   Default row pattern with all 10 tools: 3 lg / 4 md / 3 lg. */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: dense;
  gap: 14px;
}
.tool-card { grid-column: span 4; }  /* default */
.tool-card[data-size="lg"] { grid-column: span 4; }
.tool-card[data-size="md"] { grid-column: span 3; }
.tool-card[data-size="lg"] { min-height: 250px; }
.tool-card[data-size="md"] { min-height: 220px; }
.empty-grid {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-grid h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.02em;
}
.empty-grid p {
  margin: 0;
  color: var(--ink-mute);
  font-size: 14px;
}
.tool-card {
  border-radius: 22px;
  padding: 22px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s ease, border-color .25s ease;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Skip painting off-screen cards. contain-intrinsic-size keeps the layout
     stable (so the scrollbar doesn't jump) and prevents content-visibility
     from collapsing the card to zero height before it scrolls into view.
     Browsers without content-visibility support just ignore both lines. */
  content-visibility: auto;
  contain-intrinsic-size: 240px;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    0 28px 56px -18px rgba(50,50,100,0.32);
  border-color: var(--glass-edge);
}
.tool-card:active {
  transform: translateY(-1px);
}
.tool-card .ix {
  position: absolute; top: 14px; right: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
}
.tool-card .glyph {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.tool-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  line-height: 1.15;
}
.tool-card p {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0;
  line-height: 1.4;
}
.tool-card .meta {
  margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
}
.tool-card .meta-dot {
  width: 3px; height: 3px;
  background: var(--ink-mute);
  border-radius: 50%;
}
.tool-card .meta .arrow {
  margin-left: auto;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--field-bg);
  display: grid; place-items: center;
  transition: all .2s ease;
}
.tool-card:hover .meta .arrow {
  background: var(--teal-700);
  color: var(--cream);
  transform: translateX(3px);
}

/* color variants */
.tool-card[data-tone="teal"] .glyph { background: var(--teal-700); color: var(--cream); }
.tool-card[data-tone="coral"] .glyph { background: var(--coral); color: var(--cream); }
.tool-card[data-tone="peach"] .glyph { background: var(--peach); color: var(--coral-deep); }
.tool-card[data-tone="cream"] .glyph { background: var(--cream); color: var(--teal-700); border:1px solid var(--line); }
.tool-card[data-tone="ink"] .glyph { background: var(--hero-bg); color: var(--hero-fg); }
.tool-card[data-tone="bright"] .glyph { background: var(--teal-500); color: var(--cream); }


/* ============ tool detail ============ */
.crumbs {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.crumbs a { cursor: pointer; }
.crumbs a:hover { color: var(--teal-700); }

.tool-header {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: end;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}
.tool-header-left { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.tool-header-glyph {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  margin-bottom: 14px;
}
.tool-header-glyph[data-tone="teal"]   { background: var(--teal-700); color: var(--cream); }
.tool-header-glyph[data-tone="coral"]  { background: var(--coral);    color: var(--cream); }
.tool-header-glyph[data-tone="peach"]  { background: var(--peach);    color: var(--coral-deep); }
.tool-header-glyph[data-tone="cream"]  { background: var(--cream);    color: var(--teal-700); border: 1px solid var(--line); }
.tool-header-glyph[data-tone="ink"]    { background: var(--hero-bg);  color: var(--hero-fg); }
.tool-header-glyph[data-tone="bright"] { background: var(--teal-500); color: var(--cream); }
.tool-header-glyph svg { width: 28px; height: 28px; }
.tool-header-eyebrow { margin-bottom: 8px; }
.tool-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.98;
  font-size: clamp(40px, 6vw, 76px);
  margin: 12px 0 16px;
  color: var(--ink);
}
.tool-header h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--teal-700);
}
.tool-header p {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 50ch;
  margin: 0;
}
.tool-header .quick-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.qstat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.qstat .lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.qstat .val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  word-break: break-word;
}

/* ============ calculator layout ============ */
.calc {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 28px;
  align-items: start;
}
.calc > * { min-width: 0; }
.calc-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
}
.calc-panel.dark {
  background: linear-gradient(135deg, rgba(15, 25, 40, 0.88) 0%, rgba(8, 60, 80, 0.85) 100%);
  color: var(--hero-fg);
  border-color: rgba(255,255,255,0.18);
}
.calc-panel h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.calc-panel .dot-tag {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--coral);
}
.field {
  display: flex; flex-direction: column;
  margin-bottom: 16px;
}
.field-label {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  gap: 8px;
}
.field-label .hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-align: right;
  white-space: nowrap;
}
.input-wrap {
  display: flex; align-items: stretch;
  background: var(--field-bg);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
  min-height: 48px;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    0 4px 14px -8px rgba(50,50,80,0.18);
}
[data-theme="dark"] .input-wrap {
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 4px 14px -8px rgba(0,0,0,0.4);
}
.input-wrap:focus-within {
  border-color: color-mix(in oklab, var(--teal-500) 60%, var(--glass-edge));
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    0 0 0 3px color-mix(in oklab, var(--teal-500) 22%, transparent),
    0 6px 20px -8px rgba(31, 184, 176, 0.4);
}
.input-wrap .pre, .input-wrap .post {
  display: grid; place-items: center;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-mute);
  background: transparent;
  flex-shrink: 0;
}
.input-wrap input, .input-wrap select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 16px; /* 16px+ prevents iOS auto-zoom on focus */
  font-feature-settings: "tnum";
  min-width: 0;
  width: 100%;
}
.input-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236a7479' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.input-wrap input[type="date"] {
  font-family: var(--font-sans);
  font-size: 16px;
}
/* hide number spinners — they confuse on mobile */
.input-wrap input[type="number"]::-webkit-outer-spin-button,
.input-wrap input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-wrap input[type="number"] { -moz-appearance: textfield; }

.field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }

/* sliders */
.slider-row {
  display: flex; align-items: center; gap: 14px;
  margin-top: 6px;
}
.slider-row input[type="range"] { flex: 1; }

/* Range input — styled via ::-webkit-slider-runnable-track and
   ::-moz-range-track so we don't fight the global box-sizing: border-box
   (which silently zeroed the content height when we tried padding+clip). */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;          /* the touch hit area */
  background: transparent;
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

/* Track — same gradient for both engines */
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--teal-700) 0%,
    var(--teal-700) var(--p, 50%),
    rgba(50, 70, 90, 0.22) var(--p, 50%),
    rgba(50, 70, 90, 0.22) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--teal-700) 0%,
    var(--teal-700) var(--p, 50%),
    rgba(50, 70, 90, 0.22) var(--p, 50%),
    rgba(50, 70, 90, 0.22) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Dark-mode track contrast — the right-side unfilled portion needs to
   show up on the deeper canvas. */
[data-theme="dark"] input[type="range"]::-webkit-slider-runnable-track,
[data-theme="dark"] input[type="range"]::-moz-range-track {
  background: linear-gradient(
    to right,
    var(--teal-500) 0%,
    var(--teal-500) var(--p, 50%),
    rgba(255, 255, 255, 0.13) var(--p, 50%),
    rgba(255, 255, 255, 0.13) 100%
  );
  border-color: rgba(255, 255, 255, 0.1);
}

/* Thumb — vertically centered on the 6px track inside the 28px hit area
   (margin-top compensates between thumb height and track height). */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -8px;          /* (22-6)/2 = 8 */
  width: 22px; height: 22px;
  background: var(--cream);
  border: 2px solid var(--teal-700);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(11, 37, 43, .25);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  background: var(--cream);
  border: 2px solid var(--teal-700);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(11, 37, 43, .25);
}

input[type="range"]:focus-visible::-webkit-slider-thumb,
input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 3px solid color-mix(in oklab, var(--teal-500) 40%, transparent);
  outline-offset: 2px;
}

/* segmented */
.seg {
  display: inline-flex;
  background: var(--field-bg);
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  padding: 4px;
  max-width: 100%;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 4px 14px -8px rgba(50,50,80,0.16);
}
[data-theme="dark"] .seg { box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 4px 14px -8px rgba(0,0,0,0.4); }
.seg button {
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-soft);
  white-space: nowrap;
  min-height: 36px;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
  position: relative;
}
.seg button.is-active {
  background: linear-gradient(135deg, rgba(20,30,50,0.92), rgba(8,40,55,0.95));
  color: var(--hero-fg);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 4px 14px -4px rgba(20,30,50,0.45);
}
[data-theme="dark"] .seg button.is-active {
  background: linear-gradient(135deg, rgba(127, 215, 210, 0.25), rgba(31, 184, 176, 0.4));
  color: var(--cream);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 4px 14px -4px rgba(31,184,176,0.45);
}

.btn {
  position: relative;
  border: 1px solid var(--coral);
  background: linear-gradient(135deg, #f08a7a 0%, var(--coral) 50%, #d65a4a 100%);
  color: white;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: filter .2s ease, transform .1s ease, box-shadow .2s ease;
  min-height: 46px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.4) inset,
    0 -2px 6px rgba(0,0,0,0.08) inset,
    0 10px 24px -10px rgba(233, 110, 93, 0.55);
  overflow: hidden;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 40%;
  border-radius: 999px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0));
  pointer-events: none;
}
.btn:hover { filter: brightness(1.04); box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 -2px 6px rgba(0,0,0,0.08) inset, 0 14px 32px -10px rgba(233, 110, 93, 0.7); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: var(--card);
  color: var(--ink-soft);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 6px 16px -8px rgba(50,50,80,0.2);
}
.btn-ghost::before {
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), rgba(255,255,255,0));
}
[data-theme="dark"] .btn-ghost {
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 6px 16px -8px rgba(0,0,0,0.4);
}
.btn-ghost:hover {
  border-color: color-mix(in oklab, var(--teal-500) 60%, var(--glass-edge));
  color: var(--teal-700);
}
[data-theme="dark"] .btn-ghost:hover { color: var(--teal-300); }

/* results */
.result-hero {
  background:
    linear-gradient(135deg, rgba(15, 25, 40, 0.88) 0%, rgba(8, 60, 80, 0.85) 100%);
  color: var(--hero-fg);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  padding: 32px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 24px 56px -20px rgba(8, 30, 50, 0.55);
}
.result-hero::before {
  content: "";
  position: absolute;
  inset: auto -40px -80px auto;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    rgba(127, 215, 210, 0.7) 0%,
    rgba(200, 185, 245, 0.4) 35%,
    transparent 70%);
  opacity: 0.7;
  filter: blur(8px);
}
.result-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 35%);
}
.result-hero .lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--cream) 60%, transparent);
  position: relative;
  z-index: 1;
}
.result-hero .big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 7vw, 72px);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 10px 0 6px;
  font-feature-settings: "tnum";
  position: relative;
  z-index: 1;
  word-break: break-word;
}
.result-hero .sub {
  color: color-mix(in oklab, var(--cream) 75%, transparent);
  font-size: 14px;
  position: relative;
  z-index: 1;
}
.result-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 18px;
}
.rstat {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.rstat .lbl { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--ink-mute); text-transform: uppercase; }
.rstat .val { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin-top: 4px; letter-spacing: -0.02em; font-feature-settings: "tnum"; word-break: break-word; }
.rstat .delta { font-family: var(--font-mono); font-size: 11px; color: var(--teal-700); margin-top: 4px; }

/* chart area */
.chart-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  margin-top: 18px;
}
.chart-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
  flex-wrap: wrap;
}
.chart-head h5 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.legend .sw {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* table */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -22px;
  padding: 0 22px;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-mute);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10.5px;
  white-space: nowrap;
}
.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
/* Data rows want nowrap (numbers in columns must align), but full-width
   "explanation" rows that use colspan should wrap normally — they're
   usually a sentence of prose ("$11,152 + 4.5% on portion above
   $372,000"). Without this, long formulas overflow the card on mobile. */
.tbl td[colspan] {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.tbl tr:hover td { background: var(--paper-soft); }

/* misc badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--peach);
  color: var(--coral-deep);
}
.badge.open { background: color-mix(in oklab, var(--teal-500) 30%, white); color: var(--teal-900); }
.badge.closed { background: var(--peach); color: var(--coral-deep); }
.badge.pre { background: var(--line-soft); color: var(--ink-soft); }

/* related */
.related {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}
.related h4 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.related-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.related-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.related-card:hover { border-color: var(--teal-500); }
.related-card .title { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.related-card .sub { font-size: 12.5px; color: var(--ink-mute); }

/* ============ about page ============ */
.about-header {
  padding: 24px 0 48px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 48px;
}
.about-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  font-size: clamp(36px, 5.5vw, 68px);
  margin: 16px 0 20px;
  max-width: 18ch;
}
.about-header p {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0;
  line-height: 1.55;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 56px;
}
.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 28px;
}
.about-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 10px 0 10px;
}
.about-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.about-stack {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px;
}
.about-stack h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 12px 0 16px;
}
.about-stack ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.about-stack li {
  font-size: 14px;
  color: var(--ink-soft);
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.about-stack li:last-child { border-bottom: none; }
.about-stack strong { color: var(--ink); font-weight: 600; }

/* footer */
.foot {
  margin-top: 80px;
  padding: 40px 36px 36px;
  padding-left: max(36px, var(--safe-l));
  padding-right: max(36px, var(--safe-r));
  padding-bottom: calc(36px + var(--safe-b));
  border-top: 1px solid var(--glass-edge);
  background: color-mix(in oklab, var(--paper) 55%, transparent);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  position: relative;
}
.foot-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  /* Brand block (2fr) + tool columns (1fr each). Adding a tool category
     means adding a 1fr to keep the row balanced. The 'Site' block at the
     end of the JSX wraps to a second row under the brand. */
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px;
}
.foot h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 12px;
}
.foot ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.foot li { cursor: pointer; }
.foot li:hover { color: var(--teal-700); }
.foot-tag {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.foot-tag .dot { color: var(--coral); }
.foot-note { font-size: 12.5px; color: var(--ink-mute); margin-top: 16px; max-width: 38ch; }
.foot-bar {
  max-width: 1280px;
  margin: 28px auto 0;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============ responsive ============ */
@media (max-width: 1380px) {
  .rail-inner { width: 140px; }
  .ad-slot { width: 140px; }
  .ad-slot.tall { height: 500px; }
}
@media (max-width: 1180px) {
  .rail { padding: 36px 6px 0; }
  .rail-inner { width: 100px; gap: 10px; }
  .ad-slot { width: 100px; padding: 12px 6px; }
  .ad-slot.tall { height: 380px; }
  .ad-slot.short { height: 180px; }
  .ad-slot .ad-size { font-size: 10px; }
  .ad-slot .ad-note { display: none; }
  .page { padding: 40px 24px 80px; padding-left: max(24px, var(--safe-l)); padding-right: max(24px, var(--safe-r)); }
  /* Bento: tighten to 8-col so it still feels intentional */
  .tool-grid { grid-template-columns: repeat(8, 1fr); }
  .tool-card[data-size="lg"] { grid-column: span 4; }
  .tool-card[data-size="md"] { grid-column: span 4; }
}

/* tablet -> below */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 24px 0 40px; }
  .hero-demo, .basic-calc { min-height: 0; }
  /* Split hero on mobile: stack vertically, calc first for primary CTA.
     The clock is hidden — the OS status bar already shows time and the
     hero needs to stay compact on small screens. */
  .hero.hero-split { grid-template-columns: 1fr; gap: 20px; padding: 16px 0 32px; }
  .hero.hero-split > .basic-calc { order: 1; margin: 0 auto; max-width: 520px; width: 100%; }
  .hero.hero-split > .hero-left   { order: 2; }
  .hero-left { flex-direction: column; }
  .hero-tiles { margin-top: 0; }
  .hero-clock { display: none; }
  .hero-tile { padding: 14px 16px; gap: 12px; border-radius: 16px; }
  .hero-tile-glyph { width: 44px; height: 44px; border-radius: 12px; }
  .hero-tile-glyph svg { width: 22px; height: 22px; }
  .hero-tile-name { font-size: 17px; }
  .hero-tile-desc { font-size: 12.5px; }
  .masthead { grid-template-columns: 1fr; gap: 18px; align-items: stretch; padding: 36px 0 22px; }
  .masthead-right { align-items: stretch; flex-direction: column; }
  .masthead-right .filter-row { justify-content: flex-start; }
  .home-search { width: 100%; }
  /* Bento: stay 8-col, lg = 4 (2 per row), md = 4 (2 per row) → essentially 2x5 */
  .tool-grid { grid-template-columns: repeat(8, 1fr); }
  .tool-card[data-size="lg"] { grid-column: span 4; }
  .tool-card[data-size="md"] { grid-column: span 4; }
  .tool-card[data-size="lg"] { min-height: 220px; }
  .tool-card[data-size="md"] { min-height: 200px; }
  .tool-header { grid-template-columns: 1fr; gap: 24px; }
  .calc { grid-template-columns: 1fr; gap: 18px; }
  .related-row { grid-template-columns: 1fr 1fr; }
  .foot-inner { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}

/* phones */
@media (max-width: 760px) {
  .nav {
    padding: 12px 16px;
    padding-left: max(16px, var(--safe-l));
    padding-right: max(16px, var(--safe-r));
    gap: 12px;
  }
  .nav-search { display: none; }
  .nav-wordmark { font-size: 18px; }
  .nav-mark { width: 28px; height: 28px; font-size: 15px; }
  .theme-toggle { width: 40px; height: 40px; }
  .rail { display: none; }
  .layout { grid-template-columns: 1fr; }
  .page {
    padding: 24px 18px 60px;
    padding-left: max(18px, var(--safe-l));
    padding-right: max(18px, var(--safe-r));
  }
  .page-home { padding-top: 18px; }

  /* hero */
  .hero { padding: 12px 0 28px; }
  .hero.hero-solo { padding: 16px 0 32px; }
  .hero-title { font-size: clamp(44px, 14vw, 72px); margin: 12px 0 18px; }
  .hero-lede { font-size: 15px; margin-bottom: 20px; }
  .hero-ctas { gap: 8px; }
  .hero-ctas .btn { padding: 13px 14px; min-width: 0; font-size: 14px; white-space: nowrap; }
  .hero-ctas .btn:first-child { flex: 1; }
  .hero-demo { padding: 18px 20px; min-height: 0; }
  .hero-demo-big { font-size: 38px; }

  /* masthead */
  .masthead { padding: 28px 0 18px; margin-bottom: 18px; }
  .masthead-title { font-size: 20px; }

  /* tool grid -> 2 cols, tighter (bento collapses) */
  .tool-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tool-card,
  .tool-card[data-size="lg"],
  .tool-card[data-size="md"] {
    grid-column: span 1;
    min-height: 200px;
    padding: 16px;
    border-radius: 16px;
  }
  .tool-card .ix { top: 10px; right: 12px; font-size: 10px; }
  .tool-card .glyph { width: 36px; height: 36px; margin-bottom: 10px; border-radius: 10px; }
  .tool-card .glyph svg { width: 20px; height: 20px; }
  .tool-card h3 { font-size: 15px; }
  .tool-card p { font-size: 11.5px; }
  .tool-card .meta { font-size: 9px; gap: 5px; }
  .tool-card .meta .arrow { width: 20px; height: 20px; }
  .tool-card .meta .arrow svg { width: 12px; height: 12px; }

  /* tool detail header */
  .tool-header { padding-bottom: 24px; margin-bottom: 24px; gap: 18px; }
  .tool-header h1 { font-size: clamp(36px, 11vw, 56px); margin: 8px 0 12px; }
  .tool-header p { font-size: 15px; }
  .tool-header-glyph { width: 48px; height: 48px; margin-bottom: 10px; }
  .tool-header-glyph svg { width: 24px; height: 24px; }
  .qstat { padding: 12px 14px; }
  .qstat .val { font-size: 18px; }

  /* calc panel */
  .calc-panel { padding: 18px; border-radius: 16px; }
  .calc-panel h4 { font-size: 16px; margin-bottom: 14px; }
  .result-hero { padding: 22px 22px; border-radius: 16px; }
  .result-hero .big { font-size: clamp(36px, 11vw, 56px); }
  .chart-wrap { padding: 16px; border-radius: 16px; margin-top: 12px; }
  .chart-wrap .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
  .chart-head h5 { font-size: 15px; }

  /* result grid */
  .result-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .rstat { padding: 11px 13px; border-radius: 11px; }
  .rstat .val { font-size: 17px; }

  /* field stuff */
  .field { margin-bottom: 14px; }
  .field-row { gap: 8px; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .field-label { font-size: 12.5px; margin-bottom: 6px; }
  .input-wrap { min-height: 48px; }  /* better touch target */
  .input-wrap input, .input-wrap select { padding: 12px 12px; font-size: 16px; }
  .input-wrap .pre, .input-wrap .post { padding: 0 10px; font-size: 12.5px; }

  /* seg buttons wider tap */
  .seg button { padding: 10px 12px; font-size: 13px; flex: 1; }

  /* related */
  .related { margin-top: 36px; padding-top: 24px; }
  .related h4 { font-size: 18px; }
  .related-row { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* footer */
  .foot { padding: 28px 18px; padding-bottom: calc(28px + var(--safe-b)); margin-top: 48px; }
  .foot-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .foot-tag { font-size: 26px; }
  .foot-bar { font-size: 10px; flex-direction: column; gap: 6px; align-items: flex-start; }

  /* about */
  .about-header { padding: 16px 0 28px; margin-bottom: 28px; }
  .about-header h1 { font-size: 36px; }
  .about-header p { font-size: 15px; }
  .about-card { padding: 20px; border-radius: 14px; }
  .about-card h3 { font-size: 19px; }
  .about-stack { padding: 22px; }
  .about-stack h3 { font-size: 22px; }
}

/* extra-small phones */
@media (max-width: 380px) {
  .nav { gap: 8px; padding: 10px 12px; }
  .nav-wordmark { display: none; }
  .nav-mark { width: 32px; height: 32px; }
  .theme-toggle { width: 38px; height: 38px; }
  .nav-burger { width: 38px; height: 38px; }
  .hero-title { font-size: 44px; }
  .hero-demo-big { font-size: 32px; }
  .tool-card { padding: 14px; min-height: 184px; }
  .tool-card h3 { font-size: 14px; }
  .result-hero { padding: 18px; }
  .field-row { grid-template-columns: 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .foot-inner { grid-template-columns: 1fr; }
}

/* prevent hover sticking on touch */
@media (hover: none) {
  .tool-card:hover { transform: none; box-shadow: none; border-color: var(--line); }
  .tool-card:hover .meta .arrow { background: var(--field-bg); color: var(--ink-mute); transform: none; }
  .theme-toggle:hover { transform: none; }
  .chip:hover { border-color: var(--line); color: var(--ink-soft); }
  .nav-links a:hover { color: var(--ink-soft); }
}

/* ============ timezone clocks ============ */
.tz-clocks {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
}
.tz-arrow {
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.tz-arrow > div {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  display: grid;
  place-items: center;
}
@media (max-width: 540px) {
  .tz-clocks { grid-template-columns: 1fr; }
  .tz-arrow > div { transform: rotate(90deg); }
}

/* ============ world markets ============ */
.markets { margin-top: 36px; }

/* — Visual world map ─────────────────────────────────── */
.wm-wrap {
  position: relative;
  margin: 0 0 24px;
  border: 1px solid var(--glass-edge);
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(15, 25, 40, 0.72) 0%, rgba(8, 50, 70, 0.78) 100%);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 24px 56px -20px rgba(8, 30, 50, 0.55);
}
.wm-wrap::after {
  /* subtle pastel glow in the corner like the result-hero */
  content: "";
  position: absolute;
  inset: auto -40px -80px auto;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    rgba(127, 215, 210, 0.32) 0%,
    rgba(200, 185, 245, 0.18) 35%,
    transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
.wm-map-inner {
  position: relative;
  aspect-ratio: 1000 / 500;
  width: 100%;
}
.wm-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.wm-noon {
  position: absolute;
  top: 0; bottom: 38px;
  width: 1px;
  background: linear-gradient(to bottom,
    rgba(255, 240, 180, 0) 0%,
    rgba(255, 240, 180, 0.55) 30%,
    rgba(255, 240, 180, 0.55) 70%,
    rgba(255, 240, 180, 0) 100%);
  box-shadow: 0 0 12px rgba(255, 240, 180, 0.4);
  pointer-events: none;
  transition: left 1s linear;
}

/* — Sticker (a glass pill anchored at a city's coordinates) ─── */
.wm-sticker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1f2a;
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 4px 10px -2px rgba(0, 10, 30, 0.45);
  transition: transform .15s ease, box-shadow .15s ease, z-index 0s linear .15s;
  z-index: 1;
}
.wm-sticker:hover {
  transform: translate(-50%, -50%) scale(1.12);
  z-index: 5;
  transition: transform .15s ease, box-shadow .15s ease, z-index 0s;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 6px 18px -2px rgba(0, 10, 30, 0.6);
}
.wm-sticker-time {
  font-weight: 500;
  font-feature-settings: "tnum";
  letter-spacing: -0.03em;
}
.wm-sticker-code {
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  background: #1a1f2a;
  color: var(--cream);
  font-size: 9.5px;
  letter-spacing: 0.05em;
}
.wm-sticker-status {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.wm-sticker-status.open   { background: #3acf6f; box-shadow: 0 0 6px rgba(58,207,111,0.7); }
.wm-sticker-status.pre    { background: #f5c155; box-shadow: 0 0 6px rgba(245,193,85,0.7); }
.wm-sticker-status.closed { background: #f06557; box-shadow: 0 0 6px rgba(240,101,87,0.5); }

/* Tone the whole pill by status */
.wm-sticker[data-status="closed"] { opacity: 0.62; }
.wm-sticker[data-status="open"]   { background: linear-gradient(135deg, #d8f2e0, #b4e8c4); }
.wm-sticker[data-status="pre"]    { background: linear-gradient(135deg, #fce6c0, #f7d397); }

/* — Legend ──────────────────────────────────────────── */
.wm-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 10px 16px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(252, 246, 217, 0.7);
  border-top: 1px solid rgba(255,255,255,0.1);
  position: relative;
  z-index: 1;
}
.wm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wm-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.wm-dot.open   { background: #3acf6f; }
.wm-dot.pre    { background: #f5c155; }
.wm-dot.closed { background: #f06557; }
.wm-legend-noon i {
  display: inline-block;
  width: 2px; height: 11px;
  background: rgba(255, 240, 180, 0.7);
  box-shadow: 0 0 4px rgba(255, 240, 180, 0.6);
}

/* — Mobile: shrink stickers, hide on very small screens ── */
@media (max-width: 760px) {
  .wm-wrap { border-radius: 16px; margin-bottom: 16px; }
  .wm-sticker {
    padding: 3px 6px 3px 5px;
    font-size: 8.5px;
    gap: 3px;
  }
  .wm-sticker-code { font-size: 8px; padding: 1px 3px; }
  .wm-sticker-status { width: 5px; height: 5px; }
  .wm-legend { font-size: 10px; gap: 10px; padding: 8px 12px 10px; }
}
@media (max-width: 480px) {
  /* Condensed map: only open exchanges show (handled in JSX via the
     isSmall flag). Hide the solar-noon line — too much detail for the size. */
  .wm-noon { display: none; }
  /* Markers shrink further so they don't overlap on a phone */
  .wm-sticker {
    padding: 2px 5px 2px 4px;
    font-size: 8px;
    gap: 2px;
  }
  .wm-sticker-code { font-size: 7.5px; padding: 0 3px; }
  .wm-sticker-status { width: 4px; height: 4px; }
}

.markets-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.markets-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 26px;
  margin: 0;
}
.markets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.market-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.market-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  color: white;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  background: var(--teal-700);
}
.market-logo[data-tone="teal"]   { background: var(--teal-700); color: var(--cream); }
.market-logo[data-tone="coral"]  { background: var(--coral);    color: var(--cream); }
.market-logo[data-tone="peach"]  { background: var(--peach);    color: var(--coral-deep); }
.market-logo[data-tone="ink"]    { background: var(--hero-bg);  color: var(--hero-fg); }
.market-logo[data-tone="bright"] { background: var(--teal-500); color: var(--cream); }
.market-body { min-width: 0; }
.market-name-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.market-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.market-city { font-size: 11px; color: var(--ink-mute); }
.market-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.market-status { text-align: right; }
.market-until { font-size: 10.5px; color: var(--ink-mute); margin-top: 6px; white-space: nowrap; }

@media (max-width: 760px) {
  .markets-head h2 { font-size: 20px; }
  .markets-grid { grid-template-columns: 1fr; gap: 8px; }
  .market-card { padding: 12px 14px; gap: 10px; }
  .market-logo { width: 38px; height: 38px; border-radius: 10px; font-size: 11px; }
  .market-name { font-size: 15px; }
  .market-meta { font-size: 11px; }
  .market-until { font-size: 10px; }
}

/* ============ currency popular grid ============ */
.ccy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ccy-card {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  cursor: pointer;
}
.ccy-card.is-active {
  background: var(--hero-bg);
  color: var(--hero-fg);
  border-color: var(--hero-bg);
}
.ccy-card-eyebrow {
  color: var(--ink-mute);
}
.ccy-card.is-active .ccy-card-eyebrow {
  color: color-mix(in oklab, var(--hero-fg) 70%, transparent);
}
.ccy-card-val {
  font-size: 14px;
  margin-top: 4px;
  font-feature-settings: "tnum";
}
@media (max-width: 540px) {
  .ccy-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ccy-card { padding: 10px 12px; }
  .ccy-card-val { font-size: 13px; }
}

/* ============ compound takeaway ============ */
.takeaway {
  display: flex;
  align-items: center;
  gap: 24px;
}
.takeaway-body { flex: 1; min-width: 0; }
@media (max-width: 540px) {
  .takeaway { flex-direction: column; align-items: flex-start; gap: 16px; }
  .takeaway > svg { align-self: center; }
}

/* ============ age triple display ============ */
.age-triple {
  display: flex;
  gap: 28px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.age-triple > div {
  display: flex;
  flex-direction: column;
}
.age-triple .big { margin: 0; }
.age-unit {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: color-mix(in oklab, var(--cream) 70%, transparent);
}
@media (max-width: 540px) {
  .age-triple { gap: 18px; }
  .age-triple .big { font-size: clamp(32px, 12vw, 48px); }
}

/* ═══ Word Unscrambler ════════════════════════════════════════════
   Tile preview of the user's input + grouped result list with
   click-to-copy word chips. Tile colours echo a wooden Scrabble rack
   in both themes. */

/* Letter tiles showing the user's current input. Each tile carries the
   Scrabble point value in the corner — blank tiles show no letter and
   no value but get a dashed border. */
.wu-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 18px;
}
.wu-tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 42px;
  border-radius: 7px;
  background: linear-gradient(135deg, #fef0c8 0%, #f5d990 100%);
  color: #1a1f2a;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 -2px 0 rgba(0,0,0,0.08) inset,
    0 2px 4px rgba(80, 50, 0, 0.18);
  border: 1px solid rgba(160, 100, 30, 0.25);
}
.wu-tile.is-blank {
  background: rgba(255,255,255,0.5);
  border: 1.5px dashed rgba(120, 90, 40, 0.5);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}
.wu-tile-pts {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  color: rgba(70, 40, 0, 0.65);
  text-transform: none;
}
[data-theme="dark"] .wu-tile {
  background: linear-gradient(135deg, #d8b774 0%, #b89252 100%);
  color: #1a1411;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.4) inset,
    0 -2px 0 rgba(0,0,0,0.18) inset,
    0 2px 4px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .wu-tile.is-blank {
  background: rgba(255,255,255,0.12);
  border: 1.5px dashed rgba(216, 183, 116, 0.5);
}
[data-theme="dark"] .wu-tile-pts { color: rgba(40, 20, 5, 0.65); }

/* Results — one section per word-length, descending */
.wu-results {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wu-group {
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 12px 14px 14px;
}
.wu-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.wu-group-len {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}
.wu-group-count {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
}
.wu-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wu-word {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.wu-word:hover {
  transform: translateY(-1px);
  background: color-mix(in oklab, var(--cream) 50%, var(--surface));
  border-color: color-mix(in oklab, var(--ink) 25%, var(--line));
}
.wu-word:active {
  transform: translateY(0);
}
.wu-word-text {
  letter-spacing: 0.02em;
}
.wu-word-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.wu-word.is-active {
  background: color-mix(in oklab, var(--coral) 20%, var(--surface));
  border-color: color-mix(in oklab, var(--coral) 50%, var(--line));
}

/* ═══ Definition popover ════════════════════════════════════════════
   Floating panel anchored bottom-right on desktop, full-width bottom
   sheet on mobile. Persists until dismissed; clicking another word
   updates it in place. Powered by /api/define (Cloudflare Worker → DeepSeek). */
.wu-defpop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  max-width: calc(100vw - 32px);
  z-index: 100;
  padding: 18px 20px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 22px 44px -16px rgba(0, 20, 60, 0.4);
  animation: wu-defpop-in 0.18s cubic-bezier(.2,.8,.2,1);
}
@keyframes wu-defpop-in {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.wu-defpop-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.wu-defpop-close:hover { background: var(--surface-2); color: var(--ink); }
.wu-defpop-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 8px;
  text-transform: lowercase;
}
.wu-defpop-def {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  margin-bottom: 8px;
}
.wu-defpop-ex {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-mute);
  padding: 8px 10px;
  border-left: 2px solid color-mix(in oklab, var(--coral) 50%, var(--line));
  background: color-mix(in oklab, var(--coral) 6%, transparent);
  border-radius: 0 6px 6px 0;
}
.wu-defpop-ex em { color: var(--coral); font-style: normal; font-weight: 600; margin-right: 4px; }
.wu-defpop-err {
  font-size: 12px;
  color: var(--ink-mute);
  padding: 6px 0;
}
.wu-defpop-loading {
  font-size: 12px;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.wu-dots {
  display: inline-flex;
  gap: 3px;
}
.wu-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-mute);
  animation: wu-dot-bounce 1.2s ease-in-out infinite;
}
.wu-dots span:nth-child(2) { animation-delay: 0.15s; }
.wu-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wu-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}
.wu-defpop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.wu-defpop-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.wu-defpop-copy:hover {
  background: color-mix(in oklab, var(--coral) 12%, var(--surface-2));
  border-color: color-mix(in oklab, var(--coral) 40%, var(--line));
}
.wu-defpop-credit {
  font-size: 10px;
  color: var(--ink-mute);
  opacity: 0.7;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: opacity .12s ease, color .12s ease;
}
.wu-defpop-credit:hover {
  opacity: 1;
  color: var(--ink);
}

/* Mobile — bottom sheet across the full width */
@media (max-width: 540px) {
  .wu-defpop {
    bottom: 0;
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(16px + var(--safe-b, 0px));
  }
}

/* Small screens: smaller tiles, tighter result groups */
@media (max-width: 540px) {
  .wu-tile {
    width: 30px;
    height: 36px;
    font-size: 16px;
    border-radius: 6px;
  }
  .wu-tile-pts { font-size: 8px; bottom: 2px; right: 3px; }
  .wu-group { padding: 10px 12px 12px; }
  .wu-word { font-size: 12px; padding: 4px 7px 4px 9px; }
}

/* ═══ Base Converter ═══════════════════════════════════════════════
   Copy button anchored inside each number field, an inline error,
   and the clickable MSB-→-LSB bit grid that appears once a bit
   width is selected. */

/* Copy button — anchored to the right edge of each base field. The
   field's <TextInput> is wrapped in a position:relative div in the JSX,
   so this absolute-positioned button overlays the input's trailing
   space. .input-wrap itself has overflow:hidden, so the button lives
   as a sibling alongside it (both inside the same wrapping div). */
.base-copy {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.base-copy:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
.base-copy:active { transform: translateY(-50%) scale(0.94); }

/* Per-field validation message (red mono). Sits below the input. */
.base-field-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d35441;
  margin-top: 6px;
}
[data-theme="dark"] .base-field-error { color: #f0867a; }

/* Bit grid — one button per bit, MSB at the left. Byte separators are
   drawn as a tiny vertical gap so the eye can group nibbles/bytes
   naturally. The bit-position number sits below each cell in mono. */
.base-bit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 3px;
  margin-top: 6px;
}
.base-bit-sep {
  display: inline-block;
  width: 6px;
  height: 36px;
  pointer-events: none;
}
.base-bit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-mute);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .12s ease;
}
.base-bit:hover {
  border-color: color-mix(in oklab, var(--ink) 25%, var(--line));
  transform: translateY(-1px);
}
.base-bit.is-on {
  background: linear-gradient(135deg, color-mix(in oklab, var(--teal-700) 92%, white) 0%, var(--teal-700) 100%);
  color: #fff;
  border-color: color-mix(in oklab, var(--teal-700) 70%, transparent);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 2px 4px rgba(0, 20, 30, 0.18);
}
.base-bit-pos {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--ink-mute);
  opacity: 0.55;
  letter-spacing: 0;
}
.base-bit-grid { padding-bottom: 16px; } /* room for the bit-position labels */

/* Mobile: smaller bits, looser tap targets, hide bit-position labels
   below 16-bit since they crowd at narrow widths. */
@media (max-width: 540px) {
  .base-bit { width: 26px; height: 32px; font-size: 13px; }
  .base-bit-pos { font-size: 8px; bottom: -12px; }
  .base-bit-sep { width: 4px; height: 32px; }
  .base-copy { width: 26px; height: 26px; right: 6px; }
}

/* ═══ Text Summarizer ═════════════════════════════════════════════
   Glass-styled textarea and bullet list, matching the rest of the site. */

/* TL;DR card — keeps ResultHero's dark glass aesthetic but uses prose-
   sized body type instead of the display-numeral font. ResultHero is
   designed for short numerals ("$2,491") and renders sentences at 60+ px
   which looks like a billboard. */
.summarize-tldr {
  background:
    linear-gradient(135deg, rgba(15, 25, 40, 0.88) 0%, rgba(8, 60, 80, 0.85) 100%);
  color: var(--hero-fg);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 22px 24px 18px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 16px 36px -16px rgba(8, 30, 50, 0.45);
}
.summarize-tldr-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--cream) 55%, transparent);
  margin-bottom: 8px;
}
.summarize-tldr-text {
  font-family: var(--font-sans);
  font-size: clamp(17px, 1.5vw, 20px);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--hero-fg);
  margin: 0 0 14px;
}
.summarize-tldr-copy {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  color: color-mix(in oklab, var(--cream) 80%, transparent);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.summarize-tldr-copy:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.36);
  color: var(--cream);
}

.summarize-textarea {
  width: 100%;
  min-height: 240px;
  padding: 14px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  resize: vertical;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
}
.summarize-textarea:focus {
  border-color: color-mix(in oklab, var(--coral) 50%, var(--glass-edge));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--coral) 16%, transparent);
}
.summarize-textarea::placeholder {
  color: var(--ink-mute);
  opacity: 0.7;
}

/* Inline privacy notice — sits right under the textarea so users see it
   BEFORE pasting potentially sensitive content. Deliberately small but
   not buried; gray-on-paper, mono for the "this is system info" feel. */
.summarize-privacy {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  line-height: 1.55;
  letter-spacing: 0;
}
.summarize-privacy a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in oklab, var(--coral) 40%, transparent);
}
.summarize-privacy a:hover {
  text-decoration-color: var(--coral);
}

.summarize-bullets {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.summarize-bullets li {
  position: relative;
  padding: 10px 12px 10px 28px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.summarize-bullets li:last-child { border-bottom: none; }
.summarize-bullets li::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
