:root {
  --bg: #bceefa;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --text: #28402b;
  --muted: #687a67;
  --line: rgba(60, 104, 68, 0.18);
  --accent: #d88739;
  --app-height: 100vh;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: var(--app-height);
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.48), transparent 34%),
    linear-gradient(180deg, #85d8f5 0%, #d9f7f2 58%, #9ad381 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: #91def5;
  box-shadow: 0 24px 70px rgba(37, 91, 70, 0.28);
}

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

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

.hud-chip,
.panel-block,
.home-link,
.overlay {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(37, 91, 70, 0.16);
  backdrop-filter: blur(10px);
}

.hud-chip {
  min-width: 92px;
  padding: 9px 12px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

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

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

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

.overlay[hidden] {
  display: none;
}

.overlay-icon {
  width: min(50%, 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: 310px;
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 700;
}

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

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

.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;
  }

  .hud-chip {
    min-width: 82px;
    padding: 8px 10px;
  }
}
