/* =========================================================
   BIRTHDAY TODAY — DESIGN TOKENS
   Palette: warm ivory paper + premium brown accent + gold #1 spotlight
   Type: Instrument Serif (display / rank numerals) + Manrope (UI) + Space Mono (bid ticker)
   ========================================================= */
:root {
  --bg: #FBF6F0;
  --paper: #FFFFFF;
  --ink: #201A1D;
  --ink-soft: #55494E;
  --muted: #948890;
  --hairline: #ECE3DB;

  --accent: #8B5E3C;
  --accent-dark: #68432B;
  --accent-tint: #EFE3D7;

  --gold: #C9971C;
  --gold-tint: #FFF3D6;

  --success: #1F9D63;

  --font-display: 'Instrument Serif', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Mono', monospace;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(32, 26, 29, 0.04), 0 8px 24px rgba(32, 26, 29, 0.05);
  --shadow-card-hover: 0 4px 10px rgba(32, 26, 29, 0.06), 0 16px 36px rgba(32, 26, 29, 0.09);
  --shadow-modal: 0 24px 60px rgba(32, 26, 29, 0.25);

  --max-width: 980px;
}

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

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

a { color: inherit; }

button, input, textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(139, 94, 60, 0.32);
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 8px 20px rgba(139, 94, 60, 0.4); }

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--hairline);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.btn-lg { padding: 14px 26px; font-size: 15.5px; }
.btn-full { width: 100%; margin-top: 6px; padding: 13px 20px; font-size: 15px; }
.btn-header { padding: 9px 16px; font-size: 13.5px; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 246, 240, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand-mark { font-size: 20px; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding: 56px 20px 44px;
}
.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.hero-date {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-dark);
  background: var(--accent-tint);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero-headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.hero-highlight {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}
.hero-sub {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0 0 30px;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.hero-status {
  font-size: 13.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(31, 157, 99, 0.5);
  animation: pulseDot 2s infinite;
  flex-shrink: 0;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(31, 157, 99, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(31, 157, 99, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 157, 99, 0); }
}

/* =========================================================
   LEADERBOARD
   ========================================================= */
.leaderboard-section {
  padding: 12px 20px 60px;
}
.leaderboard-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.leaderboard-heading {
  text-align: center;
  margin-bottom: 30px;
}
.leaderboard-heading h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.leaderboard-sub {
  color: var(--muted);
  margin: 0;
  font-size: 14.5px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Card base --- */
.entry-card {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 44px 72px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.2s ease;
}
.entry-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: var(--accent);
}
.entry-card .bid-chip,
.entry-card .like-btn {
  cursor: pointer;
}

.entry-rank {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 20px;
  color: var(--muted);
  text-align: center;
}

.entry-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-tint);
  flex-shrink: 0;
  border: 2px solid var(--hairline);
}

.entry-body { min-width: 0; }
.entry-name {
  font-weight: 700;
  font-size: 15.5px;
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.entry-handle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 2px 7px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background 0.15s ease, color 0.15s ease;
}
.entry-handle:hover { background: var(--accent); color: #fff; }
.entry-handle .handle-platform-tag {
  font-size: 9px;
  opacity: 0.8;
}
.entry-wish {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.bid-chip {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  background: var(--ink);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

/* --- Digital-style like widget: SVG heart, unlimited taps, no toggle state --- */
.like-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1.5px solid var(--hairline);
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  overflow: visible;
}
.like-btn:hover { border-color: var(--accent); color: var(--accent); }
.like-btn:active { transform: scale(0.95); }

.like-heart-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transform-origin: center;
}
.like-heart-svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 0.12s ease;
}
.like-btn.pulsing { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-dark); }
.like-btn.pulsing .like-heart-svg path { fill: var(--accent); stroke: var(--accent); }
.like-btn.pulsing .like-heart-svg { animation: heartPop 0.35s ease; }

@keyframes heartPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}

