@font-face { font-family: "NotoTC"; src: url("fonts/NotoSansTC-VF.ttf") format("truetype"); font-weight: 100 900; font-display: block; }
@font-face { font-family: "InterV"; src: url("fonts/Inter.ttf") format("truetype"); font-weight: 100 900; font-display: block; }
@font-face { font-family: "InstrumentSerif"; src: url("fonts/InstrumentSerif-Regular.ttf") format("truetype"); font-weight: 400; font-display: block; }

:root {
  --ink: #161616;
  --ink-2: #4a4a4a;
  --mute: #9a9a98;
  --faint: #bdbdbb;
  --hair: #efefee;
  --stage: #efefed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #fff; }
body {
  font-family: "InterV", "NotoTC", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}

#app { display: flex; width: 100vw; height: 100vh; }

/* ---------- left: the list ---------- */
#panel {
  position: relative;
  flex: 0 0 33.333%;
  height: 100%;
  background: #fff;
  padding: 84px 56px 0 64px;
  border-right: 1px solid #ececeb;
  z-index: 2;
}
h1 {
  font-family: "NotoTC", sans-serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--ink);
}
#meta {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--mute);
  letter-spacing: 0.02em;
}
#meta .dot, footer .dot { margin: 0 9px; color: var(--faint); }

#add {
  margin-top: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 16px;
  border-radius: 11px;
  background: #f6f6f5;
  cursor: text;
}
#add:focus-within { background: #f2f2f1; }
#add .plus { flex: 0 0 auto; stroke: #a8a8a6; stroke-width: 1.4; stroke-linecap: round; fill: none; }
#new {
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: 0.02em;
  caret-color: var(--ink);
}
#new::placeholder { color: #aaaaa8; }

#list { position: relative; margin-top: 14px; height: 600px; }

.row {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding-left: 2px;
  cursor: pointer;
  user-select: none;
  will-change: transform;
}
.row::after {
  content: "";
  position: absolute;
  left: 35px; right: 0; bottom: 0;
  height: 1px;
  background: var(--hair);
}
.box {
  position: relative;
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border-radius: 5.5px;
  border: 1.5px solid #c8c8c6;
}
.row:hover .box { border-color: #8f8f8d; }
.box .fill {
  position: absolute; inset: -1.5px;
  border-radius: 5.5px;
  background: var(--ink);
  opacity: 0;
}
.box svg { position: absolute; left: -1.5px; top: -1.5px; width: 18px; height: 18px; }
.box .tick { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.label { position: relative; font-size: 15px; letter-spacing: 0.02em; white-space: nowrap; color: var(--ink); }
.label .strike {
  position: absolute; left: -2px; top: 52%;
  height: 1.2px; width: 0;
  background: #b3b3b1;
}

#doneHead {
  position: absolute; left: 0; top: 0;
  display: flex; gap: 10px;
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.12em;
  opacity: 0;
}
#doneCount { color: var(--faint); letter-spacing: 0.04em; }

footer {
  position: absolute;
  left: 64px; bottom: 44px;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* ---------- right: the stage ---------- */
#stage { position: relative; flex: 1 1 auto; height: 100%; background: var(--stage); overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.cap { position: absolute; color: var(--mute); font-size: 12px; letter-spacing: 0.08em; pointer-events: none; }
.cap.tl { left: 48px; top: 84px; }
.cap.tl .k { font-size: 12px; letter-spacing: 0.14em; }
.cap.tl .v { margin-top: 12px; color: var(--ink); display: flex; align-items: baseline; gap: 8px; }
#count { font-family: "InterV", sans-serif; font-weight: 300; font-size: 34px; letter-spacing: -0.01em; line-height: 1; }
.cap.tl .u { font-size: 13px; color: var(--mute); }
.cap.bl { left: 48px; bottom: 44px; display: flex; gap: 12px; opacity: 0; }
.cap.bl #latestName { color: var(--ink-2); }
.cap.hint { left: 0; right: 0; bottom: 118px; text-align: center; color: #a6a6a4; font-size: 13px; letter-spacing: 0.1em; }

/* ---------- 形狀庫 ---------- */
#libBtn {
  position: absolute; right: 48px; top: 78px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px 0 12px;
  border: 1px solid #dcdcda; border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  font: inherit; font-size: 12.5px; letter-spacing: 0.08em; color: var(--ink-2);
  cursor: pointer;
}
#libBtn:hover { border-color: #b9b9b7; color: var(--ink); background: #fff; }
#libBtn svg rect { fill: none; stroke: currentColor; stroke-width: 1.2; }

#lib {
  position: absolute; inset: 0; z-index: 5;
  display: none; opacity: 0;
  background: var(--stage);
}
.libhead { position: absolute; left: 48px; top: 78px; }
.libhead h2 { font-family: "NotoTC", sans-serif; font-weight: 400; font-size: 24px; letter-spacing: 0.06em; line-height: 32px; color: var(--ink); }
#libSub { margin-top: 8px; font-size: 12px; color: var(--mute); letter-spacing: 0.06em; }

#grid {
  position: absolute; left: 48px; right: 48px; top: 164px; bottom: 48px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
}
.cell {
  position: relative;
  border-radius: 14px;
  background: #f7f7f5;
  cursor: pointer;
  overflow: hidden;
}
.cell:hover { background: #fbfbfa; }
.cell canvas { display: block; width: 232px; height: 168px; margin: 0 auto; }
.cell .meta { position: absolute; left: 16px; right: 16px; bottom: 30px; display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink); letter-spacing: 0.04em; }
.cell .meta .wd { color: var(--faint); }
.cell .cnt { position: absolute; left: 16px; bottom: 12px; font-size: 11.5px; color: var(--mute); letter-spacing: 0.06em; }
.cell .cnt b { font-weight: 500; color: var(--ink-2); }

#viewer {
  position: absolute; inset: 0;
  display: none; opacity: 0;
  background: var(--stage);
  overflow: hidden;
  transform-origin: 50% 50%;
  cursor: zoom-out;
}
#gl2 { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#viewer .cap.tl { top: 84px; }
#viewer .num { font-family: "InterV", sans-serif; font-weight: 300; font-size: 34px; letter-spacing: -0.01em; line-height: 1; color: var(--ink); }
#viewer .cap.bl { opacity: 1; color: var(--faint); }
