@font-face { font-family: "Inter"; src: url(fonts/Inter.ttf) format("truetype"); font-weight: 100 900; }
@font-face { font-family: "Noto TC"; src: url(fonts/NotoSansTC-Bold.otf) format("opentype"); font-weight: 700; }
@font-face { font-family: "JB Mono"; src: url(fonts/JetBrainsMono-Bold.ttf) format("truetype"); font-weight: 700; }
@font-face { font-family: "Instrument Serif"; src: url(fonts/InstrumentSerif-Regular.ttf) format("truetype"); }

:root {
  --bg: #F2F2EF; --ink: #16161A; --muted: #707076; --faint: #A3A3A8; --line: rgba(20,20,30,.08);
  --card: #FFFFFF; --accent: #E0522C;
  --sans: "Inter", "Microsoft JhengHei", "PingFang TC", "Noto TC", sans-serif;
  --tc: "Inter", "Noto TC", sans-serif;
  --mono: "JB Mono", ui-monospace, monospace;
  --serif: "Instrument Serif", "Noto TC", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before { content: ""; position: fixed; inset: 0; background-image: var(--noise); opacity: .55; pointer-events: none; z-index: 0; }
#app { position: relative; z-index: 1; min-height: 100vh; }
button { font: inherit; color: inherit; }

/* ---------- 頂部 ---------- */
.top { display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 48px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); cursor: pointer; }
.brand b { font-family: var(--tc); font-size: 20px; letter-spacing: .04em; }
.brand i { font-family: var(--serif); font-style: italic; font-size: 24px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(224,82,44,.15); align-self: center; }
.top nav { display: flex; gap: 28px; font-size: 13px; color: var(--muted); }
.top nav span b { color: var(--ink); font-weight: 600; }

/* ---------- 首頁 ---------- */
.hero { padding: 40px 48px 26px; display: flex; align-items: flex-end; justify-content: space-between; }
.hero h1 { margin: 0; font-family: var(--tc); font-size: 46px; letter-spacing: .02em; line-height: 1.1; }
.hero h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 54px; margin-left: 10px; }
.hero p { margin: 12px 0 0; color: var(--muted); font-size: 15px; max-width: 560px; line-height: 1.7; }
.hero .meta { font-family: var(--mono); font-size: 12px; color: var(--faint); text-align: right; line-height: 1.8; letter-spacing: .06em; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 0 48px 48px; }
.card {
  position: relative; background: var(--card); border-radius: 18px; cursor: pointer; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.04), 0 calc(6px + var(--lift,0)*10px) calc(18px + var(--lift,0)*22px) rgba(20,20,40,calc(.05 + var(--lift,0)*.05));
  transform: translateY(calc(var(--lift,0) * -4px));
}
.card .pv { position: relative; height: 222px; margin: 8px 8px 0; border-radius: 12px; background: #F6F6F3; overflow: hidden;
  background-image: radial-gradient(rgba(0,0,0,.07) 1px, transparent 1px); background-size: 16px 16px; }
.card .pv > .holder { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.card .info { padding: 14px 18px 18px; }
.card .num { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .1em; }
.card h3 { margin: 4px 0 4px; font-family: var(--tc); font-size: 17px; display: flex; align-items: baseline; gap: 8px; }
.card h3 small { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 17px; color: var(--muted); }
.card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.card .go { position: absolute; right: 16px; bottom: 18px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: #F2F2EF; font-size: 14px; color: var(--ink); transform: translateX(calc(var(--lift,0) * 3px)); }
.card.intro { background: #18181B; color: #F4F2EC; padding: 26px; display: flex; flex-direction: column; justify-content: space-between; cursor: default; }
.card.intro h3 { font-size: 22px; line-height: 1.4; }
.card.intro p { color: #A6A6AE; }
.card.intro .kbd { font-family: var(--mono); font-size: 11px; color: #77777F; letter-spacing: .08em; }

/* ---------- 元件頁 ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; padding: 18px 48px 0; }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; background: none; border: 0; padding: 6px 0; }
.back:hover { color: var(--ink); }
.title { display: flex; align-items: baseline; gap: 14px; }
.title h2 { margin: 0; font-family: var(--tc); font-size: 26px; }
.title em { font-family: var(--serif); font-size: 26px; color: var(--muted); }
.title .num { font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: .1em; }
.tabs { position: relative; display: flex; background: #E7E7E3; border-radius: 12px; padding: 4px; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.tabs button { position: relative; z-index: 1; border: 0; background: none; padding: 8px 20px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: var(--tc); letter-spacing: .06em; }
.tabs button.on { color: var(--ink); }
.tabs .pill { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 9px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 3px 8px rgba(0,0,0,.06); }
.sub { padding: 6px 48px 0; font-size: 13px; color: var(--muted); }
.stage { position: absolute; left: 48px; right: 48px; top: 172px; bottom: 32px; border-radius: 22px; background: #F7F7F4;
  box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 #fff;
  background-image: radial-gradient(rgba(0,0,0,.075) 1px, transparent 1px); background-size: 22px 22px; overflow: hidden; }
.stage > .holder { position: absolute; left: 50%; top: 50%; }
.stage .corner { position: absolute; font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .1em; }
.pager { display: flex; gap: 8px; }
.pager button { width: 34px; height: 34px; border-radius: 10px; border: 0; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.05); cursor: pointer; color: var(--muted); }

/* 程式碼 */
.code { position: absolute; left: 48px; right: 48px; top: 172px; bottom: 32px; border-radius: 22px; background: #141417; color: #D7D7DC;
  box-shadow: 0 20px 50px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.4); overflow: hidden; display: flex; flex-direction: column; }
.code .head { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 16px 0 22px; border-bottom: 1px solid rgba(255,255,255,.07); }
.code .file { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 12.5px; color: #9A9AA3; }
.code .file .lights { display: flex; gap: 6px; }
.code .file .lights i { width: 10px; height: 10px; border-radius: 50%; background: #3A3A40; }
.code .file b { color: #ECECF0; }
.copy { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px; border: 0; cursor: pointer; font-family: var(--tc); font-size: 13px; letter-spacing: .04em;
  background: linear-gradient(#2C2C32, #232328); color: #EDEDF0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px rgba(0,0,0,.5), 0 calc(2px - var(--press,0)*2px) 0 #0B0B0D;
  transform: translateY(calc(var(--press,0) * 2px)); }
.copy.done { background: linear-gradient(#2F7D53, #256A45); }
.copy svg { width: 14px; height: 14px; }
.code .body { flex: 1; overflow: auto; display: flex; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
.code .gut { padding: 18px 14px 18px 22px; color: #4A4A52; text-align: right; user-select: none; white-space: pre; }
.code pre { margin: 0; padding: 18px 24px 18px 8px; white-space: pre; tab-size: 2; font-family: inherit; }
.code .body::-webkit-scrollbar { width: 10px; height: 10px; }
.code .body::-webkit-scrollbar-thumb { background: #2E2E34; border-radius: 10px; border: 2px solid #141417; }
.tk-c { color: #6A6A74; font-style: italic; }
.tk-s { color: #B8D7A3; }
.tk-n { color: #F0A56B; }
.tk-k { color: #C99BF2; }
.tk-f { color: #82B8FF; }
.tk-p { color: #F2C66D; }
