/*
 * Custom styles that Tailwind utilities don't cover.
 * Layout and theming live in the markup as Tailwind classes.
 */

:root {
  color-scheme: dark;
}

html,
body {
  -webkit-tap-highlight-color: transparent;
}

/* Hide native number spinners — the mobile keypad is the input method. */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ---------- Bottom tab bar ---------- */
.tab-btn {
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b; /* slate-500 */
  position: relative;
  transition: color 0.15s ease;
}

.tab-btn:hover {
  color: #cbd5e1; /* slate-300 */
}

.tab-btn[aria-selected='true'] {
  color: #34d399; /* emerald-400 */
}

/* Active indicator pill above the icon */
.tab-btn[aria-selected='true']::before {
  content: '';
  position: absolute;
  top: 0;
  width: 32px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: currentColor;
}

.tab-btn:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: -4px;
  border-radius: 12px;
}

/* ---------- Edit sheet (<dialog>) ---------- */
/* Bottom sheet on phones, centred card on wider screens. */
.edit-sheet {
  width: 100%;
  max-width: 36rem;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0 0 env(safe-area-inset-bottom);
  border-radius: 1.25rem 1.25rem 0 0;
  border-bottom: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.edit-sheet::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}

@media (min-width: 640px) {
  .edit-sheet {
    margin: auto;
    border-radius: 1.25rem;
    border-bottom: 1px solid #1e293b;
  }
}

/* Lock the page behind an open sheet (iOS scrolls the background otherwise). */
html.sheet-open {
  overflow: hidden;
}

/* ---------- Coin hero (animated by services/motion.js) ---------- */
/* Real 3D flip: an HTML element with two SVG faces back to back. */
.coin-stage {
  position: relative;
  height: 168px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 22px;
  perspective: 700px;
}

.coin {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  border-radius: 9999px;
  transform-style: preserve-3d;
  cursor: pointer;
  /* Button reset that doesn't depend on Tailwind's preflight. */
  padding: 0;
  border: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

.coin:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 4px;
}

.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  filter: drop-shadow(0 6px 14px rgba(245, 158, 11, 0.25));
}

.coin-face svg {
  display: block;
  width: 100%;
  height: 100%;
}

.coin-back {
  transform: rotateY(180deg);
}

.coin-shadow {
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 84px;
  height: 14px;
  margin-left: -42px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent);
}

/* Four-point sparkles that burst when the coin lands. */
.coin-sparkle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: #fcd34d;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
  pointer-events: none;
}

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