:root {
	--night: #1b1210;
	--night-2: #2a1b16;
	--cream: #f7ecd9;
	--cream-2: #efdfc6;
	--ink: #2a1a12;
	--ink-soft: #7a6352;
	--caramel: #d98a1f;
	--flame: #d9471c;
	--on-night: #f3e6d3;
	--on-night-soft: #b9a391;
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.45;
	color: var(--on-night);
	background:
		radial-gradient(120% 55% at 50% -10%, rgba(217, 71, 28, .38), transparent 62%),
		radial-gradient(60% 30% at 85% 4%, rgba(217, 138, 31, .22), transparent 70%),
		var(--night);
	background-attachment: fixed;
}

.wrap {
	max-width: 440px;
	margin: 0 auto;
	padding: calc(22px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

/* Kopf */
.brand { text-align: center; margin-bottom: 20px; }
.brand-name {
	margin: 0;
	font-family: var(--serif);
	font-size: 25px;
	line-height: 1.1;
	letter-spacing: .01em;
	color: #fff6e6;
}
.brand-name span { font-style: italic; font-size: .7em; color: var(--on-night-soft); }
.brand-name em { font-style: italic; color: #f2b45a; }
.brand-logo {
	display: block;
	max-width: 190px;
	max-height: 84px;
	margin: 0 auto;
	border-radius: 10px;
}
.brand-place {
	margin: 8px 0 0;
	font-size: 12px;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--on-night-soft);
}

/* Karte */
.card {
	position: relative;
	color: var(--ink);
	background: var(--cream);
	border-radius: 20px;
	box-shadow: 0 22px 50px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
	overflow: hidden;
}
.card-head { padding: 22px 22px 6px; text-align: center; }
.card-head h1 {
	margin: 0;
	font-family: var(--serif);
	font-weight: 600;
	font-size: 31px;
	line-height: 1.1;
	text-wrap: balance;
}
.card-head p { margin: 6px 0 0; font-size: 15px; color: var(--ink-soft); text-wrap: balance; }

.slots {
	list-style: none;
	margin: 0;
	padding: 18px 20px 22px;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px 12px;
}
.slots[data-cols="3"] { grid-template-columns: repeat(3, 1fr); padding-inline: 44px; }
.slots[data-cols="5"] { grid-template-columns: repeat(5, 1fr); gap: 12px 8px; }

.slot {
	position: relative;
	aspect-ratio: 1;
	display: grid;
	place-items: center;
	border-radius: 50%;
	border: 1.5px dashed #c9b193;
	background: rgba(255, 255, 255, .35);
}
.slot-num {
	font-family: var(--serif);
	font-size: 19px;
	font-variant-numeric: lining-nums;
	color: #b59a7c;
}
.stamp {
	position: absolute;
	inset: -3px;
	width: calc(100% + 6px);
	height: calc(100% + 6px);
	opacity: 0;
	transform: scale(.4) rotate(-25deg);
	filter: drop-shadow(0 3px 4px rgba(60, 25, 5, .35));
}
.slot.is-on { border-color: transparent; background: none; }
.slot.is-on .slot-num { opacity: 0; }
.slot.is-on .stamp { opacity: 1; transform: none; }
.slot:nth-child(3n).is-on .stamp { transform: rotate(40deg); }
.slot:nth-child(3n+1).is-on .stamp { transform: rotate(-65deg); }

.stamp-img {
	inset: -9%;
	width: 118%;
	height: 118%;
	object-fit: contain;
	filter: drop-shadow(0 2px 3px rgba(60, 25, 5, .28));
}
.slot.is-on .stamp-img, .slot:nth-child(3n).is-on .stamp-img { transform: rotate(4deg); }
.slot:nth-child(3n+1).is-on .stamp-img { transform: rotate(-6deg); }
.slot:nth-child(3n+2).is-on .stamp-img { transform: rotate(-1deg); }

.slot.is-new .stamp { animation: ffsk-pop .55s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: var(--d, 0s); }
.slot.is-new::after {
	content: "";
	position: absolute;
	inset: -30%;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 196, 80, .95), rgba(217, 71, 28, .55) 45%, transparent 70%);
	opacity: 0;
	pointer-events: none;
	animation: ffsk-flash .6s ease-out both;
	animation-delay: var(--d, 0s);
}
@keyframes ffsk-pop {
	0% { opacity: 0; transform: scale(1.7) rotate(-30deg); }
	60% { opacity: 1; }
	100% { opacity: 1; }
}
@keyframes ffsk-flash {
	0% { opacity: 0; transform: scale(.3); }
	35% { opacity: 1; }
	100% { opacity: 0; transform: scale(1.25); }
}

