/* ============ Arrow Fight 基础 ============ */
:root {
  --bg: #14161f;
  --panel: #202433;
  --panel-2: #2a2f42;
  --line: #3a3f55;
  --text: #f2f4ff;
  --muted: #9aa1bd;
  --accent: #73c9ff;
  --gold: #ffdd77;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", "Microsoft YaHei", monospace;
  overflow: hidden;
  touch-action: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============ 视图切换 ============ */
.view {
  display: none;
  width: 100%;
  height: 100%;
}
.view.active {
  display: block;
}

/* ============ 大厅 ============ */
#view-lobby {
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
#view-lobby.active {
  display: flex;
}

.lobby-card {
  width: 100%;
  max-width: 520px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.logo-title {
  font-size: 38px;
  letter-spacing: 2px;
  text-align: center;
}
.logo-title span {
  color: var(--accent);
}
.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 24px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.form-row label {
  width: 60px;
  color: var(--muted);
  font-size: 15px;
  flex-shrink: 0;
}
.form-row input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 10px 12px;
  outline: none;
  user-select: text;
}
.form-row input:focus {
  border-color: var(--accent);
}

.room-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
#room-code {
  letter-spacing: 4px;
  color: var(--gold);
  font-size: 18px;
}

.slot-title {
  margin: 22px 0 10px;
  font-size: 18px;
  color: var(--gold);
}

.slot-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.slot-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 15px;
}
.slot-list li.you {
  border-color: var(--accent);
}
.slot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.slot-tag {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.slot-tag.ai {
  color: var(--gold);
}

.lobby-actions {
  margin-top: 24px;
  text-align: center;
}

.primary-btn {
  background: var(--accent);
  color: #10222e;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  padding: 14px 34px;
  letter-spacing: 1px;
  transition: opacity 0.2s ease;
}
.primary-btn:hover { opacity: 0.88; }

.ghost-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  padding: 12px 24px;
}

.mini-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  padding: 6px 12px;
}
.mini-btn:hover { border-color: var(--accent); }

.howto {
  margin-top: 22px;
  border-top: 1px dashed var(--line);
  padding-top: 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.howto .note {
  margin-top: 8px;
  color: #7d84a3;
  font-size: 12px;
}

/* ============ 游戏视图 ============ */
#view-game {
  position: relative;
  display: none;
  flex-direction: column;
}
#view-game.active {
  display: flex;
}

#hud {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(20, 22, 31, 0.9);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
#hud-left, #hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
#hud-hp {
  color: var(--gold);
}
#hud-alive {
  color: var(--muted);
}

#stage {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-canvas {
  background: #1b1e2b;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ============ 移动端摇杆 ============ */
.touch-control {
  display: none;
  position: absolute;
  z-index: 15;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  bottom: 36px;
  left: 32px;
}
#joy-knob {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(115, 201, 255, 0.7);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ============ 结算遮罩 ============ */
#result {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 11, 16, 0.78);
}
#result.hidden {
  display: none;
}
.result-card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 32px 36px;
  text-align: center;
  max-width: 360px;
}
.result-card h2 {
  font-size: 28px;
  margin-bottom: 12px;
}
.result-card p {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.6;
}
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ============ 小屏适配 ============ */
@media (max-width: 600px) {
  .lobby-card { padding: 22px 16px; }
  .logo-title { font-size: 30px; }
  .slot-list { grid-template-columns: 1fr; }
  #hud { font-size: 13px; padding: 8px 10px; }
  .touch-control { display: block; }
}
