:root {
  --paper: #f3e6c4;
  --paper-2: #fff8e8;
  --ink: #1c140c;
  --red: #c4232b;
  --red-deep: #8d1520;
  --cream: #f7f1e1;
  --teal: #03686f;
  --teal-face: #39bfb1;
  --shadow: 6px 6px 0 var(--ink);
  --font: "Patrick Hand", "Gill Sans", "Trebuchet MS", sans-serif;
  --display: "Rye", "Palatino Linotype", Palatino, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #0e0c0a;
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.25;
}

button, [role="button"] {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button { cursor: pointer; }

.stage {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
}

.sprocket {
  width: 42px;
  flex: none;
  background:
    radial-gradient(circle at 50% 18px, #d9d0c2 0 8px, #0e0c0a 9px) 0 0 / 100% 46px repeat-y;
}

.frame {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: radial-gradient(#e4d2a4 1.1px, transparent 1.2px);
  background-size: 8px 8px;
}

.depth,
.grain,
.wash,
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.depth { z-index: 0; }

.drape {
  position: absolute;
  top: 0;
  height: 100%;
}

.drape.left { left: 0; }
.drape.right { right: 0; transform: scaleX(-1); }
.drape.far { width: min(16vw, 150px); opacity: 0.055; }
.drape.near { width: min(9vw, 84px); opacity: 0.1; }

.grain,
.wash,
.vignette { z-index: 4; }

.grain {
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.85'/%3E%3C/svg%3E");
  animation: grain 0.45s steps(2) infinite;
}

.wash {
  background: radial-gradient(circle at 16% 0%, rgba(255, 214, 150, 0.45), transparent 46%);
  mix-blend-mode: multiply;
}

.vignette {
  background: radial-gradient(circle at 50% 56%, transparent 46%, rgba(20, 10, 0, 0.28) 100%);
}

.frame-inner {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: max(64px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.mute {
  position: fixed;
  z-index: 6;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  min-height: 48px;
  padding: 0.2rem 0.8rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-2);
  box-shadow: 3px 3px 0 var(--ink);
}

.title-screen,
.over,
.studio,
.lager,
.moms {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding-top: 0.4rem;
}

.studio {
  min-height: 70dvh;
  justify-content: center;
  width: 100%;
  border: 0;
  background: transparent;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.studio .studio-sub { max-width: 18em; }

.brand .cube {
  width: 56px;
  height: auto;
  filter: drop-shadow(3px 3px 0 rgba(28, 20, 12, 0.28));
}

.brand.big .cube { width: 104px; }

.brand-name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(22px, 3vw, 34px);
  border-bottom: 5px solid var(--teal-face);
  line-height: 1.1;
}

.studio-kicker,
.eyebrow {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-size: clamp(22px, 3vw, 34px);
}

.studio-sub,
.intro,
.record,
.helper,
.keys {
  margin: 0;
  max-width: 28ch;
}

.record,
.keys,
.helper {
  font-size: 0.95rem;
}

.record { max-width: 46ch; }

.keys { display: none; }

.title {
  margin: 0.1rem 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-shadow: 4px 4px 0 var(--red);
}

.title span {
  display: inline-block;
  animation: drop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.end-title {
  font-size: clamp(36px, 6vw, 68px);
  text-shadow: 3px 3px 0 var(--red);
}

.kalle {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: bob 1.4s ease-in-out infinite;
}

.kalle-sprite {
  width: min(230px, 52vw);
  height: auto;
  display: block;
  filter: drop-shadow(4px 4px 0 rgba(28, 20, 12, 0.22));
  user-select: none;
  -webkit-user-drag: none;
}

.kalle.wave { animation: bounce 0.9s ease-in-out infinite; }
.kalle.slip { animation: slip 0.45s ease forwards; }
.kalle.happy { animation: hop 0.45s ease infinite alternate; }

.hud-kalle {
  width: 68px;
  height: 68px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bob 1.4s ease-in-out infinite;
}

.hud-kalle .kalle-sprite {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 rgba(28, 20, 12, 0.2));
}

.hud-kalle.slip { animation: slip 0.45s ease forwards; }
.hud-kalle.happy { animation: hop 0.4s ease; }

.film-row {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 0.4rem;
}

.film-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  min-height: 92px;
  padding: 0.85rem 1rem 1rem;
  background: var(--paper-2);
  border: 4px solid var(--ink);
  border-radius: 18px 28px 16px 22px;
  box-shadow: var(--shadow);
  transform: rotate(-1deg);
}

.film-card.alt { transform: rotate(1deg); background: #f6d7c4; }
.film-card.teal { transform: rotate(-0.4deg); background: #e5f6f3; }

.film-card strong {
  font-family: var(--display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 400;
}

.film-card em,
.film-card span { font-style: normal; }

.film-card:active,
.stamp-btn:active,
.chip:active,
.rate:active,
.menu-item:active,
.mute:active {
  transform: translate(3px, 3px) scale(0.98, 1.02);
  box-shadow: 2px 2px 0 var(--ink);
}

.play {
  display: grid;
  gap: 14px;
}

.hud {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.score strong {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  line-height: 1;
}
.score em, .score-label { font-style: normal; font-size: 0.9rem; }
.score em { color: var(--red-deep); }

.lives { display: flex; gap: 6px; }
.life {
  width: 20px;
  height: 20px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}
.life.gone { background: transparent; }

.fuse {
  height: 16px;
  background: var(--ink);
  border-radius: 99px;
  overflow: hidden;
  margin: 4px 0 8px;
}
.fuse-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--red);
  transform-origin: left center;
}
.fuse.hot .fuse-bar { background: #ffb703; }

.ticket {
  position: relative;
  background: var(--paper-2);
  border: 4px solid var(--ink);
  border-radius: 8px 18px 12px 16px;
  box-shadow: 8px 10px 0 rgba(28, 20, 12, 0.22);
  padding: 0.85rem 1rem 1rem;
  transform: rotate(-1.1deg);
}

.ticket::before { content: none; }

.ticket-top { display: flex; gap: 10px; align-items: center; }
.patron svg { width: 58px; height: 58px; display: block; }
.tills {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.till {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.4rem 0.85rem;
  background: var(--paper-2);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.till.on {
  background: #e5f6f3;
  box-shadow: 6px 6px 0 var(--teal);
}

.till strong {
  font-family: var(--display);
  font-size: clamp(56px, 12vw, 92px);
  font-weight: 400;
  line-height: 0.9;
}

.ask { max-width: 36ch; }

.who, .lapp, .say, .uten { margin: 0; }
.who { font-family: var(--display); font-size: 1.15rem; }
.lapp { opacity: 0.8; }
.say { font-size: clamp(24px, 3vw, 32px); }

.tear {
  border-top: 3px dashed var(--ink);
  margin: 0.55rem 0 0.7rem;
}

.uten {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.05rem 0.45rem;
  border: 3px solid var(--red);
  color: var(--red);
  font-family: var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.modes, .times, .rates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip, .rate, .stamp-btn, .minus {
  border: 4px solid var(--ink);
  background: var(--paper-2);
  box-shadow: 4px 4px 0 var(--ink);
}

.chip, .rate {
  min-height: 64px;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 1.25rem;
}

.chip.on {
  background: var(--ink);
  color: var(--paper);
}

.menu-item.on {
  background: #2b2014;
  border-color: var(--red);
  color: var(--paper-2);
}

.times[hidden] { display: none; }

.menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.menu-item {
  position: relative;
  min-height: 96px;
  padding: 0.45rem 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  border: 4px solid var(--ink);
  border-radius: 16px;
  background: var(--paper-2);
  box-shadow: 4px 4px 0 var(--ink);
  text-align: left;
}

.menu-item strong { font-size: 1.15rem; font-weight: 400; line-height: 1.05; }
.menu-item small { font-size: 0.95rem; min-height: 1.1em; }
.item-sprite {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(2px 2px 0 rgba(28, 20, 12, 0.18));
  user-select: none;
  -webkit-user-drag: none;
}

.menu-item.on .item-sprite {
  filter: drop-shadow(0 0 4px rgba(255, 248, 232, 0.7));
}

.qty {
  position: absolute;
  top: 6px;
  right: 8px;
  font-style: normal;
  font-family: var(--display);
  font-size: 1.2rem;
}

.minus {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}
.minus[hidden] { display: none; }

.pointer {
  position: absolute;
  right: 8px;
  bottom: -6px;
  font-size: 1.4rem;
  animation: poke 0.7s ease-in-out infinite;
}

.stamp-btn {
  width: 100%;
  min-height: 76px;
  margin-top: 4px;
  border-radius: 14px;
  background: var(--red);
  color: var(--cream);
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.08em;
  transform: rotate(-1.5deg);
}

.card-word {
  margin: 0.2rem 0 0.4rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 0.95;
  text-shadow: 4px 4px 0 var(--red);
  max-width: 16ch;
}

.card-word.small { font-size: clamp(28px, 4vw, 44px); text-shadow: 3px 3px 0 var(--red); }

.rate span {
  display: block;
  font-size: 0.8rem;
  opacity: 0.7;
}

.rates.freight { flex-direction: column; width: min(520px, 100%); }
.rate.wide { width: 100%; border-radius: 18px; }

.takings {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(40px, 7vw, 72px);
}

.bubble {
  margin: 0.6rem 0 0;
  padding: 0.45rem 0.7rem;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 4px 4px 0 var(--ink);
  text-align: left;
}

.bubble.static { max-width: 34ch; }

.ink-stamp {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 38%;
  pointer-events: none;
  color: var(--red);
  border: 8px solid var(--red);
  padding: 0.05em 0.25em;
  font-family: var(--display);
  font-size: clamp(42px, 8vw, 84px);
  letter-spacing: 0.04em;
  mix-blend-mode: multiply;
  animation: slam 0.42s cubic-bezier(0.2, 1.5, 0.3, 1) both;
}

.coin {
  position: absolute;
  top: 30%;
  font-style: normal;
  font-family: var(--display);
  color: var(--red-deep);
  animation: coinup 0.7s ease-out forwards;
  pointer-events: none;
}

.shake { animation: shake 0.4s linear; }

@keyframes drop {
  from { transform: translateY(-70%) scale(1.3, 0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes bob {
  50% { transform: translateY(7px); }
}
@keyframes hop {
  40% { transform: translateY(-16px) scale(0.96, 1.06); }
  100% { transform: none; }
}
@keyframes slip {
  to { transform: translate(16px, 8px) rotate(18deg); }
}
@keyframes wave {
  50% { transform: rotate(-16deg); }
}
@keyframes poke {
  50% { transform: translateY(8px); }
}
@keyframes slam {
  from { transform: translate(-50%, -50%) rotate(-18deg) scale(1.7); opacity: 0; }
  to { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 1; }
}
@keyframes coinup {
  to { transform: translateY(-110px) scale(0.5); opacity: 0; }
}
@keyframes shake {
  20% { transform: translateX(-7px) rotate(-0.4deg); }
  40% { transform: translateX(7px) rotate(0.4deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes grain {
  50% { transform: translate(2%, -1%); }
}

@media (min-width: 860px) {
  .frame { justify-content: center; }
  .mute { right: 58px; }
  .film-row { grid-template-columns: 1fr 1fr; }
  .film-card.teal { grid-column: 1 / -1; }
  .play {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
    gap: 28px;
  }
  .menu { grid-template-columns: repeat(3, 1fr); }
  .keys { display: block; }
  .kalle svg { width: 280px; }
}

@media (max-width: 720px) {
  .sprocket, .drape { display: none; }
  .title { font-size: clamp(28px, 8.4vw, 52px); }
  .mute { right: max(10px, env(safe-area-inset-right)); }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .kalle, .hud-kalle, .title span, .pointer, .kalle .arm-r { animation: none !important; }
}
