/* GARBLE — museum theme. Ink walls, gold frames, paper exhibits. */

:root {
  --ink: #15121f;
  --ink-2: #1c1729;
  --wall: #241e33;
  --wall-2: #2c2440;
  --gold: #d8a94e;
  --gold-2: #f0cd86;
  --paper: #fff6e4;
  --text: #efe9dc;
  --muted: #9b91ad;
  --red: #b13e53;
  --green: #38b764;
  --blue: #41a6f6;
  --serif: 'DM Serif Display', serif;
  --ui: 'Space Grotesk', system-ui, sans-serif;
  --floor-h: 84px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, #2a2142 0%, transparent 60%), var(--ink);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

body::after {
  /* gallery grain */
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 5;
}

button {
  font-family: var(--ui);
  cursor: pointer;
}

canvas.pix {
  image-rendering: pixelated;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
}

a {
  color: var(--gold-2);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--gold);
  color: var(--ink);
  box-shadow:
    0 2px 0 #8c6a26,
    0 6px 14px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.06s ease,
    box-shadow 0.06s ease,
    background 0.15s;
}

.btn:hover {
  background: var(--gold-2);
}

.btn:active {
  transform: translateY(2px);
  box-shadow:
    0 0 0 #8c6a26,
    0 3px 8px rgba(0, 0, 0, 0.35);
}

.btn.ghost {
  background: transparent;
  color: var(--gold-2);
  box-shadow: inset 0 0 0 2px rgba(216, 169, 78, 0.55);
}

.btn.ghost:hover {
  box-shadow: inset 0 0 0 2px var(--gold-2);
  background: rgba(216, 169, 78, 0.08);
}

.btn.danger {
  background: var(--red);
  color: var(--paper);
  box-shadow:
    0 2px 0 #6e2434,
    0 6px 14px rgba(0, 0, 0, 0.35);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---------- header ---------- */

header.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(to bottom, rgba(21, 18, 31, 0.96), rgba(21, 18, 31, 0.88));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(216, 169, 78, 0.25);
}

.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-decoration: none;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.wordmark em {
  font-style: normal;
  color: var(--paper);
}

.bar .gallery-name {
  font-size: 15px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar .spacer {
  flex: 1;
}

.online-chips {
  display: flex;
  align-items: center;
}

.chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  margin-left: -7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  padding: 6px;
  color: var(--muted);
  border-radius: 6px;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- landing ---------- */

.landing {
  max-width: 880px;
  margin: 0 auto;
  padding: 9vh 24px 140px;
  text-align: center;
}

.landing .pediment {
  font-size: clamp(44px, 9vw, 92px);
  letter-spacing: 0.14em;
  color: var(--gold);
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.45),
    0 0 60px rgba(216, 169, 78, 0.25);
  margin-bottom: 6px;
}

.landing .sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 3vw, 26px);
  color: var(--text);
  opacity: 0.9;
}

.landing .how {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 44px 0 36px;
  text-align: left;
}

.how .card {
  background: var(--wall);
  border: 1px solid rgba(216, 169, 78, 0.2);
  border-radius: 10px;
  padding: 16px;
}

