* { box-sizing: border-box; }

:root {
  --paper: #f4ead8;
  --ink: #302a24;
  --muted: #756a5d;
  --gold: #c99a4a;
  --card: #fffdf8;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 50% 30%, #fffaf0 0, var(--paper) 48%, #e9dcc6 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.kiosk {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(20px, 5vw, 60px);
  text-align: center;
}

.hero {
  align-self: center;
  justify-self: center;
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cookie-button {
  position: relative;
  width: clamp(180px, 35vw, 280px);
  height: clamp(150px, 30vw, 230px);
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  margin-bottom: clamp(18px, 3vw, 30px);
}

.cookie {
  position: relative;
  z-index: 2;
  font-size: clamp(100px, 19vw, 170px);
  line-height: 1;
  filter: drop-shadow(0 18px 12px rgba(70, 52, 31, .20));
  transform: rotate(-4deg);
  transition: transform .25s ease, filter .25s ease;
}

.cookie-button:hover .cookie,
.cookie-button:focus-visible .cookie {
  transform: rotate(4deg) translateY(-5px) scale(1.05);
  filter: drop-shadow(0 23px 14px rgba(70, 52, 31, .24));
}

.cookie-glow {
  position: absolute;
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: rgba(255,255,255,.65);
  filter: blur(25px);
}

.sparkle {
  position: absolute;
  z-index: 3;
  color: var(--gold);
  font-size: 28px;
  opacity: .7;
  animation: float 3s ease-in-out infinite;
}

.sparkle-one { top: 8%; right: 10%; }
.sparkle-two { bottom: 14%; left: 10%; animation-delay: .8s; }
.sparkle-three { top: 22%; left: 18%; animation-delay: 1.4s; }

#eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .22em;
  font: 700 12px/1.2 system-ui, sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1;
}

#message {
  max-width: 560px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: clamp(17px, 2.5vw, 22px);
  line-height: 1.45;
}

.status {
  min-height: 28px;
  margin-top: 18px;
  color: var(--muted);
  font: 600 14px/1.4 system-ui, sans-serif;
}

.status.error { color: #9a3b32; }
.status.success { color: #487148; }

.fortune-card {
  display: none;
  width: min(600px, 94vw);
  margin-top: 24px;
  padding: 28px 30px 24px;
  background: var(--card);
  border: 1px solid rgba(90, 70, 45, .14);
  box-shadow: 0 18px 50px rgba(70, 52, 31, .14);
  transform: rotate(-.6deg);
}

.fortune-card.visible {
  display: block;
  animation: reveal .55s cubic-bezier(.2,.8,.2,1);
}

.card-cookie { font-size: 38px; }
.card-label {
  margin-top: 7px;
  color: var(--gold);
  font: 700 11px/1 system-ui, sans-serif;
  letter-spacing: .2em;
}

.fortune-text {
  margin: 17px auto;
  max-width: 510px;
  font-size: clamp(23px, 4vw, 34px);
  line-height: 1.25;
}

.card-footer {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

footer {
  color: rgba(48,42,36,.38);
  font: 700 10px/1 system-ui, sans-serif;
  letter-spacing: .25em;
}

#printCanvas { display: none; }

.is-busy .cookie-button {
  pointer-events: none;
}

.is-busy .cookie {
  animation: shake .7s ease-in-out infinite;
}

.is-busy .cookie-glow {
  animation: pulse .8s ease-in-out infinite alternate;
}

.is-printing .cookie {
  animation: printBounce 1s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(-4deg) translateX(0); }
  20% { transform: rotate(5deg) translateX(-7px); }
  40% { transform: rotate(-7deg) translateX(7px); }
  60% { transform: rotate(6deg) translateX(-5px); }
  80% { transform: rotate(-3deg) translateX(4px); }
}

@keyframes pulse {
  from { transform: scale(.88); opacity: .45; }
  to { transform: scale(1.08); opacity: .85; }
}

@keyframes printBounce {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-9px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50% { transform: translateY(-10px); opacity: 1; }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(18px) rotate(-2deg) scale(.97); }
  to { opacity: 1; transform: translateY(0) rotate(-.6deg) scale(1); }
}

@media (max-height: 650px) {
  .cookie-button {
    width: 150px;
    height: 125px;
    margin-bottom: 8px;
  }
  .cookie { font-size: 95px; }
  #message { margin-top: 8px; }
  .fortune-card { margin-top: 12px; padding: 18px 22px; }
}
