* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #1a2a1c; }
[hidden] { display: none !important; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #eef4e8; user-select: none; touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
#stage { position: fixed; inset: 0; }
#game { width: 100%; height: 100%; display: block; }

#crosshair {
  position: fixed; left: 50%; top: 46%; width: 10px; height: 10px;
  margin: -5px; border: 2px solid rgba(255,255,255,.45); border-radius: 50%;
  pointer-events: none; z-index: 12; transition: border-color .15s, transform .15s;
}
#crosshair.lock {
  border-color: #ff7060; transform: scale(1.35);
  box-shadow: 0 0 10px rgba(255,80,60,.45);
}

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#topbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; font-size: 13px; font-weight: 700;
  pointer-events: none;
}
#topbar .hud-btn { pointer-events: auto; min-height: 32px; padding: 4px 10px; margin-left: auto; }
#stat-world {
  padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12); color: #c8f080;
}
.panel.wide { width: min(640px, 96vw); }
.world-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; margin: 12px 0 16px;
}
.world-card {
  text-align: left; padding: 12px; border-radius: 6px; cursor: pointer;
  background: #243428; border: 1px solid #4a6850; color: #e8f0e0;
  font-family: inherit;
}
.world-card b { display: block; font-size: 14px; }
.world-card small { color: #8aaa80; font-size: 11px; }
.world-card em { display: block; margin-top: 4px; color: #a07060; font-size: 11px; font-style: normal; }
.world-card.on { border-color: #80c060; box-shadow: 0 0 0 1px #80c060; }
.world-card.locked { opacity: 0.45; cursor: not-allowed; }
#hp-wrap {
  position: relative; width: min(220px, 42vw); height: 16px;
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.15); border-radius: 4px; overflow: hidden;
}
#hp-fill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #2a8a40, #7adf6a);
}
#hp-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10px; color: #f4fff0;
}
#stat-combo { color: #ffd060; min-width: 4em; }
#tip {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 8px; background: rgba(0,0,0,.4);
  font-size: 14px; color: #ffe9b0; text-align: center; max-width: 90vw;
}
#tip:empty { display: none; }

#touch-ui {
  position: fixed; inset: 0; z-index: 18; pointer-events: none;
}
#stick-ring {
  position: absolute; left: 28px; bottom: 28px; width: 110px; height: 110px;
  border: 2px solid rgba(255,255,255,.25); border-radius: 50%;
  background: rgba(0,0,0,.15);
}
#btn-atk, #btn-dodge {
  pointer-events: auto; position: absolute; bottom: 36px;
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  color: #fff; font-weight: 800; font-size: 16px; font-family: inherit;
}
#btn-atk { right: 28px; background: rgba(180,60,40,.75); }
#btn-dodge { right: 104px; background: rgba(40,80,160,.7); }

.btn {
  padding: 10px 14px; font-size: 13px; font-weight: 700; background: #2a4030; color: #e8f0e0;
  border: 1px solid #5a7850; cursor: pointer; font-family: inherit; text-decoration: none;
  display: inline-block; border-radius: 4px; min-height: 40px;
}
.btn.primary { background: #3a7040; border-color: #80c060; }
.btn.ghost { background: transparent; }
.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(40,70,45,.75), rgba(10,16,12,.94));
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.panel {
  width: min(520px, 94vw); background: #1a281c; border: 1px solid #4a6850;
  border-top: 3px solid #80c060; padding: 22px 24px;
}
.logo {
  font-size: clamp(22px, 5vw, 34px); font-weight: 900; letter-spacing: .04em;
  background: linear-gradient(90deg, #c8f080, #50c070); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.logo.sm { font-size: 20px; }
.sub { color: #7a9a70; font-size: 13px; margin: 4px 0 12px; }
.intro { font-size: 13.5px; line-height: 1.85; color: #c0d0b8; margin-bottom: 14px; }
.menu-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.help-body { font-size: 13.5px; line-height: 1.9; color: #c0d0b8; }
.help-body b { color: #c8f080; }
.help-body p { margin-bottom: 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 #2a3a28; }
.board-rank { color: #80c060; font-weight: 800; width: 28px; }
.board-score { margin-left: auto; color: #ffd257; font-weight: 700; }
.submit-row { display: flex; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
#player-name {
  flex: 1; min-width: 140px; padding: 10px; background: #142018; border: 1px solid #4a6850;
  color: #eef4e8; font-family: inherit; font-size: 16px;
}
#submit-status { font-size: 12px; color: #7a9a70; min-height: 18px; }

@media (min-width: 900px) {
  #touch-ui { display: none !important; }
}
