* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #080c18; font-family: 'Segoe UI', Arial, sans-serif; color: #e0ddd4; }

canvas { display: block; width: 100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 0; cursor: default; }

#backBtn {
  position: fixed; top: 14px; left: 14px; z-index: 100;
  color: #aaa; text-decoration: none; font-size: 14px; font-weight: 600;
  background: rgba(0,0,0,0.5); padding: 6px 14px; border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
#backBtn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== Start Screen ===== */
#startScreen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5,8,18,0.88);
}
#startScreen h1 {
  font-size: 72px; font-weight: 900; letter-spacing: 8px;
  color: #e8c44a; text-shadow: 0 0 30px rgba(232,196,74,0.4);
}
#startScreen .sub {
  font-size: 18px; letter-spacing: 6px; color: #aaa; margin-top: 6px;
}
.pick-label {
  font-size: 16px; color: #888; margin: 32px 0 14px; letter-spacing: 2px;
}
.nation-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  max-width: 520px;
}
.nation-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 22px; border: 2px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04); border-radius: 8px;
  color: #ddd; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; letter-spacing: 1px;
}
.nation-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}
.ndot {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  box-shadow: 0 0 8px currentColor;
}
.controls {
  font-size: 13px; color: #555; margin-top: 28px; text-align: center; line-height: 1.7;
}
.controls kbd {
  background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 3px;
  font-family: inherit; font-size: 12px; border: 1px solid rgba(255,255,255,0.15);
}

/* ===== HUD ===== */
#hud {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 20px;
  background: rgba(8,12,24,0.88); padding: 10px 24px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  pointer-events: none;
}
#timerBox {
  font-size: 22px; font-weight: 900; letter-spacing: 2px;
  color: #e8c44a; font-variant-numeric: tabular-nums;
}
#statsBox { font-size: 14px; color: #aab; }
#provCount { color: #88ccff; font-weight: 700; }
#troopCount { color: #66ff88; font-weight: 700; }

/* ===== Tooltip ===== */
#tip {
  position: fixed; z-index: 40; pointer-events: none;
  background: rgba(8,12,24,0.94); padding: 8px 14px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12); font-size: 13px;
  min-width: 130px; max-width: 220px;
}
#tipName { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
#tipOwner { color: #aaa; }
#tipTroops { color: #ccc; margin-top: 2px; }
#tipHint { color: #e8c44a; margin-top: 4px; font-size: 12px; }

/* ===== End Overlay ===== */
#endOverlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5,8,18,0.92);
}
#endOverlay h1 { font-size: 64px; font-weight: 900; letter-spacing: 6px; }
#endOverlay #endMsg { font-size: 18px; color: #aaa; margin: 12px 0 24px; text-align: center; line-height: 1.6; }
#restartBtn {
  background: #e8c44a; color: #111; border: none; padding: 12px 32px;
  border-radius: 6px; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: background 0.2s;
}
#restartBtn:hover { background: #f5d76e; }

.hidden { display: none !important; }