/* ripple ping for each tap — reinforces "unlimited, instant" digital feel */
.like-ping {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  opacity: 0.6;
  pointer-events: none;
  animation: pingOut 0.5s ease-out forwards;
}
@keyframes pingOut {
  0%   { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}

.like-count {
  min-width: 1.4em;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.like-count.bump { animation: countBump 0.3s ease; }
@keyframes countBump {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* --- Rank 1: prestige --- */
.entry-card.rank-1 {
  grid-template-columns: 56px 92px 1fr auto;
  padding: 22px 24px;
  background: linear-gradient(180deg, #FFFDF8 0%, var(--paper) 100%);
  border: 1.5px solid var(--gold);
  box-shadow: 0 4px 14px rgba(201, 151, 28, 0.16), 0 20px 44px rgba(201, 151, 28, 0.12);
}
.entry-card.rank-1 .entry-rank {
  font-size: 28px;
  color: var(--gold);
  position: relative;
}
.entry-card.rank-1 .entry-avatar {
  width: 92px;
  height: 92px;
  border: 3px solid var(--gold);
}
.entry-card.rank-1 .entry-name { font-size: 18px; }
.entry-card.rank-1 .entry-wish { font-size: 14.5px; -webkit-line-clamp: 2; }
.entry-card.rank-1 .bid-chip {
  background: var(--gold);
  color: #3A2A00;
  font-size: 15px;
  padding: 8px 12px;
}

.flame {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  animation: flicker 1.6s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { transform: translateX(-50%) scale(1) rotate(-2deg); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.12) rotate(2deg); opacity: 0.85; }
}

/* --- Rank 2 & 3: elevated --- */
.entry-card.rank-2, .entry-card.rank-3 {
  padding: 16px 20px;
  border: 1px solid var(--hairline);
}
.entry-card.rank-2 .entry-rank { color: #9AA0A6; font-size: 22px; }
.entry-card.rank-3 .entry-rank { color: #C08552; font-size: 22px; }

/* --- Open spot --- */
.entry-card.open-spot {
  background: transparent;
  border: 1.5px dashed var(--hairline);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.entry-card.open-spot:hover { transform: none; border-color: var(--accent); }
.open-spot-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.open-spot-rank {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--muted);
  width: 44px;
  text-align: center;
}
.open-spot-text strong {
  display: block;
  font-size: 14.5px;
  color: var(--ink-soft);
}
.open-spot-text span {
  font-size: 13px;
  color: var(--muted);
}
.open-spot .btn { padding: 8px 16px; font-size: 13px; }

/* --- New entry / reorder animation --- */
.entry-card.card-new {
  animation: newEntry 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes newEntry {
  0%   { opacity: 0; transform: scale(0.94) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* =========================================================
   HOW IT WORKS
   ========================================================= */
.how-it-works {
  padding: 50px 20px 70px;
  border-top: 1px solid var(--hairline);
}
.how-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.how-inner h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 30px;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
.how-step {
  text-align: left;
}
.how-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-dark);
  background: var(--accent-tint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-bottom: 10px;
}
.how-step p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}
.how-step strong { color: var(--ink); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  text-align: center;
  padding: 26px 20px 40px;
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 26, 29, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 30px 26px 26px;
  position: relative;
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
}
.modal-close:hover { background: var(--accent-tint); color: var(--accent-dark); }

.modal h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
}
.modal-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 20px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.field label .optional {
  font-weight: 400;
  color: var(--muted);
}
.field input[type="text"],
.field input[type="number"],
.field textarea {
  width: 100%;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14.5px;
  background: var(--bg);
  color: var(--ink);
  resize: none;
  transition: border-color 0.15s ease;
}
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  outline: none;
  background: var(--paper);
}
.field-error {
  display: block;
  color: var(--accent-dark);
  font-size: 12px;
  margin-top: 5px;
  min-height: 14px;
}
.field-hint {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 5px;
  text-align: right;
}

.image-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.image-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px dashed var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  animation: none;
}
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview.filled {
  animation: previewPop 0.3s ease;
  border-style: solid;
  border-color: var(--accent);
}
@keyframes previewPop {
  0% { transform: scale(0.85); }
  100% { transform: scale(1); }
}
.image-preview-placeholder { font-size: 20px; opacity: 0.4; }
.upload-btn { font-size: 13px; padding: 9px 14px; }

.bid-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.bid-input-wrap:focus-within { border-color: var(--accent); background: var(--paper); }
.bid-prefix {
  padding: 0 0 0 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 700;
}
.bid-input-wrap input {
  border: none !important;
  background: transparent !important;
  font-family: var(--font-mono);
  font-weight: 700;
}
.bid-input-wrap input:focus { background: transparent !important; }

.handle-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.handle-input-wrap:focus-within { border-color: var(--accent); background: var(--paper); }
.handle-input-wrap select {
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  padding: 10px 6px 10px 12px;
  color: var(--ink-soft);
  border-right: 1.5px solid var(--hairline);
  cursor: pointer;
}
.handle-input-wrap select:focus { outline: none; }
.handle-at {
  padding: 0 0 0 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 700;
}
.handle-input-wrap input {
  border: none !important;
  background: transparent !important;
}
.handle-input-wrap input:focus { background: transparent !important; }

.target-banner {
  display: block;
  background: var(--accent-tint);
  color: var(--accent-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

/* --- Success step --- */
#modalStepSuccess { text-align: center; padding-top: 10px; }
.success-burst {
  font-size: 44px;
  animation: burst 0.6s ease;
}
@keyframes burst {
  0% { transform: scale(0.4) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.success-rank {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink-soft);
  margin: 6px 0 2px;
}
.success-rank strong { color: var(--accent-dark); font-size: 17px; }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 13px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius-lg);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
}
.empty-state p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 640px) {
  .how-grid { grid-template-columns: 1fr 1fr; }

  .entry-card {
    grid-template-columns: 28px 56px 1fr;
    gap: 12px;
    padding: 12px 14px;
  }
  .entry-avatar { width: 56px; height: 56px; }
  .entry-meta {
    grid-column: 1 / -1;
    justify-content: flex-end;
    margin-top: 8px;
    gap: 12px;
  }
  .entry-rank { font-size: 16px; }
  .entry-wish { -webkit-line-clamp: 1; }

  .entry-card.rank-1 {
    grid-template-columns: 32px 72px 1fr;
    padding: 18px 16px;
  }
  .entry-card.rank-1 .entry-avatar { width: 72px; height: 72px; }
  .entry-card.rank-1 .entry-meta { grid-column: 1 / -1; }

  .hero { padding: 40px 16px 34px; }
  .header-inner { padding: 12px 16px; }
  .btn-header { padding: 8px 13px; font-size: 12.5px; }
}
