* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0c1218; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e8f0f4; user-select: none; touch-action: none;
}
#stage { position: fixed; inset: 0; }
#game { width: 100%; height: 100%; display: block; }

#stick {
  position: fixed; left: 28px; bottom: 28px; width: 110px; height: 110px; z-index: 30;
  border-radius: 50%; background: rgba(20,40,50,.45); border: 2px solid rgba(120,200,180,.35);
}
#knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px;
  border-radius: 50%; background: rgba(120,220,190,.75); border: 2px solid #9ff;
}

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#hud-top {
  display: flex; gap: 14px; padding: 12px 16px;
  background: linear-gradient(180deg, rgba(8,16,20,.85), transparent);
  font-size: 13px; font-weight: 700;
}
#hud-phase { color: #7dffc8; }
#hud-stat { color: #d0e8ff; }
#hud-hp { color: #ffb0a0; }
#hud-diet { color: #b8e0a0; font-weight: 600; }
#hud-bars {
  display: flex; align-items: center; gap: 10px; padding: 0 16px 6px;
  pointer-events: none;
}
.hbar {
  flex: 0 0 110px; height: 7px; background: rgba(20,40,48,.7); border: 1px solid #2a4a50;
  border-radius: 2px; overflow: hidden;
}
.hbar.dna { flex-basis: 90px; }
.hbar > i {
  display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #3a9a70, #7dffc8);
  transition: width .2s ease;
}
.hbar.dna > i { background: linear-gradient(90deg, #3a6aaa, #80d0ff); }
#hud-next { font-size: 11px; color: #9ab8b0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
#hud-quest {
  padding: 0 16px; font-size: 12px; color: #c8e8a0; text-shadow: 0 1px 4px #000;
  min-height: 16px;
}
#hud-msg {
  position: absolute; left: 50%; top: 78px; transform: translateX(-50%);
  font-size: 14px; text-shadow: 0 2px 6px #000; color: #c8ffe8;
}

.ed-tools {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 6px 0; border-top: 1px solid #1a2830;
}
.ed-color {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #9ab;
}
.ed-color input[type="color"] {
  width: 28px; height: 22px; padding: 0; border: 1px solid #3a5a60; background: #182028; cursor: pointer;
}
.btn.on { border-color: #7dffc8; color: #fff; }

#poses {
  position: fixed; right: 16px; bottom: 28px; z-index: 30;
  display: flex; flex-direction: column; gap: 6px; pointer-events: auto;
}
.pose {
  padding: 10px 14px; background: rgba(16,28,36,.85); border: 1px solid #3a5a60;
  color: #b8d8d0; font-weight: 700; cursor: pointer; font-family: inherit;
}
.pose.on { border-color: #7dffc8; color: #fff; background: rgba(30,60,50,.9); }

.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(20,50,60,.8), rgba(6,10,14,.95));
  overflow-y: auto; padding: 16px;
}
.panel {
  width: min(520px, 94vw); background: #101820; border: 1px solid #2a4a50;
  border-top: 3px solid #5ec4a0; padding: 24px 28px;
}
.logo {
  font-size: clamp(24px, 5vw, 34px); font-weight: 900; letter-spacing: .06em;
  background: linear-gradient(90deg, #7dffc8, #60b0ff); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.logo.sm { font-size: 22px; }
.sub { color: #6a9a98; font-size: 13px; margin: 4px 0 12px; letter-spacing: .08em; }
.intro { font-size: 13.5px; line-height: 1.85; color: #a8c4c0; margin-bottom: 14px; }
.menu-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  padding: 9px 16px; font-size: 13px; font-weight: 700; background: #1e3038; color: #e0f0ec;
  border: 1px solid #3a5a60; cursor: pointer; text-decoration: none; display: inline-block; font-family: inherit;
}
.btn.primary { background: #2a7a60; border-color: #5ec4a0; }
.btn.ghost { background: transparent; }
.help-body { font-size: 13.5px; line-height: 1.9; color: #a8c4c0; }
.help-body b { color: #7dffc8; }
.help-body p { margin-bottom: 8px; }

.editor-panel {
  width: min(900px, 96vw); background: #101820; border: 1px solid #2a4a50;
  border-top: 3px solid #5ec4a0; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  max-height: 94vh;
}
.ed-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: start; }
#creature-name {
  margin-top: 6px; padding: 8px 10px; background: #182028; border: 1px solid #2a4a50;
  color: #e8f0f4; font-family: inherit; width: 200px;
}
.ed-stats { font-size: 12px; color: #9ab; line-height: 1.7; text-align: right; }
.ed-body { display: grid; grid-template-columns: 140px 1fr; gap: 10px; min-height: 200px; }
.ed-slots, .ed-parts { overflow-y: auto; max-height: 42vh; }
.slot-btn, .part-btn {
  display: block; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 4px;
  background: #182028; border: 1px solid #2a4a50; color: #cde; cursor: pointer; font-family: inherit; font-size: 12.5px;
}
.slot-btn.on, .part-btn.on { border-color: #7dffc8; }
.part-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.part-btn small { display: block; color: #6a9a98; font-size: 10.5px; }
.ed-foot { display: flex; flex-wrap: wrap; gap: 8px; }
.board { margin: 8px 0; max-height: 150px; overflow-y: auto; }
.board-row { display: flex; gap: 8px; padding: 4px 6px; font-size: 12px; border-bottom: 1px solid #1a2830; }
.board-rank { color: #5ec4a0; font-weight: 800; width: 28px; }
.board-score { margin-left: auto; color: #ffd257; font-weight: 700; }
.board-empty { color: #5a6a70; font-size: 12px; padding: 8px; }
.submit-row { display: flex; gap: 8px; margin: 10px 0 4px; }
#player-name {
  flex: 1; padding: 10px; background: #182028; border: 1px solid #2a4a50; color: #e8f0f4; font-family: inherit;
}
#submit-status { font-size: 12px; color: #6a9a98; min-height: 18px; }

@media (max-width: 700px) {
  .ed-body { grid-template-columns: 1fr; }
  #stick { width: 96px; height: 96px; left: 16px; bottom: 16px; }
}
