* {
  box-sizing: border-box;
}
:root {
  color: #fff;
  font-family:
    ui-rounded, 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  font-weight: 800;
  background: #064069;
}
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
#sea {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
main {
  --w: min(31vw, calc((100svh - 108px) * 0.672), 480px);
  display: grid;
  grid-template-columns: 205px var(--w) 205px;
  grid-template-areas: 'head tank chain' '. stir .';
  gap: 18px clamp(22px, 5vw, 90px);
  align-items: center;
  padding: 12px;
}
header {
  grid-area: head;
  text-align: center;
}
h1 {
  margin: 0 -12px 30px;
  transform: rotate(-8deg);
  filter: drop-shadow(0 6px 0 #02274344);
}
svg {
  display: block;
  width: 100%;
}
.stats,
#next,
h2 {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 14px;
  font-weight: 900;
  color: #b6f5ff;
  text-shadow: 0 2px 2px #003257;
}
.stats strong {
  display: block;
  font-size: 46px;
  color: white;
  letter-spacing: -2px;
  line-height: 1.2;
  margin: 2px 0 22px;
  text-shadow: 0 4px #043357;
}
#best {
  color: #ffdf73;
  font-size: 31px;
}
nav {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 34px;
}
button {
  cursor: pointer;
  font: inherit;
  color: white;
  background: #043557bd;
  border: 2px solid #91e7ff80;
  border-radius: 50px;
  box-shadow: 0 4px 0 #022942;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
nav button {
  width: 43px;
  height: 43px;
  font-size: 21px;
  display: grid;
  place-items: center;
  padding: 9px;
  line-height: 1;
}
button:hover {
  filter: brightness(1.14);
}
button:active {
  transform: translateY(2px);
  box-shadow: none;
}
:focus-visible {
  outline: 3px solid #ffdc67;
  outline-offset: 3px;
}
#tank {
  grid-area: tank;
  position: relative;
  border-radius: 26px;
  background: linear-gradient(#32c2d9ba, #0876a7b8 49%, #084170dc);
  box-shadow:
    inset 0 0 0 3px #b6faffad,
    inset 0 0 0 8px #91f8ff20,
    inset 0 -9px 0 #58c6e03d,
    0 7px 0 #032b50,
    0 15px 42px #00143152;
  overflow: hidden;
}
#game {
  width: 100%;
  aspect-ratio: 430/640;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
#next {
  position: absolute;
  right: 4%;
  top: 2.3%;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-align: center;
  pointer-events: none;
}
#next canvas {
  display: block;
  width: clamp(32px, 4vw, 48px);
  margin: auto;
}
#hint,
#toast {
  position: absolute;
  top: 41%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  font-size: clamp(14px, 1.2vw, 18px);
  width: 95%;
  text-shadow: 0 2px 4px #01416e;
}
#toast {
  top: 30%;
  font-size: 24px;
  color: #fff2a3;
}
aside {
  grid-area: chain;
  justify-self: center;
}
h2 {
  margin: 0 0 16px;
}
ol {
  padding: 0;
  margin: 0;
  list-style: none;
  display: grid;
  gap: min(1svh, 10px);
}
li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  text-shadow: 0 2px 3px #012d52;
}
li canvas {
  width: min(5.6svh, 47px);
  height: auto;
  filter: drop-shadow(0 2px 0 #00294470);
}
#stir {
  grid-area: stir;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
}
.fill {
  position: absolute;
  inset: 0;
  background: #118bb0;
  transform-origin: left;
  z-index: -1;
  transition: transform 0.2s;
}
.label {
  width: 26px;
}
small {
  font-variant-numeric: tabular-nums;
  color: #b6f5ff;
}
#stir.ready,
.ready .fill,
#primary {
  background: #ffda60;
  color: #123250;
  border-color: #fff0a7;
}
.ready small {
  color: inherit;
}
dialog {
  width: min(360px, 90vw);
  text-align: center;
  background: #063c63;
  color: white;
  border: 3px solid #76d7ed;
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 10px 0 #022646;
}
dialog::backdrop {
  background: #02152eb5;
}
dialog h2 {
  font-size: 26px;
  letter-spacing: 0;
  text-transform: none;
  color: white;
}
#copy {
  line-height: 1.5;
  font-weight: 600;
}
dialog button {
  width: 100%;
  padding: 12px;
  margin-top: 15px;
}
@media (max-width: 850px), (max-aspect-ratio: 11/10) {
  main {
    --w: min(
      calc(100vw - 20px),
      calc((100svh - 168px - env(safe-area-inset-bottom)) * 0.672),
      490px
    );
    grid-template-columns: max(246px, var(--w));
    grid-template-areas: 'head' 'tank' 'chain' 'stir';
    gap: 9px;
    padding: 6px 0 max(10px, env(safe-area-inset-bottom));
  }
  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  h1 {
    width: 23%;
    margin: 0;
  }
  .stats {
    display: flex;
    gap: 12px;
    font-size: 10px;
    letter-spacing: 1px;
  }
  .stats strong,
  #best {
    font-size: 19px;
    margin: 0;
    letter-spacing: -0.5px;
  }
  nav {
    gap: 4px;
    margin: 0;
  }
  nav button {
    width: 30px;
    height: 30px;
    padding: 5px;
    font-size: 15px;
  }
  aside {
    width: 100%;
  }
  aside h2,
  li span {
    display: none;
  }
  ol {
    display: flex;
    justify-content: space-between;
    gap: 0;
  }
  li {
    width: 9.6%;
  }
  li canvas {
    width: 100%;
  }
  #stir {
    height: 39px;
    font-size: 15px;
  }
  #tank {
    border-radius: 19px;
  }
  #hint {
    font-size: 13px;
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  main {
    --w: min(39vw, calc((100svh - 24px) * 0.672));
    grid-template-columns: 120px var(--w) 110px;
    grid-template-areas: 'head tank chain' 'stir tank chain';
    gap: 8px 22px;
    grid-template-rows: 1fr auto;
  }
  header,
  .stats,
  ol {
    display: grid;
  }
  h1 {
    width: 100%;
    margin-bottom: 14px;
  }
  .stats strong,
  #best {
    font-size: 21px;
  }
  nav {
    margin-top: 12px;
  }
  ol {
    grid-template-columns: 1fr 1fr;
  }
  li {
    width: min(14vh, 46px);
  }
  li span,
  aside h2 {
    display: none;
  }
  #stir {
    font-size: 11px;
    gap: 4px;
  }
  .label {
    display: none;
  }
  #next canvas {
    width: 22px;
  }
  #next {
    font-size: 8px;
  }
  #hint {
    font-size: 11px;
  }
}
#next {
  pointer-events: auto;
  right: 2%;
  top: 1.5%;
  background: #03426855;
  border: 1px solid #b6faff66;
  border-radius: 13px;
  padding: 4px 7px 0;
  box-shadow: none;
  color: white;
  letter-spacing: 1px;
}
#hint {
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.15;
}
#hint span {
  font-size: 14px;
  color: #d6faff;
}
.biggest canvas {
  border-radius: 50%;
  box-shadow: 0 0 0 2px #ffdf73;
  background: #ffda4626;
}
@media (max-height: 560px) and (orientation: landscape) {
  #next {
    font-size: 7px;
    padding: 2px;
  }
  #hint {
    font-size: 15px;
  }
  #hint span {
    font-size: 11px;
  }
}
#next.left {
  right: auto;
  left: 2%;
}
.arcade {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  color: white;
  background: #043557bd;
  border: 2px solid #91e7ff80;
  border-radius: 50%;
  box-shadow: 0 4px 0 #022942;
  text-decoration: none;
  font-size: 22px;
}
@media (max-width: 850px), (max-aspect-ratio: 11/10), (max-height: 560px) {
  .arcade {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }
  nav {
    gap: 3px;
  }
}
@media (max-width: 385px) {
  .stats > div + div {
    display: none;
  }
}
#next.suggest {
  background: #ffe175;
  color: #032946;
  border-color: #fff5ca;
  letter-spacing: 0;
}
