/* Tom Pearl Love Calculator v2 (love-calculator.php): a fairground love tester on a sunny poster. Tom Games sticker family
   (thick ink lines, flat colours, press-down buttons, real Tom heads as stickers) but its own world: sunburst, bunting, the
   machine, a crowd of Toms behind a fence. No explanations on the page (12-03 Hecksu). */
.lt {
  --ink: #2a140a; --red: #ee3440; --red2: #b81d2a; --cream: #fff4dc; --sun: #ffc21a; --sun2: #ffd84a;
  --blue: #2b8fe0; --green: #22b357; --yellow: #ffd23f; --orange: #ff8a1f; --h: clamp(180px, calc(100svh - 610px), 300px); --p: 0%;
  background: var(--sun); color: var(--ink); font: 700 16px/1.35 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.lt .tpt-top { color: var(--ink); background: none; }
.lt .tpt-foot { background: var(--ink); }
.lt-lock { overflow: hidden; }
.lt-fair {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  min-height: calc(100svh - 52px); padding: 26px 12px 150px; box-sizing: border-box;
  background: repeating-conic-gradient(from 0deg at 50% 46%, var(--sun2) 0 6deg, var(--sun) 6deg 12deg);
}
.lt-flags { position: absolute; left: 0; top: 0; width: 100%; height: 90px; overflow: visible; }
.lt-rope { fill: none; stroke: var(--ink); stroke-width: 3; vector-effect: non-scaling-stroke; }
.lt-flags polygon { stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* the machine */
.lt-machine {
  position: relative; z-index: 2; width: min(430px, 100%); margin-top: 50px; padding: 0 16px 20px; box-sizing: border-box;
  background: var(--red); border: 5px solid var(--ink); border-radius: 36px 36px 22px 22px;
  box-shadow: inset -16px 0 0 #00000024, 0 10px 0 var(--ink);
}
.lt-machine::after { /* the stand */
  content: ''; position: absolute; z-index: -1; left: 50%; bottom: -60px; width: 46%; height: 56px; transform: translateX(-50%);
  background: var(--red2); border: 5px solid var(--ink); border-top: 0; border-radius: 0 0 18px 18px;
}
.lt-sign {
  position: relative; margin: -48px -26px 14px; padding: 13px 16px 11px; background: var(--cream); border: 5px solid var(--ink); border-radius: 28px;
  box-shadow: 0 7px 0 var(--ink); text-align: center; font: 400 42px/.92 'Luckiest Guy', system-ui; color: var(--red);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink);
}
.lt-sign small { display: block; font-size: 25px; color: var(--blue); }
.lt-bulb { position: absolute; width: 13px; height: 13px; margin: -8.5px 0 0 -8.5px; border: 2px solid var(--ink); border-radius: 50%; background: #fff7c8; }
.lt-machine.is-run .lt-bulb:nth-child(odd), .lt-machine.is-run.is-b .lt-bulb:nth-child(even) { background: #ffe23a; box-shadow: 0 0 10px 3px #fff27aaa; }
.lt-machine.is-run.is-b .lt-bulb:nth-child(odd) { background: #fff7c8; box-shadow: none; }
.lt-machine.is-win .lt-bulb { animation: lt-blink .22s steps(1) infinite; }
.lt-machine.is-win .lt-bulb:nth-child(even) { animation-delay: .11s; }

.lt-names { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; margin: 0 0 14px; }
.lt-names input {
  min-width: 0; height: 52px; padding: 0 10px; border: 4px solid var(--ink); border-radius: 15px; background: #fff; color: var(--ink);
  font: 800 19px/1 system-ui, sans-serif; text-align: center; box-shadow: inset 0 5px 0 #0000001a; outline: none;
}
.lt-names input::placeholder { color: #a8927a; }
.lt-names input:focus { box-shadow: inset 0 5px 0 #0000001a, 0 0 0 4px var(--yellow); }
.lt-names input.is-want { animation: lt-shake .4s; box-shadow: inset 0 5px 0 #0000001a, 0 0 0 4px #fff; }
.lt-names b { font: 400 34px/1 'Luckiest Guy', system-ui; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }

.lt-meter { padding: 12px 12px 14px; background: var(--cream); border: 5px solid var(--ink); border-radius: 24px; }
.lt-num {
  display: block; width: 150px; margin: 0 auto 12px; padding: 7px 0 1px; background: var(--ink); border: 4px solid var(--ink); border-radius: 14px;
  color: var(--yellow); font: 400 50px/1 'Luckiest Guy', system-ui; text-align: center; letter-spacing: 2px; font-variant-numeric: tabular-nums;
}
.lt-col { --hs: 104px; display: grid; grid-template-columns: 1fr 112px; gap: 6px; height: var(--h); }
.lt-levels { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.lt-levels li {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 6px; border: 4px solid var(--ink); border-radius: 13px;
  color: #fff; font: 400 20px/1 'Luckiest Guy', system-ui; text-align: center; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  box-shadow: inset 0 -5px 0 #0000002a; transition: transform .12s, filter .12s;
}
.lt-levels li[data-t="0"] { background: var(--red); }
.lt-levels li[data-t="1"] { background: var(--orange); }
.lt-levels li[data-t="2"] { background: var(--yellow); }
.lt-levels li[data-t="3"] { background: var(--green); }
.lt-levels li[data-t="4"] { background: var(--blue); }
.lt-levels.is-live li { filter: saturate(.35) brightness(1.15); }
.lt-levels.is-live li.on { filter: none; transform: scale(1.06); box-shadow: inset 0 -5px 0 #0000002a, 0 0 0 4px #fff; }
.lt-tube { grid-area: 1 / 2; justify-self: center; width: 58px; position: relative; overflow: hidden; background: #fff; border: 4px solid var(--ink); border-radius: 30px; }
.lt-tube i {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc((var(--h) - 8px - var(--hs)) * var(--u, 0) + var(--hs) / 2); border-top: 4px solid var(--ink);
  background: linear-gradient(0deg, var(--blue), var(--green) 30%, var(--yellow) 55%, var(--orange) 76%, var(--red)) bottom / 100% calc(var(--h) - 8px) no-repeat;
}
.lt-rail { grid-area: 1 / 2; position: relative; }
.lt-head {
  position: absolute; left: 50%; bottom: calc((var(--h) - var(--hs)) * var(--u, 0)); width: var(--hs); height: var(--hs); margin-left: calc(var(--hs) / -2);
  filter: drop-shadow(2.5px 0 0 #fff) drop-shadow(-2.5px 0 0 #fff) drop-shadow(0 2.5px 0 #fff) drop-shadow(0 -2.5px 0 #fff) drop-shadow(0 4px 0 var(--ink));
}
.lt-machine.is-run .lt-head { animation: lt-jit .09s infinite; }
.lt-machine.is-win .lt-head { animation: lt-pop .5s cubic-bezier(.2, 1.8, .5, 1); }

.lt-hold {
  position: relative; display: block; width: 148px; height: 148px; margin: 18px auto 0; padding: 0; border: 5px solid var(--ink); border-radius: 50%;
  background: #ff3b47; box-shadow: inset 0 -12px 0 #c81f2c, inset 0 9px 0 #ff8189, 0 12px 0 var(--ink); cursor: pointer;
  color: #fff; font: 400 40px/1 'Luckiest Guy', system-ui; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .06s, box-shadow .06s;
}
.lt-hold span { position: relative; top: 3px; pointer-events: none; }
.lt-hold.is-down { transform: translateY(10px); box-shadow: inset 0 -6px 0 #c81f2c, inset 0 9px 0 #ff8189, 0 2px 0 var(--ink); }
.lt-hold.is-call { animation: lt-call 1.1s ease-in-out infinite; }
.lt-hold:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
.lt-plate { margin: 14px 0 0; color: #fff; text-align: center; font: 400 21px/1.1 'Luckiest Guy', system-ui; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.lt-plate.is-bad { color: var(--yellow); animation: lt-shake .4s; }

/* the crowd of Toms behind the fence */
.lt-crowd { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 150px; pointer-events: none; }
.lt-fan {
  position: absolute; bottom: 34px; width: var(--s, 92px); height: var(--s, 92px); margin-left: calc(var(--s, 92px) / -2);
  filter: drop-shadow(2.5px 0 0 #fff) drop-shadow(-2.5px 0 0 #fff) drop-shadow(0 -2.5px 0 #fff) drop-shadow(0 4px 0 #0003);
  animation: lt-bob 2.4s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.lt-crowd svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 76px; }
.lt-crowd svg path { fill: #fff; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.lt-fair.is-tense .lt-fan { animation: lt-jit .12s infinite; }
.lt-fair.is-up .lt-fan { animation: lt-jump .45s ease-out 3; animation-delay: var(--d2, 0s); }
.lt-fair.is-down .lt-fan { animation: none; transform: translateY(26px); transition: transform .3s; }
.lt-fan--big { display: none; }

/* Tom's verdict: the whole screen */
.lt-show { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: 1fr auto; background: var(--ink); }
.lt-show[hidden] { display: none; }
.lt-media { position: relative; min-height: 0; overflow: hidden; background: #000; cursor: pointer; }
.lt-media video, .lt-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lt-media [hidden] { display: none; }
.lt-show.is-in .lt-media > * { animation: lt-zoom 1.4s cubic-bezier(.2, .9, .3, 1) both; }
.lt-show.is-still .lt-media img { animation: lt-zoom 1.4s cubic-bezier(.2, .9, .3, 1) both, lt-push 7s 1.4s linear both; }
.lt-res {
  position: relative; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); text-align: center;
  background: repeating-conic-gradient(from 0deg at 50% 0, var(--sun2) 0 6deg, var(--sun) 6deg 12deg); border-top: 5px solid var(--ink);
}
.lt-who { margin: 14px 0 0; font: 400 26px/1.05 'Luckiest Guy', system-ui; color: var(--ink); overflow-wrap: anywhere; }
.lt-big { margin: 2px 0 0; font: 400 clamp(84px, 24vw, 150px)/.9 'Luckiest Guy', system-ui; color: var(--red); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink); }
.lt-word { margin: 6px 0 0; font: 400 clamp(32px, 8vw, 46px)/1 'Luckiest Guy', system-ui; color: #fff; -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); }
.lt-show.is-in .lt-big { animation: lt-stamp .45s .25s cubic-bezier(.2, 1.7, .5, 1) both; }
.lt-show.is-in .lt-word { animation: lt-stamp .45s .5s cubic-bezier(.2, 1.7, .5, 1) both; }
.lt-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px; margin: 16px 0 0; }
.lt-btn {
  min-height: 54px; padding: 4px 18px 0; border: 4px solid var(--ink); border-radius: 16px; background: #fff; color: var(--ink);
  font: 400 21px/1 'Luckiest Guy', system-ui; box-shadow: 0 6px 0 var(--ink); cursor: pointer;
}
.lt-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.lt-btn--go { background: var(--green); color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.lt-btn:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }

@keyframes lt-call { 50% { transform: scale(1.07); } }
@keyframes lt-pop { 40% { transform: scale(1.3) rotate(-6deg); } }
@keyframes lt-blink { 50% { background: #ffe23a; box-shadow: 0 0 12px 4px #fff27acc; } }
@keyframes lt-shake { 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-4px); } }
@keyframes lt-jit { 25% { transform: translate(1.5px, -1px) rotate(1.5deg); } 75% { transform: translate(-1.5px, 1px) rotate(-1.5deg); } }
@keyframes lt-bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
@keyframes lt-jump { 40% { transform: translateY(-34px) rotate(4deg); } }
@keyframes lt-zoom { from { transform: scale(1.25); filter: brightness(2.2); } to { transform: none; filter: none; } }
@keyframes lt-push { to { transform: scale(1.12); } }
@keyframes lt-stamp { from { transform: scale(2.2) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 900px) {
  .lt { --h: clamp(200px, calc(100svh - 590px), 330px); }
  .lt-fair { padding-bottom: 70px; }
  .lt-crowd { z-index: 1; height: 170px; } .lt-crowd .lt-fan { bottom: 38px; }
  .lt-fan--big { display: block; z-index: 1; top: 150px; bottom: auto; --s: 250px; }
  .lt-fan--big.l { left: calc(50% - 400px); } .lt-fan--big.r { left: calc(50% + 400px); animation-delay: -1.2s; }
  .lt-fair.is-down .lt-fan--big { transform: translateY(40px) rotate(8deg); }
  .lt-show { grid-template-rows: none; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); }
  .lt-res { display: flex; flex-direction: column; justify-content: center; border-top: 0; border-left: 5px solid var(--ink); background: repeating-conic-gradient(from 0deg at 50% 50%, var(--sun2) 0 6deg, var(--sun) 6deg 12deg); }
  .lt-who { font-size: 40px; } .lt-big { font-size: 230px; } .lt-word { font-size: 66px; }
  .lt-acts { gap: 16px 14px; margin-top: 28px; } .lt-btn { min-height: 64px; padding: 5px 24px 0; font-size: 26px; }
}
@media (max-width: 400px) {
  .lt { --h: 264px; }
  .lt-sign { font-size: 36px; margin-left: -20px; margin-right: -20px; } .lt-sign small { font-size: 22px; }
  .lt-col { --hs: 92px; grid-template-columns: 1fr 98px; }
  .lt-tube { width: 50px; }
  .lt-levels li { font-size: 17px; }
  .lt-hold { width: 132px; height: 132px; font-size: 36px; }
  .lt-names input { font-size: 17px; height: 48px; }
}
@media (max-height: 740px) and (max-width: 899px) {
  .lt { --h: 170px; }
  .lt-fair { padding-top: 14px; } .lt-machine { margin-top: 44px; padding-bottom: 14px; }
  .lt-sign { font-size: 31px; margin-top: -42px; padding: 10px 12px 8px; } .lt-sign small { font-size: 19px; }
  .lt-names { margin-bottom: 10px; } .lt-names input { height: 44px; }
  .lt-meter { padding: 8px 10px 10px; } .lt-num { font-size: 34px; width: 120px; margin-bottom: 8px; padding: 5px 0 0; }
  .lt-col { --hs: 80px; } .lt-levels { gap: 4px; } .lt-levels li { font-size: 15px; border-width: 3px; }
  .lt-hold { width: 104px; height: 104px; font-size: 30px; margin-top: 12px; } .lt-plate { margin-top: 10px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .lt *, .lt *::before, .lt *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
