/* 大逃殺網頁版 復古終端機與緊湊清晰風格 */
:root {
  --bg-dark: #0a0c10;
  --panel-bg: #12151c;
  --panel-border: #2a313d;
  --text-main: #e4e4e7;
  --text-dim: #9aa2b1;
  --accent-green: #2ed573;
  --accent-red: #ff4757;
  --accent-yellow: #ffa502;
  --accent-blue: #38bdf8;
  --gold: #f1c40f;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  font-size: 15px;
}

#game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
}

.screen-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ==================== 1. 等候大廳樣式 (LOBBY) ==================== */
#lobby-screen {
  background: radial-gradient(circle at center, #181d28 0%, #080a0f 100%);
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

.lobby-card {
  background: rgba(18, 22, 30, 0.95);
  border: 2px solid var(--panel-border);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(241, 196, 15, 0.15);
  border-radius: 8px;
  width: 960px;
  max-width: 95vw;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.lobby-header {
  text-align: center;
  border-bottom: 2px solid #232b3d;
  padding-bottom: 12px;
}

.btn-exit-game {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #1e2430;
  border: 1px solid var(--panel-border);
  color: #94a3b8;
  font-size: 18px;
  font-weight: bold;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 20;
}

.btn-exit-game:hover {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.game-title {
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
}

.game-subtitle {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

.lobby-timer-box {
  background: #090c12;
  border: 1px solid #2b3345;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer-label {
  font-size: 13px;
  color: var(--accent-yellow);
  font-weight: bold;
}

.lobby-countdown-digits {
  font-family: "Courier New", Courier, monospace;
  font-size: 38px;
  font-weight: bold;
  color: var(--accent-red);
  text-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
  letter-spacing: 4px;
}

.lobby-status-note {
  font-size: 12px;
  color: var(--text-dim);
}

.lobby-main-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

.lobby-panel {
  background: #0d1017;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.register-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.form-row label {
  color: var(--text-dim);
  font-weight: 500;
}

.form-input, .form-select {
  background: #06080c;
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--gold);
}

.radio-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  cursor: pointer;
}

.club-desc-box {
  background: #141a24;
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  font-size: 13px;
  color: #e2e8f0;
  border-radius: 0 4px 4px 0;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.btn-action.full-width {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.btn-action.secondary {
  background: #252b38;
  border-color: #4a5568;
  color: #cbd5e1;
}

.btn-action.secondary:hover {
  background: #374151;
  color: #fff;
}

/* 42 人簽到名冊格 */
.roster-panel {
  height: 340px;
}

.roster-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  overflow-y: auto;
  padding-right: 4px;
}

.roster-item {
  background: #07090e;
  border: 1px solid #1a202c;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.roster-item.player-self {
  border-color: var(--gold);
  background: #232014;
  color: var(--gold);
  font-weight: bold;
}

.roster-item.empty-slot {
  color: #4a5568;
  font-style: italic;
}

.roster-item .num-tag {
  color: var(--accent-yellow);
  font-weight: bold;
}

/* ==================== 2. 正式戰場樣式 (BATTLE) ==================== */
#top-broadcast {
  background: #06080b;
  border-bottom: 2px solid #202633;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
  font-size: 14.5px;
  height: 44px;
}

.broadcast-cell {
  display: flex;
  align-items: center;
  gap: 16px;
}

.danger-status .label {
  color: var(--accent-red);
  font-weight: bold;
}

.blink-text {
  color: #fff;
  font-weight: 500;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.text-yellow { color: var(--accent-yellow); font-weight: bold; }
.text-green { color: var(--accent-green); font-weight: bold; }
.text-red { color: var(--accent-red); font-weight: bold; }
.text-blue { color: var(--accent-blue); font-weight: bold; }
.text-gold { color: var(--gold); font-weight: bold; }

#main-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 44px);
}

#viewport-panel {
  flex: 1.1; /* 左側 2.5D 畫面維持寬敞視野 */
  display: flex;
  flex-direction: column;
  background: #040507;
  position: relative;
  border-right: 2px solid var(--panel-border);
}

#canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#location-bar {
  background: #0b0e14;
  border-top: 1px solid var(--panel-border);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.loc-left {
  display: flex;
  gap: 14px;
  align-items: center;
}

#retro-terminal {
  flex: 1.2; /* 右側介面加寬加大，閱讀與操作更舒適 */
  max-width: 640px; /* 原 520px -> 640px */
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  gap: 12px;
  overflow-y: auto;
}

.panel-box {
  background: #0b0e14;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 10px 12px;
}

