/* ZY portfolio — engineering-zine aesthetic (bryllim.com reference):
   monospace everything, paper background, hairlines, halftone dots. */

:root {
  --bg: #fafafa;
  --ink: #171717;
  --soft: #8a8a8a;
  --line: #e6e6e6;
  --accent: #2451ff;
  --kbd-bg: #f0f0f0;
  --dot: #d9d9d9;
  --live: #16a34a;
}
html.dark {
  --bg: #0e0e0e;
  --ink: #eaeaea;
  --soft: #7d7d7d;
  --line: #242424;
  --accent: #7c9aff;
  --kbd-bg: #1c1c1c;
  --dot: #2c2c2c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: var(--bg); color: var(--ink);
  font-size: 14px; line-height: 1.65;
  transition: background .2s, color .2s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- sidebar ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: 224px;
  border-right: 1px solid var(--line);
  padding: 2rem 1.6rem; display: flex; flex-direction: column; gap: 1.4rem;
  overflow-y: auto;
}
.side-name {
  color: var(--ink); font-weight: 600; font-size: 1.02rem; letter-spacing: .01em; line-height: 1.4;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
}
.side-scroll {
  overflow-y: auto; max-height: 42vh; padding-right: .5rem;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.side-scroll::-webkit-scrollbar { width: 8px; }
.side-scroll::-webkit-scrollbar-track { background: var(--kbd-bg); border-radius: 8px; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.side-scroll::-webkit-scrollbar-thumb:hover { background: var(--soft); }
.side-group { display: grid; gap: .55rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.side-group + .side-group { padding-top: 1.2rem; }
.side-group a { color: var(--soft); font-size: .82rem; transition: color .15s; }
.side-group a:hover { color: var(--ink); }
.side-main { gap: .85rem; }
.side-main a {
  display: flex; align-items: center; gap: .7rem;
  color: var(--ink); font-size: .95rem; font-weight: 500;
}
.side-main a svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; color: var(--soft); flex: none;
}
.side-main a:hover svg { color: var(--ink); }
.side-last { border-bottom: none; padding-bottom: .2rem; }
.side-bottom { margin-top: auto; display: grid; gap: .7rem; }
.side-hint {
  color: var(--soft); font-size: .8rem; white-space: nowrap;
  background: none; border: none; padding: 0; font-family: inherit;
  cursor: pointer; text-align: left; width: max-content;
}
.side-hint:hover { color: var(--ink); }
.side-hint kbd { font-size: .68rem; }
.side-people { line-height: 0; }
.ava-stack { display: inline-flex; align-items: center; }
.ava-stack svg { width: 26px; height: 26px; color: var(--soft); margin-right: -8px; }
.ava-more {
  width: 26px; height: 26px; border-radius: 50%; background: var(--kbd-bg);
  border: 1px solid var(--line); color: var(--soft); font-size: .6rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-chat {
  display: flex; align-items: center; gap: .55rem; color: var(--ink); font-size: .85rem;
}
.side-chat svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--soft); }
.side-chat:hover svg { color: var(--ink); }
kbd {
  background: var(--kbd-bg); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: .05rem .35rem; font-size: .7rem; font-family: inherit;
}
.side-live { font-size: .8rem; color: var(--soft); }
.side-live strong { color: var(--ink); font-size: .9rem; }
.theme-row {
  display: inline-flex; gap: .2rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--kbd-bg); padding: .22rem; width: max-content;
}
.theme-row button {
  border: none; background: transparent; color: var(--soft); cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-family: inherit;
}
.theme-row button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-row button.on { background: var(--bg); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.side-note { color: var(--soft); font-size: .74rem; line-height: 1.5; }
.side-mail {
  color: var(--ink); font-size: .72rem; text-decoration: underline; text-underline-offset: 3px;
  word-break: break-all; display: flex; align-items: center; gap: .5rem;
}
.side-mail svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; color: var(--soft); }

/* ---------- overlays: Ask Anything (Alt+K) + Typing Test (Alt+J) ---------- */
@font-face {
  font-family: 'Geist Pixel';
  src: url('https://cdn.jsdelivr.net/gh/vercel/geist-pixel-font@main/fonts/webfonts/GeistPixel-Square.woff2') format('woff2');
  font-display: swap;
}
.no-scroll { overflow: hidden; }
.ov {
  position: fixed; inset: 0; z-index: 80; background: var(--bg);
  display: grid; place-items: center; padding: 1.5rem;
}
.ov-hint { color: var(--soft); font-size: .78rem; margin-top: 1.4rem; }

