:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #1c1e26;
  --dim: #666b78;
  --accent: #d93a3f;
  --line: #dcdfe5;
  --line-strong: #a2a8b4;
  --surface: rgba(255, 255, 255, 0.97);
  --chip: rgba(255, 255, 255, 0.88);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
header, #hint, #count, nav { position: fixed; pointer-events: none; }
#count { top: max(16px, env(safe-area-inset-top)); right: 16px; margin: 0; font-size: 0.85rem; color: var(--dim); font-variant-numeric: tabular-nums; }
header { top: max(16px, env(safe-area-inset-top)); left: 16px; }
h1 { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -0.02em; }
.blink { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#hint {
  left: 16px; right: 16px;
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 72px));
  margin: 0;
  text-align: center;
  color: var(--dim);
  font-size: 0.85rem;
  transition: opacity 1.2s;
}
#hint.gone { opacity: 0; }
nav {
  left: 0; right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 8px;
}
button {
  pointer-events: auto;
  font: inherit;
  font-size: 0.8rem;
  color: var(--dim);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover { color: var(--fg); border-color: var(--line-strong); }
button[aria-pressed="true"] { color: var(--fg); border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
button.primary { color: var(--fg); border-color: var(--accent); margin-left: 8px; }

dialog {
  position: fixed;
  inset: auto 0 0 0;
  width: min(560px, 100%);
  max-width: 100%;
  max-height: 85dvh;
  margin: 0 auto;
  padding: 20px 20px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  color: var(--fg);
  background: var(--surface);
  box-shadow: 0 -12px 40px rgba(28, 30, 38, 0.12);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  -webkit-user-select: text;
  user-select: text;
}
dialog[open] { animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog::backdrop { background: rgba(255, 255, 255, 0.6); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.03em; }
.lede { margin: 8px 0 16px; color: var(--dim); font-size: 0.85rem; }
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.projects a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.projects a:hover { border-color: var(--accent); }
.projects a:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.name { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.url { color: var(--dim); font-size: 0.8rem; }
.projects a:hover .url { color: var(--fg); }
.desc { grid-column: 1 / -1; color: var(--dim); font-size: 0.85rem; line-height: 1.5; }
.badge {
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  white-space: nowrap;
}
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: var(--accent); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.kind {
  grid-column: 1 / -1;
  color: var(--fg);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Standalone pages (sites.html): normal scrolling document, same cards. */
body.page { overflow: auto; -webkit-user-select: text; user-select: text; }
body.page main { width: min(640px, 100%); margin: 0 auto; padding: 24px 16px 64px; }
.home { color: var(--fg); text-decoration: none; font-weight: 600; letter-spacing: -0.02em; }
.title { margin: 48px 0 0; font-size: clamp(2.5rem, 10vw, 4rem); letter-spacing: -0.04em; }
.back { margin: 24px 0 0; font-size: 0.85rem; }
.back a { color: var(--dim); }
.back a:hover, .home:hover { color: var(--accent); }
.shot {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--line);
}
button[hidden] { display: none; }
nav { flex-wrap: wrap; padding: 0 8px; }
@media (max-width: 420px) {
  nav { gap: 5px; }
  nav button { padding: 8px 9px; font-size: 0.75rem; }
  button.primary { margin-left: 3px; }
}
