:root {
  --amber: #ffb454;
  --cyan: #6be3ff;
  --ink: #0c0a12;
  --panel: rgba(12, 9, 18, 0.62);
  --panel-border: rgba(255, 210, 140, 0.22);
  --text: #f1e9da;
  --text-dim: #b9aea0;
  --display: "Press Start 2P", monospace;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--ink); overflow: hidden; }
body { font-family: var(--body); color: var(--text); }

#stage { position: fixed; inset: 0; overflow: hidden; }

#stage { background: var(--ink); }

/* the looping animated city — positioned/sized by JS (computeFit) to stay
   centered and fully visible ("contain") at any window shape, same math the
   old static-image version used */
#cityStage {
  position: fixed; top: 0; left: 0;
  user-select: none;
  overflow: hidden;
}
#cityVideo { display: block; width: 100%; height: 100%; object-fit: fill; -webkit-user-drag: none; }
/* #cityStage itself is sized/positioned by JS (computeFit, "cover" mode) to
   always fill the full viewport on any screen — #stage's overflow:hidden
   clips whichever axis overflows */

.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(4,3,8,0.55) 100%),
    linear-gradient(180deg, rgba(4,3,8,0.55) 0%, transparent 16%, transparent 74%, rgba(4,3,8,0.7) 100%);
}

/* ---------- brand (also the sole Explore trigger) ---------- */
.brand {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%); z-index: 6;
  text-align: center; display: flex; flex-direction: column; align-items: center;
}
.brand-name {
  font-family: var(--display); font-size: 34px; color: #fff;
  letter-spacing: 0.02em; cursor: pointer; background: none; border: none; padding: 0;
  text-shadow:
    0 0 6px rgba(255, 210, 140, 0.9),
    0 0 16px rgba(255, 180, 84, 0.75),
    0 0 34px rgba(107, 227, 255, 0.5),
    0 2px 8px rgba(0,0,0,0.8);
  animation: brandGlow 3.2s ease-in-out infinite;
}
@keyframes brandGlow {
  0%, 100% {
    text-shadow:
      0 0 6px rgba(255, 210, 140, 0.9),
      0 0 16px rgba(255, 180, 84, 0.75),
      0 0 34px rgba(107, 227, 255, 0.5),
      0 2px 8px rgba(0,0,0,0.8);
  }
  50% {
    text-shadow:
      0 0 10px rgba(255, 210, 140, 1),
      0 0 24px rgba(255, 180, 84, 0.9),
      0 0 48px rgba(107, 227, 255, 0.7),
      0 2px 8px rgba(0,0,0,0.8);
  }
}

.nav-menu {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); min-width: 180px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 10px 0; backdrop-filter: blur(3px);
}
.nav-menu[hidden] { display: none; }
.nav-item {
  color: var(--text); text-decoration: none; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 8px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; cursor: pointer;
}
.nav-item:hover:not(.locked) { background: rgba(255,180,84,0.14); color: var(--amber); }
.nav-item.locked { color: var(--text-dim); opacity: 0.55; cursor: default; }
.nav-item i { font-style: normal; font-size: 11px; }

/* ---------- districts (future areas, all locked for now) ---------- */
.districts {
  position: absolute; top: 22px; right: 26px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
}
.district {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); opacity: 0.6;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 5px 10px; display: flex; gap: 6px; align-items: center;
}

/* ---------- hotspots ---------- */
.hotspot {
  position: fixed; z-index: 4; cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 0 0 rgba(255,196,102,0);
  transition: box-shadow 0.25s ease, background 0.25s ease;
}
.hotspot:hover, .hotspot:focus-visible {
  background: rgba(255,196,102,0.10);
  box-shadow: 0 0 26px rgba(255,196,102,0.45), inset 0 0 20px rgba(255,196,102,0.15);
  outline: none;
}
.hotspot-tip {
  position: fixed; z-index: 6; transform: translate(-50%, -100%);
  background: rgba(12,9,18,0.85); border: 1px solid var(--panel-border);
  color: var(--amber); font-family: var(--display); font-size: 10px;
  padding: 6px 10px; border-radius: 5px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.15s ease;
}
.hotspot-tip.show { opacity: 1; }

