/* Portfolio: calm premium, light + dark. System fonts only (no external requests). */
:root {
  --bg: #f7f5f1; --surface: #ffffff; --surface2: #f1eee8; --ink: #17181c; --ink2: #3a3c42; --muted: #62656d;
  --line: #e3dfd7; --accent: #24427c; --accent-ink: #ffffff; --accent-soft: #e7ecf5; --ok: #2b7a4b; --warn: #a15c07;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 8px 28px rgba(20, 20, 30, .07);
  --shadow-lg: 0 2px 6px rgba(20, 20, 30, .06), 0 22px 60px rgba(20, 20, 30, .12);
  --pa: var(--accent);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 16px; --gut: 24px; --max: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012; --surface: #17181b; --surface2: #1d1f23; --ink: #ecebe8; --ink2: #cfcdc8; --muted: #a0a3ab;
    --line: #2a2c31; --accent: #9fb9ec; --accent-ink: #0f1012; --accent-soft: #1a2232; --ok: #6cc596; --warn: #e2a54b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .3);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 22px 60px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1012; --surface: #17181b; --surface2: #1d1f23; --ink: #ecebe8; --ink2: #cfcdc8; --muted: #a0a3ab;
  --line: #2a2c31; --accent: #9fb9ec; --accent-ink: #0f1012; --accent-soft: #1a2232; --ok: #6cc596; --warn: #e2a54b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .3);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 22px 60px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, video, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2.3rem, 5.4vw, 3.9rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
b, strong { font-weight: 600; color: var(--ink); }
small { color: var(--muted); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 12px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
.i { width: 18px; height: 18px; flex: none; }
.eyebrow { font: 600 .78rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--pa); margin: 0 0 .9em; }
.sub { color: var(--muted); max-width: 720px; }

/* header */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; padding-top: env(safe-area-inset-top); }
.top.scrolled { border-bottom-color: var(--line); }
.bar { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { margin-left: auto; display: flex; gap: 4px; }
.nav a { color: var(--ink2); text-decoration: none; font-size: .93rem; padding: 8px 12px; border-radius: 999px; }
.nav a:hover { background: var(--surface2); color: var(--ink); }
.theme { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.theme:hover { border-color: var(--muted); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: block; }
}
.mono { display: inline-grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--serif); font-weight: 600; letter-spacing: .02em; flex: none; }
.mono.sm { width: 32px; height: 32px; font-size: .8rem; }
.mono.lg { width: min(280px, 62vw); aspect-ratio: 1; font-size: clamp(3rem, 9vw, 5.4rem); background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--ink))); color: var(--accent-ink); box-shadow: var(--shadow-lg); }
.photo { width: min(300px, 64vw); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 50%; box-shadow: var(--shadow-lg); }

/* hero */
.hero { display: grid; grid-template-columns: 1.35fr .65fr; gap: 48px; align-items: center; padding-top: clamp(40px, 8vw, 96px); padding-bottom: 40px; }
.hero-pic { display: flex; justify-content: center; }
.lede { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--ink2); max-width: 640px; }
.meta { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .95rem; }
.meta li { display: flex; align-items: center; gap: 7px; }
.meta .ok { color: var(--ok); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: .95rem; font-weight: 500; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: var(--muted); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; box-shadow: none; }

/* numbers */
.numbers ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.numbers li { padding: 24px 22px; border-left: 1px solid var(--line); }
.numbers li:first-child { border-left: 0; }
.numbers b { display: block; font: 600 clamp(1.7rem, 3vw, 2.3rem)/1.1 var(--serif); color: var(--accent); margin-bottom: 6px; }
.numbers span { font-size: .9rem; color: var(--muted); line-height: 1.45; display: block; }

/* sections */
.sec { padding-top: clamp(56px, 8vw, 96px); }
.sec-h { margin-bottom: 28px; }
.sec-h h2 { margin-bottom: .35em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }

.job { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding: 30px 0; border-top: 1px solid var(--line); }
.job .when span { display: block; font-weight: 600; font-size: .95rem; }
.job .role { font-weight: 600; color: var(--accent); margin: -.3em 0 .5em; }
.job .note { color: var(--muted); font-size: .95rem; }
.pts { padding-left: 1.1em; margin: 0; }
.pts li { margin: 0 0 .6em; color: var(--ink2); }
.pts li::marker { color: var(--pa); }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .93rem; color: var(--pa); text-decoration: none; margin-top: 8px; }
.more .i { width: 16px; height: 16px; transition: transform .2s; }

/* project cards */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s, border-color .25s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--pa) 40%, var(--line)); }
.card:hover .more .i { transform: translateX(3px); }
.card .shot { height: 400px; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--pa) 22%, var(--surface2)), var(--surface2)); display: flex; align-items: center; justify-content: center; padding: 22px 24px; overflow: hidden; }
.card .shot .frame.phone { width: 164px; }
.card .shot .frame.reel { width: 198px; }
.card .shot .frame.desktop, .card .shot .frame.wide { width: 100%; margin-bottom: -40px; }
.card .shot:has(.svgf) { align-items: center; padding: 18px; }
.card .shot .frame.svgf { width: 100%; align-self: center; margin-bottom: 0; background: transparent; box-shadow: none; border: 0; }
.card .body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }
.card .body p { color: var(--muted); font-size: .97rem; }
.card .chips { margin-bottom: 14px; }
.card .more { margin-top: auto; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.chip { font-size: .8rem; padding: 4px 10px; border-radius: 8px; background: var(--surface2); color: var(--ink2); border: 1px solid var(--line); line-height: 1.4; }

/* device frames */
.frame { position: relative; background: var(--surface); }
.frame .m { width: 100%; height: auto; }
.frame.phone { border-radius: 30px; padding: 7px; background: #111; box-shadow: var(--shadow-lg); }
.frame.phone .m { border-radius: 24px; aspect-ratio: 390 / 844; object-fit: cover; object-position: top; background: #222; }
.frame.reel { border-radius: 26px; padding: 6px; background: #111; box-shadow: var(--shadow-lg); }
.frame.reel .m { border-radius: 20px; aspect-ratio: 9 / 16; object-fit: cover; background: #222; }
.frame.desktop, .frame.wide { border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; padding-top: 26px; background: var(--surface2); }
.frame.desktop::before, .frame.wide::before { content: ""; position: absolute; left: 12px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: #e5534b; box-shadow: 14px 0 0 #e8b84a, 28px 0 0 #57b26a; }
.frame.desktop .m { aspect-ratio: 1440 / 900; object-fit: cover; object-position: top; }
.frame.wide .m { aspect-ratio: auto; }
.frame .ph { display: grid; place-items: center; text-align: center; padding: 16px; font-size: .8rem; color: #aaa; background: repeating-linear-gradient(135deg, #1d1d20 0 12px, #222226 12px 24px); }
.frame.svgf { border-radius: 16px; border: 1px solid var(--line); background: var(--surface); padding: 12px; }
video.m { background: #111; }

/* diagrams */
.diagram { width: 100%; height: auto; font-family: var(--sans); }
.diagram .d-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.diagram .d-box2 { fill: var(--surface2); stroke: var(--line); stroke-width: 1.2; }
.diagram .d-acc { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 45%, var(--line)); stroke-width: 1.2; }
.diagram .d-pill { fill: var(--ink); }
.diagram .d-pill + text { fill: var(--bg); }
.diagram .d-line { stroke: var(--muted); stroke-width: 1.5; fill: none; marker-end: none; }
.diagram .dash { stroke-dasharray: 4 4; }
.diagram .d-t { font-size: 13px; fill: var(--ink); font-weight: 500; }
.diagram .d-h { font-size: 15px; fill: var(--ink); font-weight: 600; }
.diagram .d-s { font-size: 11.5px; fill: var(--muted); }

/* skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.sk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; }
.sk h3 { font-size: 1.05rem; margin-bottom: 12px; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.list b { display: block; }
.list span { color: var(--muted); font-size: .95rem; }
.list small { white-space: nowrap; }

.contact { padding-bottom: 24px; }
.contact-list { list-style: none; padding: 0; margin: 0 0 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.contact-list li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; min-width: 0; }
.contact-list li a, .contact-list li span { overflow-wrap: anywhere; }
.contact-list .i { color: var(--muted); }
.contact-list small { width: 100%; padding-left: 30px; margin-top: -6px; }

.foot { margin-top: 80px; border-top: 1px solid var(--line); padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); color: var(--muted); font-size: .88rem; }
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot p { margin: 0; }
.foot a { color: var(--ink2); }

/* project pages */
.p-hero { padding-top: 28px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .93rem; margin-bottom: 28px; }
.back:hover { color: var(--ink); }
.p-top { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.p-top h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.p-top .chips { margin: 4px 0 22px; }
.p-cover { display: flex; justify-content: center; padding: 28px; border-radius: 28px; background: radial-gradient(110% 80% at 50% 0%, color-mix(in srgb, var(--pa) 26%, var(--surface2)), var(--surface2)); }
.p-cover .frame.phone { width: min(290px, 70vw); }
.p-cover .frame.reel { width: min(330px, 78vw); }
.p-cover .frame.desktop, .p-cover .frame.wide, .p-cover .frame.svgf { width: 100%; }
.lives { display: flex; flex-wrap: wrap; gap: 10px; }
.live { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.live span { display: flex; flex-direction: column; line-height: 1.3; }
.live b { font-weight: 600; font-size: .93rem; }
.live small { font-size: .8rem; }
.live.private .i { color: var(--warn); }
.live:not(.private) .i { color: var(--ok); }
.live:hover { border-color: var(--muted); }
.p-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 48px; }
.p-grid > div > p { color: var(--ink2); }
.hls { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px; align-items: start; }
.hl { margin: 0; }
.hl:has(.desktop), .hl:has(.wide) { grid-column: span 2; }
.hl figcaption { font-size: .92rem; color: var(--muted); margin-top: 14px; }
.credit { font-size: .85rem; color: var(--muted); margin-top: 18px; }
.credits { font-size: .9rem; color: var(--muted); }
.credits h2 { font-size: 1.3rem; }

.flow { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 0; counter-reset: s; }
.flow li { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .95rem; position: relative; margin-right: 34px; }
.flow li:not(:last-child)::after { content: ""; position: absolute; right: -27px; top: 50%; width: 20px; height: 2px; background: var(--muted); opacity: .6; }
.flow li:not(:last-child)::before { content: ""; position: absolute; right: -28px; top: calc(50% - 4px); width: 7px; height: 7px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); opacity: .6; }
.flow .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--pa); color: #fff; flex: none; }

.pn { display: flex; justify-content: space-between; gap: 16px; padding-top: 72px; }
.pn a { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.pn a:hover { border-color: var(--muted); }
.pn span { display: flex; flex-direction: column; line-height: 1.3; font-weight: 600; }
.pn a:last-child span { align-items: flex-end; }
.pn small { font-weight: 400; }

/* demos */
.demo { margin-top: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.demo:first-child { margin-top: 0; }
.demo-h { padding: 26px 28px 0; max-width: 760px; }
.demo-h h3 { font-size: 1.5rem; }
.demo-h p:last-child { color: var(--muted); }
.demo-body { padding: 8px 28px 28px; min-height: 120px; }
.demo-body .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.demo-body .hint { font-size: .88rem; color: var(--muted); }
.demo-body .err { color: #c92a2a; font-size: .9rem; }
.panel { background: var(--surface2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
textarea.code, .code { font: 13px/1.55 var(--mono); }
textarea.code { width: 100%; min-height: 250px; resize: vertical; background: var(--surface2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .93rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
mark.red { background: color-mix(in srgb, #e03131 20%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
input[type="range"] { width: 100%; accent-color: var(--pa); }
select, input[type="number"], input[type="text"] { font: inherit; font-size: .93rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; min-height: 38px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem; color: var(--ink2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal, .reveal.instant { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .btn { transition: none; }
}

/* responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-pic { order: -1; justify-content: flex-start; }
  .mono.lg, .photo { width: 120px; font-size: 2.4rem; }
  .numbers ul { grid-template-columns: repeat(2, 1fr); }
  .numbers li:nth-child(3) { border-left: 0; }
  .numbers li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .p-top { grid-template-columns: 1fr; gap: 32px; }
  .p-grid { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 720px) {
  :root { --gut: 16px; }
  body { font-size: 16px; }
  .nav { display: none; }
  .brand { margin-right: auto; }
  .grid, .skills, .two, .split, .contact-list { grid-template-columns: 1fr; }
  .two { gap: 8px; }
  .job { grid-template-columns: 1fr; gap: 8px; }
  .card .shot { height: 360px; }
  .card .shot .frame.phone { width: 146px; }
  .card .shot .frame.reel { width: 176px; }
  .hls { grid-template-columns: 1fr 1fr; gap: 18px; }
  .hl:has(.desktop), .hl:has(.wide) { grid-column: span 2; }
  .flow { flex-direction: column; gap: 22px; }
  .flow li { margin-right: 0; }
  .flow li:not(:last-child)::after { right: auto; left: 27px; top: auto; bottom: -18px; width: 2px; height: 14px; }
  .flow li:not(:last-child)::before { right: auto; left: 24px; top: auto; bottom: -19px; transform: rotate(135deg); }
  .demo-h { padding: 20px 18px 0; }
  .demo-body { padding: 6px 18px 20px; }
  .pn { flex-direction: column; }
  .pn a:last-child { justify-content: flex-end; }
  .list li { flex-direction: column; gap: 4px; }
  .p-cover { padding: 20px; }
}
@media (max-width: 380px) {
  .hls { grid-template-columns: 1fr; }
  .hl:has(.desktop), .hl:has(.wide) { grid-column: auto; }
  .numbers li { padding: 18px 14px; }
}
@media print {
  .top, .theme, .demo, .pn, .foot { display: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ---- demos ---------------------------------------------------------------------------------------------------- */
.panel h4 { margin: 0 0 12px; font-size: 1rem; }
.hint { margin: 8px 0 0; }

/* dice (ported from BashGames) */
.dice-panel { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.dice-row { display: flex; gap: 26px; padding: 34px 0 18px; }
.dice-total { font-weight: 600; min-height: 1.6em; margin: 0; }
.die3d { --s: 64px; width: var(--s); height: var(--s); position: relative; perspective: calc(var(--s) * 7); flex: none; }
.die3d .cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; will-change: transform; }
.die3d .face { position: absolute; inset: 0; border-radius: 18%; background: linear-gradient(145deg, #ffffff, #efe8db 70%, #e2d8c6);
  border: 1px solid #d6cbb7; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 13%;
  box-shadow: inset 0 0 calc(var(--s) * .12) rgba(120, 90, 50, .18); backface-visibility: hidden; }
.die3d .face i { display: block; border-radius: 50%; margin: 14%; }
.die3d .face i.pip { background: radial-gradient(circle at 35% 30%, #5b5148, #1e1a16 70%); box-shadow: inset 0 1px 1px rgba(0,0,0,.4); }
.die3d .face i.pip.red { background: radial-gradient(circle at 35% 30%, #ff7b7b, #c1121f 70%); margin: 4%; }
.die3d .f1 { transform: translateZ(calc(var(--s) / 2)); }
.die3d .f6 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.die3d .f3 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.die3d .f4 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.die3d .f5 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.die3d .f2 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.die3d .die-shadow { position: absolute; left: 12%; right: 12%; bottom: -16%; height: 16%; border-radius: 50%; background: radial-gradient(rgba(0,0,0,.3), transparent 70%); }
.die3d.rolling .die-shadow { animation: dieShadow .9s ease-out; }
@keyframes dieShadow { 40% { transform: scale(.6); opacity: .5; } }

/* spot the twin */
.km-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.km-wrap figure { margin: 0; text-align: center; }
.km-wrap figcaption { font-size: .8rem; color: var(--muted); }
.km-wrap > .hint { grid-column: 1 / -1; }
.km { width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.km-bg { fill: #fffdf8; stroke: #e2d6c2; stroke-width: 1.2; }
.km-sym { pointer-events: none; }
.km-sym.got { animation: kmGot .35s ease-out; }
.km-hit { fill: transparent; cursor: pointer; }
.km-wrap.miss { animation: kmMiss .4s; }
.km-msg { font-weight: 600; margin: 10px 0; min-height: 1.6em; }
@keyframes kmGot { 50% { filter: drop-shadow(0 0 6px gold); } }
@keyframes kmMiss { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* karaoke */
.ko-stage { position: relative; background: #121318; border-radius: 12px; padding: 10px; }
.ko-lane { width: 100%; height: 170px; }
.ko-bar { fill: #3d4252; }
.ko-sung { fill: none; stroke: #ffd43b; stroke-width: .9; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ko-sung { stroke-width: 3; }
.ko-head { stroke: #ff6b6b; stroke-width: 2; vector-effect: non-scaling-stroke; }
.ko-big { position: absolute; inset: 0; display: grid; place-items: center; font: 700 3.4rem/1 var(--sans); color: #fff; pointer-events: none; }
.ko-words { font-size: 1.15rem; margin: 14px 0; }
.ko-words span { color: var(--muted); transition: color .1s; }
.ko-words span.on { color: var(--pa); font-weight: 700; }
.ko-opt { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* finance parser */
.redact-panel { margin-top: 18px; }
pre.redacted { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; max-height: 380px; overflow: auto; }
.demo-body > .row { margin-bottom: 4px; }
.demo-body > .hint { margin-bottom: 14px; }

/* envelopes */
.env-top { display: flex; flex-wrap: wrap; gap: 18px 32px; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.env-inc { display: flex; flex-direction: column; gap: 2px; min-width: 240px; flex: 1; }
.env-inc b { font-size: 1.2rem; }
.env-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.env-left { font: 600 1.9rem/1.1 var(--serif); color: var(--warn); }
.env-left.ok { color: var(--ok); }
.env-left.bad { color: #e03131; }
.env-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin-bottom: 14px; background: var(--line); }
.env-bar i { min-width: 0; flex-basis: 0; transition: flex-grow .2s; }
.env-bar i.rest { background: repeating-linear-gradient(135deg, var(--line) 0 6px, transparent 6px 12px); }
.env-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: 12px; align-items: center; padding: 4px 0; }
.env-n { display: flex; align-items: center; gap: 8px; font-size: .93rem; }
.env-v { text-align: right; font-variant-numeric: tabular-nums; font-size: .93rem; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.s0 { background: #4c6ef5; } .s1 { background: #40c057; } .s2 { background: #fab005; } .s3 { background: #15aabf; }
.s4 { background: #fd7e14; } .s5 { background: #be4bdb; } .s6 { background: #2f9e44; } .s7 { background: #e64980; }

/* family set */
.fs-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.fs-row { display: grid; grid-template-columns: 1fr auto auto 84px 32px; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.fs-p { text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.fs-rm { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.fs-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fs-sum > div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fs-sum > div.ok { color: var(--ok); font-weight: 600; }
.fs-total b { font: 600 1.6rem/1.2 var(--serif); }

/* lyrics */
.ly-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.ly-head div { display: flex; flex-direction: column; }
.ly-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pa); box-shadow: 0 0 0 6px color-mix(in srgb, var(--pa) 20%, transparent); }
.ly-box { height: 250px; overflow: hidden; position: relative; display: flex; flex-direction: column; gap: 4px; padding: 90px 0; mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent); }
.ly-line { text-align: left; background: none; border: 0; padding: 6px 4px; font: 600 clamp(1.15rem, 2.6vw, 1.5rem)/1.3 var(--serif); color: var(--muted); cursor: pointer; opacity: .55; transition: opacity .2s, color .2s, transform .2s; transform-origin: left center; }
.ly-line.past { opacity: .35; }
.ly-line.on { opacity: 1; color: var(--ink); transform: scale(1.04); }
.ly-box.waiting .ly-line { opacity: .9; color: var(--ink2); }
.ly-box.waiting .ly-line:hover { color: var(--pa); }
.ly-status { font-weight: 600; margin: 10px 0; }

/* jobradar score */
.sc-w { display: grid; grid-template-columns: 100px 1fr 32px; gap: 10px; align-items: center; font-size: .93rem; margin-bottom: 6px; }
.sc-w b { text-align: right; font-variant-numeric: tabular-nums; }
.sc-list { display: flex; flex-direction: column; gap: 12px; }
.sc-job { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
.sc-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sc-top div { display: flex; flex-direction: column; }
.sc-score { font: 700 1.5rem/1 var(--sans); border-radius: 12px; padding: 8px 10px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.sc-score.hi { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.sc-score.mid { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.sc-score.lo { background: var(--surface2); color: var(--muted); }
.sc-bar { display: grid; grid-template-columns: 92px 1fr 28px; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); }
.sc-track { height: 6px; border-radius: 9px; background: var(--surface2); overflow: hidden; }
.sc-track i { display: block; height: 100%; background: var(--pa); border-radius: 9px; }
.sc-bar small { text-align: right; }
.sc-note { color: #e03131; font-size: .85rem; margin: 8px 0 0; }
.sc-act { font-size: .85rem; font-weight: 600; margin: 8px 0 0; color: var(--ink2); }

/* clip pipeline */
.cp { display: grid; grid-template-columns: 1fr 230px; gap: 24px; align-items: start; }
.cp-steps { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: c; }
.cp-steps li { counter-increment: c; font-size: .8rem; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); transition: all .25s; }
.cp-steps li::before { content: counter(c) " · "; }
.cp-steps li.on { background: var(--pa); border-color: var(--pa); color: #fff; }
.cp-steps li.done { color: var(--ink2); border-color: color-mix(in srgb, var(--pa) 40%, var(--line)); }
.cp-frame { border-radius: 12px; overflow: hidden; background: #000; }
.cp-src { width: 100%; height: auto; }
.cp-info { margin-top: 12px; }
.cp-words { margin: 0 0 10px; font-size: .9rem; line-height: 1.7; min-height: 4.8em; }
.cp-words span { opacity: 0; transition: opacity .2s; border-radius: 4px; }
.cp-words span.in { opacity: 1; }
.cp-words .sp1 { color: var(--ink); }
.cp-words .sp0 { color: var(--muted); }
.cp-words span.sel { background: color-mix(in srgb, var(--pa) 12%, transparent); }
.cp-words span.now { background: #ffd43b; color: #000; }
.cp-wave { width: 100%; height: 56px; display: block; }
.cp-pick { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; opacity: .15; transition: opacity .4s; font-size: .9rem; }
.cp-pick.in { opacity: 1; }
.cp-pick b { color: var(--pa); }
.cp .btn { margin-top: 12px; }
.cp-right { display: flex; flex-direction: column; align-items: center; }
.cp-phone { width: 100%; max-width: 220px; }
.cp-out { width: 100%; height: auto; border-radius: 24px; display: block; }

@media (max-width: 720px) {
  .cp { grid-template-columns: 1fr; }
  .cp-right { order: -1; }
  .cp-phone { max-width: 190px; }
  .env-row { grid-template-columns: 1fr 96px; }
  .env-row input { grid-column: 1 / -1; grid-row: 2; }
  .fs-row { grid-template-columns: 1fr auto auto 32px; }
  .fs-p { display: none; }
  .dice-row { gap: 18px; }
}
