:root {
  --ink: #101110;
  --paper: #e7e6de;
  --muted: #a6a69e;
  --line: rgba(231, 230, 222, 0.16);
  --sun: #776bce; /* 776nyc.com --accent */
  --heptagon: polygon(50% 0%, 89.09% 18.83%, 98.75% 61.13%, 71.69% 95.05%, 28.31% 95.05%, 1.25% 61.13%, 10.91% 18.83%);
  --font: "Switzer Variable", Switzer, "Helvetica Neue", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--paper); font: 400 17px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--paper); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Door ─────────────────────────────────────────────── */
.door { min-height: 100dvh; display: flex; padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 70% at 50% 0%, rgba(119, 107, 206, 0.22), transparent 60%), var(--ink); }
.screen { width: 100%; max-width: 440px; margin: auto; display: flex; flex-direction: column; gap: 16px; animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.kicker { margin: 0; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: clamp(34px, 10vw, 46px); line-height: 1.02; font-weight: 600; letter-spacing: -0.02em; }
.sub { margin: 0; color: var(--muted); font-size: 18px; }
.fine { margin: 0; color: var(--muted); font-size: 14px; }
.error { color: #ff8a7a; margin: 0 0 12px; }
.intro h1 { font-size: clamp(42px, 13vw, 60px); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input, textarea, .admin input:not([type]) , .admin .field input {
  font: 500 18px var(--font); color: var(--paper); background: rgba(231, 230, 222, 0.06); border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 16px; outline: none; width: 100%; }
.field input:focus, textarea:focus { border-color: var(--paper); }
textarea { resize: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--sun); flex: none; }

.go { display: inline-flex; justify-content: center; align-items: center; min-height: 56px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--paper); color: var(--ink); font: 600 18px var(--font); cursor: pointer; text-decoration: none; flex: 1; }
.go.ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.go:active { transform: scale(0.98); }
.link { background: none; border: 0; color: var(--muted); font: 500 15px var(--font); text-decoration: underline; cursor: pointer; padding: 6px; }
.row { display: flex; gap: 10px; }

.selfie-frame { width: min(72vw, 300px); aspect-ratio: 1; margin: 8px auto; clip-path: var(--heptagon); overflow: hidden; display: grid; place-items: center;
  background: rgba(231, 230, 222, 0.06); box-shadow: 0 0 0 2px var(--line); font-size: 72px; color: var(--muted); }
.selfie-frame { position: relative; }
/* The heptagon clips the photo, not the frame: the emoji badge sits on the edge, uncut. */
.selfie-frame.has-badge { clip-path: none; overflow: visible; background: none; box-shadow: none; }
.selfie-frame.has-badge > :not(.emoji-badge) { width: 100%; height: 100%; clip-path: var(--heptagon); display: grid; place-items: center; background: rgba(231, 230, 222, 0.06); }
.selfie-frame img, .crop-canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.crop-canvas { touch-action: none; cursor: grab; }
.emoji-badge { position: absolute; right: 2%; bottom: 4%; z-index: 1; font-size: 44px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.selfie-frame.small .emoji-badge { font-size: 26px; right: 4%; bottom: 2%; }
.zoom-row { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 20px; }
.zoom { flex: 1; accent-color: var(--sun); }
.emoji-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.emoji { font-size: 26px; padding: 8px 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(231, 230, 222, 0.04); cursor: pointer; }
.emoji.is-on { border-color: var(--sun); background: rgba(119, 107, 206, 0.2); }
.center { text-align: center; }
.selfie-frame.small { width: 120px; font-size: 32px; box-shadow: 0 0 0 3px var(--sun); }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

.mayor { border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: grid; gap: 12px; background: rgba(119, 107, 206, 0.12); }
.mayor-row { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.crown { color: var(--sun); font-size: 22px; }
.mayor-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.mayor-stats b { display: block; font-size: 28px; font-weight: 600; }
.mayor-stats span { font-size: 12px; color: var(--muted); }

.polaroid-wrap { display: grid; gap: 12px; }
.polaroid { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); transform: rotate(-1.5deg); }
.preview-banner + .door { padding-top: 64px; }
.preview-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 10; background: var(--sun); color: var(--ink); text-align: center; font: 600 13px var(--font); padding: 6px; }

/* Member card: the 776NYC heptagon as the stamp. */
.member-card { border-radius: 18px; padding: 16px 18px; display: grid; gap: 10px;
  background: linear-gradient(135deg, rgba(119, 107, 206, 0.32), rgba(119, 107, 206, 0.08)); box-shadow: inset 0 0 0 1px rgba(231, 230, 222, 0.14); }
.member-top { display: flex; justify-content: space-between; align-items: baseline; }
.member-no { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.member-name { font-size: 20px; font-weight: 600; }
.stamps { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.stamp { aspect-ratio: 1; clip-path: var(--heptagon); background: rgba(231, 230, 222, 0.14); }
.stamp.is-on { background: var(--sun); }

/* ── Wall (TV) ────────────────────────────────────────── */
.wall { position: relative; min-height: 100dvh; overflow: hidden; }
.wall .d776-layer.is-page { inset: 0; }
.wall-head { position: absolute; left: 32px; top: 28px; z-index: 1; }
.wall-mark { width: min(40vw, 420px); filter: invert(1); }
.wall-count { color: var(--muted); font-size: 20px; margin: 10px 0 0; }

/* ── Admin ────────────────────────────────────────────── */
.admin { max-width: 980px; margin: 0 auto; padding: 32px 16px 80px; }
.admin h1 { font-size: 40px; }
.admin h2 { font-size: 20px; margin: 0 0 12px; }
.admin section { border-top: 1px solid var(--line); padding: 24px 0; }
.admin .stats, .muted { color: var(--muted); }
.admin button { font: 600 15px var(--font); background: var(--paper); color: var(--ink); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; margin: 4px 6px 4px 0; }
.admin button.ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.exps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.exp { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; }
.exp.is-on, .exp:has(input:checked) { border-color: var(--sun); background: rgba(119, 107, 206, 0.12); }
.exp input { accent-color: var(--sun); }
.exp-name { font-weight: 600; font-size: 18px; }
.exp-flow { font-size: 13px; color: var(--sun); letter-spacing: 0.02em; }
.exp-pitch { font-size: 14px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 14px; }
.admin .field input { font-size: 15px; padding: 10px 12px; border-radius: 10px; }
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.mod { display: grid; gap: 6px; font-size: 14px; }
.mod img, .mod-nophoto { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: rgba(231, 230, 222, 0.06); display: grid; place-items: center; color: var(--muted); }
.mod p { margin: 0; }
.board { padding-left: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
pre { background: rgba(231, 230, 222, 0.06); padding: 14px; border-radius: 10px; overflow-x: auto; }
.sim { background: rgba(119, 107, 206, 0.12); border: 1px dashed var(--sun); border-radius: 14px; padding: 12px; margin: 12px 0; }
@media (max-width: 600px) { .admin table { display: block; overflow-x: auto; } }
