@font-face {
  font-family: "Special Ramen";
  src: url("../fonts/SpecialRamen.otf") format("opentype");
  font-display: swap;
}

:root {
  --red: #B11917;
  --red-dark: #6F1510;
  --cream: #EDDCCC;
  --cream-2: #F6ECE2;
  --ink: #1E1D1B;
  --blue: #15529A;
  --script: "Special Ramen", "Brush Script MT", cursive;
  --sans: "neue-haas-grotesk-display", "neue-haas-grotesk-text", "Neue Haas Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --check: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--red);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.35;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* šachovnicový pruh jako v assetech */
.checker {
  flex: none;
  height: calc(var(--check) * 2);
  background: repeating-conic-gradient(var(--red) 0 25%, var(--cream) 0 50%) 0 0 / calc(var(--check) * 2) calc(var(--check) * 2);
  border-bottom: 3px solid var(--cream);
}
.checker.bottom { border-bottom: 0; border-top: 3px solid var(--cream); }

#app {
  flex: 1;
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: grid;
}
.screen {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(.98);
  transition: opacity .35s ease, transform .45s cubic-bezier(.2,.9,.3,1.2), visibility 0s .35s;
}
.screen.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .35s ease, transform .45s cubic-bezier(.2,.9,.3,1.2), visibility 0s;
}

/* ---------- úvod ---------- */
.logo {
  width: min(78vw, 400px);
  height: auto;
  margin: 4px 0 6px;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.18));
  animation: wobble 5s ease-in-out infinite;
}
@keyframes wobble { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-4px); } }

.title, .pname, .res-name {
  font-family: var(--script);
  font-weight: normal;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 rgba(0,0,0,.18);
  line-height: 1.05;
  margin: 0;
}
.title { font-size: clamp(38px, 9vw, 64px); margin-top: 6px; }
.sub { margin: 10px 0 22px; font-size: 18px; opacity: .92; max-width: 30ch; }

.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  width: 100%;
}
.product {
  background: var(--cream);
  color: var(--red-dark);
  border: 0;
  border-radius: 22px;
  padding: 18px 16px 16px;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
  position: relative;
}
.product:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.product .nm { font-family: var(--script); font-size: 46px; line-height: 1.1; display: block; color: var(--red); }
.product:nth-child(2n) .nm { color: var(--red-dark); }
.product .nt { font-size: 15px; font-weight: 600; letter-spacing: .02em; color: var(--ink); opacity: .75; }
.product .done {
  position: absolute; top: 10px; right: 12px;
  background: var(--blue); color: var(--cream);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 99px; padding: 4px 9px;
}

.rank {
  margin-top: 22px;
  width: 100%;
  max-width: 420px;
  font-size: 15px;
}
.rank:empty { display: none; }
.rank .lbl { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 700; }
.rank .lbl b { font-family: var(--script); font-weight: normal; font-size: 24px; line-height: 1; }
.bar { height: 12px; background: rgba(0,0,0,.25); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--cream); border-radius: 99px; transition: width .8s cubic-bezier(.2,.9,.3,1); }

/* ---------- hodnocení ---------- */
.back {
  position: absolute; left: 16px; top: 12px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.18); border: 0; font-size: 22px; font-weight: 700;
}
.kicker { margin: 18px 0 26px; text-transform: uppercase; letter-spacing: .14em; font-size: 14px; font-weight: 700; opacity: .85; }
.pname { font-size: clamp(64px, 16vw, 110px); margin: 0 0 8px; padding: 0 .15em; }
.q { margin: 0 0 18px; font-size: 20px; font-weight: 600; }

.meter {
  width: 100%; max-width: 520px; height: 18px;
  border-radius: 99px; background: rgba(0,0,0,.25);
  border: 3px solid var(--cream);
  overflow: hidden; margin-bottom: 18px;
}
.meter-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #F2B33D, #E8661C 45%, var(--cream) 46%, #E8661C 47%, #C0261C 75%, var(--ink));
  background-size: 520px 100%;
  transition: width .35s cubic-bezier(.2,.9,.3,1.2);
}