/* ---------- sign in / account button ---------- */
.signin-btn {
  position: absolute; top: 22px; left: 26px; z-index: 6;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font: inherit; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); background: var(--panel); border: 1px solid var(--amber);
  border-radius: 6px; padding: 8px 14px; backdrop-filter: blur(3px);
  box-shadow: 0 0 8px rgba(255,180,84,0.45), 0 0 18px rgba(255,180,84,0.25);
}
.signin-btn:hover { background: rgba(255,180,84,0.16); }
.signin-avatar { width: 22px; height: 22px; border-radius: 4px; display: block; }
.signin-avatar[hidden] { display: none; }

@media (max-width: 860px) {
  .districts, .nav-menu .nav-item.locked { display: none; }
  .brand { top: 64px; }
  .signin-btn { left: auto; right: 16px; top: 16px; }
}

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

/* ---------- content windows (Thoughts first) ---------- */
.window[hidden] { display: none; }
.window { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.window-backdrop { position: absolute; inset: 0; background: rgba(6, 4, 10, 0.72); backdrop-filter: blur(4px); animation: fadeIn 0.2s ease; }
.window-panel {
  position: relative; width: min(560px, 100%); max-height: min(62vh, 560px);
  display: flex; flex-direction: column;
  background: #14101c; border: 1px solid var(--panel-border); border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: rise 0.22s ease;
}
.window-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--panel-border); }
.window-title { margin: 0; font-family: var(--display); font-size: 12px; color: var(--amber); letter-spacing: 0.04em; font-weight: 400; }
.window-close {
  background: none; border: 1px solid var(--amber); color: var(--amber);
  border-radius: 8px; width: 40px; height: 40px; cursor: pointer; font-size: 18px;
  box-shadow: 0 0 8px rgba(255,180,84,0.55), 0 0 16px rgba(255,180,84,0.3);
  animation: navGlow 3.2s ease-in-out infinite;
}
.window-close:hover, .window-close:focus-visible { color: var(--text); border-color: var(--amber); outline: none; }
.window-body { overflow-y: auto; padding: 6px 16px 16px; }

.entry { padding: 14px 0; border-bottom: 1px solid rgba(255,210,140,0.1); display: flex; flex-direction: column; gap: 4px; }
.entry:last-child { border-bottom: none; }

/* "8-bit paper" post card — parchment card with a hard pixel-style shadow
   and two taped corners, standing in for the plain dark box */
.entry-paper {
  position: relative;
  background: #efe3c4;
  border: 3px solid #2a1f14;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.45);
  border-radius: 2px;
  padding: 22px 18px 16px;
  margin: 6px 4px 14px;
  background-image: repeating-linear-gradient(rgba(42,31,20,0.06) 0 1px, transparent 1px 24px);
}
.entry-paper::before, .entry-paper::after {
  content: ""; position: absolute; top: -10px; width: 46px; height: 20px;
  background: rgba(255, 210, 140, 0.55); border: 1px solid rgba(42,31,20,0.35);
}
.entry-paper::before { left: 18px; transform: rotate(-5deg); }
.entry-paper::after { right: 18px; transform: rotate(4deg); }

