:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  background: #15191c;
  color: #f5f4ef;
  --ink: #1c1d21;
  --muted: #8c8d90;
  --accent: #f4b506;
  --input-accent: #ffd801;
  --on-accent: #111;
  --eyebrow-accent: #ffd801;
  --ambient-top: #3c3528;
  --ambient-mid: #25282b;
  /* Per-tool palette for the All tools cards: fill, text on dark, text on fill. */
  --c-rem: #f4b506; --t-rem: #ffd801; --i-rem: #111;
  --c-em: #ff5102; --t-em: #ff783d; --i-em: #111;
  --c-vw: #b2d8d9; --t-vw: #b2d8d9; --i-vw: #111;
  --c-vh: #014a2c; --t-vh: #a9dec4; --i-vh: #effff7;
  --c-inline: #9d92b8; --t-inline: #bdb2e0; --i-inline: #111;
  --c-tailwind: #8f8b1c; --t-tailwind: #cdc85a; --i-tailwind: #111;
}

:root[data-mode="em"] {
  --accent: #ff5102;
  --input-accent: #ff6a28;
  --eyebrow-accent: #ff783d;
  --ambient-top: #3a2d2c;
  --ambient-mid: #25282b;
}

:root[data-mode="vw"] {
  --accent: #b2d8d9;
  --input-accent: #b2d8d9;
  --eyebrow-accent: #b2d8d9;
  --ambient-top: #293c40;
  --ambient-mid: #222b2e;
}

:root[data-mode="vh"] {
  --accent: #014a2c;
  --input-accent: #effff7;
  --on-accent: #effff7;
  --eyebrow-accent: #a9dec4;
  --ambient-top: #273a31;
  --ambient-mid: #222b27;
}

:root[data-mode="inline"] {
  --accent: #9d92b8;
  --input-accent: #dcd3fb;
  --eyebrow-accent: #bdb2e0;
  --ambient-top: #332f3f;
  --ambient-mid: #25242b;
}

