diff --git a/src/app.css b/src/app.css index 9737d2a..ba5b25c 100644 --- a/src/app.css +++ b/src/app.css @@ -79,38 +79,52 @@ /* ── Highlighted result (above grid) ──────────────────────────────────────── */ .highlighted-result { - text-align: center; - padding: 2rem 1rem; + /* Fixed height that never changes whether populated or empty */ + height: 10rem; margin-bottom: 1.5rem; border-radius: var(--pico-border-radius, 0.25rem); background-color: var(--pico-card-background-color); - border: 2px solid var(--pico-primary); + border: 2px solid transparent; /* always present, color changes */ box-shadow: var(--shadow-medium); display: flex; flex-direction: column; align-items: center; - gap: 0.4rem; + justify-content: center; + gap: 0.3rem; position: relative; - min-height: 8rem; + overflow: hidden; + transition: border-color 0.2s ease; + text-align: center; } -.highlighted-value { - font-size: 2.5rem; - font-weight: 700; +.highlighted-result.has-highlight { + border-color: var(--pico-primary); +} + +.highlighted-equation-from { + font-size: clamp(0.85rem, 2vw, 1.1rem); + color: var(--color-text-muted, #888880); font-variant-numeric: tabular-nums; - line-height: 1.1; - word-break: break-all; - color: var(--pico-color); } -.highlighted-label { - font-size: 1.25rem; - color: var(--pico-color); +.highlighted-equation-equals { + font-size: clamp(1.2rem, 3.5vw, 2rem); + font-weight: 700; + color: var(--pico-primary); + font-variant-numeric: tabular-nums; + word-break: break-all; + text-align: center; } .highlighted-symbol { + font-size: clamp(0.75rem, 1.5vw, 0.9rem); + color: var(--pico-muted-color, #888880); + font-style: italic; +} + +.highlighted-placeholder { font-size: 0.9rem; - color: var(--pico-muted-color, #666); + color: var(--pico-muted-color, #888880); font-style: italic; } @@ -142,22 +156,18 @@ /* ── Highlight dismiss button ──────────────────────────────────────────────── */ .highlight-dismiss { position: absolute; - top: 0.5rem; - right: 0.75rem; + top: 0.4rem; + right: 0.6rem; background: none; border: none; + font-size: 1.1rem; + color: var(--pico-muted-color, #888880); cursor: pointer; - font-size: 1rem; + padding: 0.2rem 0.4rem; line-height: 1; - color: var(--pico-muted-color, #888); - padding: 0.15rem 0.3rem; - border-radius: 0.2rem; - transition: color 0.15s ease, background-color 0.15s ease; } - .highlight-dismiss:hover { - color: var(--pico-color); - background-color: rgba(0, 0, 0, 0.06); + color: var(--pico-color, #2C2C2C); } /* ── Hotkey hint ───────────────────────────────────────────────────────────── */ diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 0612d0d..a831d25 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -6,7 +6,7 @@ import { convertById } from '$lib/convert'; import { FRACTIONAL_DIGITS } from '$lib/config'; import { formatBig } from '$lib/format'; - import type { Big } from 'big.js'; + import Big from 'big.js'; import type { Unit, ResultItem } from '$lib/types'; import ConverterCard from '../components/ConverterCard.svelte'; @@ -60,6 +60,8 @@ : null ); + let fromUnit = $derived(units.find(u => u.id === fromUnitId) ?? units[0]); + // ── URL sync: update URL only when serialized params actually change ──────── $effect(() => { if (!browser) return; @@ -107,16 +109,14 @@