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

body {
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'Oswald', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}

#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: linear-gradient(180deg, rgba(13,17,23,0.95) 0%, rgba(13,17,23,0.7) 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 24px;
  z-index: 10;
  border-bottom: 1px solid rgba(201,209,217,0.1);
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
}

#hud-top > div {
  white-space: nowrap;
}

#hud-turn { color: #8b949e; font-weight: 700; }
#hud-faction { font-weight: 700; font-size: 15px; }
#hud-phase {
  background: rgba(255,255,255,0.08);
  padding: 2px 12px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: #58a6ff;
}
#hud-reinforcements { color: #3fb950; }

#side-panel {
  position: absolute;
  top: 56px; right: 8px;
  width: 240px;
  max-height: calc(100vh - 160px);
  background: rgba(13,17,23,0.92);
  border: 1px solid rgba(201,209,217,0.12);
  border-radius: 6px;
  z-index: 10;
  overflow-y: auto;
  font-size: 13px;
}

#panel-title {
  background: rgba(255,255,255,0.04);
  padding: 10px 14px;
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 11px;
  color: #8b949e;
  border-bottom: 1px solid rgba(201,209,217,0.08);
}

#panel-content { padding: 12px 14px; }

#panel-territory-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #e6edf3;
}

#panel-details { margin-bottom: 10px; line-height: 1.6; color: #8b949e; }
#panel-adjacent { margin-bottom: 12px; font-size: 12px; color: #6e7681; }

#panel-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-btn {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 16px;
  border: 1px solid rgba(201,209,217,0.15);
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: #c9d1d9;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}

.game-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(201,209,217,0.3);
}

.game-btn.accent {
  background: rgba(230,57,70,0.25);
  border-color: rgba(230,57,70,0.4);
  color: #ff6b6b;
}

.game-btn.accent:hover {
  background: rgba(230,57,70,0.4);
}

.game-btn.secondary {
  font-size: 11px;
  padding: 5px 10px;
  color: #6e7681;
  border-color: rgba(201,209,217,0.08);
}

.game-btn.attack-btn {
  background: rgba(230,57,70,0.2);
  border-color: rgba(230,57,70,0.35);
  color: #ff7b7b;
}

.game-btn.move-btn {
  background: rgba(56,139,253,0.2);
  border-color: rgba(56,139,253,0.35);
  color: #79c0ff;
}

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

#bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(0deg, rgba(13,17,23,0.95) 0%, rgba(13,17,23,0.7) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  border-top: 1px solid rgba(201,209,217,0.1);
}

#faction-overview {
  display: flex;
  gap: 16px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
}

.faction-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.faction-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

#bottom-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

#turn-log {
  position: absolute;
  bottom: 64px; left: 8px;
  width: 280px;
  max-height: 200px;
  background: rgba(13,17,23,0.88);
  border: 1px solid rgba(201,209,217,0.08);
  border-radius: 6px;
  z-index: 10;
  overflow: hidden;
  font-size: 11px;
}

#log-title {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #6e7681;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(201,209,217,0.06);
}

#log-entries {
  max-height: 160px;
  overflow-y: auto;
  padding: 6px 12px;
  font-family: 'Share Tech Mono', monospace;
  line-height: 1.5;
  color: #8b949e;
}

#log-entries::-webkit-scrollbar { width: 4px; }
#log-entries::-webkit-scrollbar-thumb { background: rgba(201,209,217,0.15); border-radius: 2px; }

.log-entry { padding: 2px 0; border-bottom: 1px solid rgba(201,209,217,0.04); }
.log-entry.battle { color: #ff7b7b; }
.log-entry.conquer { color: #3fb950; }
.log-entry.deploy { color: #58a6ff; }

#tooltip {
  display: none;
  position: absolute;
  background: rgba(13,17,23,0.95);
  border: 1px solid rgba(201,209,217,0.2);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'Share Tech Mono', monospace;
  z-index: 100;
  pointer-events: none;
  max-width: 200px;
  color: #e6edf3;
}

#combat-overlay, #victory-overlay, #new-game-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.hidden { display: none !important; }

#combat-box, #victory-box, #new-game-box {
  background: #161b22;
  border: 1px solid rgba(201,209,217,0.15);
  border-radius: 10px;
  padding: 28px 36px;
  text-align: center;
  min-width: 320px;
}

#combat-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 16px;
  color: #ff7b7b;
}

#combat-attacker, #combat-defender {
  font-size: 16px;
  margin: 8px 0;
  font-family: 'Share Tech Mono', monospace;
}

#combat-vs {
  font-size: 24px;
  font-weight: 200;
  color: #6e7681;
  margin: 4px 0;
}

#combat-dice {
  font-size: 28px;
  margin: 12px 0;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 6px;
}

#combat-result {
  font-size: 15px;
  margin: 12px 0;
  font-weight: 700;
}

#victory-box { min-width: 400px; position: relative; overflow: hidden; }

#victory-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 16px;
}

#victory-stats {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 20px;
  color: #8b949e;
}

#confetti-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.overlay-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 20px;
  color: #e6edf3;
}

#new-game-box label {
  display: block;
  margin: 12px 0 4px;
  font-size: 13px;
  color: #8b949e;
  text-align: left;
}

#new-game-box select {
  width: 100%;
  padding: 8px 10px;
  background: #0d1117;
  border: 1px solid rgba(201,209,217,0.15);
  border-radius: 4px;
  color: #c9d1d9;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
}

footer {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 10px;
}

footer a {
  color: #484f58;
  text-decoration: none;
}

footer a:hover { color: #8b949e; }

@keyframes screenShake {
  0%, 100% { transform: translate(0,0); }
  10% { transform: translate(-3px, 2px); }
  30% { transform: translate(3px, -2px); }
  50% { transform: translate(-2px, -3px); }
  70% { transform: translate(2px, 3px); }
  90% { transform: translate(-1px, 1px); }
}

.shake { animation: screenShake 0.3s ease-out; }

@media (max-width: 768px) {
  #side-panel { width: 180px; right: 4px; top: 52px; font-size: 11px; }
  #panel-territory-name { font-size: 15px; }
  #turn-log { width: 200px; }
  #hud-top { font-size: 11px; gap: 10px; height: 40px; padding: 0 10px; }
  #bottom-bar { height: 48px; }
  .game-btn { font-size: 11px; padding: 5px 10px; }
  #faction-overview { font-size: 10px; gap: 8px; }
}