:root[data-mode="tailwind"] {
  --accent: #8f8b1c;
  --input-accent: #ece77f;
  --eyebrow-accent: #cdc85a;
  --ambient-top: #36351f;
  --ambient-mid: #26271f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 72% 65% at 50% 88%, var(--ambient-top) 0%, transparent 78%),
    linear-gradient(155deg, var(--ambient-mid) 0%, #171b1e 58%, #111518 100%);
  background-attachment: fixed;
}
button, input { font: inherit; }
button { color: inherit; }

.shell { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 38px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: clamp(44px, 8vh, 84px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #f5f4ef; font-family: "Space Grotesk", sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -.02em; text-decoration: none; }
.brand img { display: block; border-radius: 8px; }
.site-nav { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.site-nav a:not(.coffee-button) { padding: 8px 12px; border-radius: 999px; color: #a3a5a8; font-size: 14px; font-weight: 600; text-decoration: none; transition: color .2s, background .2s; }
.site-nav a:not(.coffee-button):hover { color: #f5f4ef; background: rgba(255,255,255,.06); }
.site-nav a[aria-current="page"] { color: #f5f4ef; background: rgba(255,255,255,.08); }
.coffee-button { display: inline-flex; align-items: center; gap: 7px; margin-left: 8px; padding: 9px 15px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; text-decoration: none; transition: filter .2s, transform .2s; }
.coffee-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.coffee-button svg { width: 17px; height: 17px; }
.coffee-short { display: none; }
.coffee-button--large { margin: 8px 0 0; padding: 12px 20px; font-size: 15px; }
.page .hero { margin-left: 0; }
.page .hero h1 { font-size: clamp(32px, 4.4vw, 48px); }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 48px; }
.tool-card { display: flex; flex-direction: column; color: #f5f4ef; text-decoration: none; }
.tool-card__tab { align-self: flex-start; padding: 9px 14px 7px; border-radius: 12px 12px 0 0; background: var(--card-accent); color: var(--card-ink); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.tool-card__body { display: grid; flex: 1; gap: 8px; align-content: start; padding: 20px 20px 18px; border: 1px solid rgba(255,255,255,.06); border-top: 3px solid var(--card-accent); border-radius: 0 16px 16px 16px; background: #131517; transition: border-color .2s, transform .2s; }
.tool-card__body strong { font-family: "Space Grotesk", sans-serif; font-size: 20px; letter-spacing: -.02em; }
.tool-card__body span { color: #9a9ca0; font-size: 14px; line-height: 1.5; }
.tool-card__body em { margin-top: 6px; color: var(--card-text); font-size: 13px; font-style: normal; font-weight: 700; }
a.tool-card:hover .tool-card__body { transform: translateY(-2px); border-color: color-mix(in srgb, var(--card-accent) 60%, transparent); border-top-color: var(--card-accent); }
.tool-card--soon { padding-top: 30px; }
.tool-card--soon .tool-card__body { border: 1px dashed rgba(255,255,255,.14); border-radius: 16px; background: transparent; }
.tool-card--soon .tool-card__body em { color: #f5f4ef; }
a.tool-card--soon:hover .tool-card__body { border-color: rgba(255,255,255,.4); }
.about { max-width: 640px; margin: 36px 0 0; color: #c9cacc; font-size: 17px; line-height: 1.7; }
.about p { margin: 0 0 18px; }
.about strong { color: #f5f4ef; }
.about a:not(.coffee-button) { color: var(--eyebrow-accent); }
.hero { margin-left: 7.5%; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--eyebrow-accent); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow span { width: 28px; height: 2px; background: var(--eyebrow-accent); }
h1 { margin: 14px 0 2px; font-family: "Space Grotesk", sans-serif; font-size: clamp(36px, 5vw, 56px); line-height: 1; letter-spacing: -.04em; }
.hero p { margin: 10px 0 0; color: var(--muted); font-size: 17px; }

.calculator { width: min(820px, 100%); margin: 72px auto 0; }
/* Tabs run 20px behind the panel so the panel's rounded corners sit over tab colour, not background;
   the active tab rises above the panel. */
.tabs { --tab-overlap: 20px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; align-items: end; margin-bottom: calc(var(--tab-overlap) * -1); }
/* Index-divider tabs: a flat top with S-curved sides that rise tangentially from the panel line,
   so the active tab and the panel read as one continuous shape. The curves are fixed-size paths
   (the right one mirrored); each foot reaches --foot past the tab's edge and overlaps the body
   and panel by 1px, so no seam can show. */
.tab { --tab-bg: #131313; --run: 24px; --foot: 6px; position: relative; isolation: isolate; border: 0; min-height: calc(44px + var(--tab-overlap)); padding: 0 calc(var(--run) * .5) var(--tab-overlap); background: transparent; color: #929397; font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: .04em; cursor: pointer; transition: min-height .2s ease, color .2s ease; }
.tab:hover { color: #d5d5d3; }
.tab.is-active { --tab-bg: var(--accent); --run: 30px; z-index: 2; min-height: calc(52px + var(--tab-overlap)); color: var(--on-accent); }
.tab-shape-body, .tab-shape-left, .tab-shape-right { position: absolute; z-index: -1; background: var(--tab-bg); pointer-events: none; }
.tab-shape-body { inset: 0 var(--run); }
.tab-shape-left, .tab-shape-right { top: 0; width: calc(var(--run) + var(--foot) + 1px); height: 45px; clip-path: path("M0 44C15 44 15 0 30 0H31V45H0Z"); }
.tab-shape-left { left: calc(var(--foot) * -1); }
.tab-shape-right { right: calc(var(--foot) * -1); transform: scaleX(-1); }
.tab.is-active .tab-shape-left, .tab.is-active .tab-shape-right { height: 53px; clip-path: path("M0 52C18 52 18 0 36 0H37V53H0Z"); }
/* Outer tabs: like a folder, the outside edge is a straight line flush with the panel edge,
   with a rounded top corner; only the inner side curves. */
.tab:first-child .tab-shape-left, .tab:last-child .tab-shape-right { display: none; }
.tab:first-child .tab-shape-body { left: 0; border-top-left-radius: 12px; }
.tab:last-child .tab-shape-body { right: 0; border-top-right-radius: 12px; }
/* Outer labels align to the straight outer edges; inner labels stay centred between the curves. */
.tab:first-child { padding-left: 18px; text-align: left; }
.tab:last-child { padding-right: 18px; text-align: right; }
.panel { position: relative; z-index: 1; padding: 34px 32px 28px; border-radius: 16px; background: var(--accent); color: var(--on-accent); box-shadow: 0 28px 70px rgba(0,0,0,.22); }
/* Value blocks share the row's two tracks (label, field) so the swap sits dead centre on the field row. */
.conversion-row { display: grid; grid-template-columns: 1fr 54px 1fr; grid-template-rows: auto auto; gap: 8px 16px; }
.value-block { display: grid; grid-row: span 2; grid-template-rows: subgrid; }
.value-block > span:first-child, .control { display: grid; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.input-wrap { display: flex; align-items: baseline; gap: 10px; width: 100%; border: 1px solid rgba(255,255,255,.07); border-radius: 13px; background: var(--ink); padding: 11px 15px; box-shadow: inset 0 1px rgba(255,255,255,.04); }
.input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--input-accent); font-family: "Space Grotesk", sans-serif; font-size: clamp(32px, 5vw, 47px); line-height: 1; }
.input-wrap b { color: #b6b9bc; font-size: 12px; font-weight: 700; }
input::-webkit-inner-spin-button { appearance: none; }
.swap { grid-row: 2; grid-column: 2; align-self: center; display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 0; background: transparent; color: var(--on-accent); cursor: pointer; transition: transform .2s, opacity .2s; }
.swap svg { display: block; width: 28px; height: 28px; }
.swap:hover { transform: rotate(180deg); opacity: .65; }
.divider { height: 1px; margin: 32px 0 25px; background: rgba(0,0,0,.16); }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.settings-heading div { display: grid; gap: 2px; }
.settings-heading span { font-size: 14px; font-weight: 800; }
.settings-heading small { opacity: .58; }
.settings-heading button, .detect-button { border: 1px solid color-mix(in srgb, var(--on-accent) 50%, transparent); border-radius: 999px; background: transparent; padding: 8px 13px; color: var(--on-accent); font-size: 12px; font-weight: 700; cursor: pointer; }
.settings-heading button:hover, .detect-button:hover { background: rgba(255,255,255,.26); }
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.control { text-transform: none; letter-spacing: 0; }
.input-wrap--small { padding: 10px 13px; border-radius: 9px; }
.input-wrap--small input { font-family: "DM Sans", sans-serif; font-size: 14px; color: #f5f4ef; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip { height: 40px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: var(--ink); color: #d5d6d8; cursor: pointer; }
.chip.is-active { background: var(--ink); color: var(--input-accent); border-color: var(--ink); }
.detect-button { height: 40px; }
.presets--viewport { grid-column: 1 / -1; }
.presets--viewport .chip { font-size: 12px; font-weight: 700; }
.settings--precision { margin-top: 12px; align-items: center; }
.presets--decimals { grid-template-columns: repeat(5, 1fr); }
.code-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 8px 16px; }
.code-area { width: 100%; min-height: 300px; resize: vertical; border: 1px solid rgba(255,255,255,.07); border-radius: 13px; background: var(--ink); color: #f5f4ef; padding: 14px 15px; font: 13px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; outline: 0; box-shadow: inset 0 1px rgba(255,255,255,.04); }
.code-area:focus { border-color: color-mix(in srgb, var(--input-accent) 55%, transparent); }
.code-area::placeholder { color: #6c6e71; }
.code-area--output { display: block; color: var(--input-accent); cursor: text; user-select: text; }
.code-area--output span { white-space: nowrap; }
.code-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.presets--options { display: flex; flex-wrap: wrap; gap: 6px; }
.presets--options .chip { padding: 0 14px; font-size: 12px; font-weight: 700; }
.presets--options .chip[aria-pressed="true"]::before { content: "✓ "; }
.presets--options .chip[aria-pressed="false"] { color: #9a9ca0; }
.code-actions { display: flex; gap: 8px; }
.formula { display: grid; gap: 8px; margin-top: 22px; font-size: 12px; font-weight: 800; }
.formula code { display: block; padding: 12px 15px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: var(--ink); color: var(--input-accent); font-family: "Space Grotesk", sans-serif; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.context-line { margin: 12px 0 0; font-size: 12px; color: var(--on-accent); opacity: .68; }
.site-footer { display: grid; justify-items: center; gap: 10px; margin-top: 64px; color: #6c6e71; font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; font-family: "Space Grotesk", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.site-footer a { color: #8c8d90; text-decoration: none; }
.site-footer a:hover { color: #f5f4ef; }
.site-footer i { width: 3px; height: 3px; border-radius: 50%; background: #484a4d; }
.site-footer p { margin: 0; }

@media (max-width: 860px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .shell { padding-top: 16px; }
  .topbar { margin-bottom: 40px; }
  .brand span, .coffee-long { display: none; }
  .coffee-short { display: inline; }
  .site-nav a:not(.coffee-button) { padding: 7px 9px; font-size: 13px; }
  .coffee-button { margin-left: 2px; padding: 8px 11px; }
  .hero { margin-left: 0; }
  .tool-grid { grid-template-columns: 1fr; }
  .about { margin-left: 0; font-size: 16px; }
  .calculator { margin-top: 48px; }
  .tabs { gap: 3px; }
  .tab, .tab.is-active { --run: 10px; --foot: 4px; padding: 0 3px var(--tab-overlap); font-size: 9px; letter-spacing: .02em; }
  .tab:first-child, .tab:last-child { padding-inline: 8px; text-align: center; }
  .tab-shape-left, .tab-shape-right { clip-path: path("M0 44C7 44 7 0 14 0H15V45H0Z"); }
  .tab.is-active .tab-shape-left, .tab.is-active .tab-shape-right { clip-path: path("M0 52C7 52 7 0 14 0H15V53H0Z"); }
  .code-row { grid-template-columns: 1fr; grid-template-rows: none; }
  .code-area { min-height: 220px; }
  .panel { padding: 28px 20px; }
  .conversion-row { grid-template-columns: 1fr; grid-template-rows: none; }
  .value-block { grid-row: auto; grid-template-rows: auto auto; gap: 8px; }
  .swap { grid-row: auto; grid-column: auto; justify-self: center; margin: -3px 0; transform: rotate(90deg); }
  .swap:hover { transform: rotate(270deg); }
  .settings { grid-template-columns: 1fr; }
  .settings-heading { align-items: flex-end; }
}

@media (max-width: 400px) {
  .topbar { gap: 8px; }
  .site-nav { gap: 0; }
  .site-nav a:not(.coffee-button) { padding: 6px 7px; font-size: 12.5px; }
  .coffee-button { gap: 5px; padding: 7px 10px; font-size: 12px; }
  .coffee-button svg { width: 15px; height: 15px; }
  .brand img { width: 26px; height: 26px; }
}
