/* Layout concept: a full-bleed camera window with glass HUD at the edges; one loud element, the spray-can Tag button. */
:root {
  --ink: #0b0d17;
  --panel: #151827;
  --glass: rgba(16, 19, 36, 0.72);
  --line: rgba(232, 228, 255, 0.14);
  --text: #f3f1ff;
  --muted: #a3a6c2;
  --paint: #ff4fa3;
  --paint-deep: #d81f7d;
  --signal: #ffd43b;
  --cool: #55d6ff;
  --danger: #ff6b6b;
  --f-display: "Bungee", "Impact", "Arial Black", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --s-top: env(safe-area-inset-top, 0px);
  --s-bot: env(safe-area-inset-bottom, 0px);
  --s-l: env(safe-area-inset-left, 0px);
  --s-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 15px/1.45 var(--f-body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
h1, h2 { text-wrap: balance; margin: 0; }

#app { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#cam, #hud, #touch { position: absolute; inset: 0; width: 100%; height: 100%; }
#cam { object-fit: cover; background: var(--ink); }
#layer, #edges { position: absolute; inset: 0; pointer-events: none; }
body.sim #touch { cursor: grab; }
body.sim #touch:active { cursor: grabbing; }

#reticle {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 1.5px solid rgba(243, 241, 255, 0.35); pointer-events: none;
}

/* AR tags */
.ar-tag {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none;
  pointer-events: auto; will-change: transform; transition: opacity .3s;
}
.ar-tag img { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .55)); pointer-events: none; }
.ar-meta {
  position: absolute; left: 50%; top: 96%; transform: translateX(-50%); white-space: nowrap;
  font: 600 11px/1 var(--f-body); letter-spacing: .01em; font-variant-numeric: tabular-nums;
  background: var(--glass); border: 1px solid var(--line); padding: 5px 9px; border-radius: 999px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.ar-tag.friend .ar-meta { border-color: color-mix(in srgb, var(--paint) 70%, transparent); }
.ar-tag.mine .ar-meta { border-color: color-mix(in srgb, var(--signal) 70%, transparent); }
.ar-tag.fading img { animation: fading 2.6s ease-in-out infinite; }
@keyframes fading { 50% { opacity: .45; } }
.ar-tag.pop img { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }

.edge {
  position: absolute; display: flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font: 600 12px/1 var(--f-body);
  font-variant-numeric: tabular-nums; pointer-events: auto; white-space: nowrap;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.edge i { font-style: normal; color: var(--paint); font-size: 13px; }

/* Top HUD */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--s-top) + 10px) max(14px, var(--s-r)) 14px max(14px, var(--s-l));
  background: linear-gradient(to bottom, rgba(8, 9, 18, .78), rgba(8, 9, 18, 0));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { font: 19px/1 var(--f-display); letter-spacing: .01em; }
.brand span, h1 span { color: var(--paint); }
.chips { display: flex; gap: 6px; margin-left: auto; }
.chip {
  font: 600 11.5px/1 var(--f-mono); padding: 7px 9px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip.warn { color: var(--signal); }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--line);
}
.badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--paint); color: #1a0410; font: 700 11px/18px var(--f-body); text-align: center;
}
#tape {
  position: absolute; left: 0; top: calc(var(--s-top) + 62px); width: 100%; height: 26px; z-index: 4; pointer-events: none;
}

/* Radar */
#radar-btn {
  position: absolute; z-index: 5; right: max(14px, var(--s-r)); top: calc(var(--s-top) + 100px);
  width: 92px; height: 92px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#radar { width: 100%; height: 100%; display: block; }
#radar-count {
  position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%); white-space: nowrap;
  font: 600 11px/1 var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums;
}

/* Simulator controls */
.walk {
  position: absolute; z-index: 5; left: max(14px, var(--s-l)); bottom: calc(var(--s-bot) + 168px);
  display: flex; align-items: center; gap: 6px; padding: 11px 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-weight: 700; touch-action: none;
}
.walk:active, .walk.on { background: var(--text); color: var(--ink); }
#sim-hint {
  position: absolute; z-index: 4; left: 0; right: 0; top: calc(var(--s-top) + 96px); margin: 0; text-align: center;
  padding: 0 120px 0 16px; font-size: 12px; color: var(--muted); pointer-events: none;
}

