:root {
  --ink: #3e2a1a;
  --muted: #8a7461;
  --paper: #fbf3e0;
  --accent: #8cc56a;
  --brand: #d9683c;
  --straw: #ecd9a8;
  --edge: 2.5px solid var(--ink);
  --drop: 0 3px 0 var(--ink);
  --display: "Suez One", "Assistant", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #cfefff;
  color: var(--ink);
  font-family: "Assistant", "Rubik", "Segoe UI", Arial, sans-serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.box, .pill {
  background: var(--paper);
  border: var(--edge);
  box-shadow: var(--drop);
}

.hud {
  position: fixed;
  top: 12px;
  inset-inline: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}

.pill {
  margin: 0;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.4;
}

.pill.brand { background: var(--brand); color: var(--paper); }

.pill, button, #card h2, #card .head, #packs h2, #tag { font-family: var(--display); font-weight: 400; }

#packs {
  position: fixed;
  top: 12px;
  inset-inline-end: 12px;
  width: 210px;
  border-radius: 18px;
  padding: 10px 14px 12px;
}

#packs h2 { margin: 0 0 8px; font-size: 15px; }
#packs ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
#packs li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
#packs .pts { margin-inline-start: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.dot {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 2px solid var(--ink);
  flex: none;
  display: inline-block;
}

.dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 24px));
  display: grid;
  gap: 10px;
}

#search {
  display: flex;
  gap: 8px;
  border-radius: 18px;
  padding: 8px;
}

input, select, button { font: inherit; color: inherit; }

#search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: 16px;
  font-weight: 600;
}

button {
  border: var(--edge);
  border-radius: 12px;
  padding: 6px 16px;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}

button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
button.plain { background: var(--paper); }
button:disabled { opacity: 0.5; cursor: default; }

#card { border-radius: 18px; overflow: hidden; }

#card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--straw);
  border-bottom: var(--edge);
  padding: 6px 14px;
}

#card .close {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1;
}

#card .body { padding: 12px 14px 14px; }
#card h2 { margin: 0; font-size: 24px; }
#card .address { font-weight: 600; }
#card .user { color: var(--muted); direction: ltr; text-align: end; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; padding: 0; list-style: none; }

.chips li {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
}

.actions { display: flex; gap: 8px; }
.actions button { flex: 1; }

.claim { display: grid; gap: 10px; }
.claim p { margin: 0; font-weight: 600; }
.claim label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }

.claim input, .claim select {
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  color: var(--ink);
}

#tag {
  position: fixed;
  transform: translate(-50%, -100%);
  background: var(--ink);
  color: #fff;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.heart {
  position: fixed;
  color: #e53935;
  font-size: 26px;
  pointer-events: none;
  animation: float-up 1s ease-out forwards;
}

@keyframes float-up {
  from { opacity: 1; transform: translate(-50%, -100%) scale(0.6); }
  to { opacity: 0; transform: translate(-50%, -260%) scale(1.3); }
}

#toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  max-width: calc(100vw - 24px);
}

#err {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0;
  padding: 8px 12px;
  background: #b00020;
  color: #fff;
  font: 12px/1.4 monospace;
  direction: ltr;
  white-space: pre-wrap;
  z-index: 10;
}

@media (max-width: 760px) {
  #packs { display: none; }
  .pill { font-size: 13px; padding: 3px 10px; }
  #toast { top: 56px; }
}
