:root {
  --cranberry: #B5122B;
  --spruce: #0D4A38;
  --gold: #F2C14E;
  --gold-deep: #C98A12;
  --card: #FFF3DC;
  --ink: #2A1420;
  --muted: #6b4a52;
  --shout: 'Shrikhand', Georgia, serif;
  --hand: 'Gochi Hand', 'Comic Sans MS', cursive;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg fill='%23F2C14E'%3E%3Cpath transform='translate(28 30)' d='M0-11 3.2-4.4 10.5-3.4 5.2 1.7 6.5 8.9 0 5.5-6.5 8.9-5.2 1.7-10.5-3.4-3.2-4.4Z'/%3E%3Cpath transform='translate(98 92) rotate(20) scale(.7)' d='M0-11 3.2-4.4 10.5-3.4 5.2 1.7 6.5 8.9 0 5.5-6.5 8.9-5.2 1.7-10.5-3.4-3.2-4.4Z'/%3E%3Cpath transform='translate(46 118) rotate(-15) scale(.45)' d='M0-11 3.2-4.4 10.5-3.4 5.2 1.7 6.5 8.9 0 5.5-6.5 8.9-5.2 1.7-10.5-3.4-3.2-4.4Z'/%3E%3C/g%3E%3Cg fill='%23fff' opacity='.45'%3E%3Ccircle cx='112' cy='24' r='2'/%3E%3Ccircle cx='70' cy='60' r='1.5'/%3E%3Ccircle cx='12' cy='86' r='2'/%3E%3Ccircle cx='128' cy='130' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
  --red-paper: var(--star) 0 0 / 140px 140px, var(--cranberry);
  --green-paper: var(--star) 30px 10px / 90px 90px, repeating-linear-gradient(-45deg, transparent 0 22px, rgba(255, 243, 220, .85) 22px 27px, transparent 27px 34px, var(--cranberry) 34px 39px, transparent 39px 60px), var(--spruce);
  --foil: linear-gradient(90deg, #b9861a, var(--gold) 18%, #ffe39a 30%, var(--gold) 45%, #b9861a 50%, var(--gold) 55%, #ffe39a 70%, var(--gold) 82%, #b9861a);
  --tag-shape: polygon(16% 0, 84% 0, 100% 10%, 100% 100%, 0 100%, 0 10%);
}

* { box-sizing: border-box; }

html { background: var(--cranberry); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--red-paper);
  color: var(--ink);
  font: 20px/1.3 var(--hand);
}

.app { position: relative; max-width: 430px; min-height: 100dvh; margin: 0 auto; overflow: hidden; }

.screen { display: none; position: relative; min-height: 100dvh; padding: 32px 22px 28px; }
.screen.on { display: block; }

.hand { margin: 0; font: 400 21px/1.25 var(--hand); }

.shout {
  margin: 0;
  color: var(--card);
  font: 400 46px/1 var(--shout);
  text-shadow: 3px 3px 0 var(--gold), 6px 6px 0 var(--ink);
}

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 6px var(--gold); }

.ribbon.cross { display: none; }
.ribbon { position: absolute; z-index: 0; background: var(--foil); box-shadow: 0 0 0 2px rgba(42, 20, 32, .25); }
#landing .ribbon { top: 0; bottom: 0; left: 50%; width: 58px; margin-left: -29px; }
#landing { padding-top: 14px; }

