/* =====================================================================
   CALCULATOR  -  /calculator/calc.css
   Warm paper like the rest of the site. The calculator is a cream little
   machine with a glowing plum-and-rose glass screen (a heartbeat line
   runs along the bottom of it), the graph is drawn on the same dark
   glass, and the keys leave tiny hearts where you press them.
   ===================================================================== */

:root {
    --ca-ink: #1b1a17;
    --ca-muted: #6b665c;
    --ca-faint: #9a948a;
    --ca-rule: #ece4dc;
    --ca-paper: #fffdfa;
    --ca-cream: #fbf6f1;
    --ca-accent: #8a2b1d;
    --ca-rose: #b3364e;
    --ca-blush: #fbe8ec;
    --ca-glow: #ffb3c6;
    --ca-neon: #ff5c8a;
    --ca-glass-a: #2c1524;
    --ca-glass-b: #150a12;
    --ca-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
    --ca-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --ca-ease: cubic-bezier(.2, .7, .2, 1);
}

.site-title, .site-title:visited { color: inherit; text-decoration: none; }
main.ca-main {
    display: block;
    width: 100%;
    max-width: 1180px;
    margin: 6px auto 0;
    font-family: var(--ca-serif);
    color: var(--ca-ink);
}
main.ca-main p { margin: 0; }
main.ca-main button, main.ca-main input, main.ca-main select { font-family: inherit; }

/* ---------------------------------------------------------------------
   Heading and the tabs
   --------------------------------------------------------------------- */
.ca-hero { position: relative; display: grid; gap: 16px; padding: 6px 0 22px; }
.ca-hero > div:first-child > * { animation: ca-up 0.7s var(--ca-ease) both; }
.ca-hero > div:first-child > :nth-child(2) { animation-delay: 0.06s; }
.ca-hero > div:first-child > :nth-child(3) { animation-delay: 0.12s; }
main.ca-main .ca-kicker { font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ca-rose); }
main.ca-main .ca-title { margin-top: 2px; font-size: clamp(1.5rem, 2.6vw, 2rem); font-style: italic; line-height: 1.15; }
main.ca-main .ca-intro { max-width: 40em; margin-top: 8px; font-size: 0.95rem; line-height: 1.5; color: var(--ca-muted); }

.ca-tabs {
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    width: fit-content;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--ca-rule);
    border-radius: 999px;
    background: var(--ca-cream);
    animation: ca-up 0.7s var(--ca-ease) 0.15s both;
}
.ca-tab {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ca-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.3s ease;
}
.ca-tab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ca-tab:hover { color: var(--ca-ink); }
.ca-tab[aria-selected="true"] { color: #fff; }
.ca-tab:focus-visible { outline: 2px solid var(--ca-rose); outline-offset: 2px; }
.ca-tab-love[aria-selected="true"] svg { fill: currentColor; }
.ca-tab-ink {
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #2b1a22, #1b1a17);
    box-shadow: 0 6px 16px -8px rgba(27, 26, 23, 0.6);
    transition: transform 0.45s var(--ca-ease), width 0.45s var(--ca-ease), background 0.45s ease;
}
main[data-tab="love"] .ca-tab-ink { background: linear-gradient(135deg, var(--ca-neon), var(--ca-rose)); }
main:not(.is-ready) .ca-tab-ink { transition: none; }

.ca-panel[hidden] { display: none; }
.ca-panel.is-in { animation: ca-panel 0.5s var(--ca-ease); }
@keyframes ca-panel { from { opacity: 0; transform: translateY(10px); filter: blur(2px); } }

/* ---------------------------------------------------------------------
   The calculator machine
   --------------------------------------------------------------------- */
.ca-machine {
    display: grid;
    grid-template-columns: minmax(0, 430px) 270px;
    justify-content: center;
    align-items: start;
    gap: 26px;
    transition: grid-template-columns 0.5s var(--ca-ease);
}
main[data-tab="sci"] .ca-machine { grid-template-columns: minmax(0, 860px) 270px; }

.ca-device {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
    border-radius: 28px;
    background:
        linear-gradient(160deg, #fffdfb, #f6eee8 60%, #f3e6e1);
    box-shadow:
        inset 0 1px 0 #fff,
        inset 0 -2px 0 rgba(140, 90, 80, 0.12),
        0 1px 2px rgba(60, 30, 20, 0.08),
        0 30px 60px -32px rgba(110, 40, 50, 0.45);
    animation: ca-up 0.7s var(--ca-ease) 0.2s both;
}
.ca-device::before {                      /* a thin rose rim */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(160deg, rgba(255, 140, 170, 0.5), rgba(255, 255, 255, 0.4) 40%, rgba(179, 54, 78, 0.25));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
main[data-tab="sci"] .ca-device { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
main[data-tab="sci"] .ca-glass { grid-column: 1 / -1; }

/* the glass screen */
.ca-glass {
    position: relative;
    display: grid;
    gap: 2px;
    padding: 12px 18px 8px;
    overflow: hidden;
    border-radius: 18px;
    background: radial-gradient(120% 140% at 30% 0%, var(--ca-glass-a), var(--ca-glass-b) 70%);
    box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.75), 0 0 0 1px #0d060b, 0 1px 0 rgba(255, 255, 255, 0.7);
    color: var(--ca-glow);
}
.ca-glass::after {                         /* fine mesh, like an old display */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(rgba(0, 0, 0, 0.45) 0.55px, transparent 0.9px) 0 0 / 3px 3px,
        linear-gradient(115deg, rgba(255, 255, 255, 0.07), transparent 38%);
    opacity: 0.6;
}
.ca-status { display: flex; align-items: center; gap: 12px; min-height: 18px; font: 0.62rem/1 var(--ca-mono); letter-spacing: 0.18em; }
.ca-led { color: rgba(255, 179, 198, 0.16); transition: color 0.3s ease, text-shadow 0.3s ease; }
.ca-led.on { color: var(--ca-glow); text-shadow: 0 0 6px var(--ca-neon); }
.ca-heart { margin-left: auto; width: 14px; height: 14px; color: var(--ca-neon); filter: drop-shadow(0 0 4px var(--ca-neon)); opacity: 0.8; }
.ca-heart svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.ca-heart.go { animation: ca-beat 0.9s ease-out; }
@keyframes ca-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.45); } 30% { transform: scale(1); } 45% { transform: scale(1.25); } }

