/*
 * GO HAUNTED — the button set, map controls and tab bar.
 *
 * Every value is the one the app uses (src/styles/app.css). The custom properties come
 * from ../tokens/tokens.css; load that first.
 *
 * States are real pseudo-classes, and each also has a class (.is-pressed, .is-disabled,
 * .is-selected) so a static mock-up can show a state without anyone touching the screen.
 */

.gh {
  font-family: var(--font-ui);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
}

/* ───────────────────────── Buttons ───────────────────────── */

/* The standard button: 50 high, 14 radius, 17/22 semibold. Full width inside sheets and forms. */
.gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-md);
  font: 600 17px / 22px var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 100ms ease-out, transform 100ms ease-out;
}

.gh-btn:active,
.gh-btn.is-pressed {
  transform: scale(0.97);
  opacity: 0.85;
}

.gh-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.gh-btn--block {
  display: flex;
  width: 100%;
}

/* Primary: the one mint button on a screen. Black text. */
.gh-btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Sign in with Apple, and any other "platform" action: white, black text. */
.gh-btn--apple {
  background: #fff;
  color: #000;
}

/* Secondary: grey fill, white text. */
.gh-btn--secondary {
  background: var(--fill-3);
  color: var(--label);
}

/* Destructive: red fill, white text. Only for the confirming step of deleting something. */
.gh-btn--danger {
  background: var(--red);
  color: #fff;
}

.gh-btn:disabled,
.gh-btn.is-disabled {
  background: var(--fill-3);
  color: var(--label-2);
  opacity: 0.8;
  transform: none;
  cursor: default;
}

/* Text link: mint, 15 regular, a 44 high target. */
.gh-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--accent);
  font: 400 15px / 1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
}

.gh-link:active,
.gh-link.is-pressed {
  opacity: 0.6;
}

/* ───────────────────────── Map controls ───────────────────────── */

/* The floating call to action: a mint pill with a glow. One at a time, bottom left of the map. */
.gh-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 15px / 1 var(--font-ui);
  white-space: nowrap;
  box-shadow: var(--glow-accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.gh-pill:active,
.gh-pill.is-pressed {
  transform: scale(0.97);
}

.gh-pill:disabled,
.gh-pill.is-disabled {
  opacity: 0.8;
}

.gh-pill svg {
  width: 20px;
  height: 20px;
}

/* Round map button: 44 across, dark, a 22 icon. Stacked 8 apart on the right edge of the map. */
.gh-round {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--label);
  box-shadow: var(--shadow-float);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 100ms ease-out, transform 100ms ease-out;
}

.gh-round svg {
  width: 22px;
  height: 22px;
}

.gh-round:active,
.gh-round.is-pressed {
  transform: scale(0.97);
  opacity: 0.85;
}

/* On: the control is filtering or holding something. Mint icon, and a count if there is one. */
.gh-round.is-selected {
  color: var(--accent);
}

.gh-round__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #000;
  font: 700 11px / 18px var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Small icon button in headers and sheets: a 44 target around a 30 grey disc. */
.gh-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--label-2);
  cursor: pointer;
}

.gh-icon-btn svg {
  width: 30px;
  height: 30px;
  padding: 7px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--fill-3);
}

/* The player chip, top left of the map: the ghost in a ring that fills as XP grows. */
.gh-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 4px 14px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: var(--material-bar);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 0 0 0.5px var(--edge-bar), var(--shadow-float);
  color: var(--label);
  text-align: left;
  cursor: pointer;
}

.gh-chip__ring {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.16) 0);
}

.gh-chip__face {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #2b2a55, #12122a);
}

.gh-chip__face svg {
  position: absolute;
  top: 1px;
  left: 50%;
  width: 40px;
  height: 55px;
  margin-left: -20px;
}

.gh-chip__text {
  display: grid;
  gap: 2px;
}

.gh-chip__text strong {
  font: 700 15px / 1 var(--font-ui);
}

.gh-chip__text span {
  color: var(--label-2);
  font: 500 12px / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}

/* ───────────────────────── Map pins ───────────────────────── */

.gh-pin {
  display: inline-block;
  width: 36px;
  height: 46px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
  transform-origin: 50% 100%;
}

.gh-pin.is-selected {
  transform: scale(1.28);
}

/* A group of nearby places. */
.gh-cluster {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  box-sizing: border-box;
  border-radius: 19px;
  background: var(--accent);
  color: #000;
  font: 700 15px / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 5px rgba(106, 240, 191, 0.28), 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* ───────────────────────── Tab bar ───────────────────────── */

.gh-tabbar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 56px;
  background: var(--material-bar);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 0.5px 0 var(--edge-bar);
}

.gh-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  height: 56px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--tab-inactive);
  font: 500 10px / 12px var(--font-ui);
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.gh-tab svg {
  width: 26px;
  height: 26px;
}

.gh-tab.is-selected {
  color: var(--accent);
}

.gh-tab:active,
.gh-tab.is-pressed {
  opacity: 0.6;
}

/* Words kept for screen readers only. The map button's label is one: the disc speaks for itself. */
.gh-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The map is home: its tab is a raised, physical disc that stands 18 above the bar. */
.gh-tab--main {
  justify-content: flex-end;
  padding-bottom: 3px;
}

.gh-tab--main:active {
  opacity: 1;
}

.gh-disc {
  position: absolute;
  top: -18px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-left: -31px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 48%, var(--accent-pressed) 100%);
  box-shadow: 0 0 0 5px #131315, 0 8px 16px rgba(0, 0, 0, 0.55), inset 0 1.5px 0 rgba(255, 255, 255, 0.65), inset 0 -4px 0 rgba(0, 0, 0, 0.2);
  color: var(--accent-ink-soft);
  /* Away from the map it rests a little dimmer. */
  filter: saturate(0.75) brightness(0.82);
  transition: transform 110ms cubic-bezier(0.25, 0.8, 0.3, 1), box-shadow 110ms cubic-bezier(0.25, 0.8, 0.3, 1), filter 200ms ease;
}

.gh-disc svg {
  width: 32px;
  height: 32px;
}

/* On the map it glows. */
.gh-tab--main.is-selected .gh-disc {
  filter: none;
  box-shadow: 0 0 0 5px #131315, 0 0 22px rgba(106, 240, 191, 0.55), 0 8px 16px rgba(0, 0, 0, 0.55), inset 0 1.5px 0 rgba(255, 255, 255, 0.65), inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}

/* Pressed, it sinks. */
.gh-tab--main:active .gh-disc,
.gh-tab--main.is-pressed .gh-disc {
  transform: translateY(3px) scale(0.95);
  filter: none;
  box-shadow: 0 0 0 5px #131315, 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1.5px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  .gh-btn,
  .gh-round,
  .gh-disc {
    transition: none;
  }
}
