:root {
  --juniora-h: 56px;
  --board-size: min(92vmin, 400px)
}
* {
  box-sizing: border-box
}
html,
body {
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent
}
body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #280E44;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--jn-font);
  font-weight: 700;
  padding: 16px 12px calc(var(--juniora-h) + 16px);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none
}
h1,
h2,
button {
  font-family: var(--jn-font)
}
h1 {
  word-spacing: normal;
  font-size: clamp(2.2rem, 9vmin, 4rem);
  font-weight: 900;
  color: #fcc74c;
  text-shadow: #EF476F 2px 2px 0px,#9BA2FF 4px 4px 0px,#470FF4 6px 6px 0px;
  margin: 0.4em 0 0.3em;
  text-align: center
}
.instruction {
  padding: 5px 25px 5px 10px;
  color: #9BA2FF;
  margin-bottom: 24px;
  display: flex;
  border-radius: 4px;
  align-items: flex-end;
  line-height: 1.5;
  font-size: clamp(0.8rem, 2.4vmin, 1rem);
  max-width: 95vw
}
.keys {
  display: grid;
  grid-template: 30px 30px/30px 30px 30px;
  gap: 4px;
  margin-right: 18px;
  flex-shrink: 0
}
kbd {
  border: 2px solid #9BA2FF;
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 0 #9BA2FF;
  display: grid;
  place-items: center;
  font-size: 1rem
}
kbd:nth-of-type(1) {
  grid-area: 1/2
}
kbd:nth-of-type(2) {
  grid-area: 2/1
}
kbd:nth-of-type(3) {
  grid-area: 2/2
}
kbd:nth-of-type(4) {
  grid-area: 2/3
}
.game {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: var(--board-size);
  height: var(--board-size);
  max-width: 100%
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none
}
button {
  position: absolute;
  padding: 18px 22px;
  background: #470FF4;
  font-size: clamp(0.8rem, 2.4vmin, 1rem);
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  box-shadow: 2px 10px 0 0 #15044d;
  transition: all 0.15s ease
}
button:hover {
  background: #3e0adf
}
button:active {
  box-shadow: 2px 2px 0 0 #15044d;
  transform: translate(0px, 8px)
}
button.hide {
  opacity: 0;
  visibility: hidden
}
dialog {
  width: min(92vw, 600px);
  min-height: min(70vh, 420px);
  max-width: 600px;
  padding: 25px;
  border: none;
  background: #fcc74c;
  color: #280E44;
  box-shadow: 3px 3px 0 0 #EF476F,6px 6px 0 0 #9BA2FF,9px 9px 0 0 #470FF4
}
dialog .inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 360px
}
dialog button {
  position: relative;
  margin-top: 16px;
  align-self: flex-start
}
dialog p,
dialog span {
  font-size: clamp(1rem, 3vmin, 1.25rem);
  overflow-wrap: break-word;
  word-break: break-all
}
dialog.ishighscore .highscore {
  opacity: 1;
  visibility: visible
}
dialog h2 {
  font-size: clamp(1.4rem, 4.5vmin, 2rem);
  font-weight: 700;
  color: #EF476F;
  margin: 0.5rem 0 1.5rem
}
dialog .score {
  position: relative;
  display: block;
  padding: 16px;
  background: #fcbf33;
  border-radius: 4px;
  width: 100%;
  margin-bottom: 16px
}
dialog .highscore {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  display: inline-block;
  font-size: 0.85rem;
  background-color: #470FF4;
  color: white;
  top: 75px;
  right: 0;
  padding: 5px 10px;
  border-radius: 2px
}
dialog::-webkit-backdrop {
  background: rgba(40, 14, 68, 0.5)
}
dialog::backdrop {
  background: rgba(40, 14, 68, 0.5)
}
.mute {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  color: #9BA2FF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50
}
.mute .icon {
  position: absolute;
  width: 28px;
  height: 28px;
  opacity: 0
}
.mute input:checked ~ .icon-off {
  opacity: 1
}
.mute input:not(:checked) ~ .icon-on {
  opacity: 1
}
.mute input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  clip-path: rect(0, 0, 0, 0)
}

.mobile-controls {
  direction: ltr;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--juniora-h) + 14px);
  display: none;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px;
  gap: 6px;
  z-index: 90;
  user-select: none
}
.mc-btn {
  position: relative;
  background: #470FF4;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 3px 0 #15044d;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  font-family: inherit;
  transition: none
}
.mc-btn:hover {
  background: #470FF4
}
.mc-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #15044d;
  background: #3e0adf
}
.mc-up {
  grid-column: 2;
  grid-row: 1
}
.mc-left {
  grid-column: 1;
  grid-row: 2
}
.mc-down {
  grid-column: 2;
  grid-row: 2
}
.mc-right {
  grid-column: 3;
  grid-row: 2
}
@media (hover: none) and (pointer: coarse) {
  .mobile-controls {
    display: grid
  }
  body {
    padding-bottom: calc(var(--juniora-h) + 180px)
  }
  .instruction {
    display: none
  }
}
@media (max-width: 540px) {
  .mobile-controls {
    display: grid
  }
}

.juniora-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--juniora-h);
  background: #292929;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0 16px
}
.juniora-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-family: var(--jn-font);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.9
}
.juniora-logo {
  width: 28px;
  height: auto;
  display: block
}
.juniora-text {
  letter-spacing: normal
}
@media (max-width: 480px) {
  :root {
    --juniora-h: 52px
  }
  .juniora-link {
    font-size: 12.5px
  }
  h1 {
    font-size: clamp(2.2rem, 10vmin, 3.4rem)
  }
  dialog {
    padding: 18px
  }
  .mute {
    top: 12px;
    right: 12px
  }
}

@media (max-height: 520px) {
  body {
    padding: 4px 12px calc(var(--juniora-h) + 4px);
    justify-content: center
  }
  h1 {
    font-size: 1.5rem;
    margin: 0 0 4px;
    text-shadow: #EF476F 1px 1px 0,#470FF4 2px 2px 0
  }
  .instruction {
    display: none
  }
  .game {
    width: min(var(--board-size), 62vh);
    height: min(var(--board-size), 62vh)
  }
  .mobile-controls {
    left: 10px;
    right: auto;
    transform: none;
    bottom: calc(var(--juniora-h) + 6px);
    grid-template: 42px 42px/42px 42px 42px
  }
  .mc-btn {
    font-size: 16px
  }
}

.juniora-overlay {
  height: var(--juniora-h)
}
.juniora-link {
  font-family: var(--jn-font);
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 700;
  line-height: 1.9;
  letter-spacing: normal;
  gap: 8px;
  white-space: nowrap
}
.juniora-logo {
  width: 22px;
  height: auto
}
.juniora-text {
  letter-spacing: normal
}
@media (max-height: 520px) {
  .juniora-link {
    font-size: 12px
  }
  .juniora-logo {
    width: 18px
  }
}

@media (max-height: 700px) and (min-height: 521px) {
  h1 {
    font-size: 1.7rem;
    margin: 0.15em 0 0.2em
  }
  .instruction {
    margin-bottom: 10px;
    font-size: 12px
  }
  body {
    padding-top: 8px
  }
}

.mc-btn, .jump-btn, #jumpBtn, #controls button, .mc-fire {
  font-family: var(--jn-font);
  font-weight: 700;
}