.how .card b {
  display: block;
  color: var(--gold-2);
  margin-bottom: 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.how .card span {
  color: var(--muted);
  font-size: 14px;
}

.landing form.found {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.landing input[type='text'] {
  min-width: 260px;
}

.recent-wings {
  margin-top: 26px;
  color: var(--muted);
  font-size: 14px;
}

.recent-wings a {
  margin: 0 8px;
}

/* ---------- inputs ---------- */

input[type='text'],
textarea {
  font-family: var(--ui);
  font-size: 16px;
  color: var(--text);
  background: var(--ink-2);
  border: 1px solid rgba(216, 169, 78, 0.35);
  border-radius: 6px;
  padding: 10px 14px;
  outline: none;
}

input[type='text']:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(216, 169, 78, 0.18);
}

textarea {
  resize: none;
  width: 100%;
}

/* ---------- museum sections ---------- */

main.museum {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 18px calc(var(--floor-h) + 56px);
}

section.room {
  margin: 26px 0;
}

.room-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid rgba(216, 169, 78, 0.25);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.room-title h2 {
  font-size: 26px;
  color: var(--gold-2);
}

.room-title .note {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  font-family: var(--serif);
}

.room-title .count {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

/* your move strip */

.yourmove {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.move-card {
  min-width: 240px;
  background: linear-gradient(160deg, var(--wall-2), var(--wall));
  border: 1px solid rgba(216, 169, 78, 0.45);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.move-card .kind {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-2);
  font-weight: 700;
}

.move-card .code {
  font-family: var(--serif);
  font-size: 20px;
}

.move-card.donate {
  border-style: dashed;
  align-items: flex-start;
}

/* studio easels */

.easels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 16px;
}

.easel {
  background: var(--wall);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.easel .cover {
  width: 100%;
  border-radius: 4px;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.easel .code {
  font-family: var(--serif);
  font-size: 17px;
}

.easel .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.pips {
  display: flex;
  gap: 3px;
}

.pip {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.pip.full {
  background: var(--gold);
}

.dots {
  display: flex;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--wall);
  margin-left: -4px;
}

.easel .claimnote {
  font-size: 12.5px;
  color: var(--blue);
}

.easel .row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.easel .burn {
  margin-left: auto;
}

/* collection wall */

.exhibits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 26px 22px;
  padding: 8px 4px;
}

.exhibit {
  text-align: center;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.18s ease;
  cursor: pointer;
}

.exhibit:hover {
  transform: rotate(0deg) scale(1.03);
  z-index: 2;
}

.exhibit .frame {
  background: var(--paper);
  padding: 10px;
  border: 10px solid transparent;
  border-image: linear-gradient(145deg, #f0cd86, #8c6a26 38%, #d8a94e 60%, #6e5320) 1;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.exhibit .frame canvas {
  width: 100%;
  display: block;
  background: var(--paper);
}

.exhibit .plaque {
  display: inline-block;
  margin-top: 10px;
  background: linear-gradient(180deg, #3b3247, #2c2440);
  border: 1px solid rgba(216, 169, 78, 0.4);
  border-radius: 4px;
  padding: 7px 14px;
  max-width: 95%;
}

.exhibit .plaque .title {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--paper);
}

.exhibit .plaque .artists {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.exhibit .rx {
  margin-top: 7px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

.loadmore {
  text-align: center;
  margin-top: 18px;
}

/* alley */

.alley-wrap {
  background: repeating-linear-gradient(0deg, #2b1f1a 0 14px, #241a16 14px 16px), #241a16;
  border: 1px solid rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alley-canvas-box {
  position: relative;
  align-self: center;
  max-width: 100%;
}

.alley-canvas-box canvas {
  display: block;
  width: min(768px, 100%);
  border: 6px solid #15100c;
  border-radius: 4px;
  background: var(--ink-2);
  cursor: crosshair;
  touch-action: none;
}

.cursor-tag {
  position: absolute;
  pointer-events: none;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
  transform: translate(8px, -14px);
  transition: opacity 0.4s;
  white-space: nowrap;
  z-index: 3;
}

.alley-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.paint-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.paint-meter .bar {
  width: 120px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.paint-meter .fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s;
}

/* palette (shared: alley + editor) */

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 2px solid rgba(0, 0, 0, 0.5);
  padding: 0;
}

.swatch.sel {
  outline: 3px solid var(--paper);
  outline-offset: 1px;
}

.swatch.paper-swatch {
  background-image: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%);
  background-size: 10px 10px;
}

/* ---------- floor + visitors + ticker ---------- */

.floor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--floor-h);
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 30%),
    repeating-linear-gradient(90deg, #3a2b22 0 86px, #44332a 86px 90px), #3a2b22;
  border-top: 2px solid #1c130e;
  z-index: 10;
}

.visitors {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.visitor {
  position: absolute;
  bottom: 8px;
  width: 32px;
  height: 48px;
  transition: none;
}

.visitor img {
  width: 32px;
  height: 48px;
  image-rendering: pixelated;
  display: block;
}

.visitor .tag {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--paper);
  background: rgba(0, 0, 0, 0.55);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.visitor:hover .tag {
  opacity: 1;
}

.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--floor-h);
  z-index: 11;
  background: rgba(21, 18, 31, 0.92);
  border-top: 1px solid rgba(216, 169, 78, 0.3);
  font-size: 12.5px;
  color: var(--muted);
  padding: 5px 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker b {
  color: var(--text);
  font-weight: 500;
}

.ticker .t-ago {
  color: rgba(155, 145, 173, 0.7);
}

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 8, 16, 0.86);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 18px;
}

.sheet {
  background: var(--wall);
  border: 1px solid rgba(216, 169, 78, 0.35);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  padding: 26px;
  width: min(560px, 94vw);
  max-height: 94vh;
  overflow-y: auto;
}

.sheet h2 {
  color: var(--gold-2);
  font-size: 26px;
  margin-bottom: 4px;
}

.sheet .hint {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 16px;
}

.sheet .actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.sheet .actions .spacer {
  flex: 1;
}

.field {
  margin: 14px 0;
}

.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 700;
}

.charcount {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}

.target-pick {
  display: flex;
  gap: 8px;
}

.target-pick button {
  flex: 1;
  background: var(--ink-2);
  border: 1px solid rgba(216, 169, 78, 0.3);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 0;
  font-weight: 700;
}

.target-pick button.sel {
  background: var(--gold);
  color: var(--ink);
}

/* ---------- the editor ---------- */

.editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(1020px, 96vw);
}

