*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --livello-red: #c62828;
  --livello-red-dark: #b71c1c;
  --code-red: #d32f2f;
  --accent: #ef9a9a;
}

html, body { min-height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  min-height: 100vh;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  padding: 1.6rem 1rem 2.2rem;
  width: 100%;
  max-width: 460px;
}

/* ── coupon stage: furniture bg + ticket pieces (full-canvas-aligned) ────────── */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  container-type: inline-size;   /* lets the code/stamp size in cqw to match the download */
  /* overflow visible so the torn stub can fly past the edge */
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.layer-bg {
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0,0,0,.55);
  z-index: 1;
}
.main-wrap { position: absolute; inset: 0; z-index: 2; }
.layer-main { object-fit: contain; }
.layer-stub { object-fit: contain; z-index: 3; transform-origin: 68% 50%; }

/* ── the rip: stub peels from the perforation and flies away ────────────────── */
@keyframes stubRip {
  0%   { transform: none; opacity: 1; }
  18%  { transform: translateX(-1%) rotate(-2.5deg) scale(1.01); }   /* grip & lift */
  100% { transform: translateX(58%) translateY(-30%) rotate(24deg); opacity: 0; }
}
.layer-stub.rip { animation: stubRip .8s cubic-bezier(.34,.02,.3,1) forwards; }

/* main ticket glides to centre once the stub is gone */
.main-wrap.recenter { transition: transform .65s cubic-bezier(.25,.9,.3,1); transform: translateX(11%); }

/* ── code overlay (sits over "Kupon Kodunuz") ───────────────────────────────── */
.code-overlay {
  position: absolute;
  z-index: 4;
  display: flex;
  gap: .02em;
  white-space: nowrap;
  pointer-events: none;
}
.letter {
  /* 3.9cqw ≈ 42/1080 of the stage width — same proportion as the downloaded coupon */
  font-size: 3.9cqw;
  font-weight: 800;
  color: #c62828;            /* matches the rendered code colour (CODE_COLOR) */
  letter-spacing: .01em;
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.code-overlay.hidden .letter { opacity: 0; }

/* ── "Son kullanım" stamp on the web activated page (matches the download) ───── */
.validuntil-overlay {
  position: absolute;
  z-index: 4;
  white-space: nowrap;
  pointer-events: none;
  font-size: 2cqw;           /* ≈ 22/1080, matches FONT_SIZE_VALIDUNTIL */
  font-weight: 600;
  color: #4a4a4a;
  transition: opacity .4s ease;
}
.validuntil-overlay.hidden { opacity: 0; }

/* ── notice text on the activation page (same place as the handout's notice) ─── */
.notice-overlay {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  font-size: 2.2cqw;         /* ≈ 24/1080, matches FONT_SIZE_NOTICE on the handout */
  font-weight: 400;
  color: #4a4a4a;
  line-height: 1.35;
}
.code-overlay.reveal .letter {
  animation: letterPop .46s cubic-bezier(.2,1.5,.4,1) both;
  animation-delay: calc(var(--i) * 55ms);
}
@keyframes letterPop {
  0%   { opacity: 0; transform: translateY(14px) scale(.6) rotate(-6deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

/* ── countdown ──────────────────────────────────────────────────────────────*/
.info { text-align: center; }
.info-label { font-size: .72rem; color: #9a9a9a; text-transform: uppercase; letter-spacing: .12em; margin-bottom: .25rem; }
.countdown { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.post { opacity: 0; transform: translateY(8px); transition: opacity .45s ease, transform .45s ease; }
.post.show { opacity: 1; transform: none; }

/* ── buttons (reverted to the simpler, less "AI" look) ──────────────────────── */
.btn-activate {
  display: block; width: 100%; max-width: 340px; text-align: center;
  padding: 1rem; background: var(--livello-red); color: #fff; border: none;
  border-radius: 10px; font-size: 1.1rem; font-weight: 700; cursor: pointer;
  transition: background .2s, transform .08s; -webkit-tap-highlight-color: transparent;
}
.btn-activate:hover  { background: var(--livello-red-dark); }
.btn-activate:active { transform: scale(.97); }
.btn-activate:disabled { background: #555; cursor: not-allowed; }

.btn-download {
  display: block; width: 100%; max-width: 340px; text-align: center;
  padding: .85rem; background: transparent; color: var(--accent);
  border: 2px solid var(--accent); border-radius: 10px;
  font-size: 1rem; font-weight: 600; text-decoration: none;
  transition: background .2s, color .2s; -webkit-tap-highlight-color: transparent;
}
.btn-download:hover { background: var(--accent); color: #1a1a1a; }

.btn-livello {
  display: inline-block; padding: .7rem 1.6rem; background: var(--livello-red);
  color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; margin-top: .5rem;
}

/* ── misc ─────────────────────────────────────────────────────────────────── */
.hint { font-size: .88rem; color: #999; text-align: center; max-width: 340px; line-height: 1.45; }
.hint strong { color: #cfcfcf; }

.notice.error {
  background: rgba(198,40,40,.18); color: var(--accent);
  border-radius: 8px; padding: .7rem 1rem; font-size: .92rem;
  text-align: center; width: 100%; max-width: 340px;
}

/* ── expired / not-found ──────────────────────────────────────────────────── */
.page-expired { justify-content: center; text-align: center; gap: 1rem; }
.expired-icon {
  font-size: 2.4rem; color: var(--livello-red); width: 5rem; height: 5rem;
  border: 3px solid var(--livello-red); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.page-expired h1 { font-size: 1.4rem; }
.page-expired p  { color: #aaa; }

/* ── landing / catch-all (bare domain & unknown paths) ───────────────────────── */
.page-landing { justify-content: center; }
.landing-card {
  position: relative; width: 100%; min-height: 480px;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 14px 36px rgba(0,0,0,.55);
  background-size: cover; background-position: center;
  display: flex;
}
.landing-overlay {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: .85rem; padding: 2rem 1.3rem;
  /* full-card scrim — covers the whole card (bigger) but lighter, so the furniture,
     "KUPON FIRSATI" and the Livello logo still read through it */
  background: linear-gradient(to bottom,
    rgba(20,20,20,.42) 0%,
    rgba(20,20,20,.60) 50%,
    rgba(20,20,20,.42) 100%);
}
.landing-overlay h1 { font-size: 1.35rem; }
.landing-overlay p  { font-size: .95rem; color: #e2e2e2; line-height: 1.5; max-width: 340px; }
.landing-contact    { color: #b8b8b8; }

/* ── reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .stage.intro .layer-bg, .stage.intro .main-wrap, .stage.intro .layer-stub { animation: none; }
  .layer-stub.rip { animation: none; opacity: 0; }
  .main-wrap.recenter { transition: none; }
  .code-overlay.reveal .letter { animation: none; opacity: 1; }
  .post { transition: none; }
}
