@font-face {
  font-family: "Fredoka";
  src: url("../assets/fonts/fredoka.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --ink: #4a2a14;
  --cream: #fff4d6;
  --cream2: #ffe5a8;
  --red: #e5484d;
  --green: #2fb35a;
  --mustard: #ffb81f;
  --blue: #3d9bff;
  --wood: #8a5a2b;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #4a2a14;
  font-family: "Fredoka", "Trebuchet MS", sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
canvas#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hitflash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 35%,
    #ff1f4aaa 100%
  );
}
.hitflash.on {
  animation: hit 0.55s ease-out;
}
@keyframes hit {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.speedfx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  background: repeating-conic-gradient(
    from 0deg at 50% 52%,
    #ffffff55 0 0.8deg,
    transparent 0.8deg 5deg
  );
  -webkit-mask: radial-gradient(circle at 50% 52%, transparent 34%, #000 88%);
  mask: radial-gradient(circle at 50% 52%, transparent 34%, #000 88%);
}
.speedfx.on {
  opacity: 0.6;
}
.ic {
  width: 30px;
  height: 30px;
  flex: none;
  display: block;
}
.ic.s {
  width: 22px;
  height: 22px;
}
.ic.xl {
  width: 54px;
  height: 54px;
}
.screen {
  position: fixed;
  inset: 0;
  display: none;
  padding: max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}
.screen.active {
  display: flex;
}
#loader {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(#52b7ff, #bfe8ff 60%, #9be06a 60%, #5cc84c);
  z-index: 30;
}
.loadbar {
  width: min(300px, 70vw);
  height: 20px;
  border-radius: 99px;
  background: var(--cream);
  border: 3px solid var(--ink);
  overflow: hidden;
}
.loadbar i {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(
    45deg,
    #e5484d 0 12px,
    #ff8a5c 12px 24px
  );
  transition: width 0.25s;
}
.muted {
  color: #6b4a2c;
  margin: 0;
  font-weight: 500;
}
.small {
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
}
.tag {
  margin: 6px 0 14px;
  text-align: center;
  font-weight: 600;
  color: #6b4a2c;
  font-size: clamp(15px, 2.2vw, 18px);
}
/* ticket panels */
.menu-wrap,
.panel,
.card {
  background: var(--cream);
  border: 4px solid var(--ink);
  box-shadow:
    0 8px 0 #2b170a,
    inset 0 0 0 4px var(--cream2),
    inset 0 0 0 6px #e0b25a;
  position: relative;
}
.btn {
  position: relative;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 11px 20px;
  font:
    700 clamp(17px, 2.4vw, 21px) "Fredoka",
    sans-serif;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(#fff, #e9dcc0);
  box-shadow:
    0 6px 0 var(--ink),
    inset 0 3px 0 #ffffffaa,
    inset 0 -3px 0 #00000014;
  transition:
    top 0.08s,
    box-shadow 0.08s;
}
.btn:hover {
  top: -2px;
  box-shadow:
    0 8px 0 var(--ink),
    inset 0 3px 0 #ffffffaa,
    inset 0 -3px 0 #00000014;
}
.btn:active,
.btn.press {
  top: 4px;
  box-shadow:
    0 2px 0 var(--ink),
    inset 0 3px 0 #ffffffaa;
}
.btn:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: 3px;
}
.btn.green {
  background: linear-gradient(#8bf0a4, #2fb35a);
}
.btn.mustard {
  background: linear-gradient(#ffe27a, #ffb81f);
}
.btn.blue {
  background: linear-gradient(#a9d8ff, #3d9bff);
}
.btn.red {
  background: linear-gradient(#ff9c9f, #e5484d);
}
.btn.big {
  font-size: clamp(24px, 3.6vw, 32px);
  padding: 15px 30px;
  border-radius: 22px;
  width: 100%;
}
.btn.round {
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 50%;
}
.btn.round.sm {
  width: 48px;
  height: 48px;
}
.chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 99px;
  font-weight: 700;
  background: var(--cream);
  border: 3px solid var(--ink);
  color: var(--ink);
  box-shadow: 0 3px 0 #2b170a;
}
.chip b,
.pill b {
  color: #c0392b;
}
/* menu */
#menu {
  align-items: center;
  justify-content: flex-start;
  padding-left: max(18px, 6vw);
}
.menu-wrap {
  width: min(430px, 92vw);
  padding: 20px 24px 20px;
  border-radius: 26px;
}
.menu-btns {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.row2 .btn {
  padding: 12px 10px;
}
.chips {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.corner {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  top: max(14px, env(safe-area-inset-top));
  display: flex;
  gap: 12px;
}
@media (max-aspect-ratio: 1/1) {
  #menu {
    justify-content: center;
    align-items: flex-end;
    padding-bottom: max(22px, 5vh);
    padding-left: 14px;
  }
  .menu-wrap {
    padding: 14px 18px;
  }
}
@media (max-height: 480px) {
  .menu-wrap {
    padding: 8px 18px;
  }
  .tag {
    margin: 2px 0 8px;
  }
  .chips {
    margin-top: 10px;
  }
  .menu-btns {
    gap: 10px;
  }
  .btn.big {
    padding: 8px 20px;
  }
}
/* panels */
.screen#levels,
.screen#how,
.screen#settings {
  align-items: center;
  justify-content: center;
  background: #2b170a88;
}
.panel {
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 18px;
  border-radius: 26px;
}
.panel.narrow {
  width: min(460px, 100%);
}
.phead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.phead h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 32px);
  color: #c0392b;
}
.tabs {
  display: flex;
  gap: 8px;
  padding: 4px 2px 10px;
  overflow: hidden;
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 6px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  font:
    700 15px "Fredoka",
    sans-serif;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(var(--c1), var(--c2));
  opacity: 0.62;
  box-shadow: 0 4px 0 var(--ink);
  position: relative;
  top: 0;
  transition:
    top 0.08s,
    opacity 0.15s;
}
.tab:hover {
  opacity: 0.9;
}
.tab.on {
  opacity: 1;
  top: -2px;
  box-shadow: 0 6px 0 var(--ink);
}
.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 4px 4px 8px;
}
.lv {
  position: relative;
  top: 0;
  aspect-ratio: 1/1;
  min-height: 64px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: linear-gradient(var(--c1), var(--c2));
  font:
    700 clamp(20px, 3.6vw, 28px) "Fredoka",
    sans-serif;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow:
    0 5px 0 var(--ink),
    inset 0 3px 0 #ffffff80;
  transition:
    top 0.08s,
    box-shadow 0.08s;
}
.lv:hover {
  top: -2px;
  box-shadow:
    0 7px 0 var(--ink),
    inset 0 3px 0 #ffffff80;
}
.lv:active {
  top: 3px;
  box-shadow: 0 2px 0 var(--ink);
}
.lv .st {
  display: flex;
  gap: 1px;
}
.lv .st .ic {
  width: 15px;
  height: 15px;
}
.lv.locked {
  background: linear-gradient(#c9b99a, #a8977a);
  cursor: default;
  opacity: 0.9;
}
.lv.locked:hover {
  top: 0;
  box-shadow:
    0 5px 0 var(--ink),
    inset 0 3px 0 #ffffff80;
}
.lv.locked .ic {
  width: 30px;
  height: 30px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.cards article {
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 10px 14px;
}
.cards h3 {
  margin: 8px 0 4px;
  color: #c0392b;
  font-size: 19px;
}
.cards p {
  margin: 0;
  color: #5a3a20;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.35;
}
.art {
  height: 74px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(#52b7ff, #2c7fe0);
  border: 3px solid var(--ink);
}
.art.a2 {
  background: linear-gradient(#ffb066, #e5484d);
}
.art.a3 {
  background: linear-gradient(#b48bff, #6a3fd6);
}
.art.a4 {
  background: linear-gradient(#5be07f, #1b9a55);
}
.crate {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, #c98a4b 0 9px, #a9703a 9px 11px);
  border: 3px solid var(--ink);
}
.setlist {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setrow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: linear-gradient(#fff, #efe3c8);
  color: var(--ink);
  font:
    700 20px "Fredoka",
    sans-serif;
  cursor: pointer;
  position: relative;
  top: 0;
  box-shadow: 0 5px 0 var(--ink);
  transition:
    top 0.08s,
    box-shadow 0.08s;
}
.setrow:hover {
  top: -2px;
  box-shadow: 0 7px 0 var(--ink);
}
.setrow:active {
  top: 3px;
  box-shadow: 0 2px 0 var(--ink);
}
.setrow span {
  flex: 1;
  text-align: left;
}
.setrow em {
  font-style: normal;
  color: #c0392b;
}
.setrow.danger {
  background: linear-gradient(#ffc2c4, #ff7b80);
}
.sw {
  width: 54px;
  height: 30px;
  border-radius: 99px;
  background: #b9a98c;
  border: 3px solid var(--ink);
  position: relative;
  flex: none;
}
.sw::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  transition: left 0.15s;
}
.sw.on {
  background: #3fd16a;
}
.sw.on::after {
  left: 26px;
}
/* HUD */
#game {
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
#game .btn,
.modal {
  pointer-events: auto;
}
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 760px;
}
.hud .dist {
  display: none;
}
.hearts {
  display: flex;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 0 3px 0 #2b170a;
}
.hearts .ic {
  width: 28px;
  height: 28px;
}
.progress {
  position: relative;
  width: min(560px, 100%);
  height: 24px;
  margin-top: 10px;
  border-radius: 99px;
  background: var(--cream);
  border: 3px solid var(--ink);
  overflow: hidden;
  box-shadow: 0 3px 0 #2b170a;
}
.progress i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: repeating-linear-gradient(
    45deg,
    #ff6a5c 0 10px,
    #ff9a5c 10px 20px
  );
}
.progress span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.msg {
  margin-top: 14px;
  min-height: 40px;
  padding: 6px 20px;
  border-radius: 99px;
  background: var(--cream);
  border: 3px solid var(--ink);
  font-weight: 700;
  font-size: 20px;
  color: #c0392b;
  opacity: 0;
  transition: opacity 0.25s;
  box-shadow: 0 4px 0 #2b170a;
}
.msg.on {
  opacity: 1;
}
.count {
  position: absolute;
  left: 50%;
  top: 40%;
  margin-left: -80px;
  margin-top: -80px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 92px;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  background: radial-gradient(circle at 35% 30%, #ff7a7e, #e5484d 70%);
  border: 7px solid var(--ink);
  box-shadow:
    0 0 0 5px var(--cream),
    0 8px 0 #2b170a;
}
.count.on {
  display: flex;
  animation: pop 0.9s ease-out infinite;
}
@keyframes pop {
  0% {
    opacity: 0.2;
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
.pads {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left));
  pointer-events: none;
}
.pad {
  width: clamp(76px, 16vw, 110px);
  height: clamp(76px, 16vw, 110px);
  border-radius: 50%;
  background: #fff4d699;
  border: 4px solid #4a2a14aa;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.08s;
}
.pad.on {
  background: #ffb81fee;
  border-color: var(--ink);
}
.tutorial {
  position: absolute;
  left: 0;
  right: 0;
  top: 36%;
  display: none;
  justify-content: center;
}
.tutorial.on {
  display: flex;
}
.tutorial div {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  border-radius: 99px;
  background: var(--cream);
  border: 3px solid var(--ink);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 5px 0 #2b170a;
}
.tutorial .ic {
  width: 36px;
  height: 36px;
}
@media (pointer: fine) {
  .pads {
    display: none;
  }
}
/* modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #2b170aa0;
  z-index: 20;
}
.modal.hidden {
  display: none;
}
.card {
  width: min(440px, 100%);
  max-height: 100%;
  overflow: hidden;
  text-align: center;
  border-radius: 28px;
  padding: clamp(12px, 2.4vh, 22px) 22px clamp(12px, 2.2vh, 20px);
}
.card h2 {
  margin: 6px 0 2px;
  font-size: clamp(24px, 4.6vh, 40px);
  color: #c0392b;
}
.medal {
  width: clamp(50px, 9vh, 78px);
  height: clamp(50px, 9vh, 78px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(#ffe27a, #ffb81f);
  border: 4px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
}
.medal .ic {
  width: 66%;
  height: 66%;
}
.stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: clamp(4px, 1.2vh, 12px) 0 clamp(4px, 0.8vh, 8px);
}
.stars .ic {
  width: clamp(34px, 6.4vh, 58px);
  height: clamp(34px, 6.4vh, 58px);
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: clamp(6px, 1vh, 10px) 0 clamp(8px, 1.6vh, 16px);
}
.stats div {
  padding: clamp(4px, 0.9vh, 8px);
  border-radius: 12px;
  background: #fffaf0;
  border: 2px dashed #b88a4a;
  font-weight: 600;
  color: #6b4a2c;
  font-size: 14px;
}
.stats b {
  display: block;
  font-size: clamp(17px, 2.8vh, 24px);
  color: var(--ink);
}
.mbtns {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.3vh, 12px);
}
.mbtns .btn {
  width: 100%;
  padding-top: clamp(7px, 1.3vh, 12px);
  padding-bottom: clamp(7px, 1.3vh, 12px);
}
#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 25;
}
#confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: fall 2.4s ease-in forwards;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(700deg);
  }
}
.logo-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(60px, 17vh, 140px);
  object-fit: contain;
  margin: 0 auto;
}
.logo-img.big {
  max-width: 90vw;
  height: clamp(80px, 24vh, 200px);
}
@media (max-width: 380px) {
  .grid {
    gap: 6px;
  }
  .lv {
    min-height: 0;
    font-size: 18px;
    border-radius: 12px;
  }
  .lv .st .ic {
    width: 10px;
    height: 10px;
  }
  .lv.locked .ic {
    width: 22px;
    height: 22px;
  }
  .panel {
    padding: 10px;
  }
  .phead h2 {
    font-size: 20px;
  }
}
@media (max-width: 520px) {
  .grid {
    gap: 8px;
  }
  .hud .pill {
    padding: 4px 10px;
  }
  .btn {
    padding: 10px 14px;
  }
  .panel {
    padding: 12px;
  }
  .lv {
    min-height: 0;
  }
  .tabs {
    gap: 5px;
    padding-bottom: 8px;
  }
  .tab {
    padding: 5px 2px;
    font-size: 11.5px;
    line-height: 1.05;
    border-width: 2px;
    border-radius: 10px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .cards {
    gap: 8px;
  }
  .cards article {
    padding: 8px 8px 9px;
    border-radius: 14px;
  }
  .art {
    height: clamp(40px, 7.5vh, 60px);
    gap: 8px;
  }
  .art .ic.xl {
    width: clamp(26px, 5vh, 40px);
    height: clamp(26px, 5vh, 40px);
  }
  .crate {
    width: clamp(28px, 5vh, 40px);
    height: clamp(28px, 5vh, 40px);
  }
  .cards h3 {
    font-size: 14px;
    margin: 6px 0 3px;
    line-height: 1.1;
  }
  .cards p {
    font-size: 11.5px;
    line-height: 1.28;
  }
  .phead {
    margin-bottom: 8px;
  }
}
@media (max-height: 640px) and (max-width: 520px) {
  .cards p {
    font-size: 11px;
    line-height: 1.22;
  }
  .cards h3 {
    font-size: 13px;
  }
  .art {
    height: 36px;
  }
}
@media (max-height: 520px) {
  #mSub {
    display: none;
  }
  .card h2 {
    margin: 2px 0;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .panel {
    padding: 10px 14px;
  }
  .cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .cards article {
    padding: 8px;
    min-width: 0;
  }
  .cards p {
    overflow-wrap: anywhere;
    font-size: 12.5px;
  }
  .cards h3 {
    font-size: 15px;
  }
  .art {
    height: 50px;
  }
  .grid {
    gap: 8px;
  }
  .lv {
    min-height: 0;
    aspect-ratio: auto;
    height: 54px;
  }
  .lv .st .ic {
    width: 12px;
    height: 12px;
  }
  .card {
    padding: 12px 18px;
  }
  .stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .stats div {
    font-size: 11px;
  }
  .mbtns {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .mbtns .btn {
    flex: 1 1 30%;
    width: auto;
  }
}
@media (max-height: 380px) {
  .medal {
    display: none;
  }
  .cards .art {
    display: none;
  }
  .cards p {
    font-size: 11.5px;
  }
  .cards h3 {
    margin-top: 0;
  }
  .stars {
    margin: 2px 0;
  }
  .card {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .mbtns .btn {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .count.on {
    animation: none;
  }
  .hitflash.on {
    animation: none;
    opacity: 0.5;
  }
}
@media (max-height: 520px) {
  .setlist {
    gap: 8px;
  }
  .setrow {
    padding: 7px 12px;
    font-size: 17px;
    gap: 10px;
    box-shadow: 0 4px 0 var(--ink);
  }
  .setrow .ic {
    width: 24px;
    height: 24px;
  }
  .small {
    display: none;
  }
  .panel.narrow {
    padding: 10px 14px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .panel.narrow {
    width: min(640px, 100%);
  }
  .setlist {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .phead {
    margin-bottom: 8px;
  }
  .phead h2 {
    font-size: 22px;
  }
}

/* settings on short landscape screens */
@media (max-height: 460px) {
  #settings .setlist {
    gap: 6px;
  }
  #settings .setrow {
    padding: 6px 12px;
    font-size: 16px;
  }
  #settings .muted.small {
    display: none;
  }
}
@media (max-height: 360px) {
  #settings .setlist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }
  #settings .setrow {
    padding: 5px 10px;
    font-size: 14px;
  }
  #settings .setrow .ic {
    width: 20px;
    height: 20px;
  }
}
