/* RRROOOAAARRR Raffle Engine — buyer page
   Design system ported from the original /raffle page (rkrk). */

:root[data-theme="dark"] {
  --ink: #f0ece4;
  --paper: #1c1a17;
  --surface: #262320;
  --surface-raised: #302c28;
  --muted: #8a8278;
  --dim: #5c5750;
  --highlight: #c0392b;
  --highlight-bright: #e74c3c;
  --accent: #d4a017;
  --accent-dim: #a67c00;
  --border: #3a352f;
}
:root[data-theme="light"] {
  --ink: #1c1a17;
  --paper: #f5f0e8;
  --surface: #e8e2d8;
  --surface-raised: #ded6ca;
  --muted: #7a7268;
  --dim: #a39b90;
  --highlight: #a93226;
  --highlight-bright: #c0392b;
  --accent: #b8860b;
  --accent-dim: #996f00;
  --border: #ccc4b8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  transition: background .25s, color .25s;
}
h1, h2, h3, .display { font-family: 'Tilt Warp', 'Arial Black', sans-serif; line-height: 1.15; }
.mono { font-family: 'IBM Plex Mono', 'Courier New', monospace; }
a { color: var(--accent); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem var(--gutter);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.topbar__logo img { height: 40px; width: auto; display: block; }
.topbar__actions { display: flex; gap: .75rem; align-items: center; }
:root { --gutter: clamp(1rem, 3vw, 2.5rem); --measure: 72ch; }

.theme-toggle {
  font-family: 'IBM Plex Mono', monospace; font-size: .7rem; letter-spacing: .12em;
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: .45em .9em; cursor: pointer; border-radius: 3px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }

.cta-buy {
  font-family: 'Tilt Warp', 'Arial Black', sans-serif; font-size: .85rem;
  text-decoration: none; color: #fff; background: var(--highlight);
  padding: .55em 1.2em; border-radius: 3px; white-space: nowrap;
}
.cta-buy:hover { background: var(--highlight-bright); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero__image-wrap img { width: 100%; max-height: 62vh; object-fit: cover; display: block; }
.hero__overlay {
  position: absolute; inset: auto 0 0 0;
  padding: 5rem var(--gutter) 2rem;
  background: linear-gradient(transparent, rgba(10,9,8,.88));
  color: #f0ece4;
}
.hero__label {
  font-family: 'IBM Plex Mono', monospace; font-size: .72rem; letter-spacing: .25em;
  text-transform: uppercase; margin: 0 0 .4rem;
  color: var(--ink); background-color: var(--accent); width: fit-content;
  padding: .2em .6em;
}
.hero__title { font-size: clamp(1.6rem, 4.5vw, 3rem); margin: 0 0 .4rem; }
.hero__desc { max-width: var(--measure); margin: 0; color: #cfc8bd; }

/* ---------- intro ---------- */
.intro {
  display: grid; grid-template-columns: 2fr 1fr; gap: 2rem;
  padding: 2.5rem var(--gutter); max-width: 1200px; margin: 0 auto;
}
.intro__main h2 { margin-top: 0; font-size: 1.5rem; }
.intro__sidebar {
  margin: 0; border-left: 2px solid var(--border); padding-left: 1.5rem;
  display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; align-content: start;
}
.intro__sidebar dt {
  font-family: 'IBM Plex Mono', monospace; font-size: .68rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--muted); align-self: center;
}
.intro__sidebar dd { margin: 0; }

/* ---------- prize grid ---------- */
.prizes { padding: 1rem var(--gutter) 3rem; max-width: 1200px; margin: 0 auto; }
.prizes__heading {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--border); padding-bottom: .6rem; margin-bottom: 1.5rem;
}
.prizes__heading h2 { margin: 0; font-size: 1.4rem; }
.prizes__count { font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--muted); }

.prize-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem;
}
.prize-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  overflow: hidden; display: flex; flex-direction: column;
}
.prize-card--top { border-color: var(--accent); }

.carousel { position: relative; aspect-ratio: 4/3; background: var(--surface-raised); }
.carousel__frame {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity .3s; cursor: pointer;
  pointer-events: none;
}
.carousel__frame.is-active { opacity: 1; pointer-events: auto; }
.carousel__btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(15,14,12,.65); color: #fff; border: none; cursor: pointer;
  font-size: 1.2rem; padding: .5em .55em; line-height: 1;
}
.carousel__btn:hover { background: rgba(15,14,12,.9); }
.carousel__btn--prev { left: 0; border-radius: 0 3px 3px 0; }
.carousel__btn--next { right: 0; border-radius: 3px 0 0 3px; }
.carousel__dots {
  position: absolute; bottom: .5rem; left: 0; right: 0;
  display: flex; justify-content: center; gap: .4rem;
}
.carousel__dot {
  width: 8px; height: 8px; border-radius: 50%; border: none; padding: 0;
  background: rgba(255,255,255,.35); cursor: pointer;
}
.carousel__dot.is-active { background: var(--accent); }
.carousel__count {
  position: absolute; top: .5rem; right: .5rem;
  font-family: 'IBM Plex Mono', monospace; font-size: .65rem;
  background: rgba(15,14,12,.7); color: #fff; padding: .15em .5em; border-radius: 2px;
}

