:root {
  --bg: #0b0b0d;
  --fg: #ececec;
  --muted: #a7a7a7;
  --card: rgba(255, 255, 255, 0.06);
  --card-hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.14);
  --accent: #b9ff66;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-weight: 400;
  line-height: 1.4;
  overflow: hidden;
}

/* subtle grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(255,255,255,0.06), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035), rgba(255,255,255,0.035) 1px, transparent 1px, transparent 24px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.03) 1px, transparent 1px, transparent 24px);
  pointer-events: none;
}

#ui { position: fixed; inset: 0 auto auto 0; padding: 16px 16px; z-index: 10; }
.brand { font-family: "Space Grotesk", Inter, sans-serif; letter-spacing: -0.02em; font-weight: 600; opacity: 0.9; margin-bottom: 10px; }
.help { position: fixed; right: 16px; top: 16px; color: var(--muted); font-size: 12px; opacity: 0.85; }
.shuffle-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--fg);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  z-index: 11;
}
.shuffle-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.28); }
.shuffle-btn:active { transform: translateY(1px); }

.search { display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); }
.search input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--fg);
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: rgba(255,255,255,0.32); background: rgba(255,255,255,0.07); }

.results { list-style: none; padding: 0; margin: 0; max-height: 40vh; overflow: auto; backdrop-filter: blur(3px); border-radius: 12px; border: 1px solid var(--border); background: rgba(10,10,12,0.5); display: none; }
.results.show { display: block; }
.results li { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px; cursor: pointer; }
.results li:last-child { border-bottom: 0; }
.results li:hover { background: rgba(255,255,255,0.06); }
.result-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-type { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

#viewport { position: fixed; inset: 0; overflow: hidden; cursor: grab; }
#viewport.dragging { cursor: grabbing; }
#world { position: absolute; top: 0; left: 0; will-change: transform; transform: translate3d(0,0,0); }

.entry { position: absolute; color: var(--fg); border: 1px solid var(--border); background: var(--card); border-radius: 16px; padding: 12px; backdrop-filter: blur(6px); box-shadow: 0 6px 30px rgba(0,0,0,0.35); max-width: 520px; transition: background 160ms ease, border-color 160ms ease, transform 200ms ease, left 260ms ease, top 260ms ease; }
.entry:hover { background: var(--card-hover); border-color: rgba(255,255,255,0.28); }
.entry .title { font-family: "Space Grotesk", Inter, sans-serif; font-size: 14px; letter-spacing: 0.02em; color: var(--muted); margin-bottom: 8px; }

.entry.image img { display: block; width: 100%; height: auto; border-radius: 12px; }
.entry.text { max-width: 520px; }
.entry.text .content { font-size: 16px; line-height: 1.6; white-space: pre-wrap; }
.entry.link a { color: var(--fg); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.2); }
.entry.link a:hover { border-color: var(--accent); color: var(--accent); }
.entry.text_link a { color: var(--accent); }
.entry.youtube { overflow: hidden; }
.entry.youtube iframe { width: 100%; max-width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; display: block; }

.pill { display: inline-block; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; color: var(--muted); }

@media (max-width: 700px) {
  .entry { max-width: min(86vw, 520px); padding: 10px; }
}

/* lightbox */
#lightbox[hidden] { display: none; }
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: grid; place-items: center; z-index: 20; cursor: zoom-out; backdrop-filter: blur(2px); }
#lightboxImg { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 10px 50px rgba(0,0,0,0.5); }


