:root {
  --bg: #07090f;
  --panel: rgba(9, 11, 18, 0.94);
  --line: #2c2a3d;
  --text: #d9d2c0;
  --dim: #7d7a8c;
  --accent: #64a57a;
  --warm: #e39d5c;
  --gold: #ffd27a;
  --violet: #aa9dd2;
  --font: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--font);
}

a { color: inherit; }

#world {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
  touch-action: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.ready #world { opacity: 1; }

/* ---------- hud ---------- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 28px;
  padding: 20px 24px;
  pointer-events: none;
  background: linear-gradient(var(--bg), rgba(7, 9, 15, 0));
}
.hud a { pointer-events: auto; }

.brand {
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  color: #f1ead8;
}
.brand span { color: var(--accent); }
.cursor {
  font-style: normal;
  color: var(--warm);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hud nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.hud nav a {
  color: var(--dim);
  text-decoration: none;
}
.hud nav a:hover, .hud nav a:focus-visible, .hud nav a[aria-current] { color: var(--gold); }
.hud nav a:hover::before, .hud nav a[aria-current]::before { content: "> "; }

.weather {
  margin-left: auto;
  pointer-events: auto;
  font: 12px var(--font);
  color: var(--dim);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.weather:hover, .weather:focus-visible { color: #9cc8ec; outline: none; }

.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  pointer-events: none;
  transition: opacity 0.8s ease 1.5s;
}
.walked .hint { opacity: 0; }
kbd {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0 4px;
}

/* ---------- panel ---------- */

#panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 5, 9, 0.55);
  animation: fade 0.2s ease;
}
#panel[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.frame {
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: rise 0.25s ease;
}
@keyframes rise { from { transform: translateY(8px); } }

.bar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px dashed var(--line);
  background: var(--panel);
}
.bar h1 {
  margin: 0;
  font-size: 16px;
  color: var(--gold);
}
.bar h1::before { content: "$ cd "; color: var(--dim); font-weight: 400; }
.close {
  color: var(--dim);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.close:hover, .close:focus-visible { color: var(--warm); outline: none; }

#panel-body { padding: 8px 20px 20px; }
#panel-body p { margin: 0.8em 0; }
.lede { color: var(--dim); }

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
}
.projects li {
  padding: 12px 0;
  border-bottom: 1px dashed rgba(44, 42, 61, 0.7);
}
.projects li:last-child { border-bottom: 0; }
.projects a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  text-decoration: none;
}
.projects .idx { color: var(--dim); font-size: 12px; }
.projects .pname { color: #f1ead8; font-weight: 700; }
.projects .arrow { color: var(--dim); transition: transform 0.15s ease, color 0.15s ease; }
.projects a:hover .pname, .projects a:focus-visible .pname { color: var(--accent); }
.projects a:hover .arrow, .projects a:focus-visible .arrow { color: var(--accent); transform: translateX(4px); }
.projects p {
  margin: 4px 0 0 !important;
  padding-left: 30px;
  color: var(--text);
  opacity: 0.8;
}

.contact {
  list-style: none;
  margin: 0;
  padding: 0;
}
.contact li { display: flex; gap: 16px; padding: 6px 0; }
.contact .label { color: var(--dim); min-width: 72px; }
.contact a { color: var(--violet); }
.contact a:hover { color: var(--gold); }

.noscript {
  max-width: 560px;
  margin: 120px auto;
  padding: 0 16px;
}

@media (max-width: 560px) {
  .hud { padding: 16px; }
  .projects p { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
