:root {
  --bg: #07071a;
  --ink: #eef0ff;
  --font: "Inter", "SF Pro Display", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; }
img { display: block; }

#net { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; filter: blur(80px); opacity: .55; }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: screen; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: radial-gradient(circle, #3d3dd6 0, transparent 65%); }
.aurora i:nth-child(2) { width: 40vmax; height: 40vmax; right: -14vmax; top: 18vh; background: radial-gradient(circle, #6d28d9 0, transparent 65%); animation-delay: -7s; }
.aurora i:nth-child(3) { width: 36vmax; height: 36vmax; left: 28vw; bottom: -20vmax; background: radial-gradient(circle, #0e7490 0, transparent 65%); animation-delay: -13s; }
@keyframes drift { to { transform: translate(6vw, 4vh) scale(1.15); } }

.stage { position: fixed; inset: 0; z-index: 1; overflow: hidden; display: grid; place-items: center; }

/* ── card ── */
.fly {
  position: fixed; inset: 0; z-index: 5; overflow: hidden; display: grid; place-items: center; pointer-events: none;
  perspective: 1500px; animation: in 1.4s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes in { from { opacity: 0; translate: 0 30px; } }
.card-wrap { pointer-events: auto; width: min(92vw, 560px); perspective: 1400px; transform-origin: 100% 50%; }
.card {
  position: relative; width: 100%; aspect-ratio: 1.75; cursor: pointer; outline: none;
  transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2, .8, .2, 1);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  animation: float 7s ease-in-out infinite;
}
.card.moving { transition: transform .12s ease-out; }
.card.busy { animation: none; transition: none; transform: none; cursor: default; }
.card:focus-visible .face { outline: 2px solid #8f8fff; outline-offset: 4px; }
@keyframes float { 50% { translate: 0 -12px; } }

.face {
  position: absolute; inset: 0; border-radius: 26px; overflow: hidden;
  padding: clamp(20px, 5.5vw, 38px);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(91, 91, 234, .55), transparent 55%),
    radial-gradient(120% 120% at 100% 100%, rgba(34, 211, 238, .28), transparent 50%),
    linear-gradient(145deg, #15153d, #0b0b24 60%, #10102e);
  border: 1px solid rgba(170, 175, 255, .28);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 0 70px -10px rgba(91, 91, 234, .5);
  display: flex; flex-direction: column;
}
.face::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1.3px); background-size: 18px 18px;
  mask-image: linear-gradient(120deg, transparent 20%, #000 70%);
}
.sheen {
  position: absolute; inset: -40%; pointer-events: none; mix-blend-mode: overlay;
  background:
    radial-gradient(circle at var(--mx, 30%) var(--my, 20%), rgba(255, 255, 255, .55), transparent 28%),
    conic-gradient(from calc(var(--ry, 0deg) * 4) at 50% 50%, rgba(255, 0, 170, .14), rgba(0, 255, 230, .14), rgba(120, 90, 255, .14), rgba(255, 0, 170, .14));
}
.chip {
  position: absolute; top: clamp(20px, 5.5vw, 38px); right: clamp(20px, 5.5vw, 38px);
  width: 48px; height: 36px; border-radius: 7px; padding: 6px; opacity: .85;
  background: linear-gradient(135deg, #e8d9a8, #b89a52); display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
}
.chip i { border: 1px solid rgba(80, 60, 20, .45); border-radius: 2px; }
.mark {
  width: clamp(76px, 21vw, 128px); height: auto;
  filter: drop-shadow(0 0 18px rgba(120, 130, 255, .45)) drop-shadow(0 12px 18px rgba(0, 0, 20, .6));
}
.wordmark { margin: auto 0 0; font-size: clamp(30px, 8vw, 46px); font-weight: 800; letter-spacing: -1.2px; line-height: 1; }
.wordmark b { background: linear-gradient(90deg, #8f8fff, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.meta { display: flex; justify-content: space-between; align-items: center; margin-top: clamp(10px, 2.5vw, 16px); font: 500 clamp(11px, 2.8vw, 13px) var(--mono); color: #b9bdf0; }
.live { display: inline-flex; align-items: center; gap: 7px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px #34d399; animation: blink 2.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ── ATM (design size 540 px wide, scaled to the viewport in JS) ── */
.atm-fit { position: relative; z-index: 2; width: 0; height: 0; }
.atm {
  position: absolute; left: 0; top: 0; translate: -50% -50%; width: 540px; padding-bottom: 22px;
  border-radius: 30px 30px 16px 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .05), transparent 8%, transparent 92%, rgba(255, 255, 255, .04)),
    linear-gradient(180deg, #202245, #13142e 40%, #0d0e22);
  border: 1px solid rgba(170, 175, 255, .2);
  box-shadow: 0 80px 140px -40px #000, inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 120px -30px rgba(91, 91, 234, .55);
}
.atm.off { display: none; }
.atm.shake { animation: shake .35s linear; }
@keyframes shake {
  25% { translate: calc(-50% + 2px) -50%; }
  50% { translate: calc(-50% - 2px) calc(-50% + 1px); }
  75% { translate: calc(-50% + 1px) calc(-50% - 1px); }
}

.topper {
  position: relative; overflow: hidden; height: 80px; border-radius: 30px 30px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: linear-gradient(90deg, #2b2bb8, #4b3ad6 50%, #155e8a);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .45), 0 12px 36px -10px rgba(75, 58, 214, .8);
  font-weight: 800; font-size: 30px; letter-spacing: -.6px;
}
.topper b { color: #a5f3fc; }
.topper img { width: 50px; height: auto; filter: drop-shadow(0 0 10px rgba(255, 255, 255, .35)) drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
.topper::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .3) 50%, transparent 70%);
  animation: sweep 4.5s ease-in-out infinite;
}
@keyframes sweep { 60%, 100% { transform: translateX(100%); } }

.fascia { display: grid; grid-template-columns: 40px 1fr 40px; gap: 12px; padding: 26px 16px 22px; }
.keys { display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; padding-bottom: 28px; }
.sk {
  appearance: none; height: 32px; padding: 0; border-radius: 8px; cursor: pointer;
  background: linear-gradient(#3e4070, #26274e); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 4px 0 #0a0a1c;
}
.sk:active { transform: translateY(3px); box-shadow: 0 1px 0 #0a0a1c; }

.screen {
  position: relative; height: 300px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(120% 90% at 30% 0%, #1b2a6b, #0a1033 60%, #060a22);
  border: 10px solid #050512; box-shadow: inset 0 0 50px rgba(34, 211, 238, .18), 0 0 0 1px rgba(255, 255, 255, .07);
  font-family: var(--mono); color: #d6ecff;
}
.screen.on { animation: crt .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes crt { from { transform: scaleY(.02) scaleX(.6); filter: brightness(4); } 60% { transform: scaleY(1.02); filter: brightness(1.6); } }
.screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, rgba(255, 255, 255, .08), transparent 35%);
}
.scr {
  position: absolute; inset: 0; padding: 20px; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility 0s .35s;
}
.screen[data-state="idle"] .idle, .screen[data-state="read"] .read,
.screen[data-state="info"] .info, .screen[data-state="bye"] .bye { opacity: 1; visibility: visible; transition: opacity .35s .1s; }
.scr p { margin: 0; font-size: 18px; letter-spacing: .5px; color: #cfe3ff; text-shadow: 0 0 10px rgba(34, 211, 238, .5); }
.idle, .bye { align-items: center; justify-content: center; gap: 22px; }
.pulse { width: 84px; height: auto; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); filter: drop-shadow(0 0 18px rgba(91, 91, 234, .9)); } }
.read { justify-content: center; gap: 20px; padding: 28px; }
.bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5b5bea, #22d3ee); box-shadow: 0 0 12px #22d3ee; }
.screen[data-state="read"] .bar i { animation: load .9s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes load { to { width: 100%; } }
.pin { display: flex; align-items: center; gap: 14px; font-size: 16px; color: #8fa4d8; }
.pin span { margin-right: 8px; }
.pin i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #5b6bb0; transition: .15s; }
.pin i.on { background: #22d3ee; border-color: #22d3ee; box-shadow: 0 0 10px #22d3ee; }
.who { display: flex; align-items: center; gap: 14px; }
.who img { width: 52px; height: auto; filter: drop-shadow(0 0 10px rgba(120, 130, 255, .5)); }
.who b { display: block; font: 800 23px var(--font); letter-spacing: -.5px; color: #fff; }
.who em { font-style: normal; background: linear-gradient(90deg, #8f8fff, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.who small { font-size: 13px; color: #8fa4d8; }
.mail {
  margin: 22px 0 auto; text-decoration: none; font-size: 22px; font-weight: 600; color: #fff; white-space: nowrap;
  text-shadow: 0 0 12px rgba(34, 211, 238, .55); cursor: pointer;
}
.cur { display: inline-block; width: 10px; height: 22px; margin-left: 3px; vertical-align: -3px; background: #22d3ee; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.opts { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 32px; row-gap: 18px; margin: 0 -12px -2px; }
.opt {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  font: 600 15px var(--mono); color: #e6f0ff; white-space: nowrap; transition: color .15s, text-shadow .15s;
}
.opt.r { text-align: right; }
.opt:hover, .opt:focus-visible { color: #67e8f9; text-shadow: 0 0 10px #22d3ee; outline: none; }
.spin { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .12); border-top-color: #22d3ee; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(1turn); } }

.deck { display: grid; grid-template-columns: auto 1fr; gap: 24px; padding: 4px 26px 0; align-items: start; }
.pad { display: grid; grid-template-columns: repeat(3, 54px); gap: 9px; padding: 13px; border-radius: 14px; background: #0a0b1d; border: 1px solid rgba(255, 255, 255, .06); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6); }
.pad i {
  height: 38px; border-radius: 8px; display: grid; place-items: center; font: 700 15px var(--mono); font-style: normal; color: #b4bae0;
  background: linear-gradient(#30325c, #1d1e3e); box-shadow: 0 4px 0 #07071a, inset 0 1px 0 rgba(255, 255, 255, .08); transition: background .1s;
}
.pad i.x { color: #fecaca; background: linear-gradient(#8f2a3a, #5e1a26); }
.pad i.ok { color: #bbf7d0; background: linear-gradient(#1f7a4d, #135033); }
.pad i.hit { transform: translateY(3px); box-shadow: 0 1px 0 #07071a; background: #5b5bea; color: #fff; }
.slots { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.cardslot, .rcpt, .cash {
  position: relative; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(#292b55, #16172f); border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 14px -6px rgba(0, 0, 0, .7);
}
.cardslot { width: 100%; height: 92px; }
.pict {
  position: absolute; top: 12px; left: 50%; translate: -50% 0; width: 34px; height: 22px; border-radius: 4px;
  border: 2px solid #6b72b8; opacity: .8;
}
.pict::before { content: ""; position: absolute; left: 4px; top: 4px; width: 9px; height: 7px; border-radius: 2px; background: #b89a52; }
.pict::after { content: "↑"; position: absolute; right: -16px; top: -2px; font: 700 14px var(--font); color: #6b72b8; }
.cardslot .mouth {
  position: absolute; left: 19%; right: 19%; top: 54px; height: 12px; border-radius: 6px;
  background: linear-gradient(#000, #0b0b18); box-shadow: inset 0 3px 5px #000, 0 0 0 3px #34376b; transition: box-shadow .3s;
}
.cardslot.active .mouth { box-shadow: inset 0 3px 5px #000, 0 0 0 3px #34d399, 0 0 24px rgba(52, 211, 153, .85); }
.led { position: absolute; right: 12px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: #34d399; opacity: .25; }
.cardslot.active .led { opacity: 1; box-shadow: 0 0 10px #34d399; animation: blink .4s steps(1) infinite; }

.rcpt { width: 82%; height: 52px; }
.rcpt .mouth { width: 76%; height: 7px; border-radius: 4px; background: #000; box-shadow: inset 0 2px 3px #000, 0 0 0 3px #34376b; }
.paper-clip {
  position: absolute; z-index: 6; left: 50%; top: calc(50% + 2px); translate: -50% 0; width: 168px; height: 330px;
  overflow: hidden; pointer-events: none; filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .55));
}
.paper {
  --z: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%;
  padding: 14px 14px 22px; transform: translateY(-101%);
  background: linear-gradient(#f2f2f7, #fdfdff 30%); color: #15152a; font: 500 11px/1.5 var(--mono); text-align: center;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--z)) 100%;
}
.paper img { width: 40px; height: auto; filter: grayscale(1) contrast(1.6) brightness(.8); margin-bottom: 2px; }
.paper b { font-size: 12px; letter-spacing: 2px; }
.paper hr { width: 100%; margin: 5px 0; border: 0; border-top: 1px dashed #8a8aa0; }
.paper .row { width: 100%; display: flex; justify-content: space-between; }
.paper .bc {
  width: 86%; height: 26px; margin-top: 8px;
  background: repeating-linear-gradient(90deg, #15152a 0 2px, transparent 2px 4px, #15152a 4px 5px, transparent 5px 8px, #15152a 8px 11px, transparent 11px 12px);
}
.cash { grid-column: 1 / -1; margin: 22px 26px 0; height: 44px; }
.cash .mouth { width: 72%; height: 9px; border-radius: 5px; background: #000; box-shadow: inset 0 3px 4px #000, 0 0 0 3px #34376b; }

@media (max-width: 520px) {
  .face { border-radius: 18px; }
  .chip { width: 38px; height: 28px; padding: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
