/* ==========================================================================
   WIZKET — Arcade teaser · "Ready to play?"  Prefix: ar-
   Wiz flips a coin, tosses it to you, and you drag it into the cabinet's coin
   slot to warp into arcade.html. A coupon ticket says what's in it for you.
   Tokens only for the page; the cabinet is always dark (it's a machine, not a
   surface), so it reads in both themes.
   ========================================================================== */
.ar {
  position: relative; isolation: isolate; overflow: clip;
  min-height: clamp(760px, 100svh, 1100px);
  display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--nav-top) + var(--nav-h) + clamp(1.2rem, 4vh, 2.6rem)) var(--gutter) clamp(3rem, 7vh, 5rem);
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* soft orange floor glow under the machine */
.ar::before {
  content: ""; position: absolute; z-index: -1; left: 50%; bottom: -18%;
  width: min(1100px, 130vw); aspect-ratio: 2.2; translate: -50% 0;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 72%);
  pointer-events: none;
}

/* eyebrow — same language as the other sections */
.ar__bar {
  position: absolute; z-index: 4; left: clamp(1rem, 3vw, 3rem); top: clamp(1.4rem, 4vh, 2.6rem); margin: 0;
  display: inline-flex; align-items: center; gap: 0.75rem;
  font: 500 0.75rem/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); pointer-events: none;
}
.ar__rule { width: 2.25rem; height: 1px; background: currentColor; opacity: 0.5; }

/* ---------- heading ---------- */
.ar__title {
  margin: 0; text-align: center;
  font: 400 clamp(3.6rem, 9.6vw, 9.5rem)/0.88 var(--font-display);
  text-transform: uppercase; letter-spacing: 0.005em;
}
.ar__nw { white-space: nowrap; }
.ar__line { color: transparent; -webkit-text-stroke: max(1.5px, 0.012em) var(--text); }
.ar__q { color: var(--accent); display: inline-block; transform-origin: 50% 90%; }
.ar.is-won .ar__q { animation: ar-pop 0.6s var(--ease-out); }
@keyframes ar-pop { 40% { transform: scale(1.25) rotate(-8deg); } }

.ar__sub {
  max-width: 34rem; margin: clamp(0.9rem, 2vh, 1.3rem) 0 clamp(1.6rem, 4vh, 2.6rem); text-align: center;
  font-size: clamp(0.98rem, 1.3vw, 1.12rem); line-height: 1.55; color: var(--muted);
}
.ar__sub b { color: var(--text); font-weight: 600; }

/* ---------- stage: ticket · cabinet · coin ---------- */
.ar__stage {
  position: relative; width: 100%; max-width: 1080px;
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "ticket cab dock";
  align-items: center; column-gap: clamp(1.5rem, 4vw, 4rem);
}

/* ---------- the cabinet ---------- */
.ar__cab { grid-area: cab; perspective: 1100px; }

.ar-cab {
  --tx: 0deg; --ty: 0deg;
  position: relative;
  width: clamp(230px, min(24vw, 36svh), 320px);
  padding: 14px 16px 18px;
  border-radius: 22px 22px 14px 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.05), transparent 18%, transparent 82%, rgba(0,0,0,0.35)),
    linear-gradient(#1a2024, #0e1214 60%, #0b0e10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 50px 80px -30px rgba(0,0,0,0.55),
    0 18px 30px -18px rgba(0,0,0,0.5);
  transform: rotateX(var(--tx)) rotateY(var(--ty));
  transform-style: preserve-3d;
  color: #f2f1ed;
}

/* orange side trims */
.ar-cab::before, .ar-cab::after {
  content: ""; position: absolute; top: 18px; bottom: 18px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--accent), rgba(253,95,7,0.15));
  box-shadow: 0 0 14px rgba(253,95,7,0.55);
}
.ar-cab::before { left: 5px; }
.ar-cab::after  { right: 5px; }

.ar-cab__marquee {
  position: relative; margin: 0 0 12px; padding: 10px 0 9px; border-radius: 12px;
  text-align: center; font: 400 clamp(1.05rem, 1.5vw, 1.35rem)/1 var(--font-display); letter-spacing: 0.08em;
  background: linear-gradient(#20282d, #12171a);
  box-shadow: inset 0 0 0 1px rgba(253,95,7,0.25), inset 0 -12px 24px rgba(253,95,7,0.08);
}
.ar-cab__marquee b { font-weight: 400; color: var(--accent); text-shadow: 0 0 12px rgba(253,95,7,0.7); }

.ar-cab__bezel {
  position: relative; padding: 10px; border-radius: 14px;
  background: #050607;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), inset 0 8px 18px rgba(0,0,0,0.8);
}
.ar-cab__screen { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background: #07090a; }
/* scanlines + curved glass */
.ar-cab__glass {
  position: absolute; inset: 10px; border-radius: 8px; pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0,0,0,0.22) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 30% 10%, rgba(255,255,255,0.12), transparent 45%),
    radial-gradient(closest-side, transparent 70%, rgba(0,0,0,0.45));
  box-shadow: inset 0 0 30px rgba(253,95,7,0.12);
}
.ar-cab.is-glitch .ar-cab__screen { animation: ar-glitch 0.12s steps(2) infinite; }
@keyframes ar-glitch {
  0%   { transform: translate(0, 0); filter: none; }
  50%  { transform: translate(-3px, 1px); filter: hue-rotate(40deg) saturate(2); }
  100% { transform: translate(2px, -1px); filter: contrast(1.6); }
}

