:root {
  --bg-panel: rgba(18, 24, 21, 0.92);
  --bg-card: rgba(28, 36, 31, 0.95);
  --border-steel: #516158;
  --border-hi: #8fa698;
  --accent-lime: #6ee85e;
  --accent-gold: #ffd23f;
  --accent-red: #ff5449;
  --accent-blue: #4db8ff;
  --text-main: #edf4ee;
  --text-dim: #9db0a3;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101614;
  color: var(--text-main);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
}

#app {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.interactive {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

/* Military 90s Bevel Panel */
.panel {
  background: var(--bg-panel);
  border: 2px solid var(--border-steel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.65);
  border-radius: 6px;
  backdrop-filter: blur(6px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 2px solid #6c7e73;
  border-radius: 5px;
  background: linear-gradient(180deg, #3a4a40 0%, #242e28 100%);
  color: var(--text-main);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.08s, filter 0.12s, border-color 0.12s;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.14);
  border-color: var(--accent-gold);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #4b8f38 0%, #2c5c20 100%);
  border-color: #87e86b;
  color: #f6fff2;
}

.btn-gold {
  background: linear-gradient(180deg, #d99b1e 0%, #99640b 100%);
  border-color: #ffe073;
  color: #fffbe6;
}

.btn-danger {
  background: linear-gradient(180deg, #b83a32 0%, #78201b 100%);
  border-color: #ff8278;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

input[type='text'],
select {
  background: #131a16;
  color: var(--text-main);
  border: 2px solid #48594f;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  outline: none;
}

input[type='text']:focus,
select:focus {
  border-color: var(--accent-gold);
}

/* Title / Menu Screens */
.screen-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(12, 18, 15, 0.35), rgba(8, 12, 10, 0.78));
  pointer-events: auto;
  overflow-y: auto;
}

.menu-card {
  width: min(520px, 95vw);
  padding: 28px 30px;
  text-align: center;
}

.menu-wide {
  width: min(920px, 96vw);
  padding: 24px 26px;
}

.game-title {
  margin: 0;
  font-family: Impact, 'Arial Black', sans-serif;
  font-size: clamp(36px, 5.5vw, 54px);
  letter-spacing: 0.05em;
  line-height: 1.02;
  color: var(--accent-lime);
  text-shadow: 0 3px 0 #1f3d17, 0 6px 18px rgba(0, 0, 0, 0.85);
}

.game-subtitle {
  margin: 8px 0 22px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.menu-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.menu-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.section-box {
  background: var(--bg-card);
  border: 1px solid #3c4d43;
  border-radius: 5px;
  padding: 14px;
  text-align: left;
}

.section-box h3 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.swatch.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--accent-gold);
}

/* Online Lobby */
.room-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #101713;
  border: 2px solid var(--accent-gold);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: monospace;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--accent-gold);
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(15, 20, 17, 0.8);
  border: 1px solid #35453c;
  border-radius: 4px;
  margin-bottom: 8px;
}

.chat-log {
  height: 130px;
  overflow-y: auto;
  background: #0e1411;
  border: 1px solid #314037;
  border-radius: 4px;
  padding: 8px;
  font-size: 12px;
  margin-bottom: 8px;
}

/* In-Game HUD */
.hud-top {
  position: fixed;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  flex-wrap: nowrap;
}

.turn-banner {
  padding: 5px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.timer-box {
  font-family: monospace;
  font-size: 20px;
  font-weight: 900;
  min-width: 38px;
  text-align: center;
  padding: 2px 6px;
  background: #101512;
  border: 1px solid #44554b;
  border-radius: 4px;
}

.timer-urgent {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

.team-bars {
  display: flex;
  gap: 8px;
  padding: 5px 10px;
}

.team-pill {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 82px;
}

.team-pill-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.team-hp-track {
  height: 6px;
  background: #101512;
  border-radius: 3px;
  overflow: hidden;
}

.team-hp-fill {
  height: 100%;
  transition: width 0.25s;
}

.wind-box {
  padding: 5px 10px;
  min-width: 118px;
  text-align: center;
  white-space: nowrap;
}

.wind-track {
  position: relative;
  height: 8px;
  background: #101512;
  border: 1px solid #425248;
  border-radius: 4px;
  margin-top: 4px;
}

.wind-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #87998e;
}

.wind-fill {
  position: absolute;
  top: 1px;
  bottom: 1px;
  background: linear-gradient(90deg, #4db8ff, #9ce1ff);
}

.hud-bottom {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.weapon-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  max-width: min(740px, 95vw);
}

.fuse-pills {
  display: flex;
  gap: 4px;
}

.fuse-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  background: #18201b;
  color: var(--text-dim);
  border: 1px solid #47594e;
  border-radius: 3px;
  cursor: pointer;
}

.fuse-btn.active {
  background: var(--accent-gold);
  color: #161812;
  border-color: #fff3b8;
}

.target-hint-banner {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  background: rgba(24, 16, 12, 0.92);
  border: 2px solid var(--accent-gold);
  border-radius: 6px;
  color: var(--accent-gold);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* Weapon Arsenal Grid Drawer */
.arsenal-modal {
  position: fixed;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  width: min(940px, 96vw);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 16px;
  pointer-events: auto;
  z-index: 40;
}

.arsenal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 800px) {
  .arsenal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.arsenal-col-head {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 2px solid currentColor;
}

.weapon-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  margin-bottom: 5px;
  background: #17201b;
  border: 1px solid #35453b;
  border-radius: 4px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.weapon-item:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: #233029;
}

.weapon-item.selected {
  border-color: var(--accent-lime);
  background: #223823;
}

.weapon-item:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.weapon-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--accent-red);
  color: #fff;
}

.weapon-tooltip {
  margin-top: 10px;
  padding: 10px 12px;
  background: #111714;
  border: 1px solid #405247;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.status-toast {
  position: fixed;
  top: 72px;
  right: 16px;
  padding: 8px 14px;
  background: rgba(16, 24, 19, 0.94);
  border: 1px solid var(--accent-lime);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  z-index: 60;
  pointer-events: none;
}
