:root {
  --amber: #f5a623;
  --ink: #1c1c1e;
  --paper: #fff;
  --muted: #6b7280;
  --danger: #ef4444;
  --success: #22c55e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #f2f2f4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  overscroll-behavior: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1px solid #e5e5e7;
}
.topbar h1 { font-size: 1.05rem; margin: 0; }
.back-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.topbar-spacer { width: 70px; }

#deck-area {
  position: relative;
  height: calc(100vh - 56px - 92px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none;
}

#card-stack {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: 100%;
  max-height: 620px;
}

.swipe-card {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #ddd;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.swipe-card:active { cursor: grabbing; }
.swipe-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.card-gradient {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  pointer-events: none;
}

.card-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px;
  color: #fff;
}
.card-info h2 { margin: 0 0 4px; font-size: 1.4rem; }
.card-info p { margin: 0; font-size: 0.9rem; opacity: 0.9; line-height: 1.35; }

.price-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--amber);
  color: #1c1c1e;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.stamp {
  position: absolute;
  top: 24px;
  padding: 6px 14px;
  border: 4px solid;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  transform: rotate(-18deg);
}
.stamp.like-stamp { right: 20px; border-color: var(--success); color: var(--success); }
.stamp.skip-stamp { left: 20px; border-color: var(--danger); color: var(--danger); transform: rotate(18deg); }

.action-row {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 18px 0 28px;
  background: #f2f2f4;
}
.action-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  font-size: 1.6rem;
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  cursor: pointer;
}
.action-btn.skip { color: var(--danger); }
.action-btn.like { color: var(--success); }
.action-btn:active { transform: scale(0.92); }

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  color: var(--muted);
  padding: 0 24px;
}
.empty-state button {
  border: none;
  background: var(--amber);
  color: #1c1c1e;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
}
/* Same author-vs-[hidden] specificity issue as .match-overlay above -
   .empty-state also declares display:flex unconditionally, so its
   `hidden` attribute needs the same explicit override or the empty
   state and loading state would both render at once regardless of
   which one should currently be hidden. */
.empty-state[hidden] {
  display: none;
}

.match-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* Higher than any .swipe-card's z-index (cards go up to ~100 for a
     3-card visible stack) - without this the overlay would render
     correctly per the "hidden" fix below, but a swipe card could still
     sit visually on top of it and intercept clicks, exactly as caught
     by an actual Playwright click-interception failure during testing,
     not just a visual read. */
  z-index: 500;
}

/* A plain class selector like `.match-overlay { display: flex }` above
   has the same specificity as the browser's built-in `[hidden]{display:
   none}` rule, but author styles always win ties over the user-agent
   stylesheet - so without this rule the overlay would stay visible
   (display:flex) even while its `hidden` attribute was set, regardless
   of what discover.js does. Caught by an actual Playwright visibility
   check failing at page load, before any swipe had even happened. */
.match-overlay[hidden] {
  display: none;
}
.match-card {
  background: var(--paper);
  border-radius: 20px;
  max-width: 360px;
  width: 100%;
  overflow: hidden;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.match-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.85);
  font-size: 1rem;
  cursor: pointer;
  z-index: 2;
}
.match-photo {
  height: 180px;
  background-size: cover;
  background-position: center;
}
.match-body { padding: 18px 20px 22px; }
.match-body h2 { margin: 0 0 6px; font-size: 1.25rem; }
.match-price {
  display: inline-block;
  background: var(--amber);
  color: #1c1c1e;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 12px;
  font-size: 0.95rem;
}
.match-article-link {
  display: block;
  color: var(--ink);
  text-decoration: underline;
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.match-offers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.match-offer {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e5e5e7;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.match-offer:active { background: #f2f2f4; }
.match-continue {
  width: 100%;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  padding: 12px;
  border-radius: 999px;
  cursor: pointer;
}

/* Sticky launcher, for reference/reuse on the homepage - see
   sticky_launcher_snippet.html for the paste-in version. */
.discover-launcher {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--amber);
  color: #1c1c1e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  z-index: 40;
}