/* ask anything */
.ask-box { width: min(92vw, 760px); display: grid; gap: 1.2rem; }
.ask-title {
  font-family: 'Geist Pixel', 'Geist Mono', monospace;
  font-size: clamp(1.7rem, 4.6vw, 3rem); font-weight: 400;
  line-height: 1.1; text-transform: lowercase;
}
.ask-input {
  background: transparent; border: none; outline: none;
  color: var(--ink); caret-color: var(--ink);
  font-family: inherit; font-size: 1.05rem; width: 100%;
  border-bottom: 1px solid transparent; padding: .3rem 0;
}
.ask-input:focus { border-bottom-color: var(--line); }
.ask-input::placeholder { color: var(--soft); }

/* typing test */
.tt-box { width: min(94vw, 880px); display: grid; gap: 2rem; justify-items: center; text-align: center; }
.tt-stats { display: flex; gap: 3.2rem; justify-content: center; }
.tt-stat-top { display: flex; align-items: baseline; gap: .15rem; justify-content: center; }
.tt-stat strong { font-size: 2rem; font-weight: 700; }
.tt-stat i { font-style: normal; color: var(--soft); font-size: .9rem; }
.tt-stat > span { color: var(--soft); font-size: .68rem; letter-spacing: .14em; }
.tt-words {
  font-size: 1.22rem; line-height: 1.95; color: var(--soft);
  max-width: 62ch; text-align: left; user-select: none;
}
.tt-words span { border-left: 2px solid transparent; }
.tt-words .c-ok { color: var(--ink); }
.tt-words .c-bad { color: #dc2626; }
.tt-words .c-cur { border-left-color: var(--ink); animation: caret 1s step-end infinite; }
@keyframes caret { 50% { border-left-color: transparent; } }
.kb { display: grid; gap: .45rem; justify-items: center; }
.kb-row { display: flex; gap: .45rem; }
.kb-key {
  width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--kbd-bg); color: var(--soft); font-size: .8rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .1s, color .1s;
}
.kb-space { width: 330px; letter-spacing: .18em; font-size: .7rem; }
.kb-key.on { background: var(--line); color: var(--ink); }
.tt-hints { color: var(--soft); font-size: .8rem; display: flex; gap: 1.6rem; justify-content: center; }
.tt-result { gap: 1.1rem; }
.tt-big {
  font-family: 'Geist Pixel', 'Geist Mono', monospace;
  font-size: clamp(3.6rem, 11vw, 6.4rem); line-height: 1; margin-top: .6rem;
}
.tt-big-label { color: var(--soft); font-size: .72rem; letter-spacing: .22em; }
.tt-beat { color: var(--soft); font-size: .92rem; margin-top: .6rem; }
.tt-save { width: min(88vw, 380px); }
.tt-save .tt-name { text-align: center; }
.tt-saved { color: var(--accent); font-size: .85rem; text-align: center; }
.tt-recent { color: var(--soft); font-size: .76rem; }
.tt-again {
  background: var(--ink); color: var(--bg); border: none; border-radius: 999px;
  padding: .85rem 1.7rem; font-family: inherit; font-size: .92rem; font-weight: 600;
  cursor: pointer; margin-top: .4rem;
}
.tt-again:hover { opacity: .9; }

/* ---------- main ---------- */
.mn { margin-left: 224px; padding: 3.5rem clamp(1.4rem, 6vw, 5rem) 4rem; max-width: 900px; position: relative; }
.dots-corner {
  position: absolute; top: 0; right: 0; width: 240px; height: 300px; z-index: -1;
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.5px);
  background-size: 14px 14px;
  mask-image: linear-gradient(215deg, #000 20%, transparent 70%);
  -webkit-mask-image: linear-gradient(215deg, #000 20%, transparent 70%);
}
.dots-row {
  height: 14px; margin: 2.6rem 0;
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.5px);
  background-size: 22px 14px; background-position: center;
}

/* hero */
.hero { display: grid; grid-template-columns: 300px 1fr; gap: 2.6rem; align-items: center; }
.hero-img { width: 100%; height: auto; display: block; }
html.dark .hero-img { filter: invert(1); }
.hero-copy h1 {
  font-size: clamp(1.9rem, 3.8vw, 2.8rem); font-weight: 600; letter-spacing: .005em; margin-bottom: 1rem;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
}
.hero-copy p { color: var(--ink); margin-bottom: 1rem; max-width: 46ch; }
.hero-copy strong { font-weight: 700; }
.hero-links { display: flex; gap: 1.4rem; }
.hero-links a { color: var(--soft); font-size: .82rem; }
.hero-links a:hover { color: var(--accent); }

/* stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); margin-top: 2.8rem;
}
.stat { padding: 1.4rem 1rem 1.2rem; border-right: 1px solid var(--line); }
.stat:last-child { border-right: none; }
.stat strong { font-size: 1.5rem; font-weight: 700; display: block; }
.stat strong i { font-style: normal; color: var(--soft); font-size: .8rem; vertical-align: super; }
.stat span { color: var(--soft); font-size: .68rem; letter-spacing: .08em; }

/* sections */
.sec { margin-top: 3rem; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: .7rem; }
.sec-no { color: var(--soft); font-size: .82rem; }
.sec-all { color: var(--soft); font-size: .72rem; letter-spacing: .08em; }
.sec-all:hover { color: var(--accent); }
.row {
  display: flex; justify-content: space-between; gap: 2rem;
  padding: 1.15rem 0; border-bottom: 1px solid var(--line);
}
.row h3 { font-size: .95rem; font-weight: 700; margin-bottom: .25rem; }
.row p { color: var(--soft); font-size: .82rem; max-width: 62ch; }
.row time { color: var(--soft); font-size: .78rem; white-space: nowrap; padding-top: .15rem; }
.row-link { color: var(--accent); font-size: .78rem; font-weight: 400; margin-left: .5rem; }

/* stack chips */
.chips { display: flex; flex-wrap: wrap; gap: .55rem; padding-top: 1.2rem; }
.chips span {
  border: 1px solid var(--line); border-radius: 6px; padding: .3rem .7rem;
  font-size: .76rem; color: var(--ink); background: var(--kbd-bg);
}

/* footer */
.foot p { color: var(--soft); font-size: .76rem; text-align: center; }

/* ---------- community chat panel ---------- */
.cv {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(94vw, 400px); background: var(--bg); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(103%); transition: transform .25s ease-out;
  box-shadow: -20px 0 60px -30px rgba(0,0,0,.5);
}
.cv.on { transform: translateX(0); }
.cv-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--line);
}
.cv-count { color: var(--soft); font-size: .82rem; }
.cv-x {
  border: none; background: var(--kbd-bg); color: var(--soft); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; font-family: inherit;
}
.cv-x:hover { color: var(--ink); }
.cv-list { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: grid; gap: .9rem; align-content: start; }
.cv-msg { display: flex; gap: .6rem; align-items: flex-start; }
.cv-avawrap { flex: none; line-height: 0; }
.cv-ava { width: 34px; height: 34px; }
html.dark .cv-ava { filter: invert(1); }
.cv-body { min-width: 0; }
.cv-meta { color: var(--soft); font-size: .7rem; margin-bottom: .25rem; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.cv-meta strong { color: var(--ink); font-size: .78rem; }
.cv-devwrap { line-height: 0; }
.cv-dev { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.cv-bubble {
  background: var(--kbd-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: .5rem .8rem; font-size: .85rem; width: max-content; max-width: 100%;
  overflow-wrap: break-word;
}
.cv-foot { border-top: 1px solid var(--line); padding: .9rem 1.1rem 1.1rem; display: grid; gap: .6rem; }
.cv-q { color: var(--soft); font-size: .82rem; }
.cv-q strong { color: var(--ink); }
.cv-inrow { display: flex; align-items: center; gap: .8rem; }
.cv-in {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--ink); font-family: inherit; font-size: .95rem; padding: .3rem 0;
}
.cv-in::placeholder { color: var(--soft); }
.cv-send { color: var(--soft); font-size: .8rem; cursor: pointer; white-space: nowrap; }
.cv-send:hover { color: var(--ink); }
.cv-note { color: var(--soft); font-size: .68rem; }
.cv-play {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--kbd-bg);
  color: var(--ink); font-family: inherit; font-size: .82rem; padding: .6rem .9rem;
  cursor: pointer; margin-top: .2rem;
}
.cv-play small { color: var(--soft); font-size: .68rem; }
.cv-play:hover { border-color: var(--soft); }
.cv-gamewrap { border-bottom: 1px solid var(--line); padding: .8rem 1.1rem; display: grid; gap: .4rem; }
.cv-court { width: 100%; height: auto; display: block; cursor: pointer; background: var(--kbd-bg); border: 1px solid var(--line); border-radius: 10px; }
.cv-kings { color: var(--soft); font-size: .7rem; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .side {
    position: static; width: auto; border-right: none; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem;
  }
  .side-group { border-bottom: none; padding-bottom: 0; grid-auto-flow: column; gap: .9rem; }
  .side-bottom { margin-top: 0; grid-auto-flow: column; align-items: center; }
  .side-note { display: none; }
  .mn { margin-left: 0; }
  .hero { grid-template-columns: 1fr; }
  .hero-img { max-width: 320px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stats .stat { border-bottom: 1px solid var(--line); }
}