.levels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 560px;
}
@media (min-width: 700px) { .levels { grid-template-columns: repeat(4, 1fr); max-width: none; } }
.level {
  background: var(--cream);
  color: var(--ink);
  border: 0;
  border-radius: 22px;
  padding: 16px 10px 14px;
  min-height: 140px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .2s;
}
.level:hover, .level:focus-visible { transform: translateY(-3px); box-shadow: 0 9px 0 var(--ink); outline: none; }
.level:active, .level.pick { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.level .num {
  font-family: var(--script); font-size: 34px; line-height: 1; color: var(--red);
}
.level .ln { font-weight: 700; font-size: 16px; line-height: 1.15; }
.level[data-l="4"] { background: var(--ink); color: var(--cream); box-shadow: 0 6px 0 #000; }
.level[data-l="4"] .num { color: var(--cream); }
.level[data-l="4"]:hover { animation: shake .25s linear infinite; }

.chillies { display: flex; justify-content: center; gap: 0; min-height: 44px; align-items: center; }
.chilli { width: 40px; height: 40px; overflow: visible;
  --c-fill: var(--red); --c-line: var(--ink); --c-cap: var(--ink); --c-shine: var(--cream); }
.chilli .c-body { fill: var(--c-fill); stroke: var(--c-line); }
.chilli .c-cap { fill: var(--c-cap); stroke: var(--c-line); }
.chilli .c-stem { stroke: var(--c-line); }
.chilli .c-shine { stroke: var(--c-shine); opacity: .8; }
.level .chilli { width: 38px; height: 38px; margin: 0 -3px; }
.level[data-l="4"] .chilli { --c-line: var(--cream); --c-cap: var(--cream); }
.level:hover .chilli { animation: jig .5s ease-in-out infinite alternate; }
.level:hover .chilli:nth-child(2) { animation-delay: .1s; }
.level:hover .chilli:nth-child(3) { animation-delay: .2s; }
.level:hover .chilli:nth-child(4) { animation-delay: .3s; }
@keyframes jig { to { transform: rotate(12deg) translateY(-3px); } }

/* ---------- výsledek ---------- */
#s-result { justify-content: center; padding-top: 10px; }
.res-chillies { gap: 6px; }
.res-chillies .chilli { width: 76px; height: 76px; margin: 0 -6px; opacity: 0; transform: translateY(-80px) rotate(-30deg);
  --c-fill: var(--cream); --c-shine: var(--red); filter: drop-shadow(4px 4px 0 var(--ink)); }
.res-chillies.go .chilli { animation: drop .6s cubic-bezier(.3,1.6,.5,1) forwards; }
.res-chillies.go .chilli:nth-child(2) { animation-delay: .12s; }
.res-chillies.go .chilli:nth-child(3) { animation-delay: .24s; }
.res-chillies.go .chilli:nth-child(4) { animation-delay: .36s; }
@keyframes drop { to { opacity: 1; transform: none; } }

.res-name { font-size: clamp(54px, 13vw, 96px); margin: 12px 0 6px; }
.res-name.pop { animation: pop .6s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes pop { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
.res-phrase {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 700;
  margin: 0 0 22px;
  max-width: 24ch;
  background: var(--cream); color: var(--red-dark);
  padding: 10px 18px; border-radius: 16px;
  box-shadow: 0 5px 0 var(--ink);
  transform: rotate(-1.5deg);
}

.crowd {
  width: 100%; max-width: 460px;
  background: rgba(0,0,0,.18);
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  font-size: 15px;
}
.crowd:empty { display: none; }
.crowd h3 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; }
.crowd .row { display: grid; grid-template-columns: 26px 1fr 44px; align-items: center; gap: 10px; margin: 6px 0; }
.crowd .row .bar { height: 14px; }
.crowd .row.me .bar > i { background: #F2B33D; }
.crowd .row b { font-family: var(--script); font-weight: normal; font-size: 22px; line-height: 1; text-align: center; }
.crowd .row span { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.crowd .verdict { margin: 10px 0 0; font-weight: 600; }

.badge { margin-top: 16px; font-size: 15px; font-weight: 700; }
.badge:empty { display: none; }
.badge .up {
  display: inline-block; background: var(--blue); color: var(--cream);
  padding: 6px 14px; border-radius: 99px; animation: pop .6s .5s cubic-bezier(.2,1.8,.4,1) both;
}

.actions { margin-top: 20px; }
.btn {
  background: var(--cream); color: var(--red);
  border: 0; border-radius: 99px;
  padding: 14px 30px;
  font-weight: 800; font-size: 18px; letter-spacing: .02em;
  box-shadow: 0 5px 0 var(--ink);
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.countdown { font-size: 14px; opacity: .75; margin: 10px 0 0; min-height: 1em; }

/* jiskry */
.burst { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.spark {
  position: absolute; left: 50%; top: 30%;
  font-size: 28px; line-height: 1;
  animation: fly 1.3s cubic-bezier(.1,.7,.3,1) forwards;
}
@keyframes fly {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; }
}

/* úroveň 4: siréna + třes */
.siren {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 20% 0, rgba(21,82,154,.55), transparent 50%), radial-gradient(circle at 80% 0, rgba(255,60,30,.55), transparent 50%);
}
.siren.on { animation: siren .5s steps(2) 6; }
@keyframes siren {
  0% { opacity: 1; background-position: 0 0; }
  50% { opacity: 1; filter: hue-rotate(180deg); }
  100% { opacity: 0; }
}
body.quake #app { animation: shake .12s linear 10; }
@keyframes shake {
  0% { transform: translate(0,0); } 25% { transform: translate(-4px,2px) rotate(-.6deg); }
  50% { transform: translate(3px,-2px); } 75% { transform: translate(-2px,-3px) rotate(.6deg); } 100% { transform: translate(0,0); }
}

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 30px);
  background: var(--ink); color: var(--cream);
  padding: 12px 20px; border-radius: 14px; font-weight: 700;
  opacity: 0; transition: .3s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01s !important; }
  .res-chillies .chilli { opacity: 1; transform: none; }
}

/* ---------- výběr favorita 1–4 ---------- */
.picks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 460px;
}
.picks:empty { display: none; }
@media (min-width: 760px) { .picks { grid-template-columns: repeat(4, 1fr); max-width: 720px; } }
.pick {
  aspect-ratio: 1;
  background: var(--cream);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 7px 0 var(--ink), inset 0 0 0 6px var(--cream), inset 0 0 0 9px var(--red);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .12s ease, box-shadow .12s ease;
  animation: plate .5s cubic-bezier(.2,1.6,.4,1) both;
}
.pick:nth-child(2) { animation-delay: .06s; }
.pick:nth-child(3) { animation-delay: .12s; }
.pick:nth-child(4) { animation-delay: .18s; }
@keyframes plate { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
.pick .num {
  font-family: var(--script);
  font-size: clamp(64px, 19vw, 92px);
  line-height: 1;
  padding-top: .18em;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--ink);
  padding-right: .08em;
}
.pick .ln { font-weight: 700; font-size: 14px; color: var(--ink); letter-spacing: .03em; margin-top: 2px; }
.pick:nth-child(even) .num { color: var(--blue); }
.pick:hover, .pick:focus-visible { transform: translateY(-4px) rotate(-3deg); box-shadow: 0 11px 0 var(--ink), inset 0 0 0 6px var(--cream), inset 0 0 0 9px var(--red); outline: none; }
.pick:active, .pick.on { transform: translateY(6px) scale(.97); box-shadow: 0 1px 0 var(--ink), inset 0 0 0 6px var(--cream), inset 0 0 0 9px var(--red); }

.already { font-size: 20px; font-weight: 700; background: rgba(0,0,0,.18); border-radius: 18px; padding: 16px 22px; grid-column: 1 / -1; }
.already b { font-family: var(--script); font-weight: normal; font-size: 44px; vertical-align: middle; }

#s-result .kicker { margin: 0 0 4px; }
#s-result .bignum { padding-top: .22em; }
.bignum {
  font-family: var(--script);
  font-size: clamp(140px, 42vw, 220px);
  line-height: .9;
  color: var(--cream);
  text-shadow: 5px 5px 0 var(--ink), 10px 10px 0 rgba(0,0,0,.18);
  padding-right: .1em;
}
.bignum.pop { animation: pop .7s cubic-bezier(.2,1.8,.4,1) both; }
.reveal { margin: 4px 0 16px; font-size: 18px; font-weight: 600; }
.reveal b { font-family: var(--script); font-weight: normal; font-size: 38px; vertical-align: -4px; }
