* {
  box-sizing: border-box;
}
:root {
  color: #fff4ef;
  background: #13091b;
  font:
    700 16px/1.35 system-ui,
    sans-serif;
}
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 60% 45%, #431029 0, transparent 65%),
    linear-gradient(130deg, #170d26, #100814);
  overscroll-behavior: none;
}
main {
  --w: min(52vw, calc((100svh - 124px) * 0.8235), 540px);
  display: grid;
  grid-template-columns: 280px var(--w);
  grid-template-areas: 'head game' 'foot game';
  gap: 28px clamp(32px, 7vw, 110px);
  padding: 12px;
}
header {
  grid-area: head;
  align-self: end;
}
nav,
nav div,
.hud,
footer div {
  display: flex;
  align-items: center;
}
nav,
.hud {
  justify-content: space-between;
}
nav div {
  gap: 8px;
}
a,
button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}
a {
  text-decoration: none;
}
a:hover {
  color: #ff538c;
}
button {
  border: 1px solid #ffffff38;
  border-radius: 9px;
  background: #231426;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
#pause {
  width: 36px;
}
h1 {
  font: 1000 italic clamp(60px, 7vw, 86px)/0.87 system-ui;
  letter-spacing: -0.075em;
  margin: 34px 0 20px;
  text-shadow: 0 5px #881235;
}
h1 span {
  display: block;
  color: #ff367a;
}
p {
  color: #f2cbdc;
  font-weight: 550;
  margin: 0;
  line-height: 1.5;
}
section {
  grid-area: game;
}
.hud {
  font:
    700 13px ui-monospace,
    monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 4px 10px;
  color: #e2b4cd;
}
.hud b {
  font-size: 21px;
  color: white;
  letter-spacing: 0;
}
#best {
  color: #ffd54a;
}
.arena {
  position: relative;
  overflow: hidden;
  border: 2px solid #ff417b;
  box-shadow:
    0 0 28px #f913581f,
    inset 0 0 30px #f913581c;
  border-radius: 16px;
  background: #100b21;
}
canvas {
  width: 100%;
  aspect-ratio: 420/510;
  display: block;
  touch-action: none;
  cursor: crosshair;
  outline-offset: -6px;
}
.meter {
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: #49203c;
  pointer-events: none;
}
.meter i {
  display: block;
  height: 100%;
  background: #6effeb;
  transform-origin: left;
}
#status {
  text-align: center;
  color: #ffe1ee;
  font-size: 15px;
  margin-top: 12px;
  min-height: 23px;
}
footer {
  grid-area: foot;
  font-size: 14px;
  color: #f7dbe6;
}
footer div {
  gap: 13px;
  margin: 0 0 15px;
}
footer i {
  width: 15px;
  height: 15px;
  margin-left: 3px;
}
.gem {
  background: #64ffe9;
  transform: rotate(45deg);
  border: 3px double #10353b;
}
.ghost {
  background: #ff367a;
  border-radius: 50% 50% 15% 15%;
}
.shield {
  border: 2px solid #ffda53;
  border-radius: 50%;
}
#panel:not([hidden]) {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: #0d071dcc;
  backdrop-filter: blur(4px);
}
#panel small {
  color: #ff75a3;
  text-transform: uppercase;
  letter-spacing: 2px;
}
h2 {
  font-size: clamp(28px, 5vw, 44px);
  margin: 6px 0;
  letter-spacing: -0.04em;
}
#again {
  margin-top: 20px;
  background: #ffd947;
  color: #210d24;
  font-size: 18px;
  padding: 12px 36px;
  box-shadow: 0 5px #bd6526;
}
@media (max-width: 740px), (max-aspect-ratio: 1/1) {
  main {
    --w: min(calc(100vw - 22px), calc((100svh - 178px) * 0.8235), 530px);
    grid-template-columns: max(244px, var(--w));
    grid-template-areas: 'head' 'game';
    gap: 10px;
    padding: 8px 0;
  }
  header p,
  footer {
    display: none;
  }
  h1 {
    font-size: clamp(30px, 8vw, 40px);
    text-align: center;
    margin: 10px 0 5px;
    text-shadow: 0 3px #881235;
  }
  h1 span {
    display: inline;
  }
  .hud {
    font-size: 11px;
  }
  .hud b {
    font-size: 17px;
  }
  #status {
    font-size: 13px;
    margin-top: 8px;
  }
}
@media (max-height: 510px) and (orientation: landscape) {
  main {
    --w: calc((100svh - 88px) * 0.8235);
    grid-template-columns: 200px var(--w);
    grid-template-areas: 'head game';
    gap: 18px;
    padding: 5px;
  }
  header {
    align-self: center;
  }
  header p {
    display: block;
    font-size: 13px;
  }
  footer {
    display: none;
  }
  h1 {
    font-size: 44px;
    text-align: left;
    margin: 15px 0;
  }
  h1 span {
    display: block;
  }
  nav {
    font-size: 13px;
  }
  nav button {
    font-size: 11px;
    padding: 6px;
  }
  .hud {
    font-size: 10px;
  }
  .hud b {
    font-size: 14px;
  }
  #status {
    font-size: 11px;
    margin-top: 4px;
  }
}
#panel > div {
  width: 96%;
  max-height: 100%;
  overflow: auto;
  padding: 6px 0 12px;
}
#replay {
  margin: 10px auto 0;
  width: 90%;
}
#replay svg {
  width: 100%;
  height: clamp(72px, 20svh, 185px);
  background: #100b21;
  border: 1px solid #673355;
  border-radius: 12px;
}
#past,
#present {
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
  opacity: 0.75;
}
figcaption {
  font-size: 13px;
}
figcaption b {
  color: #ffdb42;
}
figcaption strong {
  color: #ff75a3;
}
@media (max-height: 510px) {
  #replay svg {
    height: 52px;
  }
  #panel h2 {
    font-size: 20px;
    margin: 0;
  }
  #panel #again {
    margin-top: 5px;
    padding: 6px 14px;
  }
  #replay {
    margin-top: 3px;
  }
}
#mode {
  color: #66ffe4;
  border-color: #66ffe466;
  margin-bottom: 14px;
}
#mode[aria-pressed='true'] {
  background: #66ffe4;
  color: #130920;
}
#sharing {
  margin-top: 8px;
  text-align: center;
}
#copy {
  width: 100%;
  margin-top: 6px;
  font-size: 16px;
}
@media (max-width: 740px), (max-aspect-ratio: 1/1) {
  .title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-top: 7px;
  }
  .title h1,
  #mode {
    margin: 0;
  }
}
@media (max-height: 510px) and (orientation: landscape) {
  #mode {
    margin: 8px 0;
  }
  header p {
    display: none;
  }
}
