@font-face { font-family: 'Fraunces'; src: url(/static/fonts/fraunces-latin-full-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Fraunces'; font-style: italic; src: url(/static/fonts/fraunces-latin-full-italic.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url(/static/fonts/instrument-sans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url(/static/fonts/instrument-sans-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url(/static/fonts/instrument-sans-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --bg: #2a1b14; --paper: #f3e9d8; --ink: #c2412d;
  --display: 'Fraunces', Georgia, serif; --body: 'Instrument Sans', system-ui, sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--body); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.tnum { font-variant-numeric: tabular-nums; }

/* ================= Kundenseite ================= */
body.kunde {
  min-height: 100dvh; color: var(--paper);
  background: radial-gradient(120% 70% at 50% -10%, color-mix(in srgb, var(--paper) 14%, var(--bg)) 0%, var(--bg) 55%), var(--bg);
  overflow-x: hidden;
}
.k-wrap { max-width: 440px; margin: 0 auto; padding: 22px 18px 48px; }
.k-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; animation: rise .5s both; }
.k-head img { width: 46px; height: 46px; border-radius: 50%; object-fit: contain; background: var(--paper); }
.k-head b { font-family: var(--display); font-weight: 600; font-size: 1.25rem; letter-spacing: -.01em; display: block; line-height: 1.1; }
.k-head span { font-size: .8rem; opacity: .65; letter-spacing: .04em; }

.paper {
  position: relative; color: #241812; background: var(--grain), var(--paper);
  border-radius: 6px 6px 22px 6px; padding: 22px 20px 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 24px 50px -18px rgba(0,0,0,.65), 0 3px 8px rgba(0,0,0,.25);
  transform: rotate(-1.2deg); animation: deal .7s cubic-bezier(.2,.9,.25,1.1) .08s both;
}
.paper::before { /* Lochung oben */
  content: ''; position: absolute; top: 12px; right: 16px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); box-shadow: inset 0 2px 3px rgba(0,0,0,.6);
}
.paper.bump { animation: bump .35s ease-out; }
.p-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 45%, transparent); padding-bottom: 12px; margin-bottom: 16px; }
.p-title { font-family: var(--display); font-style: italic; font-weight: 400; font-size: 1.05rem; color: color-mix(in srgb, #241812 70%, var(--paper)); }
.p-count { font-family: var(--display); font-weight: 800; font-size: 3.6rem; line-height: .85; letter-spacing: -.04em; color: var(--ink); font-variation-settings: 'opsz' 144, 'SOFT' 50; }
.p-count small { font-size: 1.3rem; font-weight: 500; color: #241812; opacity: .55; letter-spacing: 0; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 8px; }
.slot { aspect-ratio: 1; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--ink) 40%, transparent); display: grid; place-items: center; position: relative; }
.slot.prize::after { content: '★'; color: var(--ink); opacity: .55; font-size: 1.1rem; }
.slot .st {
  position: absolute; inset: -6%; border-radius: 50%; background: var(--ink); display: grid; place-items: center;
  color: var(--paper); font-family: var(--display); font-weight: 800; font-size: clamp(.8rem, 4.2vw, 1.15rem);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 30%, transparent);
  -webkit-mask: radial-gradient(circle at 30% 30%, #000 60%, rgba(0,0,0,.82) 61%, #000 75%);
  mask: radial-gradient(circle at 30% 30%, #000 60%, rgba(0,0,0,.82) 61%, #000 75%);
}
.slot .st::before { content: ''; position: absolute; inset: 14%; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--paper) 80%, transparent); }
.slot .st.thunk { animation: thunk .55s cubic-bezier(.3,1.4,.5,1) both; }
.p-reward { margin-top: 16px; display: flex; gap: 10px; align-items: baseline; font-size: .92rem; }
.p-reward b { font-family: var(--display); font-weight: 600; }
.p-reward .tag { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); font-weight: 600; white-space: nowrap; }
.paper.full .p-count { animation: glow 1.8s ease-in-out infinite alternate; }