/* Bottom dock */
.bottom {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; gap: 14px; justify-items: center;
  padding: 40px max(14px, var(--s-r)) calc(var(--s-bot) + 16px) max(14px, var(--s-l));
  background: linear-gradient(to top, rgba(8, 9, 18, .85), rgba(8, 9, 18, 0));
  pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.filters { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); }
.filters button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filters button.on { background: var(--text); color: var(--ink); }
.dock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; max-width: 420px; }
.dock-btn {
  justify-self: start; display: grid; justify-items: center; gap: 4px; padding: 8px 12px; border: 0; background: none;
  font-size: 12px; font-weight: 600; color: var(--text); text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
}
.dock-btn.right { justify-self: end; }
.tag-btn {
  width: 80px; height: 80px; border-radius: 50%; border: 0; color: #1d0612;
  font: 20px/1 var(--f-display); letter-spacing: .02em; text-transform: uppercase;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .55) 0 6%, transparent 7%),
    radial-gradient(circle at 50% 50%, var(--paint) 0 58%, var(--paint-deep) 72%, transparent 73%),
    radial-gradient(circle at 50% 50%, rgba(255, 79, 163, .35) 0 74%, transparent 75%);
  box-shadow: 0 10px 34px rgba(255, 79, 163, .45);
  transition: transform .15s;
}
.tag-btn:active { transform: scale(.94); }

/* Toasts */
#toasts {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(var(--s-top) + 96px); display: grid; gap: 8px;
  justify-items: center; padding: 0 16px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; max-width: 420px; padding: 11px 14px; border-radius: 14px;
  background: rgba(21, 24, 39, .94); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  font-size: 14px; pointer-events: auto; animation: tin .25s ease-out; transition: opacity .4s, transform .4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast button { border: 0; background: var(--paint); color: #1d0612; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* Sheets */
#scrim { position: fixed; inset: 0; z-index: 20; background: rgba(4, 5, 12, .55); opacity: 0; pointer-events: none; transition: opacity .22s; }
#scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 84%;
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  padding: 8px max(18px, var(--s-r)) calc(var(--s-bot) + 18px) max(18px, var(--s-l));
  touch-action: pan-y; user-select: text;
}
.sheet.on { transform: none; }
.sheet.full { top: 0; max-height: none; max-width: none; border-radius: 0; border: 0; padding-top: calc(var(--s-top) + 10px); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; flex: none; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex: none; }
.sheet h2 { font: 19px/1.1 var(--f-display); letter-spacing: .01em; }
.sheet-body { overflow: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0; }
.error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 8px 0 0; }