.entry-date {
  display: block; text-align: center; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #6b5a3f; font-variant-numeric: tabular-nums;
}
.entry-title { margin: 4px 0 10px; font-size: 17px; font-weight: 700; color: #2a1f14; line-height: 1.3; text-align: center; }
.entry-body { font-size: 13px; line-height: 1.6; color: #3a2e1e; max-width: 62ch; margin: 0 auto; text-align: center; }
.entry-body p { margin: 0 0 8px; }
.entry-photo { max-height: 260px; object-fit: contain; }
.empty { padding: 32px 0; text-align: center; color: var(--text-dim); font-size: 13px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .window { padding: 0; } .window-panel { max-height: 100vh; height: 100%; border-radius: 0; } }

.entry-body img, .entry-photo { max-width: 100%; border-radius: 4px; margin: 10px auto; display: block; }
.entry-body blockquote { margin: 0 0 12px; padding-left: 14px; border-left: 2px solid #b8a170; color: #55462f; text-align: left; }
.entry-body a { color: #8a5a1f; }
.entry-tags { margin-top: 12px; font-size: 12px; color: #6b5a3f; letter-spacing: 0.02em; text-align: center; }
.entry-link { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--text-dim); text-decoration: none; }
.entry-link:hover { color: var(--amber); }
.entry-share-btn {
  display: block; margin: 14px auto 0; background: #2a1f14; border: 2px solid #2a1f14;
  color: #efe3c4; border-radius: 6px; padding: 8px 16px; font-size: 12px; font-weight: 700;
  font-family: var(--body); cursor: pointer;
}
.entry-share-btn:hover:not(:disabled) { background: #3a2c1c; }
.entry-share-btn:disabled { opacity: 0.7; cursor: default; }

.window-counter { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; margin-right: auto; margin-left: 12px; }
.window-nav {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 16px; border-top: 1px solid var(--panel-border);
}
.window-arrow {
  background: none; border: 1px solid var(--amber); color: var(--amber);
  border-radius: 8px; padding: 12px 22px; cursor: pointer; font-size: 15px; font-weight: 600;
  font-family: var(--body);
  box-shadow: 0 0 8px rgba(255,180,84,0.55), 0 0 16px rgba(255,180,84,0.3);
  animation: navGlow 3.2s ease-in-out infinite;
}
.window-arrow:hover:not(:disabled), .window-arrow:focus-visible:not(:disabled) { color: var(--text); outline: none; }
.window-arrow:disabled {
  opacity: 0.3; cursor: default; animation: none; box-shadow: none;
  border-color: var(--panel-border); color: var(--text-dim);
}

@keyframes navGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,180,84,0.55), 0 0 16px rgba(255,180,84,0.3); }
  50% { box-shadow: 0 0 12px rgba(255,180,84,0.8), 0 0 26px rgba(255,180,84,0.5); }
}

/* ---------- comments (under Thoughts posts) ---------- */
.comments { margin-top: 4px; }
.comments-title-row { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; }
.comments-title {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink);
  background: var(--amber); border: 1px solid #2a1f14; border-radius: 3px 3px 0 0;
  padding: 4px 10px; font-weight: 700;
}
.comments-count { font-size: 10px; color: var(--text-dim); letter-spacing: 0.04em; }
.comment-list {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); border-radius: 6px;
  padding: 12px; min-height: 64px;
  background-image:
    linear-gradient(rgba(255,210,140,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,210,140,0.05) 1px, transparent 1px);
  background-size: 16px 16px;
}
.comments-empty { display: flex; flex-direction: column; gap: 4px; justify-content: center; height: 100%; }
.comments-empty-sub { color: var(--text-dim); font-size: 12px; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment-body { font-size: 12px; color: #d9cfbf; line-height: 1.4; }
.comment-composer { display: flex; gap: 8px; align-items: center; }
.comment-input {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); border-radius: 6px;
  color: var(--text); padding: 8px 10px; font-size: 12px; font-family: var(--body); resize: vertical; min-height: 38px;
}
.comment-post-btn {
  background: var(--amber); border: 2px solid #2a1f14; color: #2a1f14;
  border-radius: 6px; padding: 9px 14px; cursor: pointer; font-size: 12px; font-weight: 700;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35); flex-shrink: 0;
}
.comment-post-btn:hover:not(:disabled) { filter: brightness(1.08); }
.comment-post-btn:active:not(:disabled) { box-shadow: 1px 1px 0 rgba(0,0,0,0.35); transform: translate(2px, 2px); }
.comment-post-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.comment-avatar-img { width: 36px; height: 36px; border-radius: 6px; flex-shrink: 0; image-rendering: pixelated; background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); }