.prize-card__body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.prize-card__num {
  font-family: 'IBM Plex Mono', monospace; font-size: .68rem; letter-spacing: .2em;
  color: var(--muted);
}
.prize-card__title { font-size: 1.02rem; margin: 0; font-family: 'Tilt Warp','Arial Black',sans-serif; }
.prize-card__desc { font-size: .92rem; color: var(--muted); margin: 0; flex: 1; }

/* ---------- flow (tier / details / review / amoe) ---------- */
.flow {
  max-width: 680px; margin: 0 auto; padding: 0 var(--gutter) 4rem;
}
.flow__step-label {
  font-family: 'IBM Plex Mono', monospace; font-size: .7rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 1rem;
}
.tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: .9rem; }
.tier {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 1rem; text-align: center; cursor: pointer;
}
.tier:hover { border-color: var(--accent); }
.tier.is-selected { border-color: var(--accent); background: var(--surface-raised); outline: 1px solid var(--accent); }
.tier__count { font-family: 'Tilt Warp',sans-serif; font-size: 1.6rem; display: block; }
.tier__count small { font-size: .9rem; }
.tier__price { color: var(--accent); font-weight: 700; }
.tier__each { font-size: .78rem; color: var(--muted); }

.field { margin-bottom: 1rem; }
.field label { display: block; font-family: 'IBM Plex Mono',monospace; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.field input, .field select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: .55em .7em;
}
.field input:focus { outline: 1px solid var(--accent); }
.consent { display: flex; gap: .6rem; align-items: flex-start; margin: .8rem 0; font-size: .9rem; }
.consent input { margin-top: .3em; }

.btn {
  font-family: 'Tilt Warp','Arial Black',sans-serif; font-size: .95rem;
  background: var(--highlight); color: #fff; border: none; cursor: pointer;
  padding: .7em 1.6em; border-radius: 3px; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--highlight-bright); }
.btn--ghost { background: none; color: var(--muted); border: 1px solid var(--border); }
.btn--ghost:hover { color: var(--ink); border-color: var(--muted); background: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.review-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; }
.review-table td { padding: .45em 0; border-bottom: 1px solid var(--border); }
.review-table td:last-child { text-align: right; font-family: 'IBM Plex Mono',monospace; }
.review-table .total td { font-weight: 700; color: var(--accent); border-bottom: none; }

.amoe-note {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 1rem 1.2rem; font-size: .9rem; color: var(--muted); border-radius: 3px; margin-bottom: 1.5rem;
}

.error-banner {
  background: rgba(192,57,43,.15); border: 1px solid var(--highlight); color: var(--ink);
  padding: .8em 1em; border-radius: 3px; margin-bottom: 1rem; font-size: .9rem; display: none;
}
.error-banner.is-visible { display: block; }

.ref-banner {
  background: var(--surface); border: 1px solid var(--accent); border-radius: 4px;
  padding: 1.5rem; text-align: center; margin: 2rem auto; max-width: 680px;
}
.ref-banner .mono { font-size: 1.6rem; color: var(--accent); letter-spacing: .1em; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12,11,10,.94);
  display: none;
  align-items: center; justify-content: center;
}
.lightbox.is-open { display: flex; }
.lightbox__img {
  max-width: 92vw; max-height: 86vh;
  object-fit: contain;
  border-radius: 3px;
}
.lightbox__close {
  position: absolute; top: 1rem; right: 1.2rem;
  background: none; border: 1px solid rgba(255,255,255,.3); color: #fff;
  font-size: 1.3rem; line-height: 1; padding: .45em .55em; border-radius: 3px; cursor: pointer;
}
.lightbox__close:hover { background: rgba(255,255,255,.12); }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(15,14,12,.65); border: 1px solid rgba(255,255,255,.3); color: #fff;
  font-size: 1.6rem; line-height: 1; padding: .45em .6em; border-radius: 3px; cursor: pointer;
}
.lightbox__nav:hover { background: rgba(15,14,12,.9); }
.lightbox__nav--prev { left: 1.2rem; }
.lightbox__nav--next { right: 1.2rem; }
.lightbox__caption {
  position: absolute; bottom: 1.2rem; left: 0; right: 0; text-align: center;
  font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: rgba(255,255,255,.75);
}

.hidden { display: none !important; }
.footer { border-top: 1px solid var(--border); padding: 1.5rem var(--gutter); text-align: center; color: var(--dim); font-size: .8rem; }

@media (max-width: 760px) {
  .intro { grid-template-columns: 1fr; }
  .intro__sidebar { border-left: none; border-top: 2px solid var(--border); padding: 1rem 0 0; }
  .carousel__btn { padding: .4em .45em; }
}
