:root {
  --bg: #0b0b10;
  --card: rgba(255, 255, 255, 0.045);
  --card-strong: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --fg: #f4f2f7;
  --muted: #a39fb0;
  --accent: #c86bff;
  --radius: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.glow {
  position: fixed;
  inset: -20vh -10vw auto;
  height: 80vh;
  background:
    radial-gradient(40% 50% at 20% 30%, rgba(255, 122, 89, 0.22), transparent 70%),
    radial-gradient(35% 45% at 70% 20%, rgba(200, 107, 255, 0.22), transparent 70%),
    radial-gradient(40% 50% at 90% 60%, rgba(63, 208, 255, 0.16), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  z-index: -1;
}

.top, main, .foot { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; }
.jump { color: var(--muted); text-decoration: none; font-size: 14px; }
.top-right { display: flex; align-items: center; gap: 16px; }
.me {
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.me:hover { border-color: rgba(255, 255, 255, 0.3); }

.nick { width: min(420px, calc(100% - 32px)); padding: 28px; }
.nick h3 { margin: 0 0 8px; font-size: 20px; }
.nick p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.nick input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.nick input:focus { outline: none; border-color: var(--accent); }
.nick-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.nick .go {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #ff7a59, #c86bff);
  cursor: pointer;
}

.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
}
.person:hover, .person.active { border-color: rgba(255, 255, 255, 0.45); background: var(--card-strong); }
.person .mini { display: flex; width: 44px; height: 22px; border-radius: 999px; overflow: hidden; }
.person .mini span { flex: 1; }
.person .count { color: var(--muted); }
.jump:hover { color: var(--fg); }

.hero { padding: 40px 0 24px; text-align: center; }
h1 { font-size: clamp(36px, 6vw, 64px); line-height: 1.04; letter-spacing: -0.035em; margin: 0 0 18px; }
.grad {
  background: linear-gradient(90deg, #ff7a59, #c86bff 50%, #3fd0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { color: var(--muted); max-width: 600px; margin: 0 auto 32px; font-size: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.drop { max-width: 640px; margin: 0 auto; padding: 20px; text-align: left; }
.fine { margin: 12px 4px 0; font-size: 13px; color: var(--muted); }
.fine strong { color: var(--fg); font-weight: 500; }

/* The SDK uploader, in the page's colours. Finished rows hide: the readings below take over. */
#uploader .pb-uploader-dropzone {
  min-height: 150px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--fg);
}
#uploader .pb-uploader-dropzone:hover { border-color: rgba(255, 255, 255, 0.4); }
#uploader .pb-uploader-dropzone--dragover { border-color: var(--accent); background: rgba(200, 107, 255, 0.08); }
#uploader .pb-uploader-prompt { font-size: 16px; font-weight: 600; }
#uploader .pb-uploader-hint { color: var(--muted); font-size: 13px; }
#uploader .pb-uploader-item { background: var(--card-strong); }
#uploader .pb-uploader-item--done { display: none; }
#uploader .pb-uploader-filename { color: var(--fg); }
#uploader .pb-uploader-status { color: var(--muted); }
#uploader .pb-uploader-bar { background: rgba(255, 255, 255, 0.1); }
#uploader .pb-uploader-bar-fill { background: linear-gradient(90deg, #ff7a59, #c86bff); }

/* ---------- Readings ---------- */

.readings { max-width: 900px; margin: 28px auto 0; }
#results { display: grid; gap: 16px; }

.reading { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; padding: 18px; }
@media (max-width: 640px) { .reading { grid-template-columns: 1fr; } }

.reading .photo { aspect-ratio: 1; border-radius: 14px; background: var(--card-strong); overflow: hidden; }
.reading .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reading h3 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* Chips start grey and fill in with colour as the reading arrives. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: flex;
  flex-direction: column;
  width: 64px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-strong);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.chip:disabled { cursor: default; }
.chip[hidden] { display: none; }
.chip .swatch { height: 46px; background: rgba(255, 255, 255, 0.08); transition: background-color 0.7s ease; }
.chip .label { padding: 4px 0 5px; font-size: 10px; font-weight: 500; text-align: center; letter-spacing: 0.02em; min-height: 22px; }
.chip:not(:disabled):hover { transform: translateY(-2px); }
.chips.loading .swatch { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }

.steps { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 8px; font-size: 14px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps li.done, .steps li.active { color: var(--fg); }
.steps .icon { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); position: relative; }
.steps .done .icon { border-color: transparent; background: linear-gradient(135deg, #ff7a59, #c86bff); }
.steps .done .icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.steps .active .icon { border-color: var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.reading-text { font-size: 14px; margin: 0 0 12px; }
.sees { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.tag {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.tag:hover, .tag.active { background: var(--fg); color: var(--bg); }
.tag .count { margin-left: 6px; color: var(--muted); }
.tag:hover .count, .tag.active .count { color: #5c5866; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
button.ghost, button.quiet, .search button {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  background: var(--card-strong);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 10px;
  cursor: pointer;
}
button.ghost:hover, button.quiet:hover, .search button:hover { border-color: rgba(255,255,255,.3); }

/* ---------- The collective board ---------- */

.collective { padding: 64px 0 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
h2 { font-size: 32px; letter-spacing: -0.03em; margin: 0; }
.stats { color: var(--muted); margin: 0; font-size: 14px; }

.panel { padding: 18px 20px; margin-bottom: 14px; }
.panel h3, .readout h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }

/* The hologram table: the landscape sits on a dark stage, with the share readout beside it. */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 8px 24px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 20px 12px 12px;
  background:
    radial-gradient(70% 80% at 35% 60%, rgba(40, 140, 230, 0.18), transparent 70%),
    rgba(4, 10, 18, 0.85);
  border-color: rgba(120, 215, 255, 0.18);
}
@media (max-width: 860px) { .stage { grid-template-columns: 1fr; padding: 12px; } }

#landscape { display: block; width: 100%; aspect-ratio: 16 / 10; cursor: grab; touch-action: pan-y; }
#landscape:active { cursor: grabbing; }

.readout-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.readout-head h3 { margin: 0; }
.readout-text { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

.shares { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.shares button {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 70px 36px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.shares button:hover, .shares button.active { background: rgba(120, 215, 255, 0.1); }
.shares .dot { width: 16px; height: 16px; border-radius: 4px; }
.shares .bar { height: 6px; border-radius: 3px; background: var(--c); box-shadow: 0 0 10px var(--c); width: var(--share); min-width: 4px; }
.shares .code { color: rgba(235, 246, 255, 0.85); }
.shares .pct { text-align: right; color: var(--fg); font-weight: 600; }
.shares .empty-note { color: var(--muted); font-size: 13px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px 8px; }

.search { display: flex; gap: 8px; margin: 22px 0 14px; }
.search input {
  flex: 1;
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search button { padding: 0 18px; border-radius: 12px; background: linear-gradient(90deg, #ff7a59, #c86bff); border: 0; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.filters .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 6px; }

.grid { columns: 4 220px; column-gap: 14px; }
.tile {
  display: block;
  width: 100%;
  break-inside: avoid;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: var(--card-strong);
  cursor: zoom-in;
  font: inherit;
}
.tile img { width: 100%; height: auto; display: block; }
.tile .strip-mini { display: flex; height: 6px; }
.tile .strip-mini span { flex: 1; }
.tile .name {
  position: absolute;
  inset: auto 0 6px;
  padding: 24px 10px 6px;
  font-size: 12px;
  text-align: left;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.tile:hover .name, .tile:focus-visible .name { opacity: 1; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

dialog {
  width: min(960px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14131a;
  color: var(--fg);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); }
.lightbox-body { display: grid; grid-template-columns: 1.3fr 1fr; }
@media (max-width: 720px) { .lightbox-body { grid-template-columns: 1fr; } }
.lightbox-body > img { width: 100%; height: 100%; max-height: 80vh; object-fit: contain; background: #000; display: block; }
.lightbox-body .info { padding: 24px; overflow: auto; }
.lightbox-body h3 { margin: 0 0 4px; font-size: 18px; }
.close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 1;
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.5);
  color: #fff;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0 48px; }

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