main.ca-main .ca-prev {
    min-height: 1.3em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: right;
    font: 0.85rem/1.3 var(--ca-mono);
    color: rgba(255, 179, 198, 0.45);
}
.ca-prev.in { animation: ca-rise 0.45s var(--ca-ease); }
@keyframes ca-rise { from { opacity: 0; transform: translateY(14px); } }
.ca-expr {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #ffe3ea;
    font: 1.25rem/1.4 var(--ca-mono);
    text-align: right;
    caret-color: var(--ca-neon);
    outline: none;
}
.ca-glass.is-fresh .ca-expr { color: transparent; text-shadow: none; }
.ca-expr::placeholder { color: rgba(255, 179, 198, 0.25); }
.ca-expr::selection { background: rgba(255, 92, 138, 0.35); }
.ca-result {
    --shrink: 1;
    position: relative;
    z-index: 1;
    display: block;
    min-height: 1.25em;
    overflow: hidden;
    white-space: nowrap;
    text-align: right;
    font: 300 calc(clamp(2.4rem, 5vw, 3.2rem) * var(--shrink))/1.25 var(--ca-serif);
    color: #fff3f6;
    text-shadow: 0 0 2px #fff, 0 0 14px var(--ca-neon), 0 0 34px rgba(255, 92, 138, 0.5);
    font-variant-numeric: tabular-nums;
    cursor: copy;
    transition: color 0.3s ease, text-shadow 0.3s ease, opacity 0.3s ease;
}
.ca-result.is-dim { opacity: 0.42; text-shadow: 0 0 10px rgba(255, 92, 138, 0.35); }
.ca-result.is-final { animation: ca-land 0.55s var(--ca-ease); }
@keyframes ca-land { 0% { opacity: 0.2; transform: translateY(8px) scale(0.98); filter: blur(3px); } }
.ca-result.is-msg { font-size: 1.05rem; font-style: italic; color: #ffc2a8; text-shadow: 0 0 10px rgba(255, 120, 90, 0.5); white-space: normal; cursor: default; }
.ca-result[data-copied]::before { content: attr(data-copied); position: absolute; left: 0; bottom: 6px; font: 0.62rem var(--ca-mono); letter-spacing: 0.16em; color: var(--ca-glow); opacity: 0.8; }
.ca-glass.is-error { animation: ca-shake 0.35s ease; }
@keyframes ca-shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }

/* the heartbeat line */
.ca-pulse { position: relative; z-index: 1; display: block; width: 100%; height: 22px; margin-top: 2px; }
.ca-pulse path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ca-pulse-base { stroke: rgba(255, 92, 138, 0.18); stroke-width: 1; }
.ca-pulse-beat { stroke: var(--ca-neon); stroke-width: 2; filter: drop-shadow(0 0 4px var(--ca-neon)); stroke-dasharray: 90 1400; stroke-dashoffset: 90; opacity: 0; }
.ca-pulse.go .ca-pulse-beat { animation: ca-ecg 1.1s cubic-bezier(.35, .1, .3, 1); }
@keyframes ca-ecg { 0% { stroke-dashoffset: 90; opacity: 1; } 85% { opacity: 1; } 100% { stroke-dashoffset: -690; opacity: 0; } }
.ca-pulse.flat .ca-pulse-base { animation: ca-flat 0.6s ease; }
@keyframes ca-flat { 30% { stroke: #ff8a5c; stroke-width: 2; } }

/* the keys */
.ca-keys-sci { display: none; }
main[data-tab="sci"] .ca-keys-sci { display: block; align-self: end; animation: ca-panel 0.5s var(--ca-ease); }
.ca-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.ca-grid-sci { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.ca-mem { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.ca-key {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 58px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(180deg, #fffefd, #fbf5f1);
    box-shadow: inset 0 0 0 1px #efe3dc, 0 2px 0 #e7d9d1, 0 6px 12px -8px rgba(110, 50, 50, 0.3);
    color: var(--ca-ink);
    font-size: 1.45rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.25s ease;
}
.ca-key span { position: relative; z-index: 1; pointer-events: none; }
.ca-key:hover { background: linear-gradient(180deg, #fff, #fdf3f1); }
.ca-key:focus-visible { outline: 2px solid var(--ca-rose); outline-offset: 2px; }
.ca-key.down { animation: ca-press 0.18s ease; }
@keyframes ca-press { 40% { transform: translateY(2px); box-shadow: inset 0 0 0 1px #efe3dc, 0 0 0 #e7d9d1, 0 2px 6px -6px rgba(110, 50, 50, 0.3); } }
.ca-key.ca-fn { background: linear-gradient(180deg, #f6efe9, #efe5de); color: var(--ca-muted); font-size: 1.15rem; }
.ca-key.ca-op { background: linear-gradient(180deg, #fdf0f2, #f9e1e6); color: var(--ca-rose); font-size: 1.6rem; box-shadow: inset 0 0 0 1px #f3d3da, 0 2px 0 #ecc8d0, 0 6px 12px -8px rgba(179, 54, 78, 0.35); }
.ca-key.ca-eq {
    background: linear-gradient(160deg, #d64466, #8a2b1d);
    color: #fff;
    font-size: 1.7rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 0 #6c2116, 0 10px 22px -10px rgba(179, 54, 78, 0.8);
}
.ca-key.ca-eq:hover { background: linear-gradient(160deg, #e04f72, #962f20); }
.ca-mem .ca-key { min-height: 36px; border-radius: 11px; font: 0.82rem var(--ca-mono); color: var(--ca-muted); background: transparent; box-shadow: inset 0 0 0 1px #efe3dc; }
.ca-mem .ca-key:hover { background: #fff; color: var(--ca-ink); }
.ca-grid-sci .ca-key { min-height: 46px; border-radius: 12px; font-size: 0.98rem; font-style: italic; color: #4e463f; }
.ca-grid-sci .ca-key.is-2nd { color: var(--ca-rose); background: linear-gradient(180deg, #fff8f9, #fbecef); }
.ca-key.ca-toggle { font: 0.78rem var(--ca-mono); font-style: normal; letter-spacing: 0.06em; color: var(--ca-muted); background: linear-gradient(180deg, #f6efe9, #efe5de); }
.ca-key.ca-toggle.on { color: #fff; background: linear-gradient(160deg, #3a2430, #1b1a17); box-shadow: inset 0 0 0 1px #1b1a17, 0 0 12px -2px rgba(255, 92, 138, 0.6); }
.ca-ripple {
    position: absolute;
    z-index: 0;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    color: rgba(255, 92, 138, 0.28);
    pointer-events: none;
    animation: ca-ripple 0.6s ease-out forwards;
}
.ca-eq .ca-ripple { color: rgba(255, 255, 255, 0.45); }
.ca-ripple svg { display: block; width: 100%; height: 100%; fill: currentColor; }
@keyframes ca-ripple { from { transform: scale(0.2); opacity: 1; } to { transform: scale(3.6); opacity: 0; } }

/* the paper tape */
.ca-tape {
    position: relative;
    max-height: 640px;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(60, 30, 20, 0.06), 0 18px 34px -24px rgba(60, 30, 20, 0.35);
    animation: ca-up 0.7s var(--ca-ease) 0.3s both;
    -webkit-mask:
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 51% repeat-x,
        conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 12px 51% repeat-x;
    mask:
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 51% repeat-x,
        conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 12px 51% repeat-x;
}
.ca-tape-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 8px; border-bottom: 1px dashed var(--ca-rule); }
main.ca-main .ca-label { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ca-faint); }
.ca-link { padding: 0; border: 0; background: none; color: var(--ca-rose); font-size: 0.85rem; font-style: italic; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ca-tape-list { flex: 1; min-height: 0; margin: 0; padding: 4px 0; overflow-y: auto; list-style: none; }
.ca-tape-list li { display: flex; flex-direction: column; align-items: flex-end; padding: 8px 0; border-bottom: 1px dashed var(--ca-rule); }
.ca-tape-list li.in { animation: ca-tape-in 0.45s var(--ca-ease); }
@keyframes ca-tape-in { from { opacity: 0; transform: translateY(-10px); } }
.ca-tape-list button { max-width: 100%; padding: 1px 4px; border: 0; border-radius: 6px; background: none; text-align: right; cursor: pointer; overflow-wrap: anywhere; }
.ca-tape-list button:hover { background: var(--ca-blush); }
.ca-tape-e { font: 0.82rem var(--ca-mono); color: var(--ca-faint); }
.ca-tape-r { font-size: 1.15rem; color: var(--ca-ink); }
main.ca-main .ca-tape-empty { margin: 14px 0; font-size: 0.88rem; font-style: italic; color: var(--ca-faint); }
.ca-tape-empty[hidden] { display: none; }
main.ca-main .ca-tip { margin-top: 10px; font-size: 0.78rem; line-height: 1.6; color: var(--ca-faint); }
.ca-main kbd { display: inline-block; padding: 0 5px; border: 1px solid #ddd2c9; border-bottom-width: 2px; border-radius: 5px; font: 0.7rem/1.5 var(--ca-mono); color: var(--ca-muted); background: #fff; }

/* ---------------------------------------------------------------------
   Graph
   --------------------------------------------------------------------- */
.ca-graph { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; }
.ca-graph-side { display: grid; gap: 12px; animation: ca-up 0.6s var(--ca-ease) both; }
.ca-fns { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ca-fn {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 10px;
    border: 1px solid var(--ca-rule);
    border-radius: 14px;
    background: #fff;
    transition: border-color 0.2s ease, opacity 0.3s ease, box-shadow 0.2s ease;
    animation: ca-up 0.4s var(--ca-ease);
}
.ca-fn:focus-within { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.ca-fn.off { opacity: 0.5; }
.ca-fn-dot { width: 14px; height: 14px; padding: 0; border: 2px solid var(--c); border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); cursor: pointer; transition: background 0.2s ease, box-shadow 0.2s ease; }
.ca-fn.off .ca-fn-dot { background: transparent; box-shadow: none; }
.ca-fn-y { font-style: italic; color: var(--ca-faint); }
.ca-fn-in { width: 100%; min-width: 0; padding: 6px 2px; border: 0; background: transparent; font: 0.95rem var(--ca-mono) !important; color: var(--ca-ink); outline: none; }
.ca-fn-x { width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--ca-faint); font-size: 1.2rem; cursor: pointer; }
.ca-fn-x:hover { background: var(--ca-blush); color: var(--ca-rose); }
main.ca-main .ca-fn-err { grid-column: 1 / -1; margin: -2px 4px 2px; font-size: 0.8rem; font-style: italic; color: #b8402a; }
.ca-fn-err[hidden] { display: none; }
.ca-fn-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ca-btn {
    padding: 7px 14px;
    border: 1px solid #e3d6cd;
    border-radius: 999px;
    background: #fff;
    color: var(--ca-ink);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.ca-btn:hover:not(:disabled) { background: var(--ca-ink); border-color: var(--ca-ink); color: #fff; }
.ca-btn:disabled { opacity: 0.45; cursor: default; }
.ca-btn-main { background: linear-gradient(160deg, #d64466, #8a2b1d); border: 0; padding: 8px 18px; color: #fff; box-shadow: 0 10px 22px -12px rgba(179, 54, 78, 0.8); }
.ca-btn-main:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(160deg, #e04f72, #962f20); }
.ca-select {
    padding: 7px 30px 7px 12px;
    border: 1px solid #e3d6cd;
    border-radius: 999px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239a948a' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 10px;
    color: var(--ca-ink);
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.ca-select:focus-visible, .ca-btn:focus-visible, .ca-icon:focus-visible { outline: 2px solid var(--ca-rose); outline-offset: 2px; }
.ca-sliders { display: grid; gap: 8px; }
.ca-sliders:empty { display: none; }
.ca-slider { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--ca-cream); animation: ca-up 0.4s var(--ca-ease); }
.ca-slider label { font-size: 0.95rem; white-space: nowrap; }
.ca-slider label b { font-weight: normal; font-family: var(--ca-mono); font-size: 0.85rem; color: var(--ca-rose); }
.ca-slider input { width: 100%; accent-color: var(--ca-rose); }
.ca-play { width: 30px; height: 30px; border: 0; border-radius: 50%; background: #fff; color: var(--ca-rose); font-size: 0.7rem; cursor: pointer; box-shadow: inset 0 0 0 1px #f0d6dc; }
.ca-play.on { background: var(--ca-rose); color: #fff; }
.ca-check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--ca-muted); cursor: pointer; }
.ca-check input { accent-color: var(--ca-rose); }
main.ca-main .ca-help { font-size: 0.82rem; line-height: 1.55; color: var(--ca-faint); }
.ca-help code { padding: 0 4px; border-radius: 4px; background: var(--ca-cream); font: 0.8rem var(--ca-mono); color: var(--ca-muted); }

.ca-plot-wrap { position: relative; animation: ca-up 0.6s var(--ca-ease) 0.08s both; }
.ca-plot {
    position: relative;
    height: min(620px, 72vh);
    min-height: 340px;
    overflow: hidden;
    border-radius: 22px;
    background: #150a12;
    box-shadow: inset 0 0 0 1px #0d060b, 0 0 0 6px #f6eee8, 0 0 0 7px #ead8d0, 0 30px 60px -34px rgba(110, 40, 50, 0.6);
    cursor: crosshair;
    touch-action: none;
}
.ca-plot.is-drag { cursor: grabbing; }
.ca-plot canvas { display: block; }
.ca-plot::after {                           /* mesh and a soft reflection on the glass */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(rgba(0, 0, 0, 0.35) 0.55px, transparent 0.9px) 0 0 / 3px 3px,
        linear-gradient(115deg, rgba(255, 255, 255, 0.05), transparent 35%);
}
.ca-plot-tip {
    position: absolute;
    z-index: 2;
    padding: 7px 10px;
    border: 1px solid rgba(255, 140, 170, 0.3);
    border-radius: 10px;
    background: rgba(25, 12, 20, 0.85);
    backdrop-filter: blur(4px);
    color: #ffe3ea;
    font: 0.78rem/1.55 var(--ca-mono);
    white-space: nowrap;
    pointer-events: none;
}
.ca-plot-tip[hidden] { display: none; }
.ca-plot-tip i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }
.ca-plot-tip b { font-weight: normal; color: var(--ca-glow); }
.ca-plot-tools { position: absolute; right: 14px; top: 14px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.ca-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 140, 170, 0.25);
    border-radius: 11px;
    background: rgba(30, 14, 24, 0.75);
    backdrop-filter: blur(4px);
    color: #ffd6e0;
    font: 1.2rem/1 var(--ca-mono);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.ca-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ca-icon:hover { background: rgba(255, 92, 138, 0.25); color: #fff; box-shadow: 0 0 14px -2px rgba(255, 92, 138, 0.7); }

/* ---------------------------------------------------------------------
   Convert
   --------------------------------------------------------------------- */
.ca-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; animation: ca-up 0.6s var(--ca-ease) both; }
.ca-cat {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px 6px 10px;
    border: 1px solid var(--ca-rule);
    border-radius: 999px;
    background: #fff;
    color: var(--ca-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.ca-cat svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ca-cat:hover { color: var(--ca-ink); border-color: #dccfc5; transform: translateY(-1px); }
.ca-cat[aria-selected="true"] { background: linear-gradient(135deg, #2b1a22, #1b1a17); border-color: transparent; color: #fff; }
.ca-cat[aria-selected="true"] svg { stroke: var(--ca-glow); }
.ca-cat:focus-visible { outline: 2px solid var(--ca-rose); outline-offset: 2px; }

.ca-conv { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; }
.ca-conv[hidden] { display: none; }
.ca-conv.is-in .ca-conv-side { animation: ca-panel 0.45s var(--ca-ease); }
.ca-conv.is-in .ca-conv-side:last-child { animation-delay: 0.06s; }
.ca-conv-side {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 18px 18px 16px;
    overflow: hidden;
    border-radius: 20px;
    background: radial-gradient(120% 140% at 30% 0%, var(--ca-glass-a), var(--ca-glass-b) 70%);
    box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.75), 0 0 0 1px #0d060b, 0 0 0 5px #f6eee8, 0 0 0 6px #ead8d0;
}
.ca-conv-side::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(rgba(0, 0, 0, 0.4) 0.55px, transparent 0.9px) 0 0 / 3px 3px; opacity: 0.6; }
.ca-conv-in {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #fff3f6;
    font: 300 clamp(1.8rem, 3.6vw, 2.6rem)/1.2 var(--ca-serif) !important;
    text-shadow: 0 0 2px #fff, 0 0 14px var(--ca-neon);
    outline: none;
    caret-color: var(--ca-neon);
}
.ca-conv-in.flash { animation: ca-flash 0.5s ease; }
@keyframes ca-flash { from { text-shadow: 0 0 4px #fff, 0 0 26px var(--ca-neon), 0 0 40px var(--ca-neon); } }
.ca-conv-in.bad { color: #ffc2a8; text-shadow: 0 0 10px rgba(255, 120, 90, 0.6); }
.ca-conv-unit { position: relative; z-index: 1; justify-self: start; max-width: 100%; background-color: rgba(255, 255, 255, 0.06); border-color: rgba(255, 140, 170, 0.3); color: #ffd6e0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffb3c6' stroke-width='1.6'/%3E%3C/svg%3E"); }
.ca-conv-unit option { color: var(--ca-ink); background: #fff; }
.ca-swap {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(160deg, #d64466, #8a2b1d);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 22px -10px rgba(179, 54, 78, 0.9);
    transition: transform 0.2s ease;
}
.ca-swap svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ca-swap:hover { transform: scale(1.06); }
.ca-swap.spin svg { animation: ca-spin 0.5s var(--ca-ease); }
@keyframes ca-spin { from { transform: rotate(-180deg); } }
.ca-swap:focus-visible { outline: 2px solid var(--ca-rose); outline-offset: 3px; }
main.ca-main .ca-conv-formula { margin: 18px 0 26px; text-align: center; font-size: 1rem; font-style: italic; color: var(--ca-muted); }
.ca-conv-formula b { font-style: normal; font-weight: normal; color: var(--ca-rose); }
.ca-conv-formula[hidden], .ca-all[hidden], .ca-all-label[hidden] { display: none; }
.ca-all-label { margin-bottom: 10px !important; }
.ca-all { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ca-all-u {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--ca-rule);
    border-radius: 14px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.ca-all-u b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: normal; font-size: 1.1rem; color: var(--ca-ink); }
.ca-all-u span { font-size: 0.8rem; font-style: italic; color: var(--ca-faint); }
.ca-all-u:hover { border-color: #e7c6cf; transform: translateY(-1px); }
.ca-all-u.on { border-color: var(--ca-rose); background: var(--ca-blush); }

.ca-bases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ca-bases[hidden] { display: none; }
.ca-base { display: grid; gap: 8px; padding: 16px 18px; border-radius: 18px; background: radial-gradient(120% 140% at 30% 0%, var(--ca-glass-a), var(--ca-glass-b) 70%); box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.75), 0 0 0 1px #0d060b; }
.ca-base span { font: 0.68rem var(--ca-mono); letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255, 179, 198, 0.6); }
.ca-base input { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: #fff3f6; font: 1.35rem/1.3 var(--ca-mono) !important; text-shadow: 0 0 10px var(--ca-neon); outline: none; caret-color: var(--ca-neon); }
.ca-base input.flash { animation: ca-flash 0.5s ease; }
.ca-base input.bad { color: #ffc2a8; }
.ca-bases .ca-help { grid-column: 1 / -1; }

/* ---------------------------------------------------------------------
   Love
   --------------------------------------------------------------------- */
.ca-love { display: grid; justify-items: center; gap: 18px; max-width: 620px; margin: 0 auto; padding: 10px 0 20px; text-align: center; }
.ca-love-names { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; animation: ca-up 0.6s var(--ca-ease) both; }
.ca-love-in {
    width: 210px;
    padding: 10px 16px;
    border: 1px solid #ecd6dc;
    border-radius: 999px;
    background: #fff;
    color: var(--ca-ink);
    font-size: 1.1rem !important;
    font-style: italic;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ca-love-in:focus { border-color: var(--ca-rose); box-shadow: 0 0 0 4px rgba(179, 54, 78, 0.12); }
.ca-love-plus { font-size: 1.6rem; color: var(--ca-rose); }
.ca-love-meter { position: relative; width: 230px; margin-top: 10px; }
.ca-love-meter svg { display: block; width: 100%; overflow: visible; filter: drop-shadow(0 18px 24px rgba(179, 54, 78, 0.28)); }
.ca-love-shell { fill: #fff6f8; stroke: #e9b9c5; stroke-width: 2; }
.ca-love-fill { fill: url(#ca-love-grad); }
.ca-love-meter.is-going .ca-love-shell { animation: ca-glow-pulse 0.8s ease-in-out infinite; }
@keyframes ca-glow-pulse { 50% { stroke: var(--ca-neon); filter: drop-shadow(0 0 6px var(--ca-neon)); } }
.ca-love-meter.beat svg { animation: ca-beat 1s ease-out; }
.ca-love-meter.shake { animation: ca-shake 0.35s ease; }
main.ca-main .ca-love-pct { position: absolute; left: 0; right: 0; top: 34%; font-size: 2.3rem; font-weight: 300; color: #fff; text-shadow: 0 1px 8px rgba(120, 20, 40, 0.5); mix-blend-mode: normal; pointer-events: none; }
main.ca-main .ca-love-line { min-height: 1.5em; font-size: 1.2rem; font-style: italic; }
main.ca-main .ca-love-note { font-size: 0.82rem; font-style: italic; color: var(--ca-faint); }

@keyframes ca-up { from { opacity: 0; transform: translateY(10px); } }

/* ---------------------------------------------------------------------
   Smaller screens
   --------------------------------------------------------------------- */
@media (max-width: 1060px) {
    .ca-machine, main[data-tab="sci"] .ca-machine { grid-template-columns: minmax(0, 1fr); max-width: 860px; margin: 0 auto; }
    main[data-tab="basic"] .ca-machine { max-width: 440px; }
    .ca-tape { max-height: 360px; }
}
@media (max-width: 860px) {
    .ca-graph { grid-template-columns: minmax(0, 1fr); }
    .ca-plot { height: 60vh; }
}
@media (max-width: 720px) {
    main[data-tab="sci"] .ca-device { grid-template-columns: minmax(0, 1fr); }
    .ca-key { min-height: 54px; }
    .ca-grid-sci .ca-key { min-height: 40px; font-size: 0.88rem; }
    .ca-conv { grid-template-columns: minmax(0, 1fr); }
    .ca-swap { justify-self: center; transform: rotate(90deg); }
    .ca-swap:hover { transform: rotate(90deg) scale(1.06); }
    .ca-bases { grid-template-columns: minmax(0, 1fr); }
    .ca-tab { padding: 7px 11px; font-size: 0.88rem; }
    .ca-tab svg { display: none; }
    .ca-device { padding: 12px; border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .ca-hero *, .ca-tabs, .ca-device, .ca-tape, .ca-panel.is-in, .ca-key.down, .ca-result.is-final, .ca-prev.in,
    .ca-heart.go, .ca-pulse.go .ca-pulse-beat, .ca-graph-side, .ca-plot-wrap, .ca-cats, .ca-fn, .ca-slider,
    .ca-love-names, .ca-love-meter.beat svg { animation: none !important; }
    .ca-tab-ink { transition: none; }
}