/* ---------- avatar builder (DiceBear pixel-art traits) ---------- */
.avatar-panel { width: min(460px, 100%); max-height: min(82vh, 680px); }
.avatar-body { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.avatar-email-label { width: 100%; font-size: 11px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.avatar-email-input {
  background: rgba(255,255,255,0.05); border: 1px solid var(--panel-border); border-radius: 6px;
  color: var(--text); padding: 8px 10px; font-size: 13px; font-family: var(--body);
}
.avatar-preview-wrap {
  position: sticky; top: -6px; z-index: 2;
  width: 100%; display: flex; justify-content: center;
  padding: 10px 0 14px; margin: -6px 0 0;
  background: #14101c;
  background-image: radial-gradient(ellipse at 50% 30%, rgba(107,227,255,0.08), transparent 70%);
  border-bottom: 1px solid var(--panel-border);
}
.avatar-preview-img { width: 208px; height: 208px; image-rendering: pixelated; display: block; }

.avatar-categories { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.avatar-cat-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px;
}
.avatar-thumb-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.avatar-thumb-row.wrap { flex-wrap: wrap; overflow-x: visible; }
.avatar-thumb-btn {
  flex-shrink: 0; background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border);
  border-radius: 6px; padding: 4px; cursor: pointer;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
.avatar-thumb-btn:hover { border-color: rgba(255,180,84,0.5); }
.avatar-thumb-btn.selected { border-color: var(--amber); box-shadow: 0 0 8px rgba(255,180,84,0.4); }
.avatar-thumb-btn img { width: 36px; height: 36px; image-rendering: pixelated; display: block; }
.avatar-thumb-btn .avatar-swatch { width: 32px; height: 32px; border-radius: 4px; display: block; }
.avatar-thumb-btn.avatar-thumb-none {
  font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; text-align: center;
}

.avatar-footer { flex-wrap: wrap; }
.avatar-save-btn { color: var(--amber); border-color: rgba(255,180,84,0.5); }

/* ---------- avatar sign-in status / privacy ---------- */
.avatar-privacy { margin: 6px 0 0; font-size: 10px; line-height: 1.4; color: var(--text-dim); }
.avatar-signout { align-self: flex-start; margin-top: 6px; background: none; border: none; padding: 0; color: var(--amber); font-size: 11px; text-decoration: underline; cursor: pointer; }
.avatar-status { margin: 0; padding: 10px 14px; font-size: 12px; line-height: 1.4; color: #14101c; background: var(--amber); }
.avatar-status.error { background: #ff6b6b; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; background: var(--amber); color: #14101c; font-size: 13px; box-shadow: 3px 3px 0 rgba(0,0,0,0.4); max-width: 90vw; text-align: center; }
.avatar-verify { align-self: stretch; margin-top: 8px; padding: 10px 14px; background: var(--amber); color: #14101c; border: none; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 3px 3px 0 rgba(0,0,0,0.35); }
.avatar-verify:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,0.35); }
.avatar-verify:disabled { opacity: 0.6; cursor: default; }
.avatar-verified { margin: 8px 0 0; font-size: 12px; color: #78e185; }
.comment-delete { background: none; border: none; padding: 0; font: inherit; color: var(--amber); text-decoration: underline; cursor: pointer; letter-spacing: inherit; text-transform: inherit; }
.comment-delete:disabled { opacity: 0.5; }
.avatar-auth-row { display: flex; gap: 8px; margin-top: 10px; width: 100%; }
.avatar-auth-row .avatar-verify { flex: 1; margin-top: 0; }
.avatar-verify.alt { background: transparent; color: var(--amber); border: 1px solid var(--amber); box-shadow: none; }
.avatar-verified.pending { color: var(--amber); }
