* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #0c1710;
  color: #eaf4ec;
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #bfe3ff;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#game { touch-action: none; }

#map { display: none; touch-action: none; cursor: grab; }
#map.on { display: block; }
#map:active { cursor: grabbing; }

.loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: #13261b;
  color: #cfe8d8;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.panel {
  background: #12251a;
  border-top: 1px solid #1e3a28;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px 6px;
}

button {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

#mapBtn { background: #2f6aa8; color: #eaf6ff; }
#mapBtn:hover { background: #3b7fc4; }
#mapBtn.on { background: #8ce1ff; color: #062436; }
#mapBtn.on:hover { background: #a5e9ff; }

#setDest { background: #3ecf7a; color: #06210f; }
#setDest:hover { background: #56e08d; }

#restart { background: #223c2b; color: #d6ecdc; }
#restart:hover { background: #2c4d38; }

.mission {
  margin: 0;
  padding: 7px 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: #8ce1ff;
}

.mission.done { color: #ffe36e; }

.hint {
  margin: 0;
  padding: 6px 10px 9px;
  font-size: 13px;
  color: #a9c9b5;
}

.dialogue {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 122px;
  width: min(92vw, 440px);
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(22, 44, 33, 0.96);
  border: 1px solid #3ecf7a;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  z-index: 12;
}

.dialogue .speaker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: #ffc98a;
}

.dialogue .line {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  color: #eafff2;
}

.dialogue button {
  width: 100%;
  background: #3ecf7a;
  color: #06210f;
}

.dialogue button:hover { background: #56e08d; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  max-width: min(90vw, 440px);
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(20, 40, 30, 0.94);
  border: 1px solid #3ecf7a;
  color: #eafff2;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.start {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 20, 14, 0.92);
}

.start-card {
  width: min(92vw, 380px);
  padding: 22px 20px 20px;
  border-radius: 16px;
  background: #16301f;
  border: 1px solid #2f6a45;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.start-title {
  margin: 0 0 8px;
  font-size: 22px;
  color: #eafff2;
}

.start-sub {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: #a9c9b5;
}

.start-actions {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
}

button.pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 136px;
  aspect-ratio: 1 / 1;
  padding: 10px;
  text-align: center;
}

.pick-view {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border-radius: 10px;
  background: rgba(6, 16, 10, 0.4);
}

.pick-text {
  flex: 0 0 auto;
  font-size: 14px;
  text-align: center;
}

#pickGirl {
  background: #e0608f;
  color: #2a0a18;
}

#pickGirl:hover { background: #ef7aa4; }

#pickBoy {
  background: #4a8fd8;
  color: #04182c;
}

#pickBoy:hover { background: #63a4e8; }

[hidden] { display: none !important; }
