:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071922;
  color: #fff6db;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 70%, rgba(52, 130, 153, 0.28), transparent 44%),
    linear-gradient(135deg, #06131b, #0a2a34 58%, #041018);
}

button {
  border: 1px solid rgba(255, 213, 126, 0.55);
  border-radius: 8px;
  padding: 9px 14px;
  background: linear-gradient(#2a1c10, #100b07);
  color: #ffe9a8;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 7px 16px rgba(0, 0, 0, 0.35);
}

button:hover {
  filter: brightness(1.15);
}

.shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.game-wrap {
  position: relative;
  width: min(100%, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  border: 2px solid #5f4527;
  border-radius: 8px;
  overflow: hidden;
  background: #08202b;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.hud {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.top-left {
  top: 12px;
  left: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.top-right {
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.bottom {
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: min(760px, calc(100% - 24px));
  color: #dbeeff;
  text-shadow: 0 2px 3px #001018;
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 800;
}

.bottom span {
  border: 1px solid rgba(91, 184, 255, 0.45);
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(6, 23, 37, 0.64);
}

.portrait {
  position: relative;
  width: 88px;
  height: 104px;
  border: 3px solid #8c6235;
  border-radius: 8px;
  background: linear-gradient(#17151b, #0c0909);
  box-shadow: inset 0 0 0 2px #180d05, 0 8px 22px rgba(0, 0, 0, 0.4);
}

.portrait .face {
  position: absolute;
  left: 21px;
  top: 36px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffd58e;
  color: #1d1210;
  font-size: 28px;
  font-weight: 900;
}

.portrait .hat {
  position: absolute;
  left: 10px;
  top: 16px;
  width: 68px;
  height: 18px;
  border-radius: 50%;
  background: #15131b;
  transform: rotate(-8deg);
}

.portrait .hat::before {
  content: "";
  position: absolute;
  left: 24px;
  top: -28px;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 38px solid #16131c;
}

.portrait span {
  position: absolute;
  left: 3px;
  bottom: 2px;
  min-width: 28px;
  padding: 2px 4px;
  border-radius: 5px;
  background: #27160b;
  color: #ffe8a0;
  text-align: center;
  font-weight: 900;
}

.bars {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

.meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 34px;
  border: 1px solid rgba(232, 170, 78, 0.6);
  border-radius: 8px;
  padding: 6px 12px;
  background: rgba(15, 13, 12, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  text-shadow: 0 2px 2px #000;
}

.meter strong {
  color: #ffc04f;
}

.meter span {
  font-weight: 900;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(rgba(2, 9, 14, 0.58), rgba(2, 9, 14, 0.76));
}

.overlay.hidden {
  display: none;
}

.overlay > div {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 209, 124, 0.55);
  border-radius: 8px;
  padding: 24px;
  background: rgba(8, 12, 18, 0.88);
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.overlay h1 {
  margin: 0 0 10px;
  color: #ffe28a;
  font-size: clamp(28px, 4.2vw, 44px);
  letter-spacing: 0;
}

.overlay p {
  margin: 0 0 20px;
  color: #e8f6ff;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .top-left {
    gap: 8px;
  }

  .portrait {
    width: 64px;
    height: 78px;
  }

  .portrait .face {
    left: 14px;
    top: 27px;
    width: 35px;
    height: 35px;
    font-size: 20px;
  }

  .portrait .hat {
    left: 7px;
    top: 13px;
    width: 50px;
  }

  .bars {
    min-width: 138px;
  }

  .meter {
    min-height: 28px;
    padding: 4px 8px;
    gap: 10px;
    font-size: 12px;
  }
}