/* Stempelfeld */
.pad {
  margin: 30px auto 0; position: relative; height: 240px; border-radius: 28px; touch-action: none; user-select: none; -webkit-user-select: none;
  border: 1.5px solid color-mix(in srgb, var(--paper) 22%, transparent);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--paper) 4%, transparent) 10px 11px);
  display: grid; place-items: center; text-align: center; overflow: hidden; animation: rise .6s .25s both;
}
.pad .ring { position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ink) 80%, var(--paper)); opacity: 0; animation: ping 2.4s ease-out infinite; }
.pad .ring:nth-child(2) { animation-delay: 1.2s; }
.pad .lbl { position: relative; pointer-events: none; }
.pad .lbl b { display: block; font-family: var(--display); font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; }
.pad .lbl span { font-size: .82rem; opacity: .6; }
.pad.active { border-color: var(--ink); background-color: color-mix(in srgb, var(--ink) 12%, transparent); }
.pad.ok { border-color: #7fd18b; }
.pad.bad { animation: shake .4s; border-color: #ff7a6b; }
.dot { position: fixed; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: radial-gradient(circle, var(--ink) 0 35%, transparent 70%); pointer-events: none; z-index: 5; opacity: .85; }

.msg { min-height: 1.4em; margin-top: 12px; text-align: center; font-size: .92rem; }
.msg.err { color: #ffb4a8; }
.msg.good { color: #b9f0c0; }

.wallet { display: grid; gap: 10px; margin-top: 26px; animation: rise .6s .35s both; }
.wbtn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 12px; background: #000; color: #fff; text-decoration: none; font-weight: 500; font-size: .98rem; border: 1px solid rgba(255,255,255,.18); }
.wbtn svg { width: 24px; height: 24px; }
.wbtn.off { opacity: .45; pointer-events: none; }
.k-more { margin-top: 26px; display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; opacity: .8; }
.k-more button { background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; }
.qrbox { display: none; margin-top: 14px; background: var(--paper); color: #241812; border-radius: 16px; padding: 18px; text-align: center; }
.qrbox.open { display: block; animation: rise .3s both; }
.qrbox img { width: 200px; height: 200px; }
.qrbox code { display: block; font-size: 1.1rem; letter-spacing: .12em; font-weight: 600; margin-top: 6px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes deal { from { opacity: 0; transform: translateY(40px) rotate(-7deg) scale(.96); } }
@keyframes bump { 0% { transform: rotate(-1.2deg); } 30% { transform: rotate(-1.2deg) translateY(4px) scale(.985); } 100% { transform: rotate(-1.2deg); } }
@keyframes thunk { 0% { transform: scale(2.4) rotate(-38deg); opacity: 0; filter: blur(3px); } 55% { transform: scale(.86) rotate(var(--r, -8deg)); opacity: 1; filter: blur(0); } 100% { transform: scale(1) rotate(var(--r, -8deg)); } }
@keyframes ping { 0% { transform: scale(.55); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes glow { to { text-shadow: 0 0 18px color-mix(in srgb, var(--ink) 55%, transparent); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* ================= Admin ================= */
body.admin { background: var(--grain), #f4efe6; color: #1d1712; min-height: 100dvh; }
.a-nav { display: flex; align-items: center; gap: 4px; padding: 14px 20px; border-bottom: 1.5px solid #1d1712; flex-wrap: wrap; position: sticky; top: 0; background: #f4efe6; z-index: 3; }
.a-nav .brand { font-family: var(--display); font-weight: 700; font-size: 1.15rem; margin-right: auto; display: flex; gap: 10px; align-items: center; }
.a-nav .brand i { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); display: inline-block; }
.a-nav a, .a-nav button { text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: .9rem; font-weight: 500; background: none; border: 0; cursor: pointer; }
.a-nav a.on { background: #1d1712; color: #f4efe6; }
.a-main { max-width: 1040px; margin: 0 auto; padding: 32px 20px 64px; }
.a-h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 7vw, 4.2rem); letter-spacing: -.035em; line-height: .95; margin-bottom: 8px; font-variation-settings: 'opsz' 144; }
.a-h1 em { font-weight: 300; font-style: italic; color: var(--ink); }
.a-sub { color: #6b5f55; margin-bottom: 28px; max-width: 60ch; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1.5px solid #1d1712; border-radius: 4px; overflow: hidden; }
.kpi { padding: 18px 18px 16px; border-right: 1.5px solid #1d1712; background: #fbf8f2; }
.kpi:last-child { border-right: 0; }
.kpi .v { font-family: var(--display); font-weight: 800; font-size: 3rem; line-height: 1; letter-spacing: -.03em; }
.kpi .l { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: #6b5f55; margin-top: 6px; }
.kpi.hot { background: var(--ink); color: #fff; }
.kpi.hot .l { color: rgba(255,255,255,.8); }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; margin-top: 32px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } .kpi { border-right: 0; border-bottom: 1.5px solid #1d1712; } }
.box h2 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin-bottom: 12px; }
.feed { list-style: none; padding: 0; border-top: 1.5px solid #1d1712; }
.feed li { display: flex; gap: 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #d9cfc0; font-size: .92rem; }
.feed .t { color: #6b5f55; }
.pill { font-size: .7rem; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; letter-spacing: .06em; text-transform: uppercase; }
.pill.stamp { color: #2f6b3b; } .pill.redeem { color: var(--ink); } .pill.fail { color: #8a7f74; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; border-bottom: 1.5px solid #1d1712; padding-top: 10px; }
.bars div { flex: 1; background: #1d1712; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: .72rem; }
.bars-l { display: flex; gap: 8px; font-size: .72rem; color: #6b5f55; margin-top: 6px; } .bars-l span { flex: 1; text-align: center; }
.cta { display: inline-flex; align-items: center; gap: 8px; background: #1d1712; color: #f4efe6; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; cursor: pointer; text-decoration: none; }
.cta.ink { background: var(--ink); color: #fff; }
.cta.ghost { background: transparent; color: #1d1712; border: 1.5px solid #1d1712; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
form.set { display: grid; gap: 18px; max-width: 620px; }
form.set label { display: grid; gap: 6px; font-weight: 500; font-size: .9rem; }
form.set input[type=text], form.set input[type=number], form.set select, .in {
  padding: 12px 14px; border: 1.5px solid #1d1712; border-radius: 4px; background: #fbf8f2; font-size: 1rem; width: 100%;
}
form.set .hint { font-weight: 400; color: #6b5f55; font-size: .82rem; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.colors input[type=color] { width: 100%; height: 48px; border: 1.5px solid #1d1712; border-radius: 4px; padding: 2px; background: #fbf8f2; }
.flash { padding: 12px 16px; border-radius: 4px; margin-bottom: 18px; background: #e3f1e2; border: 1.5px solid #2f6b3b; }
.flash.err { background: #fbe4df; border-color: var(--ink); }
.preview { position: sticky; top: 90px; }
.learn { height: 320px; border: 2px dashed #1d1712; border-radius: 18px; display: grid; place-items: center; text-align: center; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; background: #fbf8f2; }
.learn.active { background: color-mix(in srgb, var(--ink) 10%, #fbf8f2); border-style: solid; }
.learn b { font-family: var(--display); font-size: 1.6rem; display: block; }
.steps { display: flex; gap: 8px; margin: 14px 0; }
.steps i { width: 38px; height: 38px; border-radius: 50%; border: 2px dashed #1d1712; display: grid; place-items: center; font-style: normal; font-weight: 600; }
.steps i.done { background: var(--ink); border: 2px solid var(--ink); color: #fff; }
.video { width: 100%; max-width: 420px; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #1d1712; display: block; }
.result { border: 1.5px solid #1d1712; border-radius: 4px; padding: 18px; margin-top: 18px; background: #fbf8f2; }
.result .v { font-family: var(--display); font-size: 2.6rem; font-weight: 800; }
.login { max-width: 400px; margin: 10vh auto 0; padding: 0 20px; }
.login .demo { margin-top: 22px; padding: 14px; border: 1.5px dashed #1d1712; border-radius: 4px; font-size: .88rem; background: #fbf8f2; }
.mono { font-family: ui-monospace, monospace; }
@media print { .a-nav, .noprint { display: none !important; } body.admin { background: #fff; } }
