:root {
  --text: #283624;
  --muted: #61715f;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(49, 93, 48, 0.18);
  --accent: #d98b2f;
  --app-height: 100vh;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: var(--app-height);
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: linear-gradient(180deg, #8fdcf4 0%, #d8f4d4 55%, #86c96d 100%);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

button,
a {
  font: inherit;
}

.page-shell {
  width: 100vw;
  height: var(--app-height);
  min-width: 320px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, min(56vh, 450px)) minmax(180px, 1fr);
  gap: 22px;
  align-items: center;
  justify-items: center;
  padding: 24px;
}

.game-frame {
  position: relative;
  width: min(100%, 56.25vh);
  max-width: 450px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 24px;
  background: #9ee3f4;
  box-shadow: 0 24px 70px rgba(39, 92, 56, 0.28);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 13px;
  left: 13px;
  right: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hud-bar,
.hud-lives,
.panel-block,
.home-link,
.overlay {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(39, 92, 56, 0.14);
  backdrop-filter: blur(10px);
}

.hud-bar {
  min-width: 132px;
  min-height: 42px;
  padding: 7px 13px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-weight: 900;
}

.hud-bar span {
  color: var(--muted);
  font-size: 13px;
}

.hud-bar strong {
  color: var(--accent);
  font-size: 21px;
}

.hud-lives {
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 999px;
  color: #df4747;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
  background: rgba(244, 255, 246, 0.72);
}

.overlay[hidden] { display: none; }

.overlay-icon {
  width: min(52%, 190px);
  aspect-ratio: 1;
  object-fit: contain;
  margin-bottom: 18px;
}

.overlay h1 {
  margin: 0 0 10px;
  font-size: clamp(36px, 10vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.overlay p {
  max-width: 318px;
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 800;
}

.overlay button {
  min-width: 124px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: #d98b2f;
  color: #251505;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 0 #9c5a21;
}

.overlay button:active {
  transform: translateY(4px);
  box-shadow: 0 6px 0 #9c5a21;
}

.side-panel {
  width: min(100%, 280px);
  display: grid;
  gap: 14px;
}

.side-panel-left { justify-self: end; }
.side-panel-right { justify-self: start; }

.home-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
}

.panel-block {
  padding: 18px;
  border-radius: 16px;
}

.panel-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.panel-block strong {
  color: var(--accent);
  font-size: 28px;
}

.panel-block p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  font-weight: 700;
}

@media (max-width: 820px) {
  .page-shell {
    display: block;
    padding: 0;
  }

  .game-frame {
    width: 100vw;
    height: var(--app-height);
    max-width: none;
    border-radius: 0;
  }

  .side-panel {
    display: none;
  }

  .hud {
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
  }
}
