:root {
  --bg: #0a0d16;
  --fg: #eef2f9;
  --accent: #ffcc52;
  --accent-2: #5be3b4;
  --muted: #8b96a7;
  --card: #0f172a;
  --glass: rgba(255,255,255,.08);
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--fg);
  background:
    radial-gradient(60% 40% at 70% -10%, rgba(91, 227, 180, .15), transparent 60%),
    radial-gradient(60% 40% at 10% -20%, rgba(255, 204, 82, .16), transparent 60%),
    linear-gradient(180deg, #0a0d16 0%, #0b0f1a 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  overscroll-behavior: none;
}
header { position: sticky; top:0; z-index: 20; display:flex; gap:12px; align-items:center; padding: 12px 16px; backdrop-filter: blur(8px); background: linear-gradient(to bottom, rgba(10,13,22,.7), rgba(10,13,22,.2)); border-bottom: 1px solid rgba(255,255,255,.06); }
.brand { font-weight: 800; letter-spacing: .4px; text-transform: none; }
.brand-logo { height: 26px; width: auto; display:block; }
.icon-img { width: 22px; height: 22px; display:block; }
.icon-btn { background: var(--glass); border: 1px solid rgba(255,255,255,.1); color: var(--fg); border-radius: 10px; padding: 6px 10px; cursor:pointer; }
/* Shop specific */
.line { display:grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.line .controls { justify-content: flex-end; }
.stack.mini { width: 160px; height: 120px; }
.stack.mini .layer { border-radius: 12px; }
.stack.mini .title { font-size: 14px; }
.controls { display:flex; align-items:center; gap: 10px; }
.round { width: 36px; height: 36px; border-radius: 999px; display:inline-flex; align-items:center; justify-content:center; background: #fff; color:#111; border: 1px solid rgba(0,0,0,.1); box-shadow: 0 6px 20px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.6); cursor:pointer; }
.round .face { font-weight: 900; }
.qty { width: 64px; text-align:center; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(0,0,0,.1); background: #fff; color: #111; font-weight: 800; transform-origin: 50% 50%; backface-visibility: hidden; }
.qty.flip { animation: hFlip .28s ease; }
.line .line-sum { font-weight: 800; opacity: .9; color:#111; }

/* Full-page chip area for shop */
.shop-space { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.shop-space .chip { pointer-events: auto; }
.shop-space, .shop-space .chip { touch-action: none; }

/* Receipt list */
.receipt-row { display:flex; align-items:center; justify-content: space-between; gap: 8px; }
.receipt-row .l { color:#e5e7eb; }
.receipt-row .r { font-weight: 800; }
.divider { height: 1px; background: rgba(255,255,255,.12); margin: 6px 0; }
.divider.white { background: rgba(255,255,255,.9); height: 1px; }
.cta.full { display:block; width: 100%; }
/* controls */
.pill { background: var(--glass); border: 1px solid rgba(255,255,255,.1); color: var(--fg); border-radius: 999px; padding: 6px 12px; cursor:pointer; }
/* Prevent iOS double‑tap zoom on interactive controls */
button, .pill, .cta, .key, .summary-item .count-badge {
  font-size: 16px; /* iOS avoids double‑tap zoom ≥16px */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* Avoid iOS zoom on form fields */
input, select, textarea { font-size: 16px; }
.spacer { flex:1; }
main { height: calc(100dvh - 56px); display:flex; flex-direction: column; }
#stage { flex: 1; position: relative; display:flex; flex-direction: column; align-items:center; justify-content:flex-start; padding-top: 6px; gap: 6px; }
.tray-summary { display:flex; gap: 8px; align-items:center; width: min(820px, 92vw); padding: 0 6px; overflow-x: auto; user-select: none; touch-action: pan-x; }
.tray-summary .label { color: var(--muted); margin-right: 6px; white-space: nowrap; font-size: 12px; }
.summary-item { display:flex; align-items:center; gap: 8px; padding: 4px 8px; border-radius: 999px; background: var(--glass); border: 1px solid rgba(255,255,255,.08); white-space: nowrap; font-weight: 700; cursor: grab; transition: transform .18s ease; font-size: 13px; }
.summary-item .count-badge { position: relative; display:inline-flex; align-items:center; justify-content:center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #111; font-weight: 900; box-shadow: 0 6px 18px rgba(255,204,82,.35); backface-visibility: hidden; transform-style: preserve-3d; }
.summary-item .count-badge.flip { animation: flipY .5s ease; }
@keyframes flipY { 0% { transform: rotateY(0deg) } 49% { transform: rotateY(90deg) } 51% { transform: rotateY(270deg) } 100% { transform: rotateY(360deg) } }
.summary-item .name { opacity: .95; }
/* legacy bump removed; now on badge */
.summary-item.dragging { cursor: grabbing; background: rgba(255,255,255,.16); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
@keyframes bump { 0% { opacity: 0; transform: translateY(-6px) scale(.9)} 25% { opacity:1; transform: translateY(-10px) scale(1)} 100% { opacity:0; transform: translateY(-16px) scale(1.1)} }

/* Tray / Ausgabe oben */
.tray-zone { position: relative; min-height: 280px; width: min(820px, 92vw); border-radius: 20px; border: 1px dashed rgba(255,255,255,.15); background: rgba(255,255,255,.04); display:flex; align-items:center; justify-content:center; padding: 12px; }
.tray-pile { position: relative; width: 100%; height: 260px; pointer-events: none; overflow: visible; }
.tray-zone, .tray-pile { touch-action: none; }
.tray-count { position: absolute; bottom: 10px; left: 12px; background: var(--accent); color: #111; padding: 4px 10px; border-radius: 999px; font-weight: 700; }
.tray-controls { display:flex; gap: 10px; align-items:center; justify-content:center; width: min(820px, 92vw); }
.tray-controls { position: relative; z-index: 5; pointer-events: auto; }
.tray-controls /* controls */
.pill { min-width: auto; padding: 6px 10px; }
.tray-controls .cta { padding: 8px 12px; }
.cta { padding: 12px 16px; background: linear-gradient(135deg, var(--accent), #ffd980); color: #111; border: none; border-radius: 12px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 30px rgba(255,204,82,.25); }
.cta[disabled]{ opacity: .6; cursor:not-allowed; }
/* Subtle breathing for give button; base scale via --scale */
.cta.pulse { animation: btnPulse 2.6s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes btnPulse { 0%,100% { transform: scale(var(--scale, 1)); } 50% { transform: scale(calc(var(--scale, 1) + 0.02)); } }
/* QR fade hint in last second */
#qr.fade { opacity:.3; transition: opacity .35s ease; }
/* Subtle breathing for give button; base scale via --scale */
.cta.pulse { animation: btnPulse 2.6s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes btnPulse { 0%,100% { transform: scale(var(--scale, 1)); } 50% { transform: scale(calc(var(--scale, 1) + 0.02)); } }

/* Dock unten mit Carousel */
#dock { position: relative; padding: 10px 0 18px; }
.carousel { display:flex; gap: 13px; align-items: flex-end; justify-content: flex-start; overflow-x: auto; padding: 14px 16px; scroll-snap-type: x proximity; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.carousel .stack { flex: 0 0 auto; }
.carousel::-webkit-scrollbar { height: 8px; }
.carousel::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 999px; }

.stack { position: relative; width: 160px; height: 190px; perspective: 800px; cursor: grab; scroll-snap-align: start; touch-action: pan-x; user-select: none; }
.stack .layer { position: absolute; inset: 0; border-radius: 14px; transform-origin: 50% 80%; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 14px 40px rgba(0,0,0,.45); overflow: hidden; }
.stack .layer:nth-child(1){ background: var(--card); transform: translateY(8px) rotate(-2deg); opacity: .7; z-index: 1; }
.stack .layer:nth-child(2){ background: var(--card); transform: translateY(4px) rotate(1.2deg); opacity: .85; z-index: 2; }
.stack .layer:nth-child(3){ background: transparent; transform: translateY(0px) rotate(-.5deg); opacity: 1; z-index: 3; }
.stack .media { display: none; }
.media-bg { position:absolute; inset:0; background-size: cover; background-position: center; background-repeat: no-repeat; pointer-events: none; border-radius: 14px; }
/* In the wallet stacks show the entire motif without cropping and give it a light backdrop */
.stack .media-bg { background-size: contain; background-color: #fff; }
/* Chips in the tray can stay immersive */
.chip .media-bg { background-size: cover; }
.stack .title { position: absolute; top: 8px; left: 10px; right: 10px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8), 0 2px 6px rgba(0,0,0,.6); -webkit-text-stroke: 0.4px rgba(0,0,0,.6); }
.stack .badge { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #111; padding: 4px 10px; border-radius: 999px; font-weight: 900; box-shadow: 0 8px 24px rgba(255,204,82,.35); text-shadow: 0 1px 0 rgba(255,255,255,.5), 0 2px 6px rgba(0,0,0,.2); backface-visibility: hidden; transform-style: preserve-3d; }
.stack .badge.flip { animation: flipX .5s ease; }
@keyframes flipX { 0% { transform: translateX(-50%) rotateX(0deg) } 49% { transform: translateX(-50%) rotateX(90deg) } 51% { transform: translateX(-50%) rotateX(270deg) } 100% { transform: translateX(-50%) rotateX(360deg) } }
.line .line-sum { transform-origin: 50% 50%; backface-visibility: hidden; }
@keyframes hFlip { 0% { transform: rotateY(0deg) } 49% { transform: rotateY(90deg) } 51% { transform: rotateY(270deg) } 100% { transform: rotateY(360deg) } }
.stack .badge.tick { animation: tick .5s ease; }
@keyframes tick { 0% { transform: translateX(-50%) scale(1.05); filter: brightness(1.05) } 50% { transform: translateX(-50%) scale(.95) } 100% { transform: translateX(-50%) scale(1) } }
.stack:active { cursor: grabbing; }

/* Drag ghost */
.ghost { position: fixed; width: 160px; height: 190px; border-radius: 14px; pointer-events: none; will-change: transform, opacity; box-shadow: 0 18px 60px rgba(0,0,0,.5); overflow: hidden; z-index: 50; transform: translate(0,0); }
.ghost .media, .ghost video, .ghost img { display: none !important; }
.ghost .media-bg { inset:0; }

/* physics chips inside tray */
.chip { position: absolute; width: 120px; height: 160px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); overflow: hidden; transform-origin: 50% 50%; }
.chip .media-bg { border-radius: 12px; background-size: contain; background-color: #fff; }

/* Number keypad modal */
.num-modal { background: rgba(14,22,40,.9); border: 1px solid rgba(255,255,255,.1); padding: 16px; border-radius: 14px; width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.num-title { font-weight: 700; margin-bottom: 6px; color: var(--muted); }
.num-display { text-align: right; font-weight: 900; font-size: 28px; padding: 8px 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; margin-bottom: 10px; letter-spacing: 1px; }
.num-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.key { background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.14); border-radius: 8px; padding: 10px 0; font-weight: 800; color: var(--fg); box-shadow: 0 6px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06); transform: translateZ(0); line-height: 1; }
.key:active { transform: translateY(1px) scale(.98); box-shadow: 0 3px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04); }
.key.wide { grid-column: span 2; }
.key.del { background: linear-gradient(180deg, rgba(255,120,120,.18), rgba(255,255,255,.02)); }

/* keypad modal animations */
.num-modal.anim-in { animation: modalIn .24s cubic-bezier(.2,.8,.2,1) both; }
.num-modal.anim-out { animation: modalOut .18s cubic-bezier(.2,.8,.2,1) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes modalOut { from { opacity: 1; transform: none } to { opacity: 0; transform: translateY(6px) scale(.98) } }

/* Overlay / QR */
.overlay { position: fixed; inset: 0; background: rgba(2,5,10,.7); backdrop-filter: blur(8px); display:flex; align-items:center; justify-content:center; z-index: 1000; }
.hidden { display: none; }
.modal { background: rgba(14,22,40,.8); border: 1px solid rgba(255,255,255,.1); padding: 18px; border-radius: 14px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal img { width: 260px; height: 260px; display: block; margin: 12px auto; background: #fff; border-radius: 10px; box-shadow: inset 0 0 0 6px rgba(255,204,82,.6), 0 10px 30px rgba(0,0,0,.25); }
.modal.large { width: 90vw; max-width: 720px; }
/* Scanner video */
.scan-video { width: 100%; max-height: 60vh; background: #000; border-radius: 0; display:block; margin-top: 8px; object-fit: cover; }

/* Fancy on/off switch */
.switch { position: relative; display:inline-block; width: 48px; height: 28px; }
.switch input { display:none; }
.switch .track { position:absolute; inset:0; background: rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.2); border-radius:999px; transition: all .22s ease; }
.switch .thumb { position:absolute; left:3px; top:3px; width:22px; height:22px; border-radius:50%; background:#fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .22s ease; }
.switch input:checked + .track { background: linear-gradient(135deg,#34d399,#10b981); border-color: transparent; }
.switch input:checked + .track .thumb { transform: translateX(20px); }
.row { display:flex; gap: 8px; justify-content: space-between; }
input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: var(--fg); margin: 6px 0; font-size: 16px; }

/* Subtle enter motion */
.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px)} to { opacity:1; transform: none } }

/* Transfer modal layout */
.modal-title { margin: 0 0 8px; }
.transfer-intro { margin: 6px 0 10px; color: #d1d5db; }
.transfer-intro .who { font-weight: 700; margin-bottom: 2px; color: #eef2f9; }
.transfer-list { list-style: none; padding: 0; margin: 0; }
.transfer-list li { padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,.08); }
.transfer-list li:last-child { border-bottom: 0; }
.transfer-steps { margin: 12px 0 8px; display: grid; gap: 10px; }
.step { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.step .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); position: relative; }
.step.done .dot { border-color: transparent; background: linear-gradient(135deg,#34d399,#10b981); box-shadow: 0 8px 24px rgba(16,185,129,.35); }
.step .dot::after { content: ''; position: absolute; inset: 0; display: block; }
.step.done .dot::before { content: '✓'; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-54%); font-weight: 900; font-size: 14px; color: #062; mix-blend-mode: normal; }
.step .text { color: #e5e7eb; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.hint { margin: 6px 0 0; color: #9aa4b2; font-size: 14px; }