.panel-header {
  font-size: 13.5px;
  font-weight: bold;
  color: var(--gold);
  border-bottom: 1px solid #1f2633;
  padding-bottom: 6px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  background: #252e3d;
  color: #79c0ff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}

.profile-grid {
  display: flex;
  gap: 12px;
}

.avatar-cell {
  width: 80px;
  height: 80px;
  background: #060709;
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gender-tag {
  position: absolute;
  bottom: 0;
  width: 100%;
  text-align: center;
  background: rgba(0, 0, 0, 0.75);
  font-size: 11px;
  color: var(--accent-yellow);
  font-weight: bold;
  padding: 1px 0;
}

.stats-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-line {
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.stat-name { color: var(--text-dim); }
.bold { font-weight: bold; color: #fff; }

.bar-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bar-label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}

.bar-track {
  height: 9px;
  background: #1e2430;
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill.hp { background: linear-gradient(90deg, #ff4757, #ff6b81); }
.bar-fill.sta { background: linear-gradient(90deg, #2ed573, #7bed9f); }

.mini-stats {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  background: #121620;
  padding: 3px 8px;
  border-radius: 4px;
}

.mini-stats strong { color: #fff; }

.equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 13.5px;
}

.equip-slot {
  background: #07090e;
  padding: 8px 10px;
  border: 1px dashed var(--panel-border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.equip-slot:hover {
  border-color: var(--gold);
  background: #111520;
}

.slot-tag { font-size: 12px; color: var(--text-dim); }
.slot-name { font-size: 14px; font-weight: bold; color: #fff; }
.slot-stat { font-size: 12px; }

.inv-actions {
  display: flex;
  gap: 8px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.inv-cell {
  background: #07090e;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 8px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inv-cell:hover {
  border-color: var(--gold);
  background: #141824;
}

.inv-cell.selected {
  border-color: var(--accent-yellow);
  background: #202738;
  box-shadow: 0 0 8px rgba(255, 165, 2, 0.45);
}

.inv-cell.empty {
  color: #4b5563;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  cursor: default;
}

.inv-title {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-meta {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}

.btn-action {
  background: #1e2533;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover:not(:disabled) {
  background: var(--gold);
  color: #000;
}

.btn-action:disabled {
  opacity: 0.3;
  border-color: #444;
  color: #666;
  cursor: not-allowed;
}

.btn-action.danger {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.btn-action.danger:hover:not(:disabled) {
  background: var(--accent-red);
  color: #fff;
}

.btn-action.danger:disabled {
  border-color: #444;
  color: #666;
}

.log-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 150px;
}

.terminal-log {
  flex: 1;
  background: #05070a;
  border: 1px solid #1a202c;
  padding: 8px 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 230px;
}

.log-entry { margin: 0; }
.log-entry.sys { color: var(--gold); }
.log-entry.info { color: #93c5fd; }
.log-entry.combat { color: #ff6b81; font-weight: bold; }
.log-entry.loot { color: #34d399; }
.log-entry.danger { color: #f87171; background: rgba(255, 71, 87, 0.14); padding: 3px 6px; border-left: 3px solid #ff4757; }

/* 22 區全島地圖 Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-card {
  background: #11151f;
  border: 2px solid var(--gold);
  border-radius: 8px;
  width: 720px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  padding: 18px;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15.5px;
  font-weight: bold;
  color: var(--gold);
  border-bottom: 1px solid #232d3f;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.btn-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.island-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 6px;
}

.map-node {
  background: #080b10;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s ease;
}

.map-node:hover:not(.danger-node) {
  border-color: var(--gold);
  background: #18202e;
}

.map-node.current-node {
  border-color: var(--gold);
  background: #2b2413;
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
}

.map-node.caution-node {
  border-color: var(--accent-yellow);
  background: #2a210d;
}

.map-node.danger-node {
  border-color: var(--accent-red);
  background: #240f12;
  opacity: 0.55;
  cursor: not-allowed;
}

.node-title { font-size: 13.5px; font-weight: bold; color: #fff; }
.node-coord { font-size: 11px; color: var(--gold); }
.node-effect { font-size: 10.5px; color: var(--text-dim); }

.modal-footer {
  margin-top: 14px;
  border-top: 1px solid #232d3f;
  padding-top: 10px;
  display: flex;
  justify-content: space-around;
  font-size: 12.5px;
}

.legend.danger { color: var(--accent-red); font-weight: bold; }
.legend.caution { color: var(--accent-yellow); font-weight: bold; }
.legend.safe { color: var(--accent-green); font-weight: bold; }
.legend.cur { color: var(--gold); font-weight: bold; }

/* 結算畫面 */
.gameover-card {
  text-align: center;
  align-items: center;
  gap: 16px;
  width: 440px;
}

.gameover-title {
  font-size: 24px;
  color: var(--accent-red);
}

.gameover-title.win {
  color: var(--gold);
}

.gameover-desc {
  font-size: 14px;
  color: #cbd5e1;
}

.gameover-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  background: #07090e;
  padding: 14px 28px;
  border-radius: 6px;
  width: 100%;
}

.restart-btn {
  font-size: 15px;
  padding: 10px 24px;
}
