:root {
  --bg: #0e0f11;
  --fg: #e8e8ea;
  --muted: #8a8d93;
  --panel: #1a1c20;
  --accent: #4fb477;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

#wall {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  touch-action: none; /* pinch/pan handled in JS */
  cursor: grab;
}
#wall.dragging { cursor: grabbing; }

#hud {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: rgba(26, 28, 32, .78);
  backdrop-filter: blur(6px);
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}
#hud button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  font-size: 17px;
  cursor: pointer;
}
#hud button:hover { background: rgba(255, 255, 255, .08); }

#debug {
  position: fixed;
  left: 8px;
  top: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, .6);
  font: 12px/1.4 ui-monospace, monospace;
  white-space: pre;
  pointer-events: none;
}

#empty {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

#gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}
#gate h1 { margin: 0 0 8px; font-size: 26px; }
#gate .msg { margin: 0; color: var(--muted); max-width: 420px; }
#gate .login { margin-top: 20px; min-height: 48px; }

/* Card */
#card {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  color: var(--fg);
  overflow: hidden;
}
#card[open] { display: flex; }
#card::backdrop { background: rgba(0, 0, 0, .6); }
#card .close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}
#card .photos {
  flex: 0 0 min(420px, 48%);
  background: #000;
  display: flex;
  flex-direction: column;
}
#card .main {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #222;
}
#card .thumbs {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
}
#card .thumbs:empty { display: none; }
#card .thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: .6;
}
#card .thumbs img.active { opacity: 1; outline: 2px solid var(--accent); }
#card .body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}
#card .name { margin: 0 40px 2px 0; font-size: 22px; }
#card .username { color: var(--accent); text-decoration: none; }
#card .username:hover { text-decoration: underline; }
#card .text {
  margin-top: 14px;
  white-space: pre-wrap; /* questionnaire text as is: line breaks, emoji */
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  #card[open] { flex-direction: column; overflow-y: auto; }
  #card .photos { flex: none; }
  #card .body { overflow: visible; }
}