.btn {
  border: 1px solid var(--line); background: var(--text); color: var(--ink); font-weight: 700; padding: 10px 16px;
  border-radius: 999px; font-size: 14px; white-space: nowrap;
}
.btn.primary { background: var(--paint); border-color: var(--paint); color: #1d0612; }
.btn.ghost { background: transparent; color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.big { padding: 14px 26px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: default; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 8px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--text); color: var(--ink); }
.seg.small button { padding: 6px 10px; }

.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.field > span, .field legend { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 6px; }
input[type="text"], input:not([type]), input[type="datetime-local"] {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
  color: var(--text); font: 15px var(--f-body);
}
input[type="datetime-local"] { margin-top: 8px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: contain; background: #2a2030; }
.list .avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 15px var(--f-display); color: var(--ink); justify-self: center; }
.list .t1 { font-weight: 700; }
.list .t2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .num { font: 600 12px var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.list button.rowlink { all: unset; display: contents; cursor: pointer; }
.list .empty { display: block; color: var(--muted); padding: 18px 0; border: 0; }
.list .mid { min-width: 0; }

.pill { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.friends { color: var(--paint); border-color: color-mix(in srgb, var(--paint) 50%, transparent); }
.pill.private { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 50%, transparent); }

/* A brick wall behind art so transparent paint reads like it does on the street */
.wall {
  border-radius: 14px; overflow: hidden;
  background-color: #3a2b31;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='56'%3E%3Cg fill='%23000' fill-opacity='.32'%3E%3Crect y='26' width='64' height='2'/%3E%3Crect y='54' width='64' height='2'/%3E%3Crect x='0' width='2' height='26'/%3E%3Crect x='32' y='28' width='2' height='26'/%3E%3C/g%3E%3C/svg%3E");
}
.detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; overflow: auto; }
.detail .wall { aspect-ratio: 1; max-width: 100%; max-height: 38vh; margin: 0 auto; width: min(100%, 38vh); }
.detail .wall img, .preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#d-caption { margin: 6px 0 0; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 3px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.alert-card { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); margin-bottom: 8px; }
.alert-card p { margin: 0 0 10px; font-size: 14px; }
.alert-card p:last-child { margin-bottom: 0; }

/* Create */
.create-h { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 14px; }
.steps { list-style: none; display: flex; justify-content: center; gap: 14px; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.steps li::before { content: counter(s); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 11px; }
.steps li.on { color: var(--text); }
.steps li.on::before { background: var(--paint); border-color: var(--paint); color: #1d0612; }
.step { overflow: auto; min-height: 0; flex: 1; }
.canvas-wrap { width: min(100%, 440px, 50vh); aspect-ratio: 1; margin: 0 auto; touch-action: none; }
#ed-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.tools { display: grid; gap: 12px; justify-items: center; max-width: 440px; margin: 14px auto 0; }
.swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .4); padding: 0; }
.swatches button.on { outline: 2px solid var(--text); outline-offset: 2px; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.tool-row #ed-text { flex: 1 1 160px; min-width: 0; }
.range { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.range input { width: 110px; accent-color: var(--paint); }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.check input { accent-color: var(--paint); }
.details { max-width: 480px; margin: 0 auto; }
.preview { width: 140px; aspect-ratio: 1; margin: 0 auto 16px; }

/* Start */
#start {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow: auto;
  padding: calc(var(--s-top) + 24px) max(24px, var(--s-r)) calc(var(--s-bot) + 24px) max(24px, var(--s-l));
  background:
    radial-gradient(60% 40% at 50% 30%, rgba(255, 79, 163, .18), transparent 70%),
    var(--ink);
}
.start-inner { max-width: 360px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.start-mark {
  width: 120px; height: 120px; border-radius: 50%; margin-bottom: 6px;
  background:
    radial-gradient(circle, var(--paint) 0 34%, transparent 35%),
    radial-gradient(circle, rgba(255, 79, 163, .45) 0 2px, transparent 3px) 0 0 / 11px 11px,
    radial-gradient(circle, rgba(255, 212, 59, .35) 0 1.5px, transparent 2.5px) 5px 6px / 13px 13px;
  -webkit-mask: radial-gradient(circle, #000 0 55%, transparent 70%); mask: radial-gradient(circle, #000 0 55%, transparent 70%);
}
#start h1 { font: 40px/1 var(--f-display); }
#start p { color: var(--muted); margin: 0; }
#start .fine { font-size: 12px; margin-top: 8px; }

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

/* Accounts */
input[type="email"], input[type="search"] {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
  color: var(--text); font: 15px var(--f-body); -webkit-appearance: none; appearance: none;
}
#a-code { font: 600 22px/1 var(--f-mono); letter-spacing: .3em; text-align: center; }
.auth-step { display: grid; gap: 4px; }
.auth-step .btn { justify-self: start; }
.me-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); margin-bottom: 16px;
}
.me-card .avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 17px var(--f-display); color: var(--ink); background: var(--signal); }
.me-card .t1 { font-weight: 700; }
.me-card .t2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-card.out { grid-template-columns: minmax(0, 1fr) auto; }
.list-h { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 2px; }
.wall { position: relative; }
.wall-msg {
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center;
  font: 15px/1.3 var(--f-display); color: var(--text); background: rgba(11, 13, 23, .55);
}
.thumb.blank { background: #2a2030 radial-gradient(circle, rgba(255, 79, 163, .5) 0 18%, transparent 19%); }
.btn.busy { opacity: .6; pointer-events: none; }
