:root {
  color-scheme: dark;
  --bg: #101615;
  --panel: rgba(25, 31, 30, 0.82);
  --text: #f2efe6;
  --muted: #a7b0aa;
  --line: rgba(242, 239, 230, 0.14);
  --accent: #e2b15f;
  --danger: #e16d55;
  --good: #7fd082;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
  min-height: 480px;
  background:
    radial-gradient(circle at 30% 20%, rgba(127, 208, 130, 0.08), transparent 32%),
    linear-gradient(180deg, #14201b 0%, #101615 100%);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: crosshair;
}

.hud {
  position: absolute;
  top: 14px;
  left: 50%;
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.chip,
.help,
.overlay-panel,
.loading-panel,
.level-up-panel,
.skill-slot {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.chip strong {
  color: var(--accent);
  font-weight: 800;
}

.meter {
  width: 100%;
  height: 14px;
  border: 1px solid rgba(242, 239, 230, 0.16);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.34);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #79c8ef, var(--good));
}

.help {
  position: fixed;
  top: 82px;
  right: 16px;
  max-width: 310px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.skill-hud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.skill-slot {
  width: 54px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.skill-slot img {
  width: 100%;
  height: 54px;
  display: block;
  object-fit: cover;
}

.skill-slot span {
  position: absolute;
  right: 4px;
  bottom: 3px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff6d8;
  font-size: 11px;
  font-weight: 800;
}

.overlay,
.loading-overlay,
.level-up-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 9, 0.42);
  pointer-events: auto;
}

.overlay[hidden],
.loading-overlay[hidden],
.level-up-overlay[hidden] { display: none; }

.overlay-panel,
.loading-panel,
.level-up-panel {
  width: min(470px, 100%);
  padding: 24px;
  border-radius: 8px;
  text-align: center;
}

.loading-overlay {
  z-index: 8;
  background: rgba(7, 9, 9, 0.72);
}

.loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-panel img {
  width: 116px;
  height: 116px;
  object-fit: contain;
  image-rendering: pixelated;
}

.loading-panel strong {
  color: #fff3c7;
  font-size: 20px;
}

.loading-meter {
  width: min(320px, 100%);
  height: 12px;
  border: 1px solid rgba(242, 239, 230, 0.18);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.34);
}

.loading-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #79c8ef, #7fd082);
}

.loading-panel small {
  color: var(--muted);
  font-weight: 800;
}

.level-up-panel {
  width: min(820px, 100%);
}

.overlay-panel h1,
.level-up-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 8vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.overlay-panel p,
.level-up-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.actions,
.choice-grid {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

button,
.link-button {
  min-height: 42px;
  border: 1px solid rgba(242, 239, 230, 0.16);
  border-radius: 8px;
  padding: 0 16px;
  background: #dca54b;
  color: #1a1207;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.secondary,
.link-button.secondary {
  background: rgba(242, 239, 230, 0.1);
  color: var(--text);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.choice-card {
  width: min(230px, 100%);
  min-height: 232px;
  padding: 14px;
  flex-direction: column;
  gap: 8px;
  background: rgba(242, 239, 230, 0.08);
  color: var(--text);
}

.choice-card:hover,
.choice-card:focus-visible {
  border-color: rgba(226, 177, 95, 0.72);
  background: rgba(226, 177, 95, 0.13);
}

.choice-card.evolution-choice {
  border-color: rgba(127, 208, 130, 0.58);
  background: rgba(127, 208, 130, 0.12);
}

.choice-card img {
  width: 82px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
}

.choice-card strong {
  color: #fff3c7;
  font-size: 17px;
}

.choice-card small {
  color: var(--accent);
  font-weight: 800;
}

.choice-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 680px) {
  .hud {
    top: 10px;
    width: calc(100vw - 20px);
  }

  .help {
    display: none;
    font-size: 12px;
  }

  .chip {
    font-size: 12px;
    padding: 6px 8px;
  }

  .skill-hud {
    left: 10px;
    bottom: 10px;
  }

  .choice-card {
    width: 100%;
    min-height: 132px;
    display: grid;
    grid-template-columns: 72px 1fr;
    text-align: left;
    align-items: center;
  }

  .choice-card img {
    width: 64px;
    height: 64px;
    grid-row: span 3;
  }
}
