:root {
  --bg: #f7f8fc; --card: #fff; --fg: #14161a; --mut: #586071; --line: #e2e6ef; --acc: #2747d8; --acc2: #1a2f9c; --on: #fff;
  --box: #eef2fd; --finance: #0a8f5b; --text: #7a3fd1; --math: #2563eb; --time: #c2570a; --health: #d6336c; --fun: #a66b12;
  --shadow: 0 1px 2px rgba(20, 30, 70, .06), 0 6px 20px rgba(20, 30, 70, .06); color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1016; --card: #171a22; --fg: #eceef3; --mut: #a3a9b8; --line: #2a2f3b; --acc: #8ea4ff; --acc2: #c3ceff; --on: #0e1016;
    --box: #151a2b; --finance: #4fd39b; --text: #b996f5; --math: #7fb0ff; --time: #f5a15a; --health: #f58bb0; --fun: #e7b65c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.65 "Be Vietnam Pro", system-ui, sans-serif; }
.bar, main { max-width: 780px; margin: 0 auto; padding: 0 16px; }
.home main, .bar { max-width: 1080px; }
main { padding-top: 8px; padding-bottom: 24px; }
a { color: var(--acc); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; border-radius: 4px; }

header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header .bar { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--fg); text-decoration: none; letter-spacing: -.01em; }
nav a { margin-left: 6px; padding: 7px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem; }
nav a:hover { background: var(--box); }

h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.2; margin: 10px 0 18px; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 38px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; margin: 22px 0 4px; }
.crumb { font-size: .88rem; color: var(--mut); margin: 14px 0 0; }

/* home */
.hero { margin: 20px 0 8px; padding: clamp(24px, 5vw, 48px); border-radius: 24px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, #3b5bff 0%, #2747d8 45%, #5a2bd0 100%); box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 8px; font-weight: 800; }
.hero p { margin: 0; max-width: 620px; opacity: .93; }
.hero input { margin-top: 22px; max-width: 560px; height: 54px; padding: 0 20px; border: 0; border-radius: 999px; font-size: 1.05rem; background: #fff; color: #14161a; box-shadow: 0 8px 24px rgba(10, 20, 80, .28); }
.hero input:focus-visible { outline: 3px solid #ffd43b; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px !important; }
.chips span { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25); padding: 4px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; }
.cat h2 { display: flex; align-items: center; gap: 10px; }
.ico { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; color: var(--c, var(--acc)); background: color-mix(in srgb, var(--c, var(--acc)) 13%, transparent); }
.c-finance { --c: var(--finance); } .c-text { --c: var(--text); } .c-math { --c: var(--math); }
.c-time { --c: var(--time); } .c-health { --c: var(--health); } .c-fun { --c: var(--fun); }
.tools { padding: 0; margin: 12px 0 0; list-style: none; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tools li { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tools li:hover { transform: translateY(-3px); border-color: var(--c, var(--acc)); }
.tools li[hidden] { display: none; }
.tools a { display: block; margin-top: 10px; font-weight: 700; color: var(--fg); text-decoration: none; line-height: 1.35; }
.tools a::after { content: ""; position: absolute; inset: 0; border-radius: 16px; } /* whole card is the link */
.tools p { margin: 6px 0 0; color: var(--mut); font-size: .88rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.posts a { margin-top: 0; }
.about { margin-top: 48px; padding: clamp(20px, 4vw, 36px); background: var(--card); border: 1px solid var(--line); border-radius: 24px; }
.about h2 { margin-top: 0; }
.feat { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 18px; }
.feat b { display: block; padding-top: 12px; border-top: 3px solid var(--acc); }
.feat p { margin: 6px 0 0; color: var(--mut); font-size: .93rem; }

/* tool */
.tool { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--acc); border-radius: 18px; padding: clamp(16px, 3vw, 26px); box-shadow: var(--shadow); }
label { display: block; font-weight: 600; font-size: .95rem; margin: 14px 0 5px; }
.tool > label:first-child, .row3 label { margin-top: 0; }
label.chk { font-weight: 400; margin: 8px 0; }
input, textarea, button, select { font: inherit; color: inherit; }
input:not([type=checkbox]), textarea, select { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--bg); transition: border-color .15s; }
input:not([type=checkbox]):focus, textarea:focus, select:focus { border-color: var(--acc); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 22%, transparent); }
input[type=checkbox] { width: 18px; height: 18px; vertical-align: -3px; accent-color: var(--acc); }
.row input { width: 7.5em; display: inline-block; margin: 4px 2px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
button { padding: 10px 20px; margin: 12px 8px 0 0; border: 0; border-radius: 11px; background: var(--acc); color: var(--on); font-weight: 700; cursor: pointer; transition: filter .15s, transform .1s; }
button:hover { filter: brightness(1.1); } button:active { transform: scale(.97); }
button[data-copy] { background: var(--box); color: var(--acc); padding: 3px 12px; margin: 0 0 0 6px; font-size: .82rem; }
.out { margin: 10px 0 0; padding: 11px 14px; background: var(--box); border-radius: 11px; overflow-wrap: anywhere; color: var(--mut); }
.out:empty { display: none; }
output { font-weight: 700; color: var(--acc2); font-size: 1.08em; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 0; margin: 16px 0 0; border-radius: 11px; overflow: hidden; border: 1px solid var(--line); }
.stats dt, .stats dd { margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.stats dd { font-weight: 700; text-align: right; color: var(--acc2); font-variant-numeric: tabular-nums; }
.stats dt:last-of-type, .stats dd:last-of-type { border-bottom: 0; background: var(--box); }
.big { font-size: clamp(1.6rem, 6vw, 2.6rem); font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; color: var(--fg); }
#disp.big { font-size: clamp(2.6rem, 12vw, 4.6rem); margin: 10px 0 0; letter-spacing: -.02em; }
canvas { display: block; max-width: 100%; height: auto; margin: 18px auto 0; filter: drop-shadow(0 8px 18px rgba(20, 30, 70, .2)); }
#laps { margin: 14px 0 0; padding-left: 1.8em; font-variant-numeric: tabular-nums; }
#svg svg { display: block; max-width: 100%; height: auto; margin: 14px auto 0; border-radius: 8px; }
.grp { font-size: 1rem; margin: 20px 0 8px; }
.syms { display: flex; flex-wrap: wrap; gap: 7px; }
.sym { background: var(--bg); color: var(--fg); border: 1.5px solid var(--line); min-width: 46px; min-height: 46px; margin: 0; padding: 0 8px; font-size: 1.25rem; font-weight: 400; }
.sym:hover { border-color: var(--acc); filter: none; }

/* article */
main > h2 { padding-left: 12px; border-left: 4px solid var(--acc); }
.home main > h2 { border: 0; padding: 0; }
table { border-collapse: collapse; width: 100%; margin: 14px 0; background: var(--card); border-radius: 11px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
th, td { border-bottom: 1px solid var(--line); padding: 9px 13px; text-align: left; }
th { background: var(--box); font-size: .92rem; }
tr:last-child td { border-bottom: 0; }
.mean li { margin: 6px 0; }
.post-meta { color: var(--mut); font-size: .9rem; margin-top: -8px; }

footer { margin-top: 56px; padding: 36px 0 28px; border-top: 1px solid var(--line); background: var(--card); font-size: .9rem; }
.fcols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.fcols ul { list-style: none; padding: 0; margin: 8px 0 0; }
.fcols li { margin: 5px 0; }
.fcols a { color: var(--mut); text-decoration: none; }
.fcols a:hover { color: var(--acc); text-decoration: underline; }
.copy { margin: 28px 0 0; color: var(--mut); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
