﻿/* ./css/game-ui.css */

/* ===== Page base ===== */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0b0f14;
  touch-action: none;
}

/* ===== HUD ===== */
#hud {
  position: fixed;
  left: 12px;
  top: 12px;
  color: #e8eef7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.55;
  background: rgba(0,0,0,0.38);
  padding: 12px 12px 10px 12px; /* 有 toggle 所以 top padding 一起合併 */
  border-radius: 12px;
  user-select: none;
  z-index: 30;
  min-width: 260px;
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(6px);
}

#hud .big { font-size: 18px; font-weight: 800; }
#hud .hint { opacity: 0.82; }

#hud button {
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

/* 右上角收放鍵 */
#hudToggle {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: #e8eef7;
  cursor: pointer;
  user-select: none;
}

/* 收合：只留第一行 big + toggle */
#hud.hud-collapsed .hint,
#hud.hud-collapsed #micBtn,
#hud.hud-collapsed div:not(.big) {
  display: none;
}

#hud.hud-collapsed {
  min-width: 0;
  padding-right: 44px;
}

/* ===== Score HUD (Top Right) ===== */
#scoreHud {
  position: fixed;
  right: 12px;
  top: 12px;
  color: #e8eef7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.45;
  background: rgba(0,0,0,0.38);
  padding: 12px 12px 10px 12px;
  border-radius: 12px;
  user-select: none;
  z-index: 11;
  min-width: 280px;
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(6px);
}

#scoreToggle {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: #e8eef7;
  cursor: pointer;
}

#scoreHud .score-total {
  font-size: 18px;
  font-weight: 800;
  padding-right: 36px;
}

#scoreHud .score-details {
  margin-top: 8px;
}

#scoreHud .camera-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

#scoreHud .camera-mode-label {
  font-weight: 700;
  opacity: 0.9;
}

#scoreHud .camera-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

#scoreHud .camera-mode-text {
  min-width: 56px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: #f2f6ff;
}

#scoreHud .camera-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#scoreHud .camera-switch-slider {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.16);
  transition: background .18s ease, border-color .18s ease;
}

#scoreHud .camera-switch-slider::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  transition: transform .18s ease;
}

#scoreHud .camera-switch input:checked + .camera-switch-slider {
  background: rgba(54, 160, 255, 0.55);
  border-color: rgba(110, 190, 255, 0.8);
}

#scoreHud .camera-switch input:checked + .camera-switch-slider::after {
  transform: translateX(18px);
}

#scoreHud .score-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

#scoreHud .score-row .k {
  opacity: 0.9;
  font-weight: 700;
}

#scoreHud .score-row .v {
  opacity: 0.95;
}

#scoreHud.score-collapsed .score-details {
  display: none;
}

#scoreHud.score-collapsed {
  min-width: 0;
  padding-right: 44px;
}

/* ===== Target HUD (Top Center) ===== */
.target-hud {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: min(440px, 44vw);
  color: #f5f7fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  z-index: 24;
  user-select: none;
  pointer-events: none;
  text-shadow: 0 2px 5px rgba(0,0,0,0.72);
}

.target-hidden {
  display: none;
}

.target-title {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 18px;
  font-weight: 900;
}

.target-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #ff4d4f;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.82), 0 2px 6px rgba(0,0,0,0.48);
}

.target-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.target-hp-text {
  font-size: 16px;
  font-weight: 900;
}

.target-bar {
  height: 16px;
  padding: 3px;
  background: rgba(15, 18, 24, 0.82);
  border: 2px solid rgba(255,255,255,0.88);
  box-shadow: 0 2px 0 rgba(0,0,0,0.72), inset 0 0 0 1px rgba(0,0,0,0.5);
}

.target-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #48ff5b 0%, #08b51d 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35);
  transition: width .12s linear, background .12s linear;
}

/* ===== Team / Enemy Roster (legacy, unused) ===== */
.roster-panel { display: none !important; }

@media (max-width: 820px) {
  #scoreHud .score-roster-wrap { grid-template-columns: 1fr; }
  #scoreHud { min-width: 250px; }
  .target-hud {
    top: 64px;
    width: min(360px, 58vw);
  }
  .target-title {
    font-size: 15px;
  }
  .target-hp-text {
    font-size: 13px;
  }
}



/* ===== Unified Roster in Score Panel ===== */
#scoreHud .score-roster-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#scoreHud .score-roster-col {
  min-height: 120px;
  max-height: 34vh;
  overflow: auto;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 6px;
}

#scoreHud .roster-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

#scoreHud .roster-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#scoreHud .roster-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}

#scoreHud .roster-item img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.22);
}

#scoreHud .roster-item .nm {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

#scoreHud .roster-item.dead,
#scoreHud .roster-item.offline {
  opacity: 0.45;
  filter: grayscale(1);
}

#scoreHud .roster-empty {
  opacity: 0.65;
  font-size: 12px;
  padding: 4px 2px;
}

@media (max-width: 820px) {
  #scoreHud .score-roster-wrap {
    grid-template-columns: 1fr;
  }
  #scoreHud {
    min-width: 250px;
  }
}

/* ===== Overlay (GameOver) ===== */
#overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.58);
  z-index: 20;
  color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans TC", "PingFang TC", sans-serif;
  text-align: center;
  padding: 24px;
}

#overlay .panel {
  background: rgba(10,14,20,0.88);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 18px 18px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 18px 55px rgba(0,0,0,0.55);
}

#overlay .title { font-size: 22px; font-weight: 900; margin-bottom: 6px; }
#overlay .sub { font-size: 16px; opacity: 0.95; }

#overlay button {
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== Joystick ===== */
#joystickWrap {
  position: fixed;
  left: 14px;
  bottom: 100px;
  width: 140px;
  height: 140px;
  z-index: 15;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#joyBase {
  position: absolute;
  left: 0;
  top: 0;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 0 18px rgba(0,0,0,0.35);
}

#joyKnob {
  position: absolute;
  left: 52px;
  top: 52px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transform: translate(0,0);
}

#joyLabel {
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: rgba(232,238,247,0.70);
}

/* ===== Hotbar ===== */
#hotbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10050 !important;
  pointer-events: auto;
}

.hb-slot {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-family: system-ui, Segoe UI, Arial;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  cursor: pointer;
  user-select: none;
  overflow: visible;
}

.hb-slot:hover { border-color: rgba(255,255,255,0.45); }
.hb-slot.active { border-color: rgba(255,220,120,0.9); }

.hb-k { font-size: 12px; opacity: 0.85; margin-bottom: 2px; }

.hb-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  color: #000;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  padding: 0 6px;
  pointer-events: none;
  z-index: 10;
}

.hb-t {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: system-ui, Segoe UI, Arial;
  font-size: 12px;
  z-index: 10050 !important;
  display: none;
  max-width: 70vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-slot {
  position: relative;
  overflow: hidden;
}

.hb-ico {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
  user-select: none;
}

.hb-k {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
}

.hb-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 6;
}