.bow { position: relative; z-index: 1; display: block; filter: drop-shadow(3px 4px 0 rgba(42, 20, 32, .45)); }
.bow .loop { fill: var(--gold); stroke: #9A6A0E; stroke-width: 3; }
.bow .tail { fill: #E0A93A; stroke: #9A6A0E; stroke-width: 3; }
.bow .knot { fill: #ffe39a; stroke: #9A6A0E; stroke-width: 3; }
#landing .bow { width: 190px; margin: 0 auto; }

.tag-wrap { position: relative; z-index: 2; width: min(340px, 100%); margin: -62px auto 0; transform-origin: 50% 0; animation: swing 4s ease-in-out infinite; }
@keyframes swing { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(1.5deg); } }
.twine { display: block; width: 40px; height: 84px; margin: 0 auto -16px; fill: none; stroke: #8a5a3c; stroke-width: 3; stroke-linecap: round; }
.tag { position: relative; padding: 46px 26px 26px; background: var(--card); text-align: center; clip-path: var(--tag-shape); }
.tag-wrap::before { content: ""; position: absolute; inset: 48px 0 0; z-index: -1; background: rgba(42, 20, 32, .45); clip-path: var(--tag-shape); transform: translate(7px, 8px); }
.hole { position: absolute; top: 12px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--cranberry); box-shadow: inset 0 0 0 4px #e7d3b0; }
.to { text-align: left; }
.mast { margin: 6px 0 4px; color: var(--cranberry); font: 400 54px/.92 var(--shout); text-shadow: 3px 3px 0 var(--gold); transform: rotate(-4deg); }
.from { margin-bottom: 18px; text-align: right; color: var(--muted); }

.field label { display: block; color: var(--muted); }
.field input {
  width: 100%;
  padding: 2px 4px 6px;
  border: 0;
  border-bottom: 3px dotted var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 24px var(--hand);
  text-align: center;
}
.field input:focus-visible { outline: none; box-shadow: none; border-bottom-style: solid; border-bottom-color: var(--cranberry); }
.field input[aria-invalid="true"] { border-bottom-color: var(--cranberry); }
.hint { margin: 6px 0 0; font-size: 17px; color: var(--muted); }
.err { margin: 8px 0 0; font-size: 18px; color: var(--cranberry); }

.cta {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 12px 18px 16px;
  border: 2px solid #9A6A0E;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe7a3, var(--gold) 45%, #d99d22);
  color: var(--ink);
  font: 400 26px/1 var(--shout);
  box-shadow: 0 6px 0 #9A6A0E, 0 10px 16px rgba(42, 20, 32, .35);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.cta:active { transform: translateY(5px); box-shadow: 0 1px 0 #9A6A0E, 0 3px 6px rgba(42, 20, 32, .35); }
.cta:disabled { border-color: #c9b9a0; background: #eadfca; color: #a8957c; box-shadow: 0 6px 0 #c9b9a0; cursor: default; }
.cta.ghost { border: 2px solid var(--ink); background: none; box-shadow: none; font-size: 22px; }

.screen.on.opening { display: block; overflow: hidden; }
.opening .ribbon.v { top: 0; bottom: 0; left: 50%; width: 58px; margin-left: -29px; animation: untie-v .9s .25s ease-in forwards; }
.opening .ribbon.h { left: 0; right: 0; top: 50%; height: 58px; margin-top: -29px; background: linear-gradient(180deg, #b9861a, var(--gold) 18%, #ffe39a 30%, var(--gold) 45%, #b9861a 50%, var(--gold) 55%, #ffe39a 70%, var(--gold) 82%, #b9861a); animation: untie-h .9s .25s ease-in forwards; }
@keyframes untie-v { to { transform: translateY(-110%); } }
@keyframes untie-h { to { transform: translateX(110%); } }
.bow.big { position: absolute; top: 50%; left: 50%; width: 240px; margin: -80px 0 0 -120px; animation: tug .45s ease-in-out infinite alternate; }
@keyframes tug { from { transform: rotate(-6deg) scale(1); } to { transform: rotate(5deg) scale(1.08); } }
.opening .shout { position: absolute; bottom: 18%; left: 0; right: 0; text-align: center; font-size: 40px; }

#hello { padding-top: 58px; }
.hello { margin: 8px 0 26px; }
.hero { position: relative; width: 270px; margin: 0 auto; }
.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 86px;
  height: 26px;
  background: repeating-linear-gradient(90deg, rgba(255, 243, 220, .8) 0 8px, rgba(242, 193, 78, .8) 8px 16px);
  box-shadow: 0 1px 2px rgba(42, 20, 32, .3);
}
.hero::before { top: 0; left: -20px; transform: rotate(-38deg); }
.hero::after { top: 0; right: -20px; transform: rotate(38deg); }
.hero .angel { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.note {
  margin: 26px -6px 0;
  padding: 12px 34px;
  background: var(--card);
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  transform: rotate(1.2deg);
  text-align: center;
}

.spark { position: absolute; z-index: 2; color: var(--gold); font-style: normal; text-shadow: 2px 2px 0 var(--ink); animation: sparkle 1.4s ease-in-out infinite; }
.spark.s1 { top: -8%; left: -10%; font-size: 34px; }
.spark.s2 { top: 22%; right: -14%; font-size: 24px; animation-delay: .5s; }
.spark.s3 { bottom: 12%; left: -14%; font-size: 20px; animation-delay: .9s; }
.spark.s4 { bottom: -8%; right: -6%; font-size: 30px; animation-delay: .25s; }
@keyframes sparkle { 0%, 100% { opacity: .2; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }

.angel { display: block; width: 100%; height: auto; }
img.angel {
  aspect-ratio: 1;
  object-fit: cover;
  border: 10px solid var(--card);
  border-bottom-width: 34px;
  border-radius: 3px;
  box-shadow: 6px 8px 0 rgba(42, 20, 32, .45);
  transform: rotate(-3deg);
}
.fighter.right img.angel { transform: rotate(4deg); }
.angel .wing-l, .angel .wing-r { transform-box: fill-box; animation: flap 1.1s ease-in-out infinite alternate; }
.angel .wing-l { transform-origin: 100% 70%; }
.angel .wing-r { transform-origin: 0% 70%; animation-direction: alternate-reverse; }
@keyframes flap { from { transform: rotate(8deg); } to { transform: rotate(-10deg); } }

#reveal { padding: 0; background: var(--card); }
.arena { position: relative; height: 600px; overflow: hidden; }
.half, .tear { position: absolute; inset: 0; }
.half.left { background: var(--red-paper); }
.tear { background: var(--card); clip-path: polygon(0.0% 59.9%, 4.5% 58.9%, 9.1% 56.5%, 13.6% 57.4%, 18.2% 53.8%, 22.7% 54.9%, 27.3% 53.6%, 31.8% 50.5%, 36.4% 51.8%, 40.9% 48.6%, 45.5% 49.1%, 50.0% 46.5%, 54.5% 45.1%, 59.1% 45.5%, 63.6% 46.3%, 68.2% 42.6%, 72.7% 41.6%, 77.3% 42.2%, 81.8% 42.8%, 86.4% 40.0%, 90.9% 37.9%, 95.5% 39.9%, 100.0% 36.6%, 100% 100%, 0 100%); }
.half.right { background: var(--green-paper); clip-path: polygon(0.0% 62.0%, 4.5% 60.1%, 9.1% 58.3%, 13.6% 59.4%, 18.2% 55.8%, 22.7% 56.7%, 27.3% 54.9%, 31.8% 52.4%, 36.4% 53.3%, 40.9% 50.1%, 45.5% 50.8%, 50.0% 48.1%, 54.5% 47.1%, 59.1% 47.5%, 63.6% 48.2%, 68.2% 44.0%, 72.7% 43.3%, 77.3% 44.0%, 81.8% 44.3%, 86.4% 41.6%, 90.9% 39.7%, 95.5% 41.2%, 100.0% 38.0%, 100% 100%, 0 100%); }
.fighter { position: absolute; width: 50%; }
.fighter.left { top: 26px; left: 20px; }
.fighter.right { right: 20px; bottom: 30px; }
.role { position: absolute; z-index: 1; display: flex; flex-direction: column; gap: 4px; white-space: nowrap; }
.role .hand { color: var(--card); font-size: 22px; text-shadow: 2px 2px 0 var(--ink); }
.role.left { top: 70px; right: 16px; align-items: flex-end; }
.role.left .hand { max-width: 150px; white-space: normal; text-align: right; line-height: 1.05; }
.role.right { bottom: 84px; left: 16px; align-items: flex-start; }
.plate {
  display: inline-block;
  padding: 4px 16px 6px 32px;
  background: radial-gradient(circle at 15px 50%, var(--ink) 4px, #e7d3b0 5px 6px, transparent 7px), var(--card);
  color: var(--ink);
  font: 400 32px/1.1 var(--hand);
  clip-path: polygon(10% 0, 100% 0, 100% 100%, 10% 100%, 0 50%);
  transform: rotate(-4deg);
  filter: drop-shadow(3px 3px 0 rgba(42, 20, 32, .5));
}
.role.right .plate { transform: rotate(3deg); }
.fighter.rolling { animation: jitter .12s steps(2) infinite; }
.fighter.rolling .angel { filter: blur(1.2px) saturate(.6); }
.fighter.rolling + .role .plate { opacity: .6; }
@keyframes jitter { 50% { transform: translate(2px, -2px); } }

.vs {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  padding: 0 .1em;
  opacity: 0;
  color: var(--gold);
  font: 400 118px/1 var(--shout);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 1px 1px 0 var(--gold-deep), 2px 2px 0 var(--gold-deep), 3px 3px 0 var(--gold-deep), 4px 4px 0 var(--gold-deep), 5px 5px 0 var(--gold-deep), 6px 6px 0 var(--gold-deep), 8px 8px 0 var(--ink), 12px 12px 0 rgba(42, 20, 32, .35);
  transform: translate(-50%, -50%) rotate(-12deg);
}
.arena.landed { animation: shake .4s .18s; }
.arena.landed .vs { animation: slam .55s cubic-bezier(.15, 1.6, .35, 1) forwards; }
@keyframes slam {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-30deg) scale(3.2); }
  to { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}
@keyframes shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }

.rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 900px;
  height: 900px;
  margin: -450px 0 0 -450px;
  opacity: 0;
  background: repeating-conic-gradient(rgba(255, 227, 154, .5) 0 7deg, transparent 7deg 20deg);
  mask: radial-gradient(circle, #000 12%, transparent 58%);
}
.arena.landed .rays { animation: rays-in .5s .1s forwards, spin 18s linear infinite; }
@keyframes rays-in { to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.arena::after { content: ""; position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; pointer-events: none; }
.arena.landed::after { animation: flash .45s ease-out; }
@keyframes flash { from { opacity: .85; } }

.result { padding: 22px 22px 30px; background: var(--card); text-align: center; }
.result .shout { color: var(--cranberry); font-size: 34px; text-shadow: 3px 3px 0 var(--gold); }
.result .hand { margin-top: 8px; color: var(--muted); }

.snow, .confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.snow { z-index: 5; }
.confetti { z-index: 6; }

.langs { position: fixed; top: 12px; right: 12px; z-index: 7; display: flex; gap: 6px; }
.langs button {
  padding: 4px 9px 6px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: 400 15px/1 'Shrikhand', Georgia, serif;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.langs button[aria-pressed="true"] { background: var(--gold); }
body:has(#reveal.on) .langs, body:has(#opening.on) .langs { display: none; }

html[lang="lt"], html[lang="ru"] { --hand: 'Caveat', cursive; }
html[lang="ru"] { --shout: 'Lobster', Georgia, serif; }
html[lang="lt"] :is(body, .hand, .field input, .plate), html[lang="ru"] :is(body, .hand, .field input, .plate) { font-weight: 700; font-size-adjust: .5; }
html[lang="lt"] .mast { font-size: 40px; }
html[lang="ru"] .mast { font-size: 56px; text-shadow: 2px 2px 0 var(--gold); }

@media (min-width: 760px) {
  .app { max-width: none; }
  .screen { padding: 40px 48px; }
  #landing .ribbon.cross { display: block; top: 71px; bottom: auto; left: 0; right: 0; width: auto; height: 58px; margin: 0; background: linear-gradient(180deg, #b9861a, var(--gold) 18%, #ffe39a 30%, var(--gold) 45%, #b9861a 50%, var(--gold) 55%, #ffe39a 70%, var(--gold) 82%, #b9861a); }
  #landing .bow { width: 250px; margin-top: 10px; }
  .tag-wrap { width: 440px; margin-top: -80px; }
  .tag { padding: 58px 44px 34px; }
  .mast { font-size: 76px; }
  html[lang="lt"] .mast { font-size: 56px; }
  html[lang="ru"] .mast { font-size: 76px; }
  .hand { font-size: 24px; }

  .screen.on#hello { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 440px); grid-template-areas: "hero title" "hero note" "hero cta"; align-content: center; justify-content: center; column-gap: clamp(32px, 5vw, 72px); padding-top: 80px; }
  #hello .hello { grid-area: title; align-self: end; font-size: 68px; }
  #hello .hero { grid-area: hero; width: 100%; align-self: center; }
  #hello .note { grid-area: note; margin: 30px 0 0; font-size: 24px; }
  #hello .cta { grid-area: cta; align-self: start; }

  .arena { height: min(680px, 82dvh); min-height: 540px; }
  .fighter { width: min(34%, 360px); }
  .fighter.left { top: 40px; left: 7%; }
  .fighter.right { right: 7%; bottom: 40px; }
  .role.left { top: 110px; right: auto; left: calc(7% + min(34%, 360px) + 40px); align-items: flex-start; }
  .role.right { bottom: 120px; left: auto; right: calc(7% + min(34%, 360px) + 40px); align-items: flex-end; }
  .role .hand { font-size: 28px; }
  .plate { font-size: 46px; }
  .vs { font-size: 170px; }
  .rays { width: 1600px; height: 1600px; margin: -800px 0 0 -800px; }
  .result:not([hidden]) { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 40px; padding: 30px 7%; text-align: left; }
  .result .shout { grid-column: 1; font-size: 44px; }
  .result .hand { grid-column: 1; }
  .result .cta { grid-column: 2; grid-row: 1 / span 2; width: auto; margin: 0; padding-inline: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .arena.landed .vs { opacity: 1; }
}