/* control deck: joystick + buttons */
.ar-cab__deck {
  position: relative; margin: 14px -6px 0; height: 54px; border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px 0 26px;
  background: linear-gradient(#232a2f, #151a1d);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 18px -10px rgba(0,0,0,0.7);
  transform: rotateX(28deg); transform-origin: top;
}
.ar-stick { position: relative; width: 26px; height: 26px; }
.ar-stick::before {
  content: ""; position: absolute; left: 50%; bottom: -3px; width: 26px; height: 10px; translate: -50% 0;
  border-radius: 50%; background: #0b0e10; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.ar-stick i {
  position: absolute; left: 50%; bottom: 2px; width: 5px; height: 20px; margin-left: -2.5px; border-radius: 3px;
  background: #3a4248; transform-origin: bottom; transform: rotate(var(--lean, 0deg));
}
.ar-stick i::after {
  content: ""; position: absolute; left: 50%; top: -10px; width: 18px; height: 18px; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9a5c, var(--accent) 45%, #b33c00);
  box-shadow: 0 3px 6px rgba(0,0,0,0.5);
}
.ar-btns { display: flex; gap: 10px; }
.ar-btns i {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #d9d9d4 40%, #8f928f);
  box-shadow: 0 3px 0 #4a4e50, 0 5px 8px rgba(0,0,0,0.5);
  transition: transform 0.12s, box-shadow 0.12s;
}
.ar-btns i:nth-child(2) { background: radial-gradient(circle at 35% 30%, #ff9a5c, var(--accent) 45%, #b33c00); box-shadow: 0 3px 0 #7a2a00, 0 5px 8px rgba(0,0,0,0.5); }
.ar-btns i.is-down { transform: translateY(3px); box-shadow: 0 0 0 #4a4e50, 0 2px 4px rgba(0,0,0,0.5); }

/* coin door — the drop target */
.ar-cab__door {
  position: relative; margin: 18px auto 0; width: 64%; height: 52px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #0a0d0f; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  transition: box-shadow 0.3s var(--ease-out);
}
.ar-slot {
  position: relative; width: 7px; height: 28px; border-radius: 4px; background: #000;
  box-shadow: 0 0 0 3px #22292e, 0 0 14px 2px rgba(253,95,7,0.55);
  animation: ar-slot 1.6s ease-in-out infinite;
  transition: transform 0.3s var(--ease-out);
}
@keyframes ar-slot { 50% { box-shadow: 0 0 0 3px #22292e, 0 0 4px 0 rgba(253,95,7,0.25); } }
.ar-cab__door small { font: 600 9px/1.2 var(--font-body); letter-spacing: 0.2em; color: var(--accent); text-transform: uppercase; }
.ar.is-dragging .ar-cab__door { box-shadow: inset 0 0 0 1px rgba(253,95,7,0.45), 0 0 0 6px rgba(253,95,7,0.08); }
.ar.is-near .ar-cab__door { box-shadow: inset 0 0 0 2px var(--accent), 0 0 30px 4px rgba(253,95,7,0.45); }
.ar.is-near .ar-slot { transform: scaleY(1.2); animation-duration: 0.4s; }

/* ---------- the coin + its tray ---------- */
.ar__dock {
  grid-area: dock; justify-self: start;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.ar-tray {
  position: relative; width: 112px; height: 112px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px dashed var(--line2);
}
.ar-tray::after { /* "this way" arrow towards the machine */
  content: ""; position: absolute; right: 100%; top: 50%; width: clamp(1.5rem, 3vw, 3.2rem); height: 1.5px; margin-right: 10px;
  background: repeating-linear-gradient(90deg, var(--muted) 0 6px, transparent 6px 11px);
  opacity: 0.6;
}
.ar-tray::before {
  content: ""; position: absolute; right: calc(100% + clamp(1.5rem, 3vw, 3.2rem) + 4px); top: 50%; width: 9px; height: 9px; margin-top: -4px;
  border-left: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); opacity: 0.6;
}

.ar-token {
  position: relative; z-index: 20;
  width: 84px; height: 84px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  font: 400 34px/1 var(--font-display); color: #8a3000;
  background:
    radial-gradient(circle at 50% 50%, transparent 54%, rgba(122,42,0,0.35) 55%, transparent 58%),
    radial-gradient(circle at 34% 28%, #ffe0c2, #ff9b52 38%, var(--accent) 66%, #b33c00);
  box-shadow: inset 0 -5px 0 rgba(122,42,0,0.35), inset 0 2px 0 rgba(255,255,255,0.5), 0 14px 24px -8px rgba(179,60,0,0.6);
  cursor: grab; touch-action: none;
  -webkit-user-select: none; user-select: none;
  will-change: transform;
}
.ar-token span { text-shadow: 0 1px 0 rgba(255,255,255,0.35); pointer-events: none; }
.ar-token:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.ar-token.is-held { cursor: grabbing; }
.ar-token.is-waiting { opacity: 0; pointer-events: none; }
.ar-token.is-nudge { animation: ar-nudge 0.9s var(--ease-out); }
@keyframes ar-nudge {
  20% { transform: translateX(-10px) rotate(-14deg); }
  40% { transform: translateX(6px) rotate(8deg); }
  60% { transform: translateX(-4px) rotate(-4deg); }
}
/* idle shimmer */
.ar-token::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.55) 48%, transparent 60%) -120% 0 / 250% 100% no-repeat;
  animation: ar-shine 3.2s ease-in-out infinite; pointer-events: none;
}
@keyframes ar-shine { 0%, 55% { background-position: -120% 0; } 100% { background-position: 220% 0; } }

.ar__dock-label {
  margin: 0; text-align: center;
  font: 500 0.68rem/1.5 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.ar__dock-label b { color: var(--text); font-weight: 600; }

/* ---------- the coupon ticket ---------- */
.ar-ticket {
  grid-area: ticket; justify-self: end;
  position: relative; width: min(100%, 250px); padding: 20px 22px 18px;
  border-radius: 14px;
  background: var(--surface); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line2), 0 24px 40px -28px rgba(0,0,0,0.35);
  /* ticket notches */
  -webkit-mask: radial-gradient(circle 10px at 0 62%, transparent 98%, #000), radial-gradient(circle 10px at 100% 62%, transparent 98%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle 10px at 0 62%, transparent 98%, #000), radial-gradient(circle 10px at 100% 62%, transparent 98%, #000);
  mask-composite: intersect;
  transform: rotate(-3deg);
}
.ar-ticket__eyebrow { margin: 0 0 8px; font: 600 10px/1 var(--font-body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.ar-ticket__h { margin: 0; font: 400 1.9rem/0.95 var(--font-display); text-transform: uppercase; }
.ar-ticket__p { margin: 8px 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--muted); }
.ar-ticket__cut { display: block; margin: 14px -22px 12px; border-top: 1.5px dashed var(--line2); }
.ar-ticket__code {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0;
  font: 700 0.95rem/1 ui-monospace, "Courier New", monospace; letter-spacing: 0.12em;
}
.ar-ticket__code span { filter: blur(3.5px); }
.ar-ticket__code i {
  font: 600 9px/1 var(--font-body); font-style: normal; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 5px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent);
}

/* ---------- warp into the arcade (appended to <body>) ---------- */
.ar-warp {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: #07090a; color: var(--accent);
  font: 400 clamp(1.6rem, 4vw, 3rem)/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  pointer-events: none;
}
.ar-warp span { opacity: 0; animation: ar-warp-in 0.3s 0.45s forwards; }
@keyframes ar-warp-in { to { opacity: 1; } }

@media (max-width: 820px) {
  .ar { min-height: auto; }
  .ar__title { font-size: clamp(3.4rem, 17vw, 7rem); }
  .ar__stage {
    grid-template-columns: 1fr 1fr; grid-template-areas: "cab cab" "ticket dock";   /* Wiz stands bottom-left: keep the coin clear of him */
    row-gap: 2rem; column-gap: 1rem; justify-items: center;
  }
  .ar__cab { justify-self: center; }
  .ar-cab { width: min(70vw, 280px); padding: 12px 13px 15px; }
  .ar-cab__deck { height: 46px; padding: 0 16px 0 20px; }
  .ar__dock, .ar-ticket { justify-self: center; }
  .ar-tray { width: 100px; height: 100px; }
  .ar-tray::before, .ar-tray::after { display: none; }
  .ar-ticket { padding: 16px 16px 14px; transform: rotate(-2deg); }
  .ar-ticket__h { font-size: 1.45rem; }
  .ar-ticket__cut { margin-left: -16px; margin-right: -16px; }
}

/* reduced motion: still playable, just calmer */
@media (prefers-reduced-motion: reduce) {
  .ar-slot, .ar-token::after { animation: none; }
  .ar-cab.is-glitch .ar-cab__screen { animation: none; }
}
