:root {
  --sky: #fff6e4;
  --sky-dot: #f3e3c3;
  --ink: #23324a;
  --ink-soft: #5d6b80;
  --card: #ffffff;
  --line: #23324a;
  --cactus: #3fa34d;
  --cactus-dark: #1d4f28;
  --sun: #ffd23f;
  --coral: #ff6b4a;
  --shadow: 0 5px 0 var(--line);
  --radius: 20px;
  --display: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--sky);
  background-image: radial-gradient(var(--sky-dot) 1.6px, transparent 1.7px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 600; }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .2px;
  text-decoration: none; color: var(--ink);
}
.brand img { width: 30px; height: 38px; transform: rotate(-8deg); }
.brand span em { font-style: normal; color: var(--cactus); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2.5px solid var(--line); border-radius: 999px; background: var(--sun);
  padding: 12px 20px; font-family: var(--display); font-weight: 600; font-size: 17px;
  box-shadow: 0 4px 0 var(--line); cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.ghost { background: var(--card); }

.card {
  background: var(--card); border: 2.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- globe page ---------- */
.globe-page { overflow: hidden; }
#globe { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#globe.dragging { cursor: grabbing; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; padding: 16px;
  display: flex; justify-content: space-between; align-items: center; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.zoom { display: flex; gap: 8px; }
.zoom button {
  width: 42px; height: 42px; border-radius: 50%; border: 2.5px solid var(--line);
  background: var(--card); box-shadow: 0 3px 0 var(--line); font-size: 20px; font-weight: 800;
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.zoom button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

.panel {
  position: fixed; left: 16px; bottom: 16px; width: 360px; max-height: calc(100% - 100px);
  display: flex; flex-direction: column; overflow: hidden;
}
.tabs { display: flex; border-bottom: 2.5px solid var(--line); }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 12px 8px; cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--ink-soft);
}
.tabs button + button { border-left: 2.5px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--sun); color: var(--ink); }
.tab-body { padding: 18px; overflow-y: auto; }

.eyebrow { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.place { font-size: 28px; line-height: 1.15; margin: 4px 0 8px; }
.holder { font-size: 17px; margin: 0; }
.holder strong { color: var(--cactus-dark); }
.since { color: var(--ink-soft); font-size: 14px; margin: 4px 0 0; }
.note {
  margin: 14px 0 0; padding: 10px 14px; background: #f1f8ea; border-radius: 14px;
  font-style: italic; position: relative;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { text-align: center; padding: 8px 4px; border: 2px dashed #c9d3df; border-radius: 14px; }
.stat b { display: block; font-family: var(--display); font-size: 22px; }
.stat span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }

.history { list-style: none; margin: 0; padding: 0; }
.history li + li { margin-top: 4px; }
.history button {
  width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  text-align: left; padding: 10px 8px; border: 0; background: transparent; border-radius: 14px; cursor: pointer;
}
.history button:hover, .history button:focus-visible { background: #fff3cf; outline: none; }
.history .num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--coral); color: #fff; font-weight: 800; font-size: 13px; border: 2px solid var(--line);
}
.history li:first-child .num { background: var(--cactus); }
.history .who { font-weight: 800; }
.history .where { font-size: 14px; color: var(--ink-soft); }
.history .when { font-size: 12px; color: var(--ink-soft); text-align: right; white-space: nowrap; }
.history .hop { display: block; color: var(--coral); font-weight: 800; }

.empty { text-align: center; padding: 8px 0; }
.empty p { color: var(--ink-soft); }

.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px; font-weight: 800; white-space: nowrap; animation: pop .5s cubic-bezier(.3,1.6,.5,1);
}
@keyframes pop { from { transform: translate(-50%, -20px) scale(.7); opacity: 0; } }

@media (max-width: 640px) {
  .brand { font-size: 19px; }
  .panel { left: 16px; right: 16px; width: auto; max-height: 46%; }
  .place { font-size: 24px; }
}

/* ---------- tap page ---------- */
.tap-page main {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
}
.tap-card { width: 100%; max-width: 420px; padding: 26px 22px; text-align: center; }
.tap-card .hero { width: 92px; height: 115px; animation: wiggle 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.tap-card h1 { font-size: 28px; margin: 10px 0 6px; }
.tap-card .lede { color: var(--ink-soft); margin: 0 0 20px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 17px; border: 2.5px solid var(--line);
  border-radius: 14px; background: #fffdf7; color: var(--ink);
}
.field input:focus { outline: 3px solid var(--sun); outline-offset: 1px; }
.field small { color: var(--ink-soft); }
.tap-card .btn { width: 100%; margin-top: 6px; }
.fine { font-size: 13px; color: var(--ink-soft); margin: 14px 0 0; }
.error { color: #c0392b; font-weight: 700; margin: 12px 0 0; min-height: 1em; }
[hidden] { display: none !important; }