.editor .brief {
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.editor .brief .k {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #7a6a4d;
  white-space: nowrap;
}

.editor .brief .prompt-text {
  font-family: var(--serif);
  font-size: clamp(17px, 2.6vw, 24px);
  overflow-wrap: anywhere;
}

.editor .brief .clock {
  margin-left: auto;
  font-size: 13px;
  color: #7a6a4d;
  white-space: nowrap;
}

.editor-stage {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.canvas-shell {
  position: relative;
  background: var(--paper);
  padding: 8px;
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  line-height: 0;
}

.canvas-shell canvas {
  display: block;
  width: min(768px, calc(96vw - 56px));
  aspect-ratio: 4 / 3;
  background: var(--paper);
  cursor: crosshair;
  touch-action: none;
}

.canvas-shell canvas.ghost {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  pointer-events: none;
  background: transparent;
}

.toolcol {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 132px;
}

.toolrow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tool {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--ink-2);
  color: var(--text);
  font-size: 17px;
  display: grid;
  place-items: center;
}

.tool.sel {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

.editor .actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* describe turn */

.describe-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.describe-stage .canvas-shell canvas {
  cursor: default;
}

/* ---------- reveal ---------- */

.reveal {
  width: min(820px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  padding-bottom: 30px;
}

.reveal .marquee {
  text-align: center;
}

.reveal .marquee .code {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.reveal .marquee h2 {
  font-size: clamp(26px, 5vw, 40px);
  color: var(--gold-2);
}

.reveal-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  align-items: center;
}

.rstep {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  width: 100%;
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rstep .who {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.rstep .who .dot {
  margin: 0;
  border-color: transparent;
}

.rstep .saytext {
  font-family: var(--serif);
  font-size: clamp(20px, 4vw, 30px);
  text-align: center;
  color: var(--paper);
  max-width: 640px;
  overflow-wrap: anywhere;
  min-height: 1.4em;
}

.rstep .canvas-shell canvas {
  width: min(480px, 88vw);
  cursor: default;
}

.reveal .endcard {
  background: var(--paper);
  color: var(--ink);
  border-radius: 12px;
  padding: 22px 26px;
  text-align: center;
  width: min(640px, 94vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: rise 0.45s ease both;
}

.reveal .endcard .vs {
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #7a6a4d;
  margin: 10px 0 2px;
}

.reveal .endcard .line {
  font-family: var(--serif);
  font-size: clamp(18px, 3.4vw, 26px);
  overflow-wrap: anywhere;
}

.reveal .endcard .artists {
  margin-top: 14px;
  font-size: 13px;
  color: #7a6a4d;
}

.rx-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.rx-btn {
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  padding: 5px 12px;
  font-size: 15px;
}

.rx-btn.mine {
  background: var(--gold);
  border-color: var(--gold);
}

.rx-btn .n {
  font-size: 12.5px;
  font-weight: 700;
  margin-left: 4px;
}

.reveal .controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- identity ---------- */

.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.color-grid .swatch {
  width: 34px;
  height: 34px;
}

.me-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.me-preview img {
  width: 32px;
  height: 48px;
  image-rendering: pixelated;
}

/* ---------- toasts ---------- */

#toasts {
  position: fixed;
  bottom: calc(var(--floor-h) + 40px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 500;
  font-size: 14.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s ease both;
}

.toast.err {
  background: var(--red);
  color: var(--paper);
}

/* ---------- empty states ---------- */

.empty {
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  padding: 26px;
  text-align: center;
  border: 1px dashed rgba(216, 169, 78, 0.3);
  border-radius: 10px;
}

/* ---------- confetti ---------- */

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .bar .gallery-name {
    display: none;
  }
  .exhibits {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px 14px;
  }
  .easels {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  :root {
    --floor-h: 64px;
  }
  .sheet {
    padding: 18px;
  }
}

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