/* Abriss-Streifen: das Freigetränk */
.stub {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 22px 18px;
	background: var(--cream-2);
	border-top: 2px dashed #c9b193;
}
.stub::before, .stub::after {
	content: "";
	position: absolute;
	top: -12px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--night);
}
.stub::before { left: -11px; }
.stub::after { right: -11px; }
.stub-flame { flex: none; width: 34px; height: 34px; color: #c4a98a; }
.stub p { margin: 0; }
.stub strong { display: block; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.2; }
.stub span { display: block; font-size: 13.5px; color: var(--ink-soft); }

.card.is-free .stub { background: linear-gradient(100deg, #f6c65b, #ee8a2c 60%, #e0561f); border-top-color: rgba(90, 34, 8, .35); }
.card.is-free .stub-flame { color: #7a1f05; animation: ffsk-flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.card.is-free .stub strong { color: #3d1404; }
.card.is-free .stub span { color: #5a2208; }
@keyframes ffsk-flicker {
	0%, 100% { transform: scale(1) rotate(-2deg); }
	50% { transform: scale(1.1, 1.16) rotate(3deg); }
}

/* Status und Knöpfe */
.status {
	margin: 20px 4px 14px;
	min-height: 1.45em;
	text-align: center;
	font-size: 17px;
	color: var(--on-night);
	text-wrap: balance;
}
.status b { color: #f6c65b; font-weight: 600; }

.actions { display: grid; gap: 10px; }
.btn {
	appearance: none;
	width: 100%;
	min-height: 56px;
	padding: 14px 20px;
	border: 0;
	border-radius: 16px;
	font: 600 17px/1.2 var(--sans);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { color: #2a1206; background: linear-gradient(180deg, #f6c65b, #e79a2e); box-shadow: 0 8px 22px rgba(217, 138, 31, .32); }
.btn-primary.is-free { color: #fff8ec; background: linear-gradient(180deg, #e9632a, #c93b14); box-shadow: 0 8px 22px rgba(217, 71, 28, .4); }
.btn-ghost { color: var(--on-night); background: transparent; box-shadow: inset 0 0 0 1.5px rgba(243, 230, 211, .35); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .link:focus-visible, .foot a:focus-visible, .keypad button:focus-visible, .stepper button:focus-visible, .sheet-close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

/* Fuß */
.foot { margin-top: 28px; text-align: center; font-size: 13.5px; color: var(--on-night-soft); }
.foot p { margin: 0 0 10px; text-wrap: pretty; }
.foot a, .link { color: var(--on-night); text-decoration: underline; text-underline-offset: 3px; }
.link { appearance: none; background: none; border: 0; padding: 8px 4px; font: inherit; cursor: pointer; }
.foot-links { margin-top: 14px; }

/* Eingabe am Stand */
.sheet-backdrop {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background: rgba(12, 7, 5, .72);
	animation: ffsk-fade .2s ease both;
}
.sheet {
	position: relative;
	width: 100%;
	max-width: 440px;
	max-height: 100dvh;
	overflow-y: auto;
	padding: 22px 22px calc(20px + env(safe-area-inset-bottom));
	color: var(--ink);
	background: var(--cream);
	border-radius: 24px 24px 0 0;
	animation: ffsk-up .28s cubic-bezier(.2, .9, .3, 1) both;
}
.sheet-kicker { margin: 0 0 2px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.sheet h2 { margin: 0 44px 14px 0; font-family: var(--serif); font-weight: 600; font-size: 25px; line-height: 1.15; }
.sheet-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(42, 26, 18, .08);
	color: var(--ink);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}
.sheet-close:focus-visible, .keypad button:focus-visible, .stepper button:focus-visible { outline-color: var(--ink); }

.count {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0 14px;
	margin-bottom: 14px;
	border-bottom: 1px solid #dcc8ab;
}
.count-label { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: var(--ink);
	color: var(--cream);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}
.stepper button:disabled { opacity: .25; }
.stepper output { min-width: 40px; text-align: center; font-family: var(--serif); font-size: 30px; font-variant-numeric: lining-nums tabular-nums; }

.pin-label { margin: 0; text-align: center; font-weight: 600; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 12px 0 6px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pin-dots.shake { animation: ffsk-shake .4s ease; }
.pin-msg { min-height: 1.45em; margin: 0 0 8px; text-align: center; font-size: 14.5px; font-weight: 600; color: #b02a0c; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button {
	height: 58px;
	border: 0;
	border-radius: 14px;
	background: #fffaf0;
	box-shadow: inset 0 0 0 1px #dcc8ab;
	color: var(--ink);
	font: 500 24px/1 var(--sans);
	font-variant-numeric: lining-nums;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.keypad button:active { background: #ecd9bb; }
.keypad button[data-key="del"] { background: none; box-shadow: none; }
.keypad.is-busy { opacity: .45; pointer-events: none; }

@keyframes ffsk-fade { from { opacity: 0; } }
@keyframes ffsk-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes ffsk-shake {
	20%, 60% { transform: translateX(-8px); }
	40%, 80% { transform: translateX(8px); }
}

/* Bestätigung */
.done {
	position: fixed;
	inset: 0;
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 32px 26px calc(32px + env(safe-area-inset-bottom));
	text-align: center;
	color: #fff8ec;
	background: radial-gradient(90% 60% at 50% 30%, #f08a2b, #d9471c 55%, #8f2408);
	animation: ffsk-fade .25s ease both;
}
.done-flame { width: 92px; height: 92px; color: #ffe2a3; animation: ffsk-flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.done h2 { margin: 10px 0 0; font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.1; text-wrap: balance; }
.done-time { margin: 4px 0 6px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.done p { margin: 0; max-width: 30ch; }
.done .btn { margin-top: 26px; max-width: 300px; color: #5a1a04; background: #fff3d6; box-shadow: none; }

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(22px + env(safe-area-inset-bottom));
	z-index: 30;
	transform: translateX(-50%);
	max-width: calc(100% - 36px);
	padding: 12px 18px;
	border-radius: 12px;
	background: #fff6e6;
	color: var(--ink);
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

[hidden] { display: none !important; }

@media (max-height: 640px) {
	.keypad button { height: 50px; }
	.sheet { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
